Пример #1
0
<table id="rbac_table" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
	<thead>
		<tr>
			<th></th>
			<th>guest</th>
			<?php 
foreach ($roles as $role) {
    echo '<th>' . $role->name . '</th>';
}
?>
		</tr>
	</thead>
	<tbody>
		<?php 
foreach ($rules as $rule => $action) {
    $rule = explode('|', $rule);
    count($rule) == 2 ? $expression = $rule[1] : ($expression = '');
    echo '<tr>';
    echo '<td>' . $rule[0] . '</td>';
    $checked = Rbac::match(0, $action, $expression);
    echo '<td><input action="' . $action . '" role="0" ' . $checked . ' expression="' . $expression . '" type="checkbox" /></td>';
    foreach ($roles as $role) {
        $checked = Rbac::match($role->id, $action, $expression);
        echo '<td><input action="' . $action . '" role="' . $role->id . '" ' . $checked . ' expression="' . $expression . '" type="checkbox" /></td>';
    }
    echo '</tr>';
}
?>
	</tbody>
</table>