123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- function part_menu(&$menuItems){
- global $_,$myUser;
- if(!$myUser->can('part','read')) return;
- $menuItems[] = array(
- 'sort'=>3,
- 'url'=>'index.php?module=part&page=list.part',
- 'label'=>'Composants',
- 'icon'=> 'fas fa-microchip',
- 'color'=> '#3498db'
- );
- }
- function part_page(){
- global $_,$myUser;
- if(!isset($_['module']) || $_['module'] !='part') return;
- $page = !isset($_['page']) ? 'list.part' : $_['page'];
- $file = __DIR__.SLASH.'page.'.$page.'.php';
- if(!file_exists($file)) throw new Exception("Page ".$page." inexistante");
-
- require_once($file);
- }
- function part_install($id){
- if($id != 'fr.idleman.part') return;
- global $conf;
- Entity::install(__DIR__);
- $conf->put('hackpoint_resource_part',true);
- }
- function part_uninstall($id){
- if($id != 'fr.idleman.part') return;
- global $conf;
- Entity::uninstall(__DIR__);
- $conf->put('hackpoint_resource_part',false);
- }
- function part_section(&$sections){
- $sections['part'] = "Gestion des droits sur le plugin part";
- }
- function part_action(){
- require_once(__DIR__.SLASH.'action.php');
- }
- function part_menu_setting(&$settingMenu){
- global $_, $myUser;
-
- if(!$myUser->can('part','configure')) return;
-
- }
- function part_content_setting(){
- global $_;
- if(file_exists(__DIR__.SLASH.'setting.'.$_['section'].'.php'))
- require_once(__DIR__.SLASH.'setting.'.$_['section'].'.php');
- }
- Configuration::setting('part',array(
- "Général",
- 'part_enable' => array("label"=>"Activer","type"=>"checkbox"),
- ));
- function part_manage_types(&$types){
- $types[] = __DIR__.SLASH.'PartType.class.php';
- }
- Plugin::addCss("/css/main.css");
- Plugin::addCss("/css/component.css?v=1",true);
- Plugin::addJs("/js/component.js?v=2",true);
- Plugin::addJs("/js/main.js");
- Plugin::addHook("install", "part_install");
- Plugin::addHook("uninstall", "part_uninstall");
- Plugin::addHook("section", "part_section");
- Plugin::addHook("menu_main", "part_menu");
- Plugin::addHook("page", "part_page");
- Plugin::addHook("action", "part_action");
- Plugin::addHook("menu_setting", "part_menu_setting");
- Plugin::addHook("content_setting", "part_content_setting");
- Plugin::addHook("hackpoint_resource_type", "part_manage_types");
- ?>
|