<script language="javascript" type="text/javascript">
  var modulo = 'cms_system';
</script>
<?php
  $modulo = 'cms_system';
?>
<div class="row-fluid">
  <div class="span12 btn-inverse div-top-borded">
    Pages Categories
    <a href="<?=$this->linkTo($modulo, "new");?>" class="btn btn-small btn-primary">Add new »</a>

    <form class="search-query pull-right hidden-phone" method="get" action="<?=$this->linkTo($modulo, "list");?>">
      <input type="text" class="search-query" placeholder="Search" name="s" value="<? if(!empty($this->filters['s'])) { echo $this->filters['s']; }?>"/>
      <button type="submit" class="btn">Go</button>
      <? if(!empty($this->filters['s'])): ?>
      <input type="button" class="btn" value="clear" onclick="window.location.href = '<?=$this->linkTo($modulo, "list");?>'"/>
      <? endif; ?>
    </form>

  </div>
</div>
<div class="row-fluid">
  <table class="table table-striped">
    <thead>
    <tr>
      <th width="5">&nbsp;</th>
      <th class="">Category</th>
      <th class="" width="100">Items</th>
      <th class="tc" width="5">Online</th>
      <th class="tc" width="110">Actions</th>
    </tr>
    </thead>
    <tbody>
      <? if(count($this->items) === 0): ?>
      <tr class="first">
        <td colspan="5">No records found</td>
      </tr>
      <? endif; ?>
      <? foreach($this->items as $item):?>
      <tr class="first order" id="tr-<?= $item->id; ?>">
        <td class="updown">&nbsp;</td>
        <td><a href="<?=$this->linkTo($modulo, "edit", array("id" => $item->id));?>" title="edit"><?=$item->page_cat;?></a></td>
        <td>
          <a href="<?= $this->linkTo("cms_modules", "list", array('r' => $item->id)); ?>">
            Items (<?= $item->conta; ?>)
          </a>
        </td>
        <td class="tc online" id="item<?= $item->id; ?>">
          <img alt="" id="online_<?= $item->id; ?>" onclick="onlineItem(<?= $item->id; ?>, <?= $item->online; ?>)" src="assets/images/<?= (($item->online == 1)? "tick.png": "tick_off.png"); ?>"/>
        </td>
        <td class="tc">
          <ul class="actions">
            <li><a class="ico" href="<?=$this->linkTo($modulo, "order", array("id" => $item->id, "dir" => 1));?>" title="move up"><img src="assets/images/page_up.png" alt="move up" /></a></li>
            <li><a class="ico" href="<?=$this->linkTo($modulo, "order", array("id" => $item->id, "dir" => 0));?>" title="move down"><img src="assets/images/page_down.png" alt="move down" /></a></li>
            <li><a class="ico" href="<?=$this->linkTo($modulo, "edit", array("id" => $item->id));?>" title="edit"><img src="css/img/led-ico/pencil.png" alt="edit" /></a></li>
            <?php if($item->id > 99): ?>
            <li><a class="ico confirm" href="<?=$this->linkTo($modulo, "delete", array("id" => $item->id));?>" title="delete"><img src="css/img/led-ico/delete.png" alt="delete" /></a></li>
            <?php endif; ?>
          </ul>
        </td>
      </tr>
      <? endforeach; ?>
    </tbody>
  </table>
</div>
<div class="row-fluid">
  <!-- pagination -->
  <?=$this->paginationControl($this->items, null, '_paginator.phtml', array("filters" => $this->filters));?>
</div>
