<? 
$this->title->elem('a');
$this->title->cssClass('add_language_menu');
$this->title->name($this->Language('Add language menu'));
$this->title->create($this->Language('Language menus')); 
?>

<form method="post">
	<div class="add_language_menu_box hidden">
		<table class="header">
		<tr>
			<th><?=$this->Language('Language');?></th>
			<td><input type="text" name="language"></td>
		</tr>
		<tr>
			<th><?=$this->Language('Key');?></th>
			<td><input type="text" name="key"></td>
		</tr>
		<tr>
			<th><?=$this->Language('Is active');?></th>
			<td><input type="checkbox" name="is_active" value="1"></td>
		</tr>
		<tr>
			<th></th>
			<td><input type="submit" name="add_language_menu" value="<?=$this->Language('Add language menu');?>"></td>
		</tr>
		</table>
	</div>
</form>


<form method="post" action="<?=$this->Link();?>">
<table class="content">
<tr>
	<th><?=$this->Language('Language');?></th>
	<th><?=$this->Language('Key');?></th>
	<th><?=$this->Language('Is active');?></th>
	<th></th>
</tr>
<?PHP
while($row = $this->language_menus->Assoc()){

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

		echo '<tr>';
		echo '<td><input type="hidden" name="id" value="'.$row['id'].'"/><input type="text" name="language" value="'.$row['language'].'"/></td>';
		echo '<td><input type="text" name="key" value="'.$row['key'].'"/></td>';
		echo '<td><input type="checkbox" name="is_active" value="1" '.($row['is_active'] == 1 ? 'checked="checked"' : '').'/></td>';
		echo '<td><input type="submit" name="update_language_menu" value="'.$this->Language('Update').'"/></td>';
		echo '</tr>';
	}
	else{

		echo '<tr>';
		echo '<td><a href="'.$this->Link('?action=edit&id='.$row['id']).'">'.$row['language'].'</a></td>';
		echo '<td>'.$row['key'].'</td>';
		echo '<td>'.$row['is_active'].'</td>';
		echo '<td><a href="'.$this->Link('?action=delete_language_menu&id='.$row['id']).'" onclick="return $.confirm();">'.$this->Language('Delete').'</a></td>';
		echo '</tr>';
	}
}
?>
</table>
</form>


<script>
$('.add_language_menu').click(function(){

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