Commit 9bffed64be5def1baf39d4d714e8d9527adc5847
1 parent
6c636592
Exists in
master
and in
1 other branch
bugfix et icones
- bugfix action configurations/debugOff - Icones sur les menus Outils et Autres listes v4.108.4-3.7.9
Showing
39 changed files
with
243 additions
and
84 deletions
Show diff stats
CHANGELOG
... | ... | @@ -314,7 +314,11 @@ Commencer à implémenter le nouveau workflow v5 : |
314 | 314 | |
315 | 315 | ======= CHANGES ======= |
316 | 316 | |
317 | - | |
317 | +------- | |
318 | +12/02/2021 v4.108.4-3.7.9 | |
319 | + - Icones sur les menus Outils et Autres listes | |
320 | + - bugfix action configurations/debugOff | |
321 | + | |
318 | 322 | ------- |
319 | 323 | 11/02/2021 v4.108.3-3.7.9 |
320 | 324 | - Utilisation de View/Helper/MyHelperHelper pour les vues Template/Configurations/view et edit | ... | ... |
README.md
... | ... | @@ -52,8 +52,8 @@ Logiciel testé et validé sur les configurations suivantes : |
52 | 52 | |
53 | 53 | -------------------------------------------------------------------------------------------- |
54 | 54 | |
55 | -Date: 11/02/2021 | |
56 | -Version: v4.108.2-3.7.9 | |
55 | +Date: 12/02/2021 | |
56 | +Version: v4.108.4-3.7.9 | |
57 | 57 | |
58 | 58 | |
59 | 59 | ... | ... |
src/Controller/AppController.php
... | ... | @@ -492,7 +492,8 @@ class AppController extends Controller |
492 | 492 | return $this->is_masculin ? "d'un " : "d'une "; |
493 | 493 | } |
494 | 494 | |
495 | - | |
495 | + | |
496 | + // MODE DEBUG LOCAL : lié à variable $this->DEBUG | |
496 | 497 | public function d($msg) { |
497 | 498 | if ( $this->DEBUG || $this->isLabinventDebugMode() ) pr($msg); |
498 | 499 | } |
... | ... | @@ -912,7 +913,7 @@ class AppController extends Controller |
912 | 913 | } |
913 | 914 | // - si -1 => acccès refusé |
914 | 915 | $this->d("1) Condition (complète) (desaliased) :"); $this->d($access_condition); |
915 | - //debug($access_condition); exit; | |
916 | + //if ($action=='debugOff') debug($access_condition); exit; | |
916 | 917 | if ($access_condition === -1) return FALSE; |
917 | 918 | if ($access_condition === 0) return TRUE; |
918 | 919 | // A partir d'ici, on doit avoir un array |
... | ... | @@ -1579,15 +1580,19 @@ class AppController extends Controller |
1579 | 1580 | //public function isAuthorized(Array $user, $action=null) { |
1580 | 1581 | public function isAuthorized($user, |
1581 | 1582 | $action=null, $id=null, $role=null) { |
1583 | + | |
1584 | + // Car ces msg de debug empechent certaines actions de fonctionner !!! (ex: configurations/debugOff) | |
1585 | + $DODEBUG=false; | |
1586 | + | |
1582 | 1587 | //$action=null, $id=null, $role=null, $userCname=null) { |
1583 | - $this->myDebug("step 2C (general): AppController.isAuthorized()"); | |
1588 | + $DODEBUG && $this->myDebug("step 2C (general): AppController.isAuthorized()"); | |
1584 | 1589 | |
1585 | 1590 | // $user est l'equivalent de $this->LdapAuth->user() |
1586 | - $this->myDebug("- user is:", $user); | |
1591 | + $DODEBUG && $this->myDebug("- user is:", $user); | |
1587 | 1592 | |
1588 | 1593 | //$action = $this->getActionPassed(); |
1589 | 1594 | if (!$action) $action = $this->a; |
1590 | - $this->myDebug("- action is: $action"); | |
1595 | + $DODEBUG && $this->myDebug("- action is: $action"); | |
1591 | 1596 | |
1592 | 1597 | //if (!$id) $id = $this->getIdPassed(); |
1593 | 1598 | if (!$id) $id = $this->e_id; |
... | ... | @@ -1596,7 +1601,9 @@ class AppController extends Controller |
1596 | 1601 | $IS_RELATED_ENTITY_ID = false; |
1597 | 1602 | return $this->isAuthorizedAction($action, $id, $IS_RELATED_ENTITY_ID); // $user, $userCname |
1598 | 1603 | */ |
1599 | - return $this->isAuthorizedActionForCurrentUser($action, $id); // $user, $userCname | |
1604 | + $authorized = $this->isAuthorizedActionForCurrentUser($action, $id); // $user, $userCname | |
1605 | + //debug("autorisé ????"); debug($authorized); | |
1606 | + return $authorized; | |
1600 | 1607 | |
1601 | 1608 | // LA SUITE EST A VIRER |
1602 | 1609 | |
... | ... | @@ -1826,8 +1833,13 @@ class AppController extends Controller |
1826 | 1833 | */ |
1827 | 1834 | public function initialize() |
1828 | 1835 | { |
1829 | - $this->myDebug("step 0B (general): AppController.initialize()"); | |
1830 | - | |
1836 | + /* | |
1837 | + * TRES DANGEREUX !!! | |
1838 | + * Car ce msg de debug empeche certaines actions de fonctionner !!! (ex: configurations/debugOff) | |
1839 | + */ | |
1840 | + $DODEBUG=false; | |
1841 | + $DODEBUG && $this->myDebug("step 0B (general): AppController.initialize()"); | |
1842 | + | |
1831 | 1843 | parent::initialize(); |
1832 | 1844 | |
1833 | 1845 | $this->loadComponent('RequestHandler'); |
... | ... | @@ -2036,6 +2048,7 @@ class AppController extends Controller |
2036 | 2048 | public function beforeFilter(Event $event) { |
2037 | 2049 | // Affichages pour debug |
2038 | 2050 | //pr($event); |
2051 | + | |
2039 | 2052 | $this->myDebug("step 1B (general): AppController.beforeFilter()"); |
2040 | 2053 | |
2041 | 2054 | $controllerName = $this->request->getParam('controller'); |
... | ... | @@ -2056,7 +2069,7 @@ class AppController extends Controller |
2056 | 2069 | $this->myDebug("- action passed : ".$this->a); |
2057 | 2070 | //debug("- action passed : ".$this->a); |
2058 | 2071 | $this->e_id = $this->getIdPassed(); |
2059 | - $this->myDebug("- id passed : ".$this->a); | |
2072 | + $this->myDebug("- id passed : ".$this->e_id); | |
2060 | 2073 | |
2061 | 2074 | parent::beforeFilter($event); |
2062 | 2075 | |
... | ... | @@ -2762,7 +2775,7 @@ class AppController extends Controller |
2762 | 2775 | //if ($this->e) $emails = $this->sendNotificationForEntityAction($this->e); |
2763 | 2776 | //$action = $this->request->getAttribute('params')['action']; |
2764 | 2777 | |
2765 | - // si l'user n'est pas loggé, on ne va pas plus loin | |
2778 | + // si le user n'est pas loggé, on ne va pas plus loin | |
2766 | 2779 | if ( ! isset($_SESSION['Auth']['User']) ) return true; |
2767 | 2780 | |
2768 | 2781 | /* Moved to beforeFilter() c'est mieux |
... | ... | @@ -3167,18 +3180,20 @@ class AppController extends Controller |
3167 | 3180 | */ |
3168 | 3181 | } |
3169 | 3182 | |
3183 | + // MODE DEBUG GLOBAL DE L'APPLICATION LABINVENT | |
3184 | + // Lié à la variable mode_debug de la CONFIGURATION labinvent (table configurations.mode_debug) | |
3170 | 3185 | function myDebug($arg1, $arg2=null, $stop=false) { |
3171 | - if ($this->isLabinventDebugMode()) { | |
3172 | - | |
3173 | - // Absolument nécessaire sur inventirap (à cause de php 5 ?) | |
3174 | - // car sinon, aucun vardump() ou debug() ne s'affiche, why ???... | |
3175 | - Configure::write('debug', true); | |
3176 | - | |
3177 | - debug($arg1); | |
3178 | - if ($arg2) debug($arg2); | |
3186 | + //return true; | |
3187 | + if (! $this->isLabinventDebugMode()) return; | |
3179 | 3188 | |
3180 | - if ($stop) exit(); | |
3181 | - } | |
3189 | + // Absolument nécessaire sur inventirap (à cause de php 5 ?) | |
3190 | + // car sinon, aucun vardump() ou debug() ne s'affiche, why ???... | |
3191 | + Configure::write('debug', true); | |
3192 | + | |
3193 | + debug($arg1); | |
3194 | + if ($arg2) debug($arg2); | |
3195 | + | |
3196 | + if ($stop) exit(); | |
3182 | 3197 | } |
3183 | 3198 | |
3184 | 3199 | ... | ... |
src/Controller/ConfigurationsController.php
... | ... | @@ -216,45 +216,69 @@ class ConfigurationsController extends AppController |
216 | 216 | * |
217 | 217 | * @return \Cake\Network\Response|NULL |
218 | 218 | */ |
219 | - public function debugOn() | |
219 | + public function setModeDebug($on=true) { | |
220 | + $config = $this->Configurations->get('1')->set('mode_debug', $on?1:0); | |
221 | + $verb = $on ? "démarré" : "stoppé"; | |
222 | + if ($this->Configurations->save($config)) { | |
223 | + $this->Flash->success(__("Le mode debug a bien été $verb")); | |
224 | + } | |
225 | + //debug("redirect !"); | |
226 | + return $this->redirect([ | |
227 | + 'controller' => 'pages', | |
228 | + 'action' => 'tools' | |
229 | + ]); | |
230 | + } | |
231 | + public function debugOn() {$this->setModeDebug(true);} | |
232 | + /* | |
220 | 233 | { |
221 | 234 | $config = $this->Configurations->get('1')->set('mode_debug', 1); |
222 | - | |
223 | 235 | if ($this->Configurations->save($config)) { |
224 | 236 | $this->Flash->success(__('Le mode debug a bien été démarré.')); |
225 | 237 | } |
226 | - | |
227 | 238 | return $this->redirect([ |
228 | 239 | 'controller' => 'pages', |
229 | 240 | 'action' => 'tools' |
230 | 241 | ]); |
231 | 242 | } |
243 | + */ | |
232 | 244 | |
233 | 245 | /** |
234 | 246 | * Desactivate debug mode |
235 | 247 | * |
236 | 248 | * @return \Cake\Network\Response|NULL |
237 | 249 | */ |
238 | - public function debugOff() | |
250 | + public function debugOff() {$this->setModeDebug(false);} | |
251 | + /* | |
239 | 252 | { |
240 | 253 | $config = $this->Configurations->get('1')->set('mode_debug', 0); |
241 | - | |
242 | 254 | if ($this->Configurations->save($config)) { |
243 | 255 | $this->Flash->success(__('Le mode debug a bien été arrété.')); |
244 | 256 | } |
245 | - | |
246 | 257 | return $this->redirect([ |
247 | 258 | 'controller' => 'pages', |
248 | 259 | 'action' => 'tools' |
249 | 260 | ]); |
250 | 261 | } |
262 | + */ | |
251 | 263 | |
252 | 264 | /** |
253 | 265 | * Activate install mode |
254 | 266 | * |
255 | 267 | * @return \Cake\Network\Response|NULL |
256 | 268 | */ |
257 | - public function installOn() | |
269 | + public function setModeInstall($on=true) { | |
270 | + $config = $this->Configurations->get('1')->set('mode_install', $on?1:0); | |
271 | + $verb = $on ? "démarré" : "stoppé"; | |
272 | + if ($this->Configurations->save($config)) { | |
273 | + $this->Flash->success(__("Le mode install a bien été $verb")); | |
274 | + } | |
275 | + return $this->redirect([ | |
276 | + 'controller' => 'pages', | |
277 | + 'action' => $on?'home':'tools' | |
278 | + ]); | |
279 | + } | |
280 | + public function installOn() {$this->setModeInstall(true);} | |
281 | + /* | |
258 | 282 | { |
259 | 283 | $config = $this->Configurations->get('1')->set('mode_install', 1); |
260 | 284 | |
... | ... | @@ -267,13 +291,15 @@ class ConfigurationsController extends AppController |
267 | 291 | 'action' => 'home' |
268 | 292 | ]); |
269 | 293 | } |
294 | + */ | |
270 | 295 | |
271 | 296 | /** |
272 | 297 | * Desactivate install mode |
273 | 298 | * |
274 | 299 | * @return \Cake\Network\Response|NULL |
275 | 300 | */ |
276 | - public function installOff() | |
301 | + public function installOff() {$this->setModeInstall(false);} | |
302 | + /* | |
277 | 303 | { |
278 | 304 | $config = $this->Configurations->get('1')->set('mode_install', 0); |
279 | 305 | |
... | ... | @@ -286,6 +312,7 @@ class ConfigurationsController extends AppController |
286 | 312 | 'action' => 'tools' |
287 | 313 | ]); |
288 | 314 | } |
315 | + */ | |
289 | 316 | |
290 | 317 | /** |
291 | 318 | * Activation/Désactivation du mode no limit (SA a tous les droits) | ... | ... |
src/Template/Pages/tools.ctp
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | |
7 | 7 | $USER_IS_SUPERADMIN = $USER_IS_SUPERADMIN; |
8 | 8 | $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
9 | +$no_limit_mode = $no_limit_mode; | |
9 | 10 | |
10 | 11 | ?> |
11 | 12 | |
... | ... | @@ -16,10 +17,10 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
16 | 17 | <i class="icon-wrench"></i> Outils |
17 | 18 | </h2> |
18 | 19 | |
19 | -<table style="border-collapse: separate; border-spacing: 0; width: 400px;"> | |
20 | +<table border=0 style="border-collapse: separate; border-spacing: 0; width: 400px;"> | |
20 | 21 | |
21 | 22 | <tr> |
22 | - <th></th> | |
23 | + <th colspan=2></th> | |
23 | 24 | </tr> |
24 | 25 | |
25 | 26 | <?php |
... | ... | @@ -27,20 +28,25 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
27 | 28 | $SEP = '<tr><td></td></tr>'; |
28 | 29 | |
29 | 30 | // - Page statistiques |
31 | + $this->MyHelper->echoMenuItemWithIcon("stats.jpg", "Statistiques sur les matériels", 'pages','stats'); | |
32 | + /* | |
30 | 33 | echo '<tr><td>'; |
31 | 34 | echo $this->Html->link('Statistiques sur les matériels', [ |
32 | 35 | 'controller' => 'pages', |
33 | 36 | 'action' => 'stats', |
34 | 37 | ]); |
35 | 38 | echo '</td></tr>'; |
39 | + */ | |
36 | 40 | |
37 | - if ($USER_IS_SUPERADMIN) { | |
38 | - echo '<tr><td>'; | |
39 | - echo $this->Html->link('Statistiques sur les connexions', [ | |
40 | - 'controller' => 'stats', | |
41 | - ]); | |
42 | - echo '</td></tr>'; | |
43 | - } | |
41 | + if ($USER_IS_SUPERADMIN) | |
42 | + $this->MyHelper->echoMenuItemWithIcon("stats.jpg", "Statistiques sur les connexions", 'stats'); | |
43 | + /* | |
44 | + echo '<tr><td>'; | |
45 | + echo $this->Html->link('Statistiques sur les connexions', [ | |
46 | + 'controller' => 'stats', | |
47 | + ]); | |
48 | + echo '</td></tr>'; | |
49 | + */ | |
44 | 50 | |
45 | 51 | echo $SEP; |
46 | 52 | |
... | ... | @@ -48,7 +54,9 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
48 | 54 | |
49 | 55 | // - Page configuration |
50 | 56 | //if ($role == 'Super Administrateur') : |
51 | - if ($USER_IS_SUPERADMIN) { | |
57 | + if ($USER_IS_SUPERADMIN) | |
58 | + $this->MyHelper->echoMenuItemWithIcon("config.png", "Configuration générale", 'configurations','view'); | |
59 | + /* | |
52 | 60 | echo '<tr><td>'; |
53 | 61 | echo $this->Html->link("Configuration générale de l'application", [ |
54 | 62 | 'controller' => 'configurations', |
... | ... | @@ -56,29 +64,42 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
56 | 64 | //1 // inutile car automatiquement = 1 |
57 | 65 | ]); |
58 | 66 | echo '</td></tr>'; |
59 | - } | |
67 | + */ | |
60 | 68 | //endif; |
61 | 69 | |
70 | + if ($USER_IS_ADMIN_OR_MORE) | |
71 | + $this->MyHelper->echoMenuItemWithIcon("config2.png", "Gérer le contenu variable de l'application", 'pages','tools_sm'); | |
72 | + | |
73 | + | |
74 | + $this->MyHelper->echoMenuItemWithIcon("notif.png", "Voir les Notifications activées", 'pages','notifications'); | |
75 | + /* | |
62 | 76 | echo '<tr><td>'; |
63 | 77 | echo $this->Html->link('Voir les Notifications activées', [ |
64 | 78 | 'controller' => 'pages', |
65 | 79 | 'action' => 'notifications' |
66 | 80 | ]); |
67 | 81 | echo '</td></tr>'; |
82 | + */ | |
68 | 83 | |
84 | + $this->MyHelper->echoMenuItemWithIcon("authorize2.png", "Voir les Autorisations des profils utilisateurs", 'pages','acls'); | |
85 | + /* | |
69 | 86 | echo '<tr><td>'; |
70 | 87 | echo $this->Html->link('Voir les Autorisations des profils utilisateurs (ACLs)', [ |
71 | 88 | 'controller' => 'pages', |
72 | 89 | 'action' => 'acls' |
73 | 90 | ]); |
74 | 91 | echo '</td></tr>'; |
92 | + */ | |
75 | 93 | |
94 | + $this->MyHelper->echoMenuItemWithIcon("printer.jpg", "Etiqueteuse (documentation)", 'pages','printers'); | |
95 | + /* | |
76 | 96 | echo '<tr><td>'; |
77 | 97 | echo $this->Html->link('Etiqueteuse (documentation)', [ |
78 | 98 | 'controller' => 'pages', |
79 | 99 | 'action' => 'printers' |
80 | 100 | ]); |
81 | 101 | echo '</td></tr>'; |
102 | + */ | |
82 | 103 | |
83 | 104 | echo $SEP; |
84 | 105 | |
... | ... | @@ -92,19 +113,25 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
92 | 113 | 'Super Administrateur' |
93 | 114 | ])) { |
94 | 115 | */ |
116 | + ///$this->MyHelper->echoMenuItemWithIcon("config2.png", "Gérer le contenu variable de l'application", 'pages','tools_sm'); | |
117 | + /* | |
95 | 118 | echo '<tr><td>'; |
96 | 119 | echo $this->Html->link('Gérer le contenu variable de l\'application', [ |
97 | 120 | 'controller' => 'pages', |
98 | 121 | 'action' => 'tools_sm' |
99 | 122 | ]); |
100 | 123 | echo '</td></tr>'; |
124 | + */ | |
101 | 125 | |
126 | + $this->MyHelper->echoMenuItemWithIcon("liste.png", "Export de la liste des materiels actifs (format CSV)", 'materiels','export'); | |
127 | + /* | |
102 | 128 | echo '<tr><td>'; |
103 | 129 | echo $this->Html->link('Export de la liste des materiels actifs (format CSV)', [ |
104 | 130 | 'controller' => 'materiels', |
105 | 131 | 'action' => 'export' |
106 | 132 | ]); |
107 | 133 | echo '</td></tr>'; |
134 | + */ | |
108 | 135 | } |
109 | 136 | |
110 | 137 | |
... | ... | @@ -112,6 +139,8 @@ $USER_IS_ADMIN_OR_MORE = $USER_IS_ADMIN_OR_MORE; |
112 | 139 | //if ($role == 'Super Administrateur') : |
113 | 140 | if ($USER_IS_SUPERADMIN) : |
114 | 141 | |
142 | + $this->MyHelper->echoMenuItemWithIcon("user.jpg", "Gérer les utilisateurs", 'users'); | |
143 | + /* | |
115 | 144 | echo '<tr><td>'; |
116 | 145 | //echo $this->Html->link('Gérer les utilisateurs privilégiés', [ |
117 | 146 | echo $this->Html->link('Gérer les utilisateurs', [ |
... | ... | @@ -119,13 +148,17 @@ if ($USER_IS_SUPERADMIN) : |
119 | 148 | //'sort' => 'nom' |
120 | 149 | ]); |
121 | 150 | echo '</td></tr>'; |
151 | + */ | |
122 | 152 | |
153 | + $this->MyHelper->echoMenuItemWithIcon("docs.jpg", "Gérer les documents", 'documents','index'); | |
154 | + /* | |
123 | 155 | echo '<tr><td>'; |
124 | 156 | echo $this->Html->link('Gérer les fichiers', [ |
125 | 157 | 'controller' => 'documents', |
126 | 158 | 'action' => 'index' |
127 | 159 | ]); |
128 | 160 | echo '</td></tr>'; |
161 | + */ | |
129 | 162 | |
130 | 163 | endif; |
131 | 164 | |
... | ... | @@ -158,28 +191,43 @@ if ($USER_IS_SUPERADMIN) : |
158 | 191 | */ |
159 | 192 | |
160 | 193 | // Page des messages de log (level info, debug, et notice) |
194 | + $this->MyHelper->echoMenuItemWithIcon("logs2.jpg", "Voir les messages de LOG", 'pages','logs?level=info'); | |
195 | + /* | |
161 | 196 | echo '<tr><td>'; |
162 | 197 | echo $this->Html->link('Voir les messages de LOG', [ |
163 | 198 | //'controller' => 'pages', |
164 | 199 | 'action' => 'logs?level=info' |
165 | 200 | ]); |
166 | 201 | echo '</td></tr>'; |
202 | + */ | |
167 | 203 | |
168 | 204 | // Infos système |
205 | + $this->MyHelper->echoMenuItemWithIcon("sysinfo.jpg", "Voir les informations sur le système", 'pages','infos'); | |
206 | + /* | |
169 | 207 | echo '<tr><td>'; |
170 | 208 | echo $this->Html->link('Voir les informations sur le système', [ |
171 | 209 | //'controller' => 'pages', |
172 | 210 | 'action' => 'infos' |
173 | 211 | ]); |
174 | 212 | echo '</td></tr>'; |
175 | - | |
213 | + */ | |
176 | 214 | |
177 | 215 | echo $SEP; |
178 | 216 | |
217 | + | |
179 | 218 | /* |
180 | 219 | * Mode debug |
181 | 220 | */ |
182 | - echo '<tr><td>'; | |
221 | + if ($configuration->mode_debug) { | |
222 | + $verb = 'Stopper le'; | |
223 | + $action_name = 'debugOff'; | |
224 | + } else { | |
225 | + $verb = 'Passer en'; | |
226 | + $action_name = 'debugOn'; | |
227 | + } | |
228 | + $this->MyHelper->echoMenuItemPostLinkWithIcon("debug.jpg", "$verb mode DEBUG", 'configurations',$action_name); | |
229 | + /* | |
230 | + echo '<tr><td colspan=2>'; | |
183 | 231 | if ($configuration->mode_debug) { |
184 | 232 | echo $this->Form->postLink("Stopper le mode DEBUG", [ |
185 | 233 | 'controller' => 'configurations', |
... | ... | @@ -196,11 +244,21 @@ if ($USER_IS_SUPERADMIN) : |
196 | 244 | ]); |
197 | 245 | } |
198 | 246 | echo '</td></tr>'; |
247 | + */ | |
199 | 248 | |
200 | 249 | /* |
201 | 250 | * Mode install |
202 | 251 | */ |
203 | - echo '<tr><td>'; | |
252 | + if ($configuration->mode_install) { | |
253 | + $verb = 'Stopper le'; | |
254 | + $action_name = 'installOff'; | |
255 | + } else { | |
256 | + $verb = 'Passer en'; | |
257 | + $action_name = 'installOn'; | |
258 | + } | |
259 | + $this->MyHelper->echoMenuItemPostLinkWithIcon("install.png", "$verb mode INSTALL", 'configurations',$action_name); | |
260 | + /* | |
261 | + echo '<tr><td colspan=2>'; | |
204 | 262 | if ($configuration->mode_install) { |
205 | 263 | echo $this->Form->postLink("Stopper le mode INSTALL", [ |
206 | 264 | 'controller' => 'configurations', |
... | ... | @@ -217,16 +275,21 @@ if ($USER_IS_SUPERADMIN) : |
217 | 275 | ]); |
218 | 276 | } |
219 | 277 | echo '</td></tr>'; |
278 | + */ | |
220 | 279 | |
221 | - // SA a tous les droits, non mais... | |
222 | - echo '<tr><td>'; | |
280 | + | |
281 | + // SA a tous les droits, non mais !! | |
223 | 282 | $verb = $no_limit_mode ? 'Stopper':'Activer'; |
283 | + $this->MyHelper->echoMenuItemWithIcon("super2.png", "$verb le mode 'Superadmin a tous les droits' (pour debug only)", 'configurations','nolimit'); | |
284 | + /* | |
285 | + echo '<tr><td>'; | |
224 | 286 | echo $this->Html->link("$verb le mode 'Superadmin a tous les droits' (pour debug only)", [ |
225 | 287 | //'controller' => 'pages', |
226 | 288 | 'controller' => 'configurations', |
227 | 289 | 'action' => 'nolimit' |
228 | 290 | ]); |
229 | 291 | echo '</td></tr>'; |
292 | + */ | |
230 | 293 | |
231 | 294 | endif; // SA only |
232 | 295 | ... | ... |
src/Template/Pages/tools_sm.ctp
1 | 1 | <?php |
2 | 2 | |
3 | -global $verb; | |
3 | +// Variables passées par le controleur | |
4 | +$role = $role; | |
5 | + | |
6 | + | |
7 | + | |
8 | + | |
9 | +//global $verb; | |
10 | +$can_manage=false; | |
11 | +$title = ''; | |
4 | 12 | if (in_array($role, [ |
5 | 13 | //'Administration', |
6 | - 'Administration Plus', | |
14 | + //'Administration Plus', | |
7 | 15 | 'Super Administrateur' |
8 | 16 | ])) { |
9 | 17 | $title = "Gérer le contenu variable de l'application"; |
10 | - $verb = 'Gérer'; | |
18 | + //$verb = 'Gérer'; | |
19 | + $can_manage=true; | |
11 | 20 | } |
12 | 21 | else { |
13 | 22 | $title = "Voir les autres listes"; |
14 | - $verb = 'Voir'; | |
23 | + //$verb = 'Voir'; | |
15 | 24 | } |
16 | 25 | |
17 | 26 | |
... | ... | @@ -34,14 +43,15 @@ $admin_can_manage = array( |
34 | 43 | <?= $title; ?> |
35 | 44 | </h2> |
36 | 45 | <table style="border-collapse: separate; border-spacing: 0; width: 270px;"> |
46 | + | |
37 | 47 | <tr> |
38 | - <th></th> | |
48 | + <th colspan=2></th> | |
39 | 49 | </tr> |
40 | 50 | |
41 | 51 | |
42 | 52 | <?php |
43 | 53 | |
44 | - | |
54 | +/* moved to View/Helper | |
45 | 55 | function echo_list($html, $list_name, $controller_name, $action_name='index', $changed_verb='') { |
46 | 56 | //function echo_list($html, $verb, $list_name, $controller_name, $action_name) { |
47 | 57 | global $verb; |
... | ... | @@ -58,10 +68,13 @@ function echo_list($html, $list_name, $controller_name, $action_name='index', $c |
58 | 68 | ]); |
59 | 69 | echo '</td></tr>'; |
60 | 70 | } |
71 | +*/ | |
61 | 72 | |
62 | 73 | |
74 | +//echo_list($this->Html, 'Catégories', 'categories'); | |
63 | 75 | //echo_list($this->Html, 'Catégories', 'pages', 'tools_cat'); |
64 | -echo_list($this->Html, 'Catégories', 'categories'); | |
76 | +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Catégories', 'categories'); | |
77 | + | |
65 | 78 | /* |
66 | 79 | echo '<tr><td>'; |
67 | 80 | //echo $this->Html->link('Gérer les Catégories', [ |
... | ... | @@ -74,7 +87,7 @@ echo '</td></tr>'; |
74 | 87 | |
75 | 88 | |
76 | 89 | // types de DOCUMENTS |
77 | -echo_list($this->Html, 'types de Documents', 'type_documents'); | |
90 | +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'types de Documents', 'type_documents'); | |
78 | 91 | /* |
79 | 92 | echo '<tr><td>'; |
80 | 93 | echo $this->Html->link('Gérer les types de Documents', [ |
... | ... | @@ -86,9 +99,11 @@ echo_list($this->Html, 'types de Documents', 'type_documents'); |
86 | 99 | |
87 | 100 | |
88 | 101 | // FOURNISSEURS |
89 | -$changed_verb = $verb; | |
90 | -if ($role == 'Administration' && in_array('fournisseurs', $admin_can_manage)) $changed_verb = 'Gérer'; | |
91 | -echo_list($this->Html, 'Fournisseurs', 'fournisseurs', 'index', $changed_verb); | |
102 | +$this->MyHelper->echoListToManageOrViewWithIcon( | |
103 | + ( $can_manage || ( $role == 'Administration' && in_array('fournisseurs', $admin_can_manage)) ), | |
104 | + 'Fournisseurs', 'fournisseurs', 'index' | |
105 | +); | |
106 | + | |
92 | 107 | /* |
93 | 108 | echo '<tr><td>'; |
94 | 109 | echo $this->Html->link('Gérer les Fournisseurs', [ |
... | ... | @@ -109,8 +124,8 @@ foreach (['metier','thematique'] as $group_type) { |
109 | 124 | } else { |
110 | 125 | $nom = $names[0] . 's'; |
111 | 126 | } |
112 | - //echo_list($this->Html, $nom, 'groupes_thematiques'); | |
113 | - echo_list($this->Html, $nom, 'groupes_'.$group_type.'s'); | |
127 | + //$this->MyHelper->echoListToManageOrViewWithIcon($this->Html, $nom, 'groupes_thematiques'); | |
128 | + $this->MyHelper->echoListToManageOrViewWithIcon($can_manage, $nom, 'groupes_'.$group_type.'s'); | |
114 | 129 | /* |
115 | 130 | echo '<tr><td>'; |
116 | 131 | echo $this->Html->link('Gérer les ' . $nom, [ |
... | ... | @@ -120,27 +135,12 @@ foreach (['metier','thematique'] as $group_type) { |
120 | 135 | echo '</td></tr>'; |
121 | 136 | */ |
122 | 137 | } |
123 | -/* | |
124 | -$names = explode(" ", $configuration->nom_groupe_metier); | |
125 | -if (isset($names[1])) { | |
126 | - $nom = $names[0] . 's ' . $names[1] . 's'; | |
127 | -} else { | |
128 | - $nom = $names[0] . 's'; | |
129 | -} | |
130 | -echo_list($this->Html, $nom, 'groupes_metiers'); | |
131 | - echo '<tr><td>'; | |
132 | - echo $this->Html->link('Gérer les ' . $nom, [ | |
133 | - 'controller' => 'groupes_metiers', | |
134 | - 'sort' => 'nom' | |
135 | - ]); | |
136 | - echo '</td></tr>'; | |
137 | - */ | |
138 | - | |
139 | 138 | |
139 | +//$configuration->metrologie=true; | |
140 | 140 | // METROLOGIE MODULE ONLY |
141 | 141 | if ($configuration->metrologie) { |
142 | 142 | |
143 | - echo_list($this->Html, 'Métrologie : Unités', 'unites'); | |
143 | + $this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Métrologie : Unités', 'unites'); | |
144 | 144 | /* |
145 | 145 | echo '<tr><td>'; |
146 | 146 | echo $this->Html->link('Gérer les Unités (Métrologie)', [ |
... | ... | @@ -150,7 +150,7 @@ if ($configuration->metrologie) { |
150 | 150 | echo '</td></tr>'; |
151 | 151 | */ |
152 | 152 | |
153 | - echo_list($this->Html, 'Métrologie : Formules', 'formules'); | |
153 | + $this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Métrologie : Formules', 'formules'); | |
154 | 154 | /* |
155 | 155 | echo '<tr><td>'; |
156 | 156 | echo $this->Html->link('Gérer les Formules (Métrologie)', [ |
... | ... | @@ -163,7 +163,7 @@ if ($configuration->metrologie) { |
163 | 163 | |
164 | 164 | |
165 | 165 | // ORGANISMES |
166 | -echo_list($this->Html, 'Organismes', 'organismes'); | |
166 | +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Organismes', 'organismes'); | |
167 | 167 | /* |
168 | 168 | echo '<tr><td>'; |
169 | 169 | echo $this->Html->link('Gérer les Organismes', [ |
... | ... | @@ -173,9 +173,9 @@ echo $this->Html->link('Gérer les Organismes', [ |
173 | 173 | echo '</td></tr>'; |
174 | 174 | */ |
175 | 175 | |
176 | -echo_list($this->Html, 'Projets', 'projets'); | |
176 | +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Projets', 'projets'); | |
177 | 177 | |
178 | -echo_list($this->Html, 'Sites', 'sites'); | |
178 | +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'Sites', 'sites'); | |
179 | 179 | /* |
180 | 180 | echo '<tr><td>'; |
181 | 181 | echo $this->Html->link('Gérer les Sites', [ |
... | ... | @@ -187,7 +187,7 @@ echo '</td></tr>'; |
187 | 187 | */ |
188 | 188 | |
189 | 189 | |
190 | -echo_list($this->Html, 'types de Suivis', 'type_suivis'); | |
190 | +$this->MyHelper->echoListToManageOrViewWithIcon($can_manage, 'types de Suivis', 'type_suivis'); | |
191 | 191 | /* |
192 | 192 | echo '<tr><td>'; |
193 | 193 | echo $this->Html->link('Gérer les types de Suivis', [ | ... | ... |
src/View/Helper/MyHelperHelper.php
... | ... | @@ -10,12 +10,63 @@ use phpDocumentor\Reflection\Types\Void_; |
10 | 10 | class MyHelperHelper extends Helper { |
11 | 11 | |
12 | 12 | // On a besoin du HtmlHelper |
13 | - public $helpers = ['Html']; | |
13 | + public $helpers = ['Html', 'Form']; | |
14 | 14 | |
15 | 15 | public function initialize(array $config) { |
16 | 16 | //debug($config); |
17 | 17 | } |
18 | 18 | |
19 | + | |
20 | + | |
21 | + function echoListToManageOrViewWithIcon($can_manage=false, $list_name, $controller_name, $action_name='index') { | |
22 | + //function echo_list($html, $verb, $list_name, $controller_name, $action_name) { | |
23 | + $verb = $can_manage ? 'Gérer' : 'Voir'; | |
24 | + $icon_name = $can_manage ? 'config2.png' : 'see2.png'; | |
25 | + $this->echoMenuItemWithIcon($icon_name, "$verb les $list_name", $controller_name, $action_name, 'nom'); | |
26 | + } | |
27 | + | |
28 | + | |
29 | + function echoMenuItemPostLinkWithIcon($icon_name, $title, $controller_name, $action_name) { | |
30 | + $this->echoMenuItemLinkOrPostLinkWithIcon(true, $icon_name, $title, $controller_name, $action_name); | |
31 | + } | |
32 | + | |
33 | + function echoMenuItemWithIcon($img_name, $title, $controller_name, $action_name=null, $sort_field=null) { | |
34 | + $this->echoMenuItemLinkOrPostLinkWithIcon(false, $img_name, $title, $controller_name, $action_name, $sort_field); | |
35 | + } | |
36 | + | |
37 | + function echoMenuItemLinkOrPostLinkWithIcon($postlink, $img_name, $title, $controller_name, $action_name=null, $sort_field=null) { | |
38 | + $icon_size=40; | |
39 | + echo '<tr>'; | |
40 | + | |
41 | + echo "<td width=$icon_size>"; | |
42 | + echo $this->Html->image("icons/$img_name", [ | |
43 | + "alt" => $title, | |
44 | + 'height' => $icon_size, 'width' => $icon_size, | |
45 | + 'url' => ['controller' => $controller_name, 'action' => $action_name] | |
46 | + ]); | |
47 | + echo '</td>'; | |
48 | + | |
49 | + echo '<td>'; | |
50 | + if (! $postlink) { | |
51 | + echo $this->Html->link($title, [ | |
52 | + 'controller' => $controller_name, | |
53 | + 'action' => $action_name, | |
54 | + 'sort' => $sort_field, | |
55 | + ]); | |
56 | + } | |
57 | + else { | |
58 | + echo $this->Form->postlink($title, [ | |
59 | + 'controller' => $controller_name, | |
60 | + 'action' => $action_name, | |
61 | + ], [ | |
62 | + 'confirm' => __('Êtes-vous sur ?') | |
63 | + ]); | |
64 | + } | |
65 | + echo '</td>'; | |
66 | + | |
67 | + echo '</tr>'; | |
68 | + } | |
69 | + | |
19 | 70 | public function getActionButton($icon_class, $buttonStyle, $title, $controller, $action, $id, $other_args=[], $tip='', $confirmMessage='', $moreButtonStyle='') { |
20 | 71 | if ($controller=='') $controller='materiels'; |
21 | 72 | $controllerArgs = []; | ... | ... |
6.5 KB
2.86 KB
4.85 KB
1.61 KB
3.54 KB
3.75 KB
11 KB
4.89 KB
9.73 KB
7.3 KB
1.37 KB
2.96 KB
7.91 KB
4.01 KB
6.88 KB
4.17 KB
13.9 KB
9.08 KB
11.3 KB
3.53 KB
11.2 KB
2.2 KB
4.43 KB
6.76 KB
5.89 KB
10.8 KB
5.34 KB
7.72 KB
7.72 KB
6.34 KB
6.51 KB
webroot/index.php
... | ... | @@ -65,7 +65,6 @@ require dirname(__DIR__) . '/config/bootstrap.php'; |
65 | 65 | use Cake\Network\Request; |
66 | 66 | use Cake\Network\Response; |
67 | 67 | use Cake\Routing\DispatcherFactory; |
68 | - | |
69 | 68 | $dispatcher = DispatcherFactory::create(); |
70 | 69 | $dispatcher->dispatch( |
71 | 70 | Request::createFromGlobals(), | ... | ... |