Example #1
0
        <!-- end user info -->
    </div>

    <!-- NAVIGATION : This navigation is also responsive

	To make this navigation dynamic please make sure to link the node
	(the reference to the nav > ul) after page load. Or the navigation
	will not initialize.
	-->
    <nav class="primary-nav">
        <!-- NOTE: Notice the gaps after each icon usage <i></i>..
		Please note that these links work a bit different than
		traditional hre="" links. See documentation for details.
		-->
        <?php 
$pieces = explode('?', \Dsc\Pagination::checkRoute(str_replace($BASE, '', $URI)));
$current = $pieces[0];
$list = (new \Admin\Models\Nav\Primary())->setState('filter.root', false)->setState('filter.tree', \Admin\Models\Settings::fetch()->get('admin_menu_id'))->setState('order_clause', array('tree' => 1, 'lft' => 1))->getItems();
// push the default to the beginning of the list
array_unshift($list, new \Admin\Models\Nav\Primary(array('route' => './admin', 'title' => 'Dashboard', 'icon' => 'fa-home', 'depth' => 2)));
?>
        
        <ul>
        <?php 
foreach ($list as $key => $item) {
    if (!($hasAccess = \Dsc\System::instance()->get('acl')->isAllowed($identity->role, $item->route, '*'))) {
        continue;
    }
    $class = !empty($item->class) ? $item->class : 'menu-item';
    $selected = $current == $item->route || !empty($item->base) && strpos($current, $item->base . '/') !== false || \Dsc\String::inStrings(\Dsc\ArrayHelper::getColumn($item->getDescendants(), 'route'), $current);
    if ($selected || $current == str_replace('./', '/', $item->route)) {
Example #2
0
 /**
  * Method to auto-populate the model state.
  *
  */
 public function populateState()
 {
     if ($filters = $this->getUserStateFromRequest($this->context() . '.filter', 'filter', array(), 'array')) {
         $filters = \Dsc\ArrayHelper::dot($filters);
         foreach ($filters as $name => $value) {
             $this->setState('filter.' . $name, $value);
         }
     }
     if ($list = $this->getUserStateFromRequest($this->context() . '.list', 'list', array(), 'array')) {
         $list = \Dsc\ArrayHelper::dot($list);
         foreach ($list as $name => $value) {
             $this->setState('list.' . $name, $value);
         }
     }
     $offset = \Dsc\Pagination::findCurrentPage();
     $this->setState('list.offset', $offset - 1 >= 0 ? $offset - 1 : 0);
     if (!is_null($this->getState('list.order')) && !is_null($this->getState('list.direction'))) {
         switch (strtolower($this->getState('list.direction'))) {
             case "-1":
             case "desc":
                 $dir = -1;
                 break;
             case "1":
             case "asc":
             default:
                 $dir = 1;
                 break;
         }
         // TODO ensure that $this->getState('list.order') is a valid sorting field
         $this->setState('list.sort', array($this->getState('list.order') => $dir));
     }
     if (is_null($this->getState('list.sort'))) {
         $this->setState('list.sort', $this->__config['default_sort']);
         if (reset($this->__config['default_sort'])) {
             list($key, $value) = each($this->__config['default_sort']);
             $this->setState('list.order', $key);
             $this->setState('list.direction', $value);
         }
     }
     return $this;
 }