<header class="navbar navbarPos"> <div class="clearFix navbarIndent"> <a class="fontLogo" href="/backend/index"> <span class="top fontLogoName">wezom</span> <span class="top fontLogoTitle"> <span class="fontLogoLabel">cms</span> <span class="fontLogoVersion">4.0</span> </span> </a> <a title="Переключить навигацию" class="tip toggleSidebar" href="#"> <i class="fa-bars"></i> </a> <ul class="navbarNav"> <?php $access = \Core\User::access(); ?> <?php if (\Core\User::god() || isset($access['contacts']) && $access['log'] != 'no') { ?> <?php echo Core\Widgets::get('headerNew'); ?> <?php } ?> <?php if (\Core\User::god() || isset($access['contacts']) && $access['contacts'] != 'no') { ?> <?php echo Core\Widgets::get('headerContacts'); ?>
public function sidebarBackend($array = array()) { $result = DB::select()->from('menu')->where('status', '=', 1)->order_by('sort')->as_object()->execute(); $arr = array(); if (User::god()) { foreach ($result as $obj) { $arr[$obj->id_parent][] = $obj; } } else { $access = User::access(); $_arr = array(); foreach ($result as $obj) { $r = explode('/', trim($obj->link, '/')); if ($r[0] == 'seo') { array_splice($r, 0, 1); } if (!$obj->link || Arr::get($access, $r[0], 'no') == 'edit' || Arr::get($access, $r[0]) == 'view' && Arr::get($r, 1) == 'index') { $_arr[$obj->id_parent][] = $obj; } else { if (!$obj->link || Arr::get($access, str_replace('seo_', '', $r[0]), 'no') == 'edit' || Arr::get($access, str_replace('seo_', '', $r[0])) == 'view' && Arr::get($r, 1) == 'index') { $_arr[$obj->id_parent][] = $obj; } } } $arr = array(); foreach ($_arr[0] as $el) { if ($el->link || count(Arr::get($_arr, $el->id, array()))) { $arr[0][] = $el; } } foreach ($_arr as $key => $el) { if ($key != 0) { $arr[$key] = $el; } } } return $this->_data['sidebar'] = View::widget(array('result' => $arr, 'counts' => array()), 'Sidebar'); }
/** * @param $controller * @return string */ public static function get_access_for_controller($controller) { $access = User::access(); if (User::god() || $controller == 'auth' || $controller == 'ajax') { return 'edit'; } if (!isset($access[$controller]) || $access[$controller] == 'no') { return 'no'; } return $access[$controller]; }