Hi
I am struggling how to list all the permissions and with checkboxes.
if anyone can help me with it this is the code
echo "<table cellpadding='0' cellspacing='0' width='100%' class='table table-bordered'>";
echo "<tr>";
echo "<th>PERMISSION</th>";
foreach($user_groups->rows as $row) {
echo "<th class='checkbox'>".$row['title']."</th>";
}
echo "</tr>";
$users_permission_query = $this->db->query("SELECT * FROM users_permission");
foreach($users_permission_query->rows as $row) {
$group_permissions_rows = json_decode($row['permission'], TRUE);
echo "<tr>";
echo "<td>".$row['module']."<br />";
foreach($group_permissions_rows as $key => $value) {
echo "{$key}<br>";
}
echo "</td>";
echo "<td>";
echo "<table cellpadding='0' cellspacing='0' width='100%'>";
for($i=0; $i < count($group_permissions_rows); $i++) {
foreach($group_permissions_rows as $key => $value) {
echo "<tr>";
echo "<td><input type='checkbox' name='permissions[" . $key . "]'";
if($value) {
echo ($value==1 ? " checked =\"checked\"" : "");
}
echo " value=$value /></td>";
echo "</tr>";
}
}
echo "</table>";
echo "</td>";
echo "</tr>";
}
echo "</table>";