<?php use_helper('tvtl') ?>
<?php $cache_file = 'blog_list_'.$blogtype.'_'.$page ?>
<?php if ($sort=='id' && $page==1 && !begin_html_cache($cache_file)) return ?>

<?php if (blogStore::$blogName=='main'): ?>
  <div style="margin-top:10px; margin-bottom:10px">
    Loại trang web:&nbsp;
    <?php echo select_tag('selectblogtype', options_for_select(
      array('Tất cả', 'Blog cá nhân', 'Website trường học', 'Website Phòng GD&ĐT', 'Website Sở GD&ĐT'), $blogtype),
      array('onchange'=>"location.href='".url_for('blog/listsubblog')."?blogtype='+this.value+'&sort=$sort&order_by=$order_by'")
    )?>
  </div>
<?php endif ?>

<table class="table-content" style="width:100%">
  <tr>
    <th width="58%" align="left">Tiêu đề trang web</th>
    <th width="30%">Người quản trị</th>
    <th width="12%" style="text-align:center;">
      <?php echo link_to('Truy cập'.$hitstatus, '/blog/listsubblog?blogtype='.$blogtype.'&sort=hit&order_by='.($order_by=='desc'? 'asc': 'desc')) ?>
    </th>
  </tr>
  <?php foreach ($pager->getResult() as $i => $tblblogdepend): ?>
    <?php $blog = blogStore::$blogName=='main'? $tblblogdepend: $tblblogdepend->getTblblog() ?>
    <tr class="row<?php echo $i%2 ?>">
      <td><?php echo link_to($blog->getBlTitle(), $blog->getRootUrl()) ?></td>
      <td><?php echo TbluserPeer::retrieveByPk($blog->getBlUser())->getObject()->getHtmlname() ?></td>
      <td style="text-align:center;"><?php echo $blog->getBlHit() ?></td>
    </tr>
  <?php endforeach ?>
</table>
<br>
<?php echo showPageNav13($pager, '/blog/listsubblog?blogtype='.$blogtype.'&sort='.$sort.'&order_by='.$order_by) ?>
<?php if ($sort=='id' && $page==1) end_html_cache($cache_file) ?>
