public function __construct() { parent::__construct(); $db = Config::get('database.default'); if ($db != null) { View::share('navLinks', Admin_Menu::menuGenerator()); View::share('sidebar', Navigator::sidebar()); View::share('breadcrumb', Navigator::breadcrumb()); } $class = get_called_class(); if (!Request::ajax()) { switch ($class) { case 'Home_Controller': $this->filter('before', 'nonauth'); break; case 'Setup_Controller': $this->filter('before', 'nonauth'); break; case 'Admin_Auth_Controller': $this->filter('before', 'auth')->except(array('authenticate', 'verifyupdate', 'logout')); break; default: $this->filter('before', 'auth'); break; } } }
public function add_options_page() { //Add an options page or a sub options page //add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); //add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); // $this->options_page = add_menu_page( $this->title, $this->title, 'manage_options', $this->key, array( $this, 'admin_page_display' ) ); $this->options_page = add_submenu_page($this->parentKey, $this->title, $this->title, 'manage_options', $this->key, array($this, 'admin_page_display')); parent::add_options_page(); }
protected static function datasource() { $page = Admin_Menu::pageExist(); $dataMassage = array(); foreach ($page as $content) { if ($content->action == '') { $dataMassage[$content->controller]['alias'] = $content->controlleralias; } else { $dataMassage[$content->controller]['page'][$content->action] = $content->actionalias; } } return $dataMassage; }
/** * breadcrumb function * Create breadcrumb * @return string * @author joharijumali **/ public static function breadcrumb() { $Menu = Admin_Menu::menuGenerator(); $butternbread = array(); foreach ($Menu as $floor => $packet) { foreach ($packet->page->action as $key => $action) { if ($packet->packet == Str::lower(URI::segment(1)) && $packet->controller->name == Str::lower(URI::segment(2)) && $action->name == Str::lower(URI::segment(3)) || URI::segment(3) == NULL && $action->name == $packet->controller->name && Str::lower(URI::segment(2)) == $packet->controller->name) { $butternbread[Str::upper($packet->controller->alias)] = '#'; array_push($butternbread, Str::title($action->alias)); } } } return Breadcrumb::create($butternbread); }
public static function menuGenerator() { $Menus = Admin_Menu::order_by('arrangement', 'asc')->get(); $acces = Admin_UserAcl::aclRegistered(); $selected = new stdClass(); $page = new stdClass(); $dev = array(); $sub = array(); $logged_user = Auth::user(); foreach ($Menus as $id => $menu) { $content = new stdClass(); $controller = new stdClass(); $action = new stdClass(); $pieces = explode("/", $menu->controller); if ($menu->action == NULL || $menu->header == 1 && $menu->footer == 1) { $content->footer = $menu->footer; $content->header = $menu->header; $content->auth = $menu->auth; $content->admin = $menu->admin; $content->packet = $pieces[0]; if ($menu->action == NULL && ($menu->header == 1 || $menu->footer == 1)) { $controller->name = $pieces[1]; $controller->alias = $menu->controlleralias; } else { $controller->name = $menu->action; $controller->alias = $menu->actionalias; } $content->controller = $controller; if ($content->controller->name == URI::segment(2)) { $content->status = "active"; } else { $content->status = ""; } } elseif ($menu->action != NULL && ($menu->header != 0 || $menu->footer != 0)) { $action->name = $menu->action; $action->alias = $menu->actionalias; $action->footer = $menu->footer; $action->header = $menu->header; $action->auth = $menu->auth; if ($action->name == URI::segment(3) || URI::segment(3) == NULL && $action->name == $pieces[1] && URI::segment(2) == $pieces[1]) { $action->status = "active"; } else { $action->status = ""; } //check acl access if (Auth::check()) { if (isset($acces[$logged_user->role])) { if (isset($acces[$logged_user->role][$menu->controller])) { if (isset($acces[$logged_user->role][$menu->controller][$menu->action])) { $sub[$pieces[1]][] = $action; } } } } else { $sub[$pieces[1]][] = $action; } } $cont = (array) $content; if (!empty($cont)) { $dev[$id] = $content; } } $final = array(); foreach ($dev as $key => $value) { $action = new stdClass(); $page = new stdClass(); $ctrl = $value->controller->name; if (!empty($sub[$ctrl])) { $action->action = $sub[$ctrl]; } $value->page = $action; // check acl access if (Auth::check()) { $pages = (array) $value->page; if (isset($acces[$logged_user->role])) { if (isset($acces[$logged_user->role][$value->packet . '/' . $ctrl])) { if ((!empty($pages) || $ctrl == 'dashboard') && ($value->admin == 1 ? $value->admin == Auth::user()->role : TRUE)) { $final[$key] = $value; } } } } else { $final[$key] = $value; } } return $final; }
/** * ACL RESTful function * * @return view * @author joharijumali * **/ public function get_acl() { $data['rolelist'] = Admin_UserRole::all(); $data['page'] = Admin_Menu::pageExist(); //all(); $data['acl'] = Admin_UserAcl::aclRegistered(); $data['acree'] = Acltree::render(); return View::make('admin.console.acl', $data); }
$title = $translation->GetTranslation('files'); $adminClass = new Admin_Files($sqlConnection, $translation, $config, $user, $lib, $output); $text = $adminClass->GetPage($action); break; case 'pagestructure': // Load the pagestructure-class (manage & edit all pages) include_once __ROOT__ . '/classes/admin/admin_pagestructure.php'; $title = $translation->GetTranslation('pagestructure'); $adminClass = new Admin_PageStructure($sqlConnection, $translation, $config, $user, $lib, $output); $text = $adminClass->GetPage($action); break; case 'menueditor': // Load the menu-class (menu-management) include_once __ROOT__ . '/classes/admin/admin_menu.php'; $title = $translation->GetTranslation('menu-editor'); $adminClass = new Admin_Menu($sqlConnection, $translation, $config, $user, $lib, $output); $text = $adminClass->GetPage($action); break; case 'modules': // Load te modles-class (module-management) include_once __ROOT__ . '/classes/admin/admin_modules.php'; $title = $translation->GetTranslation('modules'); $adminClass = new Admin_Modules($sqlConnection, $translation, $config, $user, $lib, $output); $text = $adminClass->GetPage($action); break; case 'admincontrol': default: if (substr($page, 0, 7) == 'module_') { // get the name of the module which's admin-interface should be shown $moduleName = substr($page, 7); // is the module really activated? (yes, I'm paranoid... :-P )
$admin_page = new Admin_PageStructure($sqlConnection, $admin_lang, $user, $config); $text = $admin_page->GetPage($extern_action); } elseif ($extern_page == 'groups') { $title = $admin_lang['groups']; include 'classes/admin/admin_groups.php'; $admin_page = new Admin_Groups(); $text = $admin_page->GetPage($extern_action, $admin_lang); } elseif ($extern_page == 'rights') { $title = $admin_lang['rights']; include 'classes/admin/admin_rights.php'; $admin_page = new Admin_Rights(); $text = $admin_page->GetPage($extern_action, $admin_lang); } elseif ($extern_page == 'menueditor') { $title = $admin_lang['menu-editor']; include 'classes/admin/admin_menu.php'; $admin_page = new Admin_Menu($sqlConnection, $admin_lang); $text = $admin_page->GetPage($extern_action); } elseif ($extern_page == 'modules') { $title = $admin_lang['modules']; include 'classes/admin/admin_modules.php'; $admin_page = new Admin_Modules($sqlConnection, $admin_lang, $config); $text = $admin_page->GetPage($extern_action); } elseif (substr($extern_page, 0, 7) == 'module_') { // get the name of the module which's admin-interface should be shown $moduleName = substr($extern_page, 7); // is the module really activated? (yes, I'm paranoid... :-P ) if (in_array($moduleName, $modulesActivated)) { /** * @ignore */ include_once "./modules/{$moduleName}/{$moduleName}_admin.php";
public function add_options_page() { //Add an options page or a sub options page $this->options_page = add_menu_page($this->title, $this->title, 'manage_options', $this->key, array($this, 'admin_page_display')); parent::add_options_page(); }