<? content() ?>

<h1>Listado de Posts</h1>

<div>
<?= link_to('posts/adicionar', 'Nuevo Post') ?> / 
<?= link_to('datos/index', 'Cambiar Datos') ?> /
<?= link_to('contenido/index', 'Ver Blog', 'target: _new') ?> /
<?= link_to('admin/salir', 'Terminar Sesi&oacute;n') ?>
</div>
<br>

<? if($Posts->count()){ ?>
<table cellspacing='0' cellpadding='2' border='1' style='border: 1px solid #CFCFCF'>
	<tr>
		<th>Id</th>
		<th>Titulo</th>
		<th>Fecha</th>	
		<th>&nbsp;</th>
		<th>&nbsp;</th>
	</tr>

<? foreach($Posts->find('order: created_at') as $post): ?>

<? tr_color('#F0FAFF', '#FFFFFF') ?>
	<td><?= $post->id ?></td>
	<td><?= link_to('posts/consultar/'.$post->id, $post->title) ?></td>
	<td><?= $post->created_at ?></td>
	<td><?= link_to('posts/modificar/'.$post->id, 'Modificar') ?></td>
	<td>
		<b><?= link_to('posts/borrar/'.$post->id, 
						img_tag('delete.gif', 'border: 0', 'title: Eliminar registro?'),
	                   'confirm: Desea borrar el Post?') ?>
	    </b>
	</td>
</tr>

<? endforeach;?>
</table>

<? } else { print "No hay Posts"; } ?>
	
<br>
<div>
<?= link_to('posts/adicionar', 'Nuevo Post') ?> / 
<?= link_to('datos/index', 'Cambiar Datos') ?> /
<?= link_to('contenido/index', 'Ver Blog', 'target: _new') ?> /
<?= link_to('admin/salir', 'Terminar Sesi&oacute;n') ?>
</div>