can('hackpoint','read')) return; $menuItems[] = array( 'sort'=>3, 'url'=>'index.php?module=hackpoint', 'label'=>'Hackpoint', 'icon'=> 'fas fa-wrench', 'color'=> '#3498db' ); } //Cette fonction va generer une page quand on clique sur hackpoint dans menu function hackpoint_page(){ global $_,$myUser; if(!isset($_['module']) || $_['module'] !='hackpoint') return; $page = !isset($_['page']) ? 'list.sketch' : $_['page']; $file = __DIR__.SLASH.'page.'.$page.'.php'; if(!file_exists($file)) throw new Exception("Page ".$page." inexistante"); require_once($file); } //Fonction executée lors de l'activation du plugin function hackpoint_install($id){ if($id != 'fr.idleman.hackpoint') return; Entity::install(__DIR__); } //Fonction executée lors de la désactivation du plugin function hackpoint_uninstall($id){ if($id != 'fr.idleman.hackpoint') return; Entity::uninstall(__DIR__); } //Déclaration des sections de droits du plugin function hackpoint_section(&$sections){ $sections['hackpoint'] = "Gestion des droits sur le plugin hackpoint"; // $sections['part'] = "Gestion des droits sur l'entité part"; } //cette fonction comprends toutes les actions du plugin qui ne nécessitent pas de vue html function hackpoint_action(){ require_once(__DIR__.SLASH.'action.php'); } //Déclaration du menu de réglages function hackpoint_menu_setting(&$settingMenu){ global $_, $myUser; if(!$myUser->can('hackpoint','configure')) return; $settingMenu[]= array( 'sort' =>1, 'url' => 'setting.php?section=global.hackpoint', 'icon' => 'fas fa-angle-right', 'label' => 'hackpoint Général' ); } //Déclaration des pages de réglages function hackpoint_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('hackpoint',array( "Général", 'hackpoint_enable' => array("label"=>"Activer","type"=>"checkbox"), )); function hackpoint_manage_types(&$types){ $types = array_merge($types,glob(__DIR__.SLASH.'types'.SLASH.'*.class.php')); } //Déclation des assets Plugin::addCss("/css/main.css?v=1"); Plugin::addCss("/css/codemirror.css?v=1"); Plugin::addCss("/css/codemirror-monokai.css?v=1"); Plugin::addCss("/css/component.css?v=1",true); Plugin::addJs("/js/main.js?v=1"); Plugin::addJs("/js/codemirror.js?v=1"); Plugin::addJs("/js/component.js?v=2",true); foreach(glob(__DIR__.SLASH.'js'.SLASH.'codemirror-mode'.SLASH.'*.js') as $file){ Plugin::addJs("/js/codemirror-mode/".basename($file)); } //Mapping hook / fonctions Plugin::addHook("install", "hackpoint_install"); Plugin::addHook("uninstall", "hackpoint_uninstall"); Plugin::addHook("section", "hackpoint_section"); Plugin::addHook("menu_main", "hackpoint_menu"); Plugin::addHook("page", "hackpoint_page"); Plugin::addHook("action", "hackpoint_action"); Plugin::addHook("menu_setting", "hackpoint_menu_setting"); Plugin::addHook("content_setting", "hackpoint_content_setting"); Plugin::addHook("hackpoint_resource_type", "hackpoint_manage_types"); ?>