<? 
$this->title->elem('a');
$this->title->cssClass('new_role');
$this->title->name($this->language('Add role'));
$this->title->create($this->Language('Roles')); 
?>


<form method="post">
<div class="new_role_box hidden">
<table class="header">

<tr>
	<th><?=$this->Language('name', true);?></th>
	<td><input type="text"    name="name"></td>
</tr>


<tr>
	<th><?=$this->Language('level', true);?></th>
	<td><input type="text"    name="level"></td>
</tr>


<tr>
	<th><?=$this->Language('type', true);?></th>
	<td><input type="text"    name="type"></td>
</tr>

<tr>
	<th><?=$this->Language('description', true);?></th>
	<td><textarea  name="description"></textarea></td>
</tr>

<tr>
	<td></td>
	<td><input type="submit"    name="insert_role" value="<?=$this->Language('Insert');?>"></td>
</tr>
</table>
</div>


<table class="content">
<tr>

	<th><?=$this->Language('name', true);?></th>


	<th><?=$this->Language('level', true);?></th>


	<th><?=$this->Language('type', true);?></th>

	<th><?=$this->Language('description', true);?></th>

	<th></th>

</tr>
<?PHP while($row = $this->roles->Assoc()){ ?>

	<tr>
	<? if($row['id'] == $_GET['id']) {?>

		<td><input type="text"    name="name" value="<?=$row['name']?>"></td>

		<td><input type="text"    name="level" value="<?=$row['level']?>"></td>

		<td><input type="text"    name="type" value="<?=$row['type']?>"></td>

		<td><textarea name="description"><?=$row['description']?></textarea></td>

		<td><input type="submit"    name="update_role" value="<?=$this->Language('Update');?>"></td>

	<? }else{ ?>

		<td><a href="<?=$this->Link('?action=edit&id='.$row['id']);?>"><?=$row['name']?></a></td>

		<td><?=$row['level']?></td>

		<td><?=$row['type']?></td>

		<td><?=$row['description']?></td>

		<td><a href="<?=$this->Link('?action=delete_role&role_id='.$row['id']);?>" onclick="return $.confirm();"><?=$this->Language('delete');?></a></td>

	<? } ?>
	</tr>
	<? } ?>

</table>
</form>


<script type="text/javascript">
$('.new_role').click(function(){

	$('.new_role_box').slideBox(500);
	return false;
});
</script>