From 9bffed64be5def1baf39d4d714e8d9527adc5847 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Fri, 12 Feb 2021 14:56:49 +0100 Subject: [PATCH] bugfix et icones --- CHANGELOG | 6 +++++- README.md | 4 ++-- src/Controller/AppController.php | 55 +++++++++++++++++++++++++++++++++++-------------------- src/Controller/ConfigurationsController.php | 43 +++++++++++++++++++++++++++++++++++-------- src/Template/Pages/tools.ctp | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------- src/Template/Pages/tools_sm.ctp | 70 +++++++++++++++++++++++++++++++++++----------------------------------- src/View/Helper/MyHelperHelper.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- webroot/img/icons/authorize.jpg | Bin 0 -> 6652 bytes webroot/img/icons/authorize.png | Bin 0 -> 2930 bytes webroot/img/icons/authorize2.jpg | Bin 0 -> 4969 bytes webroot/img/icons/authorize2.png | Bin 0 -> 1651 bytes webroot/img/icons/config.png | Bin 0 -> 3622 bytes webroot/img/icons/config2.png | Bin 0 -> 3835 bytes webroot/img/icons/debug.jpg | Bin 0 -> 11297 bytes webroot/img/icons/debug.png | Bin 0 -> 5012 bytes webroot/img/icons/debug2.png | Bin 0 -> 9967 bytes webroot/img/icons/docs.jpg | Bin 0 -> 7479 bytes webroot/img/icons/install.png | Bin 0 -> 1406 bytes webroot/img/icons/install2.png | Bin 0 -> 3029 bytes webroot/img/icons/install3.jpg | Bin 0 -> 8097 bytes webroot/img/icons/install4.jpg | Bin 0 -> 4102 bytes webroot/img/icons/liste.jpg | Bin 0 -> 7048 bytes webroot/img/icons/liste.png | Bin 0 -> 4270 bytes webroot/img/icons/logs.jpg | Bin 0 -> 14257 bytes webroot/img/icons/logs.png | Bin 0 -> 9293 bytes webroot/img/icons/logs2.jpg | Bin 0 -> 11547 bytes webroot/img/icons/notif.png | Bin 0 -> 3613 bytes webroot/img/icons/printer.jpg | Bin 0 -> 11447 bytes webroot/img/icons/see.png | Bin 0 -> 2249 bytes webroot/img/icons/see2.png | Bin 0 -> 4538 bytes webroot/img/icons/stats.jpg | Bin 0 -> 6922 bytes webroot/img/icons/super.jpg | Bin 0 -> 6031 bytes webroot/img/icons/super2.jpg | Bin 0 -> 11081 bytes webroot/img/icons/super2.png | Bin 0 -> 5467 bytes webroot/img/icons/sysinfo.jpg | Bin 0 -> 7908 bytes webroot/img/icons/sysinfo2.jpg | Bin 0 -> 7903 bytes webroot/img/icons/sysinfo2.png | Bin 0 -> 6489 bytes webroot/img/icons/user.jpg | Bin 0 -> 6667 bytes webroot/index.php | 1 - 39 files changed, 243 insertions(+), 84 deletions(-) create mode 100644 webroot/img/icons/authorize.jpg create mode 100644 webroot/img/icons/authorize.png create mode 100644 webroot/img/icons/authorize2.jpg create mode 100644 webroot/img/icons/authorize2.png create mode 100644 webroot/img/icons/config.png create mode 100644 webroot/img/icons/config2.png create mode 100644 webroot/img/icons/debug.jpg create mode 100644 webroot/img/icons/debug.png create mode 100644 webroot/img/icons/debug2.png create mode 100644 webroot/img/icons/docs.jpg create mode 100644 webroot/img/icons/install.png create mode 100644 webroot/img/icons/install2.png create mode 100644 webroot/img/icons/install3.jpg create mode 100644 webroot/img/icons/install4.jpg create mode 100644 webroot/img/icons/liste.jpg create mode 100644 webroot/img/icons/liste.png create mode 100644 webroot/img/icons/logs.jpg create mode 100644 webroot/img/icons/logs.png create mode 100644 webroot/img/icons/logs2.jpg create mode 100644 webroot/img/icons/notif.png create mode 100644 webroot/img/icons/printer.jpg create mode 100644 webroot/img/icons/see.png create mode 100644 webroot/img/icons/see2.png create mode 100644 webroot/img/icons/stats.jpg create mode 100644 webroot/img/icons/super.jpg create mode 100644 webroot/img/icons/super2.jpg create mode 100644 webroot/img/icons/super2.png create mode 100644 webroot/img/icons/sysinfo.jpg create mode 100644 webroot/img/icons/sysinfo2.jpg create mode 100644 webroot/img/icons/sysinfo2.png create mode 100644 webroot/img/icons/user.jpg diff --git a/CHANGELOG b/CHANGELOG index 694cd4c..55a19b6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -314,7 +314,11 @@ Commencer à implémenter le nouveau workflow v5 : ======= CHANGES ======= - +------- +12/02/2021 v4.108.4-3.7.9 + - Icones sur les menus Outils et Autres listes + - bugfix action configurations/debugOff + ------- 11/02/2021 v4.108.3-3.7.9 - Utilisation de View/Helper/MyHelperHelper pour les vues Template/Configurations/view et edit diff --git a/README.md b/README.md index bc7547e..2a9557b 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ Logiciel testé et validé sur les configurations suivantes : -------------------------------------------------------------------------------------------- -Date: 11/02/2021 -Version: v4.108.2-3.7.9 +Date: 12/02/2021 +Version: v4.108.4-3.7.9 diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index 915a8d8..f5b3a5b 100755 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -492,7 +492,8 @@ class AppController extends Controller return $this->is_masculin ? "d'un " : "d'une "; } - + + // MODE DEBUG LOCAL : lié à variable $this->DEBUG public function d($msg) { if ( $this->DEBUG || $this->isLabinventDebugMode() ) pr($msg); } @@ -912,7 +913,7 @@ class AppController extends Controller } // - si -1 => acccès refusé $this->d("1) Condition (complète) (desaliased) :"); $this->d($access_condition); - //debug($access_condition); exit; + //if ($action=='debugOff') debug($access_condition); exit; if ($access_condition === -1) return FALSE; if ($access_condition === 0) return TRUE; // A partir d'ici, on doit avoir un array @@ -1579,15 +1580,19 @@ class AppController extends Controller //public function isAuthorized(Array $user, $action=null) { public function isAuthorized($user, $action=null, $id=null, $role=null) { + + // Car ces msg de debug empechent certaines actions de fonctionner !!! (ex: configurations/debugOff) + $DODEBUG=false; + //$action=null, $id=null, $role=null, $userCname=null) { - $this->myDebug("step 2C (general): AppController.isAuthorized()"); + $DODEBUG && $this->myDebug("step 2C (general): AppController.isAuthorized()"); // $user est l'equivalent de $this->LdapAuth->user() - $this->myDebug("- user is:", $user); + $DODEBUG && $this->myDebug("- user is:", $user); //$action = $this->getActionPassed(); if (!$action) $action = $this->a; - $this->myDebug("- action is: $action"); + $DODEBUG && $this->myDebug("- action is: $action"); //if (!$id) $id = $this->getIdPassed(); if (!$id) $id = $this->e_id; @@ -1596,7 +1601,9 @@ class AppController extends Controller $IS_RELATED_ENTITY_ID = false; return $this->isAuthorizedAction($action, $id, $IS_RELATED_ENTITY_ID); // $user, $userCname */ - return $this->isAuthorizedActionForCurrentUser($action, $id); // $user, $userCname + $authorized = $this->isAuthorizedActionForCurrentUser($action, $id); // $user, $userCname + //debug("autorisé ????"); debug($authorized); + return $authorized; // LA SUITE EST A VIRER @@ -1826,8 +1833,13 @@ class AppController extends Controller */ public function initialize() { - $this->myDebug("step 0B (general): AppController.initialize()"); - + /* + * TRES DANGEREUX !!! + * Car ce msg de debug empeche certaines actions de fonctionner !!! (ex: configurations/debugOff) + */ + $DODEBUG=false; + $DODEBUG && $this->myDebug("step 0B (general): AppController.initialize()"); + parent::initialize(); $this->loadComponent('RequestHandler'); @@ -2036,6 +2048,7 @@ class AppController extends Controller public function beforeFilter(Event $event) { // Affichages pour debug //pr($event); + $this->myDebug("step 1B (general): AppController.beforeFilter()"); $controllerName = $this->request->getParam('controller'); @@ -2056,7 +2069,7 @@ class AppController extends Controller $this->myDebug("- action passed : ".$this->a); //debug("- action passed : ".$this->a); $this->e_id = $this->getIdPassed(); - $this->myDebug("- id passed : ".$this->a); + $this->myDebug("- id passed : ".$this->e_id); parent::beforeFilter($event); @@ -2762,7 +2775,7 @@ class AppController extends Controller //if ($this->e) $emails = $this->sendNotificationForEntityAction($this->e); //$action = $this->request->getAttribute('params')['action']; - // si l'user n'est pas loggé, on ne va pas plus loin + // si le user n'est pas loggé, on ne va pas plus loin if ( ! isset($_SESSION['Auth']['User']) ) return true; /* Moved to beforeFilter() c'est mieux @@ -3167,18 +3180,20 @@ class AppController extends Controller */ } + // MODE DEBUG GLOBAL DE L'APPLICATION LABINVENT + // Lié à la variable mode_debug de la CONFIGURATION labinvent (table configurations.mode_debug) function myDebug($arg1, $arg2=null, $stop=false) { - if ($this->isLabinventDebugMode()) { - - // Absolument nécessaire sur inventirap (à cause de php 5 ?) - // car sinon, aucun vardump() ou debug() ne s'affiche, why ???... - Configure::write('debug', true); - - debug($arg1); - if ($arg2) debug($arg2); + //return true; + if (! $this->isLabinventDebugMode()) return; - if ($stop) exit(); - } + // Absolument nécessaire sur inventirap (à cause de php 5 ?) + // car sinon, aucun vardump() ou debug() ne s'affiche, why ???... + Configure::write('debug', true); + + debug($arg1); + if ($arg2) debug($arg2); + + if ($stop) exit(); } diff --git a/src/Controller/ConfigurationsController.php b/src/Controller/ConfigurationsController.php index ed9cfca..a3bf932 100644 --- a/src/Controller/ConfigurationsController.php +++ b/src/Controller/ConfigurationsController.php @@ -216,45 +216,69 @@ class ConfigurationsController extends AppController * * @return \Cake\Network\Response|NULL */ - public function debugOn() + public function setModeDebug($on=true) { + $config = $this->Configurations->get('1')->set('mode_debug', $on?1:0); + $verb = $on ? "démarré" : "stoppé"; + if ($this->Configurations->save($config)) { + $this->Flash->success(__("Le mode debug a bien été $verb")); + } + //debug("redirect !"); + return $this->redirect([ + 'controller' => 'pages', + 'action' => 'tools' + ]); + } + public function debugOn() {$this->setModeDebug(true);} + /* { $config = $this->Configurations->get('1')->set('mode_debug', 1); - if ($this->Configurations->save($config)) { $this->Flash->success(__('Le mode debug a bien été démarré.')); } - return $this->redirect([ 'controller' => 'pages', 'action' => 'tools' ]); } + */ /** * Desactivate debug mode * * @return \Cake\Network\Response|NULL */ - public function debugOff() + public function debugOff() {$this->setModeDebug(false);} + /* { $config = $this->Configurations->get('1')->set('mode_debug', 0); - if ($this->Configurations->save($config)) { $this->Flash->success(__('Le mode debug a bien été arrété.')); } - return $this->redirect([ 'controller' => 'pages', 'action' => 'tools' ]); } + */ /** * Activate install mode * * @return \Cake\Network\Response|NULL */ - public function installOn() + public function setModeInstall($on=true) { + $config = $this->Configurations->get('1')->set('mode_install', $on?1:0); + $verb = $on ? "démarré" : "stoppé"; + if ($this->Configurations->save($config)) { + $this->Flash->success(__("Le mode install a bien été $verb")); + } + return $this->redirect([ + 'controller' => 'pages', + 'action' => $on?'home':'tools' + ]); + } + public function installOn() {$this->setModeInstall(true);} + /* { $config = $this->Configurations->get('1')->set('mode_install', 1); @@ -267,13 +291,15 @@ class ConfigurationsController extends AppController 'action' => 'home' ]); } + */ /** * Desactivate install mode * * @return \Cake\Network\Response|NULL */ - public function installOff() + public function installOff() {$this->setModeInstall(false);} + /* { $config = $this->Configurations->get('1')->set('mode_install', 0); @@ -286,6 +312,7 @@ class ConfigurationsController extends AppController 'action' => 'tools' ]); } + */ /** * Activation/Désactivation du mode no limit (SA a tous les droits) diff --git a/src/Template/Pages/tools.ctp b/src/Template/Pages/tools.ctp index fbd181c..bc10f61 100755 --- a/src/Template/Pages/tools.ctp +++ b/src/Template/Pages/tools.ctp @@ -6,6 +6,7 @@ $USER_IS_SUPERADMIN = $USER_IS_SUPERADMIN; $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; +$no_limit_mode = $no_limit_mode; ?> @@ -16,10 +17,10 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; Outils - +
- + '; // - Page statistiques + $this->MyHelper->echoMenuItemWithIcon("stats.jpg", "Statistiques sur les matériels", 'pages','stats'); + /* echo ''; + */ - if ($USER_IS_SUPERADMIN) { - echo ''; - } + if ($USER_IS_SUPERADMIN) + $this->MyHelper->echoMenuItemWithIcon("stats.jpg", "Statistiques sur les connexions", 'stats'); + /* + echo ''; + */ echo $SEP; @@ -48,7 +54,9 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; // - Page configuration //if ($role == 'Super Administrateur') : - if ($USER_IS_SUPERADMIN) { + if ($USER_IS_SUPERADMIN) + $this->MyHelper->echoMenuItemWithIcon("config.png", "Configuration générale", 'configurations','view'); + /* echo ''; - } + */ //endif; + if ($USER_IS_ADMIN_OR_MORE) + $this->MyHelper->echoMenuItemWithIcon("config2.png", "Gérer le contenu variable de l'application", 'pages','tools_sm'); + + + $this->MyHelper->echoMenuItemWithIcon("notif.png", "Voir les Notifications activées", 'pages','notifications'); + /* echo ''; + */ + $this->MyHelper->echoMenuItemWithIcon("authorize2.png", "Voir les Autorisations des profils utilisateurs", 'pages','acls'); + /* echo ''; + */ + $this->MyHelper->echoMenuItemWithIcon("printer.jpg", "Etiqueteuse (documentation)", 'pages','printers'); + /* echo ''; + */ echo $SEP; @@ -92,19 +113,25 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; 'Super Administrateur' ])) { */ + ///$this->MyHelper->echoMenuItemWithIcon("config2.png", "Gérer le contenu variable de l'application", 'pages','tools_sm'); + /* echo ''; + */ + $this->MyHelper->echoMenuItemWithIcon("liste.png", "Export de la liste des materiels actifs (format CSV)", 'materiels','export'); + /* echo ''; + */ } @@ -112,6 +139,8 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; //if ($role == 'Super Administrateur') : if ($USER_IS_SUPERADMIN) : + $this->MyHelper->echoMenuItemWithIcon("user.jpg", "Gérer les utilisateurs", 'users'); + /* echo ''; + */ + $this->MyHelper->echoMenuItemWithIcon("docs.jpg", "Gérer les documents", 'documents','index'); + /* echo ''; + */ endif; @@ -158,28 +191,43 @@ if ($USER_IS_SUPERADMIN) : */ // Page des messages de log (level info, debug, et notice) + $this->MyHelper->echoMenuItemWithIcon("logs2.jpg", "Voir les messages de LOG", 'pages','logs?level=info'); + /* echo ''; + */ // Infos système + $this->MyHelper->echoMenuItemWithIcon("sysinfo.jpg", "Voir les informations sur le système", 'pages','infos'); + /* echo ''; - + */ echo $SEP; + /* * Mode debug */ - echo ''; + */ /* * Mode install */ - echo ''; + */ - // SA a tous les droits, non mais... - echo ''; + */ endif; // SA only diff --git a/src/Template/Pages/tools_sm.ctp b/src/Template/Pages/tools_sm.ctp index 786a0ae..0494481 100644 --- a/src/Template/Pages/tools_sm.ctp +++ b/src/Template/Pages/tools_sm.ctp @@ -1,17 +1,26 @@
'; echo $this->Html->link('Statistiques sur les matériels', [ 'controller' => 'pages', 'action' => 'stats', ]); echo '
'; - echo $this->Html->link('Statistiques sur les connexions', [ - 'controller' => 'stats', - ]); - echo '
'; + echo $this->Html->link('Statistiques sur les connexions', [ + 'controller' => 'stats', + ]); + echo '
'; echo $this->Html->link("Configuration générale de l'application", [ 'controller' => 'configurations', @@ -56,29 +64,42 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; //1 // inutile car automatiquement = 1 ]); echo '
'; echo $this->Html->link('Voir les Notifications activées', [ 'controller' => 'pages', 'action' => 'notifications' ]); echo '
'; echo $this->Html->link('Voir les Autorisations des profils utilisateurs (ACLs)', [ 'controller' => 'pages', 'action' => 'acls' ]); echo '
'; echo $this->Html->link('Etiqueteuse (documentation)', [ 'controller' => 'pages', 'action' => 'printers' ]); echo '
'; echo $this->Html->link('Gérer le contenu variable de l\'application', [ 'controller' => 'pages', 'action' => 'tools_sm' ]); echo '
'; echo $this->Html->link('Export de la liste des materiels actifs (format CSV)', [ 'controller' => 'materiels', 'action' => 'export' ]); echo '
'; //echo $this->Html->link('Gérer les utilisateurs privilégiés', [ echo $this->Html->link('Gérer les utilisateurs', [ @@ -119,13 +148,17 @@ if ($USER_IS_SUPERADMIN) : //'sort' => 'nom' ]); echo '
'; echo $this->Html->link('Gérer les fichiers', [ 'controller' => 'documents', 'action' => 'index' ]); echo '
'; echo $this->Html->link('Voir les messages de LOG', [ //'controller' => 'pages', 'action' => 'logs?level=info' ]); echo '
'; echo $this->Html->link('Voir les informations sur le système', [ //'controller' => 'pages', 'action' => 'infos' ]); echo '
'; + if ($configuration->mode_debug) { + $verb = 'Stopper le'; + $action_name = 'debugOff'; + } else { + $verb = 'Passer en'; + $action_name = 'debugOn'; + } + $this->MyHelper->echoMenuItemPostLinkWithIcon("debug.jpg", "$verb mode DEBUG", 'configurations',$action_name); + /* + echo '
'; if ($configuration->mode_debug) { echo $this->Form->postLink("Stopper le mode DEBUG", [ 'controller' => 'configurations', @@ -196,11 +244,21 @@ if ($USER_IS_SUPERADMIN) : ]); } echo '
'; + if ($configuration->mode_install) { + $verb = 'Stopper le'; + $action_name = 'installOff'; + } else { + $verb = 'Passer en'; + $action_name = 'installOn'; + } + $this->MyHelper->echoMenuItemPostLinkWithIcon("install.png", "$verb mode INSTALL", 'configurations',$action_name); + /* + echo '
'; if ($configuration->mode_install) { echo $this->Form->postLink("Stopper le mode INSTALL", [ 'controller' => 'configurations', @@ -217,16 +275,21 @@ if ($USER_IS_SUPERADMIN) : ]); } echo '
'; + + // SA a tous les droits, non mais !! $verb = $no_limit_mode ? 'Stopper':'Activer'; + $this->MyHelper->echoMenuItemWithIcon("super2.png", "$verb le mode 'Superadmin a tous les droits' (pour debug only)", 'configurations','nolimit'); + /* + echo '
'; echo $this->Html->link("$verb le mode 'Superadmin a tous les droits' (pour debug only)", [ //'controller' => 'pages', 'controller' => 'configurations', 'action' => 'nolimit' ]); echo '
+ - + '; } +*/ +//echo_list($this->Html, 'Catégories', 'categories'); //echo_list($this->Html, 'Catégories', 'pages', 'tools_cat'); -echo_list($this->Html, 'Catégories', 'categories'); +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Catégories', 'categories'); + /* echo ''; // types de DOCUMENTS -echo_list($this->Html, 'types de Documents', 'type_documents'); +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'types de Documents', 'type_documents'); /* echo ''; */ } -/* -$names = explode(" ", $configuration->nom_groupe_metier); -if (isset($names[1])) { - $nom = $names[0] . 's ' . $names[1] . 's'; -} else { - $nom = $names[0] . 's'; -} -echo_list($this->Html, $nom, 'groupes_metiers'); - echo ''; - */ - +//$configuration->metrologie=true; // METROLOGIE MODULE ONLY if ($configuration->metrologie) { - echo_list($this->Html, 'Métrologie : Unités', 'unites'); + $this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Métrologie : Unités', 'unites'); /* echo ''; */ - echo_list($this->Html, 'Métrologie : Formules', 'formules'); + $this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Métrologie : Formules', 'formules'); /* echo ''; */ -echo_list($this->Html, 'Projets', 'projets'); +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Projets', 'projets'); -echo_list($this->Html, 'Sites', 'sites'); +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Sites', 'sites'); /* echo ''; */ -echo_list($this->Html, 'types de Suivis', 'type_suivis'); +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'types de Suivis', 'type_suivis'); /* echo ''; + + echo "'; + + echo ''; + + echo ''; + } + public function getActionButton($icon_class, $buttonStyle, $title, $controller, $action, $id, $other_args=[], $tip='', $confirmMessage='', $moreButtonStyle='') { if ($controller=='') $controller='materiels'; $controllerArgs = []; diff --git a/webroot/img/icons/authorize.jpg b/webroot/img/icons/authorize.jpg new file mode 100644 index 0000000..c533ef6 Binary files /dev/null and b/webroot/img/icons/authorize.jpg differ diff --git a/webroot/img/icons/authorize.png b/webroot/img/icons/authorize.png new file mode 100644 index 0000000..d932336 Binary files /dev/null and b/webroot/img/icons/authorize.png differ diff --git a/webroot/img/icons/authorize2.jpg b/webroot/img/icons/authorize2.jpg new file mode 100644 index 0000000..8b92b05 Binary files /dev/null and b/webroot/img/icons/authorize2.jpg differ diff --git a/webroot/img/icons/authorize2.png b/webroot/img/icons/authorize2.png new file mode 100644 index 0000000..653ff1f Binary files /dev/null and b/webroot/img/icons/authorize2.png differ diff --git a/webroot/img/icons/config.png b/webroot/img/icons/config.png new file mode 100644 index 0000000..44fa241 Binary files /dev/null and b/webroot/img/icons/config.png differ diff --git a/webroot/img/icons/config2.png b/webroot/img/icons/config2.png new file mode 100644 index 0000000..af89766 Binary files /dev/null and b/webroot/img/icons/config2.png differ diff --git a/webroot/img/icons/debug.jpg b/webroot/img/icons/debug.jpg new file mode 100644 index 0000000..315ec92 Binary files /dev/null and b/webroot/img/icons/debug.jpg differ diff --git a/webroot/img/icons/debug.png b/webroot/img/icons/debug.png new file mode 100644 index 0000000..c10c250 Binary files /dev/null and b/webroot/img/icons/debug.png differ diff --git a/webroot/img/icons/debug2.png b/webroot/img/icons/debug2.png new file mode 100644 index 0000000..7a65776 Binary files /dev/null and b/webroot/img/icons/debug2.png differ diff --git a/webroot/img/icons/docs.jpg b/webroot/img/icons/docs.jpg new file mode 100644 index 0000000..a7a39b3 Binary files /dev/null and b/webroot/img/icons/docs.jpg differ diff --git a/webroot/img/icons/install.png b/webroot/img/icons/install.png new file mode 100644 index 0000000..9f5849b Binary files /dev/null and b/webroot/img/icons/install.png differ diff --git a/webroot/img/icons/install2.png b/webroot/img/icons/install2.png new file mode 100644 index 0000000..17127b9 Binary files /dev/null and b/webroot/img/icons/install2.png differ diff --git a/webroot/img/icons/install3.jpg b/webroot/img/icons/install3.jpg new file mode 100644 index 0000000..40e89fa Binary files /dev/null and b/webroot/img/icons/install3.jpg differ diff --git a/webroot/img/icons/install4.jpg b/webroot/img/icons/install4.jpg new file mode 100644 index 0000000..a115eb7 Binary files /dev/null and b/webroot/img/icons/install4.jpg differ diff --git a/webroot/img/icons/liste.jpg b/webroot/img/icons/liste.jpg new file mode 100644 index 0000000..31ec8fa Binary files /dev/null and b/webroot/img/icons/liste.jpg differ diff --git a/webroot/img/icons/liste.png b/webroot/img/icons/liste.png new file mode 100644 index 0000000..66fe92b Binary files /dev/null and b/webroot/img/icons/liste.png differ diff --git a/webroot/img/icons/logs.jpg b/webroot/img/icons/logs.jpg new file mode 100644 index 0000000..20b52b5 Binary files /dev/null and b/webroot/img/icons/logs.jpg differ diff --git a/webroot/img/icons/logs.png b/webroot/img/icons/logs.png new file mode 100644 index 0000000..cadc1b7 Binary files /dev/null and b/webroot/img/icons/logs.png differ diff --git a/webroot/img/icons/logs2.jpg b/webroot/img/icons/logs2.jpg new file mode 100644 index 0000000..f1336a9 Binary files /dev/null and b/webroot/img/icons/logs2.jpg differ diff --git a/webroot/img/icons/notif.png b/webroot/img/icons/notif.png new file mode 100644 index 0000000..bc666e6 Binary files /dev/null and b/webroot/img/icons/notif.png differ diff --git a/webroot/img/icons/printer.jpg b/webroot/img/icons/printer.jpg new file mode 100644 index 0000000..1c603a5 Binary files /dev/null and b/webroot/img/icons/printer.jpg differ diff --git a/webroot/img/icons/see.png b/webroot/img/icons/see.png new file mode 100644 index 0000000..331a6f7 Binary files /dev/null and b/webroot/img/icons/see.png differ diff --git a/webroot/img/icons/see2.png b/webroot/img/icons/see2.png new file mode 100644 index 0000000..f26bc79 Binary files /dev/null and b/webroot/img/icons/see2.png differ diff --git a/webroot/img/icons/stats.jpg b/webroot/img/icons/stats.jpg new file mode 100644 index 0000000..46f11f8 Binary files /dev/null and b/webroot/img/icons/stats.jpg differ diff --git a/webroot/img/icons/super.jpg b/webroot/img/icons/super.jpg new file mode 100644 index 0000000..b6a5e17 Binary files /dev/null and b/webroot/img/icons/super.jpg differ diff --git a/webroot/img/icons/super2.jpg b/webroot/img/icons/super2.jpg new file mode 100644 index 0000000..adb4a8f Binary files /dev/null and b/webroot/img/icons/super2.jpg differ diff --git a/webroot/img/icons/super2.png b/webroot/img/icons/super2.png new file mode 100644 index 0000000..729322d Binary files /dev/null and b/webroot/img/icons/super2.png differ diff --git a/webroot/img/icons/sysinfo.jpg b/webroot/img/icons/sysinfo.jpg new file mode 100644 index 0000000..4250662 Binary files /dev/null and b/webroot/img/icons/sysinfo.jpg differ diff --git a/webroot/img/icons/sysinfo2.jpg b/webroot/img/icons/sysinfo2.jpg new file mode 100644 index 0000000..0817f0a Binary files /dev/null and b/webroot/img/icons/sysinfo2.jpg differ diff --git a/webroot/img/icons/sysinfo2.png b/webroot/img/icons/sysinfo2.png new file mode 100644 index 0000000..75977cc Binary files /dev/null and b/webroot/img/icons/sysinfo2.png differ diff --git a/webroot/img/icons/user.jpg b/webroot/img/icons/user.jpg new file mode 100644 index 0000000..3b41d3c Binary files /dev/null and b/webroot/img/icons/user.jpg differ diff --git a/webroot/index.php b/webroot/index.php index 07511d0..5513b5e 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -65,7 +65,6 @@ require dirname(__DIR__) . '/config/bootstrap.php'; use Cake\Network\Request; use Cake\Network\Response; use Cake\Routing\DispatcherFactory; - $dispatcher = DispatcherFactory::create(); $dispatcher->dispatch( Request::createFromGlobals(), -- libgit2 0.21.2
'; //echo $this->Html->link('Gérer les Catégories', [ @@ -74,7 +87,7 @@ echo '
'; echo $this->Html->link('Gérer les types de Documents', [ @@ -86,9 +99,11 @@ echo_list($this->Html, 'types de Documents', 'type_documents'); // FOURNISSEURS -$changed_verb = $verb; -if ($role == 'Administration' && in_array('fournisseurs', $admin_can_manage)) $changed_verb = 'Gérer'; -echo_list($this->Html, 'Fournisseurs', 'fournisseurs', 'index', $changed_verb); +$this->MyHelper->echoListToManageOrViewWithIcon( + ( $can_manage || ( $role == 'Administration' && in_array('fournisseurs', $admin_can_manage)) ), + 'Fournisseurs', 'fournisseurs', 'index' +); + /* echo '
'; echo $this->Html->link('Gérer les Fournisseurs', [ @@ -109,8 +124,8 @@ foreach (['metier','thematique'] as $group_type) { } else { $nom = $names[0] . 's'; } - //echo_list($this->Html, $nom, 'groupes_thematiques'); - echo_list($this->Html, $nom, 'groupes_'.$group_type.'s'); + //$this->MyHelper->echoListToManageOrViewWithIcon($this->Html, $nom, 'groupes_thematiques'); + $this->MyHelper->echoListToManageOrViewWithIcon($can_manage, $nom, 'groupes_'.$group_type.'s'); /* echo '
'; echo $this->Html->link('Gérer les ' . $nom, [ @@ -120,27 +135,12 @@ foreach (['metier','thematique'] as $group_type) { echo '
'; - echo $this->Html->link('Gérer les ' . $nom, [ - 'controller' => 'groupes_metiers', - 'sort' => 'nom' - ]); - echo '
'; echo $this->Html->link('Gérer les Unités (Métrologie)', [ @@ -150,7 +150,7 @@ if ($configuration->metrologie) { echo '
'; echo $this->Html->link('Gérer les Formules (Métrologie)', [ @@ -163,7 +163,7 @@ if ($configuration->metrologie) { // ORGANISMES -echo_list($this->Html, 'Organismes', 'organismes'); +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Organismes', 'organismes'); /* echo '
'; echo $this->Html->link('Gérer les Organismes', [ @@ -173,9 +173,9 @@ echo $this->Html->link('Gérer les Organismes', [ echo '
'; echo $this->Html->link('Gérer les Sites', [ @@ -187,7 +187,7 @@ echo '
'; echo $this->Html->link('Gérer les types de Suivis', [ diff --git a/src/View/Helper/MyHelperHelper.php b/src/View/Helper/MyHelperHelper.php index 103a882..c06070c 100644 --- a/src/View/Helper/MyHelperHelper.php +++ b/src/View/Helper/MyHelperHelper.php @@ -10,12 +10,63 @@ use phpDocumentor\Reflection\Types\Void_; class MyHelperHelper extends Helper { // On a besoin du HtmlHelper - public $helpers = ['Html']; + public $helpers = ['Html', 'Form']; public function initialize(array $config) { //debug($config); } + + + function echoListToManageOrViewWithIcon($can_manage=false, $list_name, $controller_name, $action_name='index') { + //function echo_list($html, $verb, $list_name, $controller_name, $action_name) { + $verb = $can_manage ? 'Gérer' : 'Voir'; + $icon_name = $can_manage ? 'config2.png' : 'see2.png'; + $this->echoMenuItemWithIcon($icon_name, "$verb les $list_name", $controller_name, $action_name, 'nom'); + } + + + function echoMenuItemPostLinkWithIcon($icon_name, $title, $controller_name, $action_name) { + $this->echoMenuItemLinkOrPostLinkWithIcon(true, $icon_name, $title, $controller_name, $action_name); + } + + function echoMenuItemWithIcon($img_name, $title, $controller_name, $action_name=null, $sort_field=null) { + $this->echoMenuItemLinkOrPostLinkWithIcon(false, $img_name, $title, $controller_name, $action_name, $sort_field); + } + + function echoMenuItemLinkOrPostLinkWithIcon($postlink, $img_name, $title, $controller_name, $action_name=null, $sort_field=null) { + $icon_size=40; + echo '
"; + echo $this->Html->image("icons/$img_name", [ + "alt" => $title, + 'height' => $icon_size, 'width' => $icon_size, + 'url' => ['controller' => $controller_name, 'action' => $action_name] + ]); + echo ''; + if (! $postlink) { + echo $this->Html->link($title, [ + 'controller' => $controller_name, + 'action' => $action_name, + 'sort' => $sort_field, + ]); + } + else { + echo $this->Form->postlink($title, [ + 'controller' => $controller_name, + 'action' => $action_name, + ], [ + 'confirm' => __('Êtes-vous sur ?') + ]); + } + echo '