Beispiel #1
0
 function table_menu($parent, $level)
 {
     $CI =& get_instance();
     $result = $CI->db->query("SELECT a.id, a.name, a.target, Deriv1.Count, a.order FROM `app_menu` a  LEFT OUTER JOIN (SELECT id_parent, COUNT(*) AS Count FROM `app_menu` GROUP BY id_parent) Deriv1 ON a.id = Deriv1.id_parent WHERE a.id_parent=" . $parent)->result_array();
     $padding = $level > 0 ? "style=\"padding-left: 30px\"" : "";
     $color = $level > 0 ? "<p class=\"text-success\">" : "<p class=\"text-primary\">";
     $count = $level;
     foreach ($result as $row) {
         $count++;
         echo "<tr>";
         if ($row['Count'] > 0) {
             echo "<td>{$count}</td>";
             echo "<td>" . $row['name'] . "</td>";
             echo "<td>" . $color . $row['order'] . "</p></td>";
             echo "<td>asd</td>";
             table_menu($row['id'], $level + 1);
         } elseif ($row['Count'] == 0) {
             echo "<td>" . ($count + 1) . "</td>";
             echo "<td {$padding}>" . $row['name'] . "</td>";
             echo "<td>" . $color . $row['order'] . "</p></td>";
             echo "<td>asd</td>";
         } else {
         }
         echo "</tr>";
     }
 }
Beispiel #2
0
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered table-condensed" id="dynTable">
	<thead>
		<tr>
			<th width="25px">No</th>
			<th>Menu</th>
			<th>Order</th>
			<th width="100px">Kontrol</th>
		</tr>
	</thead>
	<tbody>
		<?php 
table_menu(0, 0);
?>
	</tbody>
</table>