Commit 197876e918905c86f32c78336edddffcbc0d12f1
1 parent
6838aed0
Exists in
master
and in
1 other branch
ajout de la page notifications.ctp
Showing
1 changed file
with
218 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,218 @@ | @@ -0,0 +1,218 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +/* | ||
4 | +use App\Controller\MaterielsController; | ||
5 | +use App\Controller\SuivisController; | ||
6 | +use App\Controller\EmpruntsController; | ||
7 | +use App\Controller\DocumentsController; | ||
8 | +use App\Controller\UsersController; | ||
9 | +use App\Controller\ConfigurationsController; | ||
10 | +use App\Controller\FournisseursController; | ||
11 | +use App\Controller\PagesController; | ||
12 | +use App\Controller\SurCategoriesController; | ||
13 | +use App\Controller\FichemetrologiquesController; | ||
14 | +use App\Controller\FormulesController; | ||
15 | +use App\Controller\QrCodesController; | ||
16 | +*/ | ||
17 | + | ||
18 | +// Variables passées à la vue par le controleur | ||
19 | +$lab_name = $lab_name; | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | +//$controllers = ['Materiels']; | ||
24 | +$controllers = [ | ||
25 | + 'Materiels', | ||
26 | + 'Suivis', | ||
27 | + 'Emprunts', | ||
28 | + 'Documents', | ||
29 | + 'Users', | ||
30 | + 'Fournisseurs', | ||
31 | +]; | ||
32 | +/* | ||
33 | +$controllers = [ | ||
34 | + new MaterielsController(), | ||
35 | + new SuivisController(), | ||
36 | + new EmpruntsController(), | ||
37 | + new DocumentsController(), | ||
38 | + new UsersController(), | ||
39 | + new FournisseursController(), | ||
40 | + /S | ||
41 | + new SurCategoriesController(), | ||
42 | + new ConfigurationsController(), | ||
43 | + new FichemetrologiquesController(), | ||
44 | + new FormulesController(), | ||
45 | + new QrCodesController(), | ||
46 | + S/ | ||
47 | +]; | ||
48 | +*/ | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | +function displayNotificationsForController($c, $lab_name) { | ||
53 | + | ||
54 | + ?> | ||
55 | + | ||
56 | + <a id="<?=$c->name?>"> | ||
57 | + <u><b>Notifications pour les <?=$c->name?> :</b></u> | ||
58 | + </a> | ||
59 | + <br><br> | ||
60 | + | ||
61 | + Pour changer ces notifications, ouvrir le fichier /src/Controller/<?=$c->name?>Controller.php : | ||
62 | + <ul> | ||
63 | + <li> | ||
64 | + modifier les règles (LOCALES) dans la fonction setAuthorizations_<?=$lab_name?>() => elles ne s'appliqueront qu'à CE laboratoire | ||
65 | + </li> | ||
66 | + <li> | ||
67 | + modifier les règles (GÉNÉRALES) dans la fonction setAuthorizations() => elles s'appliqueront à TOUS les laboratoires | ||
68 | + </li> | ||
69 | + <li> | ||
70 | + dans la fonction setAuthorizations choisie, modifier les arguments de la fonction setNotificationAllowedOnActions() | ||
71 | + </li> | ||
72 | + </ul> | ||
73 | + <i> | ||
74 | + Veuillez ensuite partager ces modifications en les intégrant au code source général du logiciel (ainsi que toute autre modification effectuée) | ||
75 | + via la commande "./PUSH_MODIFS" | ||
76 | + </i> | ||
77 | + <p> | ||
78 | + | ||
79 | + | ||
80 | + <!-- | ||
81 | + <table border=1> | ||
82 | + --> | ||
83 | + <table> | ||
84 | + <thead> | ||
85 | + <tr> | ||
86 | + <th scope="col">ACTION</th> | ||
87 | + <th scope="col">NOTIFICATION</th> | ||
88 | + </tr> | ||
89 | + </thead> | ||
90 | + | ||
91 | + <tbody> | ||
92 | + <?php | ||
93 | + $notifs = $c->getNotifications(); | ||
94 | + //debug($notifs); | ||
95 | + foreach ($notifs as $a=>$notif) { | ||
96 | + ?> | ||
97 | + <!-- Notifications pour chaque action ($a) --> | ||
98 | + <tr> | ||
99 | + <th class="action" scope="row"><?=$a?></th> | ||
100 | + <td><?=$notif?></td> | ||
101 | + </tr> | ||
102 | + <?php | ||
103 | + } | ||
104 | + ?> | ||
105 | + </tbody> | ||
106 | + | ||
107 | + </table> | ||
108 | + | ||
109 | +<?php | ||
110 | +} // displayNotificationsForController | ||
111 | +?> | ||
112 | + | ||
113 | + | ||
114 | +<style> | ||
115 | +table { | ||
116 | + /* | ||
117 | + border-collapse: separate; | ||
118 | + border: 1mm ridge grey; | ||
119 | + */ | ||
120 | + border: 1mm ridge grey; | ||
121 | +} | ||
122 | +td, th { | ||
123 | + border: 1px solid #000; | ||
124 | + /* | ||
125 | + padding: 5px; | ||
126 | + */ | ||
127 | +} | ||
128 | +th { | ||
129 | + text-align: center; | ||
130 | +} | ||
131 | +th.action { | ||
132 | + text-align: left; | ||
133 | +} | ||
134 | +</style> | ||
135 | + | ||
136 | + | ||
137 | + <h2> | ||
138 | + <!-- | ||
139 | + <i class="icon-print"></i> | ||
140 | + --> | ||
141 | + <center> | ||
142 | + NOTIFICATIONS ACTIVES<p> | ||
143 | + (log et envoi de mail pour certaines actions sur certaines entités) | ||
144 | + </center> | ||
145 | + </h2> | ||
146 | + | ||
147 | + <p> | ||
148 | + Les tableaux ci-dessous sont générés dynamiquement en fonction des notifications activées. | ||
149 | + </p> | ||
150 | + | ||
151 | + <!-- | ||
152 | + <br /> | ||
153 | + <br /> | ||
154 | + <h3>AUTORISATIONS DES UTILISATEURS (PROFILS)</h3> | ||
155 | + --> | ||
156 | + | ||
157 | + <br /> | ||
158 | + <p> | ||
159 | + <!-- Lien GDOC --> | ||
160 | + <br> | ||
161 | + => <a href="https://docs.google.com/document/d/1JTi3YX6X33asn9vfPGAPaFZ3u8IMGnAqCf2Ge0nWdtI/edit#heading=h.jaa6i3mtbmnr"> | ||
162 | + Lien vers le chapitre sur les Notifications dans la documentation technique (TODO) | ||
163 | + </a> | ||
164 | + </p> | ||
165 | + <hr /> | ||
166 | + | ||
167 | + | ||
168 | + <u><b>Tableaux des notifications par entité</b></u> | ||
169 | + <br><br> | ||
170 | + <?php | ||
171 | + echo '<u>'; | ||
172 | + foreach ($controllers as $controller) { | ||
173 | + $controller = "App\\Controller\\".$controller.'Controller'; | ||
174 | + $controller = new $controller(); | ||
175 | + if ($controller->getNotifications()) | ||
176 | + echo "<li><a href='#{$controller->name}'>{$controller->name}</a></li>"; | ||
177 | + //echo '<br>'; | ||
178 | + } | ||
179 | + echo '</u>'; | ||
180 | + ?> | ||
181 | + <hr /> | ||
182 | + | ||
183 | + <p> | ||
184 | + <u><b>Légende</b></u> : | ||
185 | + <ul> | ||
186 | + <li><b>both = log + mail</b></li> | ||
187 | + <li><b>log = log seulement</b></li> | ||
188 | + <li><b>mail = mail seulement</b></li> | ||
189 | + </ul> | ||
190 | + </p> | ||
191 | + <hr /> | ||
192 | + | ||
193 | + | ||
194 | + | ||
195 | + | ||
196 | +<?php | ||
197 | + | ||
198 | +//var_dump($mc->getAuthorizationForAction('edit')); | ||
199 | +foreach ($controllers as $controller) { | ||
200 | + //$mc = new MaterielsController(); | ||
201 | + /* | ||
202 | + $controller_name = 'MaterielsController'; | ||
203 | + $controller = new $controller_name (); | ||
204 | + $controller_name = $c.'Controller'; | ||
205 | + $controller = (new $controller_name()); | ||
206 | + */ | ||
207 | + $controller = "App\\Controller\\".$controller.'Controller'; | ||
208 | + $controller = new $controller(); | ||
209 | + if ($controller->getNotifications()) { | ||
210 | + echo '<br>'; | ||
211 | + displayNotificationsForController($controller, $lab_name); | ||
212 | + echo '<br>'; | ||
213 | + echo "<a href='#'>Haut de page</a>"; | ||
214 | + echo '<hr />'; | ||
215 | + } | ||
216 | +} | ||
217 | + | ||
218 | +?> |