public function __construct() { parent::__construct(); $this->lang->load('office_language', check_language()); if ($this->session->has_userdata('user_logged_in')) { $this->_UserLoggedIn = true; } if (!check_module_active($this->uri->rsegment(1))) { log_message('info', 'MODULE SYSTEM: Call offline Module'); return show_error('Модуль не доступен'); } }
public function render() { $_database = $this->get_menu_database(); if ($_database->num_rows() > 0) { $menu = ""; foreach ($_database->result() as $row) { switch ($row->menu_item_type) { case 1: $classActive = ""; if ($this->CI->uri->segment(1) == $row->url) { $classActive = "active"; } if ($row->need_authentication == 1) { if ($this->CI->session->has_userdata("user_logged_in")) { $menu .= "<li class='menu {$classActive}'>\n\t\t\t\t\t \t <a data-pjax class='' href='" . site_url() . "{$row->url}'>\n\t\t\t\t\t <i class='{$row->icon}'></i>\n\t\t\t\t\t <span>" . lang($row->menu_item_name) . "</span>\n\t\t\t\t\t </a>\n\t\t\t\t \t</li>"; } } else { if ($row->need_authentication == 0) { $menu .= "<li class='menu {$classActive}'>\n\t\t\t\t \t <a data-pjax class='' href='" . site_url() . "{$row->url}'>\n\t\t\t\t <i class='{$row->icon}'></i>\n\t\t\t\t <span>" . lang($row->menu_item_name) . "</span>\n\t\t\t\t </a>\n\t\t\t \t</li>"; } } break; case 2: $classActive = ""; if ($this->CI->uri->segment(1) == $row->module) { $classActive = "active"; } if (!check_module_active($row->module)) { log_message('info', 'MODULE SYSTEM: Call offline Module'); return show_error('Модуль не доступен'); } if ($row->need_authentication == 1) { if ($this->CI->session->has_userdata('user_logged_in')) { $menu .= modules::run($row->module . '/generateMenu', $classActive); } } else { if (!$this->CI->session->has_userdata('user_logged_in')) { $menu .= modules::run($row->module . '/generateMenu', $classActive); } } break; } } return $menu; } else { return NUll; } }