-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathviewItems.php
More file actions
39 lines (38 loc) · 755 Bytes
/
viewItems.php
File metadata and controls
39 lines (38 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// tableHead
$tHead = "";
foreach ($crud->attributesList as $attribute) {
$tHead .= "<th> $attribute </th>";
}
echo <<<EOT
<table>
<tr>
$tHead
<th></th>
</tr>
<tbody>
EOT;
// tableData and actions
foreach (reset($crud->data) as $idx => $item):
$tData = "";
foreach ($crud->attributesList as $attribute) {
$tData .= "<td>".$item[$attribute]."</td>";
}
echo <<<EOT
<tr>
$tData
<td>
<a href="?action=edit&id=$idx">Edit</a>
<a href="?action=delete&id=$idx">Delete</a>
</td>
</tr>
EOT;
endforeach;
echo <<<EOT
</tbody>
</table>
<hr>
<a href="?action=add">Add</a>
<hr>
EOT;
?>