<script language="javascript" type="text/javascript">
  var modulo = 'cms_modules';
</script>
<?php
  $supModulo = 'cms_system';
  $modulo = 'cms_modules';
?>
<div class="row-fluid">
  <div class="span12 btn-inverse div-top-borded">
    Modules
    <a href="<?=$this->linkTo($supModulo);?>" class="btn btn-small">&laquo; Back to System</a>
    <a href="<?=$this->linkTo($modulo, "new", array('r' => $this->page->id));?>" class="btn btn-small btn-primary">Add new &raquo;</a>

    <form class="search-query pull-right" method="get" action="<?=$this->linkTo($modulo, "list");?>">
      <input type="text" class="search-query" placeholder="Search" name="s" value="<?php if(!empty($this->filters['s'])) { echo $this->filters['s']; }?>"/>
      <button type="submit" class="btn">Go</button>
      <?php if(!empty($this->filters['s'])): ?>
      <input type="button" class="btn" value="clear" onclick="window.location.href = '<?=$this->linkTo($modulo, "list");?>'"/>
      <?php endif; ?>
    </form>
  </div>
</div>
<div class="row-fluid">
  <table class="table table-striped">
    <thead>
    <tr>
      <th width="5">&nbsp;</th>
      <th>Module</th>
      <th>Folder</th>
      <th class="tc" width="5">Hidden</th>
      <th class="tc" width="5">Online</th>
      <th class="tc" width="110">Actions</th>
    </tr>
    </thead>
    <tbody>
      <?php if(count($this->items) === 0): ?>
      <tr class="first">
        <td colspan="5">No records found</td>
      </tr>
      <?php endif; ?>
      <?php 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, 'r' => $this->page->id));?>" title="edit"><?=$item->title;?></a></td>
        <td><?=$item->folder;?></td>
        <td class="tc">
          <?= (($item->hidden == 1)? "Yes": "No"); ?>
        </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, 'r' => $this->page->id));?>" 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, 'r' => $this->page->id));?>" 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, 'r' => $this->page->id));?>" title="edit"><img src="css/img/led-ico/pencil.png" alt="edit" /></a></li>
            <li><a class="ico confirm" href="<?=$this->linkTo($modulo, "delete", array("id" => $item->id, 'r' => $this->page->id));?>" title="delete"><img src="css/img/led-ico/delete.png" alt="delete" /></a></li>
          </ul>
        </td>
      </tr>
      <?php endforeach; ?>
    </tbody>
  </table>
</div>
<div class="row-fluid">
  <!-- pagination -->
  <?=$this->paginationControl($this->items, null, '_paginator.phtml', array("filters" => $this->filters));?>
</div>
