can('navigation','read')) return; $page = basename($_SERVER['REQUEST_URI']); $menuItems = array(); $menuItems[] = array( 'sort'=>299, 'id'=>'{{id}}', 'url'=>'{{url}}', 'title'=>'{{title}}', 'target'=>'{{target}}', 'label'=>'{{{label}}}', 'icon'=> '{{icon}}', 'classes' =>'navigation-template-item hide', 'html' =>'
' ); $menuItems[] = array( 'sort'=>400, 'label'=>'Affaires', 'slug'=>'case', 'icon'=> 'fas fa-suitcase', 'classes' =>'pointer' ); $menuItems[] = array( 'sort'=>401, 'label'=>'Organisation', 'slug'=>'organization', 'icon'=> 'far fa-calendar-alt', 'classes' =>'pointer' ); $menuItems[] = array( 'sort'=>402, 'label'=>'Statistiques', 'slug'=>'statistics', 'icon'=> 'fas fa-chart-line', 'classes' =>'pointer', ); $menuItems[] = array( 'sort'=>403, 'label'=>'Exploitation', 'slug'=>'exploitation', 'icon'=> 'fas fa-cubes', 'classes' =>'pointer' ); uasort($menuItems , function($a,$b){return $a['sort']>$b['sort']?1:-1;}); //Menus ajoutés par les plugins $mainMenu = array(); Plugin::callHook("menu_main", array(&$mainMenu)); uasort ($mainMenu , function($a,$b){return $a['sort']>$b['sort']?1:-1;}); foreach ($mainMenu as $item) { foreach ($menuItems as $key=>$existingitem) { if(!isset($item['parent'])) continue; if(!isset($existingitem['slug']) || $item['parent'] != $existingitem['slug']) continue; if(!isset($existingitem['childs'])) $existingitem['childs'] = array(); $existingitem['childs'][] = $item; $menuItems[$key] = $existingitem; } } if($conf->get('navigation_show_uncategorized')){ foreach ($mainMenu as $item) if(!isset($item['parent'])) $menuItems[] = $item; } if($myUser->can('navigation','edit')){ $menuItems[] = array( 'sort'=>300, 'onclick'=>'navigation_navigation_edit()', 'title'=>'Modifier le menu', 'icon'=> 'fas fa-edit', 'classes' =>'navigation-edit-button pointer' ); $menuItems[] = array( 'sort'=>300, 'onclick'=>'navigation_navigation_save()', 'title'=>'Arrêter les modifications', 'icon'=> 'fas fa-check', 'classes' =>'navigation-validate-button pointer' ); $menuItems[] = array( 'sort'=>300, 'onclick'=>'navigation_menuitem_edit()', 'title'=>'Ajouter un item', 'icon'=> 'fas fa-plus', 'classes' =>'navigation-plus-button pointer' ); } ?> can('navigation','configure')) return; $settingMenu[]= array( 'sort' =>1, 'url' => 'setting.php?section=global.navigation', 'icon' => 'fas fa-angle-right', 'label' => 'Menu & Navigation' ); } //Déclaration des pages de réglages function navigation_content_setting(){ global $_; if(file_exists(__DIR__.SLASH.'setting.'.$_['section'].'.php')) require_once(__DIR__.SLASH.'setting.'.$_['section'].'.php'); } //Déclaration des settings de base //Types possibles : text,select ( + "values"=> array('1'=>'Val 1'),password,checkbox. Un simple string définit une catégorie. Configuration::setting('navigation',array( "Général", 'navigation_show_uncategorized' => array("label"=>"Afficher les menus natifs non catégorisés","legend"=>"Affiche les menus de plugins qui n'ont pas de catégorie parente","type"=>"checkbox"), 'navigation_allow_custom_menu' => array("label"=>"Autoriser la création de menu personnalisés","legend"=>"Autorise aux utilisateurs la création de menu custom dans la navbar","type"=>"checkbox"), )); //Déclation des assets Plugin::addCss("/css/main.css?v=1"); Plugin::addJs("/js/main.js?v=1"); //Mapping hook / fonctions Plugin::addHook("install", "navigation_install"); Plugin::addHook("uninstall", "navigation_uninstall"); Plugin::addHook("section", "navigation_section"); Plugin::addHook("header", "navigation_menu"); Plugin::addHook("page", "navigation_page"); Plugin::addHook("action", "navigation_action"); Plugin::addHook("menu_setting", "navigation_menu_setting"); Plugin::addHook("content_setting", "navigation_content_setting"); ?>