<? $this->title->create($this->Language('Elements')); ?>


<form method="post">
<table class="content">
<?
$this->Form->trHeader('elements');
while($row = $this->elements->Assoc()){

	if($_GET['action'] == 'edit' && $_GET['id'] == $row['id']){

		$roles = '';
		while($row2 = $this->roles->Assoc()){

			$selected = preg_match('/\,'.$row2['name'].'/i', ','.$row['access']) ? 'selected="selected"' : '';
			$roles .= '<option value="'.$row2['id'].'" '.$selected.'>'.$row2['name'].'</option>';
		}
		$this->Form->input(array('name', 'model', 'page'));
		$this->Form->select('access');
		$this->Form->access(array('multiple=multiple', 'value='.$roles));

		$this->Form->tr(array('name', 'model', 'page', 'access', ''), $row, array('tr' => 'class="row" id="row-'.$row['id'].'"'));
	}
	else{

		$this->Form->tr(array('name', 'model', 'page', 'access', ''), $row, array('tr' => 'class="row pointer" id="row-'.$row['id'].'"'));
	}
}
?>
</table>
</form>