<div class="tableHeading"><?=$lang_manage_templates?></div>

<?php if ( ! empty( $templates ) ):?>
	<form method="post" action="<?=$form_url?>">
		<table id="field-entries" class="tableBorder magic_checkbox_table" style="width:100%;" 
			   cellspacing='0'  cellpadding='0'  border='0'>
			<thead>
				<tr>
					<th class="tableHeadingAlt" style="width:3%;  text-align:left;">&nbsp;</th>
					<th class="tableHeadingAlt" style="width:1%; text-align:left;">
						<input type="checkbox" name="toggle_all_checkboxes" value=""/>
					</th>
					<th class="tableHeadingAlt" style="width:10%; text-align:left;">
						<?=$lang_delete?>
					</th>
					<th class="tableHeadingAlt" style="width:35%; text-align:left;"><?=$lang_name?></th>
					<th class="tableHeadingAlt" style="width:51%; text-align:left;"><?=$lang_label?></th>
				</tr>
			</thead>
			<tbody>
	<?php foreach($templates as $template):?>
				<?php $class = $this->cycle('tableCellOne', 'tableCellTwo'); ?>
				<tr>
					<td class="<?=$class?>"><?=$template['count']?></td>
					
				<?php if ( $template['locked'] ) :?>
					<td class="<?=$class?>">&nbsp;</td>
					<td class="<?=$class?>"><?=$lang_locked?></td>
				<?php else:?>
					<td class="<?=$class?>">		
						<input type="checkbox" name="toggle[]" 
						   	   id="delete_box_<?=$template['id']?>" value="<?=$template['id']?>"/>
					</td>
					<td class="<?=$class?>">&nbsp;</td>	
				<?php endif;?>
					
					<td class="<?=$class?>">
				<?php if ( $template['locked'] ) :?>
						<?=$template['name']?>
				<?php else:?>				
					<a href="<?=$template['edit_url']?>"><?=$template['name']?></a>
				<?php endif;?>						
					</td>
					<td class="<?=$class?>"><?=$template['label']?></td>
				</tr>
	<?php endforeach; ?>			
			</tbody>	
			<?php $class = $this->cycle('tableCellOne', 'tableCellTwo'); ?>
			<tfoot>
				<tr>
					<td class="<?=$class?>">&nbsp;</td>
					<td class="<?=$class?>">
						<input type="checkbox" name="toggle_all_checkboxes" value=""/>
					</td>
					<td class="<?=$class?>">
						<strong><?=$lang_delete?></strong>
					</td>
					<td class="<?=$class?>">&nbsp;</td>
					<td class="<?=$class?>">&nbsp;</td>
				</tr>
				
				<?php if ( $paginate ): ?>
					<?php $class = $this->cycle('tableCellOne', 'tableCellTwo'); ?>
						<tr>
							<td class="<?=$class?>" colspan="5">	
								<?=$paginate?>
							</td>
						<tr>		
				<?php endif; ?>
				
			</tfoot>
		</table>
		<div class='clearfix'>&nbsp;</div>

		<div class="itemWrapper">
			<input type="submit" name="submit" value="Delete" />
		</div>
	</form>		
<?php else: ?>	
	<div class="tableCellOne">
		<div class="highlight"><?=$lang_no_templates?></div>
	</div>
<?php endif; ?>
