<?php
/**
 * The index view file of index 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      Yidong Wang <yidong@cnezsoft.com>
 * @package     index
 * @version     $Id: index.html.php 4205 2016-10-24 08:19:13Z liugang $
 * @link        http://www.zdoo.com
 */
include "../../common/view/header.lite.html.php";
js::import($jsRoot . 'jquery/ips.js');
$isSuperAdmin = $this->app->user->admin == 'super';
js::set('attend', commonModel::isAvailable('attend') ? 1 : 0);
js::set('attendNotice', $notice);
?>
<!-- Desktop -->
<div id='desktop' class='fullscreen-mode auto-fade-in fade'>
  <div id='taskBar' class='dock-bottom unselectable'>
    <div id='taskbarList'>
      <ul class='bar-menu'>
        <?php if($hideNavigation):?>
        <button class="s-task-btn open task-toggle-menu" data-toggle="tooltip" data-tip-class="s-task-tooltip" data-placement="top" data-original-title="<?php echo $lang->hideMenu?>">
          <div class="avatar avatar-app avatar-inverse task-toggle-menu-div" data-tone="#edcb45">
            <i class="icon icon-angle-left"></i>
          </div>
        </button>
        <?php endif;?>
      </ul>
    </div>
    <div id='poweredBy'>
      <small class='muted'><?php echo $lang->designedByAIUX;?></small> &nbsp;
      <?php printf($lang->poweredBy, $config->version, "<img src='{$config->webRoot}theme/default/images/main/zdoo.png'/> {$lang->versionName} " . str_replace($config->versionPrefix, '', $config->version));?> &nbsp;
      <a href='https://api.zdoo.com/goto.php?item=bizversion&from=footer' target='_blank' id='bizLink' class='text-important'><?php echo $lang->bizVersion;?><i class='text-danger icon-biz-version'></i></a>
    </div>
  </div>
  <div id='appMenuBar' class='dock-right'>
  </div>
  <div id='leftBar' class='dock-left unselectable'>
    <div id='appsMenu'>
      <ul class='bar-menu apps-menu apps-main-menu'></ul>
      <ul class='bar-menu'>
        <li class='dropdown dropdown-hover'>
          <button id='moreOptionBtn' data-tip-class='s-menu-tooltip' data-btn-type='menu' class='btn-more' title='<?php echo $lang->index->more;?>'><i class='icon icon-apps-more'></i><span class='text'><?php echo $lang->index->more;?></span><i class='icon icon-angle-right icon-xs anchor-right'></i></button>
          <ul id='moreOptionMenu' class='bar-menu dropdown-menu fade'>
          </ul>
        </li>
      </ul>
      <ul class='bar-menu apps-menu apps-extra-menu hidden' id='leftBottomBar'>
      </ul>
    </div>
    <div id='userMenuBar' class='dock-bottom'>
      <ul class='bar-menu'>
        <li class='dropdown dropdown-hover'>
          <button id='start' type='button' title="<?php echo $app->user->realname;?>" data-toggle='dropdown'>
            <div class='avatar avatar-user' data-id='<?php echo $app->user->id; ?>' data-name='<?php echo $app->user->realname; ?>'><?php if(!empty($app->user->avatar)) echo html::image($app->user->avatar);?></div><span class='text'><?php echo $lang->index->profile; ?></span>
          </button>
          <ul id='startMenu' class='dropdown-menu fade pull-right'>
            <li class='text-center'><?php echo html::a($this->createLink('user', 'profile'), "<strong>{$lang->user->information}</strong>", "data-toggle='modal' data-id='profile'");?></li>
            <li class="divider"></li>
            <?php /** <li><a><i class='icon icon-bell'></i> 消息 <span class='label label-badge label-danger'>5</span></a></li> */ ?>
            <li><a class='app-btn' data-id='allapps'><i class='icon icon-apps'></i> <?php echo $lang->index->allEntries;?></a></li>
            <?php if($isSuperAdmin || commonModel::hasAppPriv('superadmin')):?>
            <li><a class='app-btn' data-id='superadmin'><i class='icon icon-config-outline'></i> <?php echo $lang->index->superAdmin;?></a></li>
            <?php endif; ?>
            <li><a class='btn-toggle-leftbar'><i class='icon icon-double-angle-right'></i> <?php echo $lang->index->expandLeftBar; ?></a></li>
            <li class="divider"></li>
            <li class='dropdown-submenu'><?php include '../../common/view/selectlang.html.php';?></li>
            <li class='dropdown-submenu'><?php include '../../common/view/selecttheme.html.php';?></li>
            <li><a href='<?php echo $this->createLink('misc', 'about');?>' data-id='about' data-toggle='modal' data-width='500'><i class='icon icon-info'></i> <?php echo $lang->index->about?></a></li>
            <li class="divider"></li>
            <?php echo $signButtons?>
          </ul>
        </li>
      </ul>
    </div>
    <button type='button' class='btn-toggle-leftbar' id='toggleLeftBarBtn'><i class="icon icon-angle-right"></i></button>
  </div>
  <div id='allapps' class='fullscreen unselectable'>
    <header>
      <ul class='nav' id='appSearchNav'>
        <li><a href="javascript:;" class='app-search' data-key=''><i class='icon-th-large'></i> <span><?php echo $lang->index->allEntries?></span> &nbsp;<small class='muted entries-count'></small></a></li>
        <li><a href="javascript:;" class='app-search' data-key=':menu'><i class=''></i> <span><?php echo $lang->index->showOnLeft?></span> &nbsp;<small class='muted search-count'></small></a></li>
        <li><a href="javascript:;" class='app-search' data-key=':!menu'><i class=''></i> <span><?php echo $lang->index->notOnLeft?></span> &nbsp;<small class='muted search-count'></small></a></li>
      </ul>
      <div class='search-input'>
        <i class='icon-search icon'></i>
        <input id='search' type='text' class='form-control-pure form-control'>
        <button id='cancelSearch' class='btn btn-pure btn-mini' type='button'><i class='icon-remove'></i></button>
      </div>
      <div class='actions'>
        <?php if($isSuperAdmin):?>
        <?php echo html::a($this->createLink('entry', 'create'), "<i class='icon-plus'></i> {$lang->index->addEntry}", "data-id='superadmin' class='app-btn btn btn-pure'")?>
        <?php endif;?>
      </div>
    </header>
    <div class='all-apps-list' id='allAppsList'>
      <ul class='bar-menu'>
      </ul>
    </div>
  </div>
  <div id='deskContainer'>
  </div>
  <div id='modalContainer'></div>
</div>
<script>
<?php $dashboardMenu = (isset($dashboard) and isset($dashboard->visible) and $dashboard->visible == 0) ? 'list' : 'all';?>
var entries = [
{
    id        : 'dashboard',
    code      : 'dashboard',
    name      : '<?php echo $lang->index->dashboard;?>',
    abbr      : '<?php echo $lang->index->dashboardAbbr;?>',
    open      : 'iframe',
    desc      : '<?php echo $lang->index->dashboard?>',
    menu      : '<?php echo $dashboardMenu;?>',
    sys       : true,
    icon      : 'icon-home',
    url       : '<?php echo $this->createLink('my', 'index')?>',
    order     : 0,
    buildin   : true
},
{
    id        : 'allapps',
    code      : 'allapps',
    name      : '<?php echo $lang->index->allEntries?>',
    display   : 'fullscreen',
    desc      : '<?php echo $lang->index->allEntries?>',
    menu      : 'menu-extra',
    icon      : 'icon-apps',
    sys       : true,
    forceMenu : true,
    buildin   : true,
    order     : 9999997
}];

<?php if($isSuperAdmin || commonModel::hasAppPriv('superadmin')):?>

entries.push(
{
    id    : 'superadmin',
    code  : 'superadmin',
    name  : '<?php echo $lang->index->superAdmin;?>',
    open  : 'iframe',
    desc  : '<?php echo $lang->index->superAdmin?>',
    menu  : 'menu-extra',
    sys   : true,
    icon  : 'icon-config-outline',
    url   : "<?php echo $this->createLink('company', 'index')?>",
    buildin   : true,
    order : 9999998
});
<?php endif;?>

var ipsLang = {};
<?php
foreach ($lang->index->ips as $key => $value)
{
    echo 'ipsLang["' . $key . '"] = "' . $value . '";';
}
?>
<?php echo $allEntries;?>
</script>
<?php include "../../common/view/footer.html.php"; ?>
