<?php
  /**
   * Header
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: header.tpl.php, v1.00 2017-10-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');

  if (!App::Auth()->is_Admin()) {
	  Url::redirect(SITEURL . '/admin/login/'); 
	  exit; 
  }
 ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $this->title;?></title>
<script type="text/javascript" src="<?php echo SITEURL;?>/assets/jquery.js"></script>
<script type="text/javascript" src="<?php echo SITEURL;?>/assets/global.js"></script>
<link href="<?php echo ADMINVIEW . '/cache/' . Cache::cssCache(array('base.css','transition.css','dropdown.css','menu.css','image.css','label.css','message.css','list.css','table.css','datepicker.css','divider.css','form.css','input.css','icon.css','button.css','segment.css','editor.css','popup.css','dimmer.css','modal.css','progress.css','utility.css','style.css'), ADMINBASE);?>" rel="stylesheet" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body>
<div id="mResults" class="wojo page inverted dimmer">
<a class="close white"><i class="icon delete"></i></a>
  <div class="padding"></div>
</div>
<div class="wojo sidebar"></div>
<div id="wrapper">
<div class="container">
<aside>
  <a id="mnav-alt"><i class="icon reorder"></i></a>
  <div class="logo"><a href="<?php echo ADMINURL;?>/"><?php echo ($this->core->logo) ? '<img src="' . SITEURL . '/uploads/' . $this->core->logo . '" alt="' . $this->core->company . '">': $this->core->company;?></a>
  </div>
  <div class="menuwrap">
    <nav>
      <ul class="clearfix">
        <li<?php if (Utility::in_array_any(["menus","categories","templates","countries","coupons","fields","news","mailer","pages", "faq", "comments", "memberships"], $this->segments)) echo ' class="active"';?>><a class="collapsed"><i class="icon files"></i>
            <span><?php echo Lang::$word->ADM_CONTENT;?></span></a>
          <ul class="cleafrfix">
            <li><a<?php if (in_array("menus", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/menus");?>"><?php echo Lang::$word->ADM_MENUS;?></a>
            </li>
            <li><a<?php if (in_array("categories", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/categories");?>"><?php echo Lang::$word->ADM_CATS;?></a>
            </li>
            <li><a<?php if (in_array("pages", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/pages");?>"><?php echo Lang::$word->ADM_PAGES;?></a>
            </li>
            <li><a<?php if (in_array("countries", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/countries");?>"><?php echo Lang::$word->ADM_CNTR;?></a>
            </li>
            <li><a<?php if (in_array("coupons", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/coupons");?>"><?php echo Lang::$word->ADM_COUPONS;?></a>
            </li>
            <li><a<?php if (in_array("comments", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/comments");?>"><?php echo Lang::$word->ADM_CMNTS;?></a>
            </li>
            <li><a<?php if (in_array("fields", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/fields");?>"><?php echo Lang::$word->ADM_CFIELDS;?></a>
            </li>
            <li><a<?php if (in_array("news", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/news");?>"><?php echo Lang::$word->ADM_NEWS;?></a>
            </li>
            <li><a<?php if (in_array("faq", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/faq");?>"><?php echo Lang::$word->ADM_FAQ;?></a>
            </li>
            <li><a<?php if (in_array("mailer", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/mailer");?>"><?php echo Lang::$word->ADM_NEWSL;?></a>
            </li>
            <li><a<?php if (in_array("memberships", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/memberships");?>"><?php echo Lang::$word->ADM_MEMS;?></a>
            </li>
          </ul>
        </li>
        <li<?php if (in_array("users", $this->segments)) echo ' class="active"';?>><a href="<?php echo Url::url("/admin/users");?>"><i class="icon users"></i>
            <span><?php echo Lang::$word->ADM_USERS;?></span></a>
        </li>
        <li<?php if (in_array("products", $this->segments)) echo ' class="active"';?>><a href="<?php echo Url::url("/admin/products");?>"><i class="icon app"></i>
            <span><?php echo Lang::$word->ADM_PROD;?></span></a>
        </li>
        <li<?php if (in_array("files", $this->segments)) echo ' class="active"';?>><a href="<?php echo Url::url("/admin/files");?>"><i class="icon folder"></i><span><?php echo Lang::$word->ADM_FILES;?></a>
          </span>
        </li>
        <li<?php if (in_array("transactions", $this->segments)) echo ' class="active"';?>><a href="<?php echo Url::url("/admin/transactions");?>"><i class="icon money bag"></i><span><?php echo Lang::$word->ADM_TRANS;?></span></a>
        </li>
        <li<?php if (Utility::in_array_any(["configuration","language","backup","maintenance"], $this->segments)) echo ' class="active"';?>><a class="collapsed"><i class="icon cog"></i>
            <span><?php echo Lang::$word->ADM_CONFIG;?></span></a>
          <ul>
            <li><a<?php if (in_array("configuration", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/configuration");?>"><?php echo Lang::$word->ADM_STNG;?></a>
            </li>
            <li><a<?php if (in_array("language", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/language");?>"><?php echo Lang::$word->ADM_LNGMNG;?></a>
            </li>
            <li><a<?php if (in_array("backup", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/backup");?>"><?php echo Lang::$word->ADM_BACKUP;?></a>
            </li>
            <li><a<?php if (in_array("maintenance", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/maintenance");?>"><?php echo Lang::$word->ADM_MTNC;?></a>
            </li>
          </ul>
        </li>
      </ul>
    </nav>
  </div>
</aside>
<main>
<div class="row align-middle">
  <div class="columns shrink">
    <a id="mnav"><i class="icon reorder"></i></a>
  </div>
  <div class="columns padding phone-100 phone-padding"><?php if (Utility::in_array_any(["pages","users","products","files","transactions"], $this->segments)):?>
    <div class="wojo transparent fluid left icon input">
      <i class="find icon"></i>
      <input id="masterSearch" placeholder="<?php echo Lang::$word->SEARCH;?>" type="text" data-page="<?php echo $this->segments[1];?>">
    </div>
	<?php endif;?>
  </div>
  <div class="columns shrink phone-padding">
    <div class="wojo inline pointing dropdown">
      <span class="wojo small semi text"><?php echo Lang::$word->ADM_STNG;?></span>
      <i class="icon dropdown"></i>
      <div class="small menu">
        <?php if(Auth::checkAcl("owner")):?>
        <a class="item" href="<?php echo Url::url("/admin/permissions");?>"><i class="icon lock"></i>
          <?php echo Lang::$word->ADM_PERMS;?></a>
        <?php endif;?>
        <a class="item" href="<?php echo Url::url("/admin/language");?>"><i class="icon flag"></i>
          <?php echo Lang::$word->ADM_LNGMNG;?></a>
        <a class="item" href="<?php echo Url::url("/admin/templates");?>"><i class="icon email"></i>
          <?php echo Lang::$word->ADM_EMTPL;?></a>
        <?php if(Auth::checkAcl("owner")):?>
        <a class="item" href="<?php echo Url::url("/admin/system");?>"><i class="icon laptop"></i>
          <?php echo Lang::$word->ADM_SYSINFO;?></a>
        <a class="item" href="<?php echo Url::url("/admin/gateways");?>"><i class="icon credit card"></i>
          <?php echo Lang::$word->ADM_GATE;?></a>
        <?php endif;?>
        <div class="wojo basic divider"></div>
        <a class="item wojo bold text" href="<?php echo Url::url("/admin/trash");?>"><i class="icon trash"></i>
          <?php echo Lang::$word->TRASH;?></a>
      </div>
    </div>
  </div>
  <div class="columns shrink padding">
    <div class="wojo pointing top right dropdown">
      <div class="wojo small text">
        <img src="<?php echo UPLOADURL;?>/avatars/<?php echo (App::Auth()->avatar) ? App::Auth()->avatar : "blank.svg";?>" alt="" class="wojo image avatar"><?php echo Lang::$word->HELLO;?>, <?php echo App::Auth()->name;?>! </div>
      <div class="small menu">
        <a class="item" href="<?php echo Url::url("/admin/myaccount");?>">
          <i class="icon note"></i><?php echo Lang::$word->ADM_MYACC;?></a>
        <a class="item" href="<?php echo Url::url("/admin/myaccount", "password");?>">
          <i class="icon lock"></i><?php echo Lang::$word->ADM_CHPASS;?></a>
        <div class="basic divider"></div>
        <a class="item wojo bold text" href="<?php echo Url::url("/admin/logout");?>"><i class="icon power"></i><?php echo Lang::$word->LOGOUT;?></a>
      </div>
    </div>
  </div>
</div>
<div id="container">
<div class="wojo small breadcrumb">
  <?php echo Url::crumbs($this->crumbs ? $this->crumbs : $this->segments, "//", Lang::$word->HOME);?>
</div>