<?php
/**
 * The index view file of blog module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Xiying Guan <guanxiying@xirangit.com>
 * @package     blog
 * @version     $Id: index.html.php 9763 2014-06-04 09:06:33Z guanxiying $
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php css::import($themeRoot . 'default/blog.css');?>
<?php include '../../../sys/common/view/treeview.html.php';?>
<?php if(isset($mode)) js::set('mode', $mode);?>

<?php if(count($months, 1) > 1):?>
<li class='dropdown month hide'>
  <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo !empty($currentMonth) ? str_replace('_', '-', $currentMonth) : $this->lang->blog->allMonth;?><span class="caret"></span></a>
  <ul role="menu" class="dropdown-menu">
    <li><?php echo html::a(inlink('index', 'category=0&author=&month='), $this->lang->blog->allMonth);?></li>
    <?php foreach($months as $year => $monthList):?>
    <li class='dropdown-submenu'>
      <?php rsort($monthList);?>
      <?php echo html::a(inlink('index', 'category=0&author=&month=' . $year), $year);?>
      <ul class='dropdown-menu'>
      <?php foreach($monthList as $month):?>
        <li><?php echo html::a(inlink('index', 'category=0&author=&month=' . $year . '_' . $month), $month);?></li>
      <?php endforeach;?>
      </ul>
    </li>
    <?php endforeach;?>
  </ul>
</li>
<?php endif;?>

<?php if(count($authors) > 1):?>
<li class='dropdown author hide'>
  <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo !empty($author) ? $authors[$author]->realname : $this->lang->blog->allAuthors;?><span class="caret"></span></a>
  <ul role="menu" class="dropdown-menu dropdown-menu-account">
    <li><?php echo html::a(inlink('index'), $this->lang->blog->allAuthors);?></li>
    <?php foreach($authors as $author):?>
    <li><?php echo html::a(inlink('index', "category=0&author={$author->account}"), $author->realname);?></li>
    <?php endforeach;?>
  </ul>
</li>
<?php endif;?>

<div id='menuActions'>
  <div class='search-group w-200px'>
    <div class='input-group'>
      <?php echo html::input('searchInput', isset($searchText) ? $searchText : '', "class='form-control search-query' placeholder=''"); ?>
      <span class='input-group-btn'>
        <?php echo html::a('###', $lang->blog->search, "class='btn btn-primary' id='searchButton'");?>
      </span>
      <div id='querybox' data-module='blog' class='hide'></div>
    </div>
  </div>

  <?php commonModel::printLink('blog', 'create', !empty($category->id) ? "categoryID={$category->id}" : '', "<i class='icon icon-plus'></i> " . $lang->blog->create, "class='btn btn-primary'");?>
</div>
<div class='main-row'>
  <?php include 'side.html.php';?>
