<?php $this->declareVars(array(
"messages"=>array(),
"foundItems"=>array()
))?>

<h2>Blog entries</h2>

<?php foreach($this->messages as $message):?>
<div style="color:blue"><?php echo $message?></div>
<?php endforeach?>

<?php if($this->foundItems):
    $this->articles = $this->foundItems;?>
<p>found entries: <?php echo $this->paginator->getTotalItemCount()?></p>
<?php endif?>

<?php if($this->paginator->getTotalItemCount()):?>
<table class="listtable">
 <tr>
  <th>Id</th><th>Title</th><th>Posted</th><th colspan="2">Actions</th>
 </tr>
<?php foreach($this->articles as $article):?>
 <tr>
  <td><?php echo $article->getId()?></td>
  <td><?php echo $article->getTitle()?></td>
  <td><?php echo $this->commentDate($article->getPosted())?></td>
  <td><?php echo $this->anchor($this->url(array(
    "module" => "blog",
    "controller" => "entry",
    "action" => "edit",
    "itemId" => $article->getId()),
    "blogAdminItemAction"),"Edit")?></td>
  <td><?php echo $this->anchor($this->url(array(
    "module" => "blog",
    "controller" => "entry",
    "action" => "delete",
    "itemId" => $article->getId()),
    "blogAdminItemAction"),"Delete")?></td>
 </tr>
<?php endforeach;?>
</table>

<!-- page navigator -->
<div style="text-align: center; margin:1em 0;">
<?php echo $this->paginationControl($this->paginator,null,null,array("mainUrl"=>$this->url()));?>
</div>
<!-- end of page navigator -->

<?php else:?>
No entries.
<?php endif;?>
