Commit 88c1b60cbdb7373e308bb1e3e525fdd299a42ba7
1 parent
5ba79d54
Exists in
master
and in
1 other branch
amélioration de la vue des utilisateurs de groupes métier/thématiq
(montre les responsabilités)
Showing
1 changed file
with
21 additions
and
2 deletions
Show diff stats
src/Template/Common/view.ctp
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 | use App\Controller\SurCategoriesController; |
3 | 3 | use App\Model\Entity\SurCategory; |
4 | 4 | use Cake\ORM\Entity; |
5 | +use App\Model\Entity\GroupesThematique; | |
6 | +use App\Model\Entity\GroupesMetier; | |
5 | 7 | |
6 | 8 | $DEBUG=false; |
7 | 9 | //$DEBUG=true; |
... | ... | @@ -11,6 +13,7 @@ $DEBUG=false; |
11 | 13 | $role = $role; |
12 | 14 | |
13 | 15 | $entity = $entity; |
16 | +//debug($entity); | |
14 | 17 | //$parent_entity_infos=$parent_entity_infos; |
15 | 18 | $parent_entities_infos = $parent_entities_infos; |
16 | 19 | $fields_label = $fields_label; |
... | ... | @@ -198,16 +201,32 @@ $child_entities_list = $child_entities_list; |
198 | 201 | <?php |
199 | 202 | //debug($entity); |
200 | 203 | //debug($child_entities_list); |
201 | - foreach ($child_entities_list as $controller_name => $es) { | |
204 | + foreach ($child_entities_list as $child_controller_name => $es) { | |
202 | 205 | //debug($es); |
203 | 206 | // function displaySectionShowHide($controller_name, $entity_type_name, $title, $id_name, $is_masculine, $name_field_name, $entities) { |
204 | 207 | $fk_contained_name = $es['fk_contained_name']; |
205 | 208 | //debug($entity->$fk_contained_name); |
206 | 209 | //$entities = $entity->$fk_contained_name; |
207 | 210 | //debug($entities); exit; |
211 | + | |
212 | + /* (EP202010) | |
213 | + * CAS TRES PARTICULIER DES UTILISATEURS ASSOCIÉS À UN GROUPE THÉMATIQUE OU MÉTIER | |
214 | + * => On ajoute à chaque nom d'utilisateur la mention '(responsable)' s'il est responsabble du groupe | |
215 | + * (bidouille, pas très clean, mais difficile de gérer des cas très particuliers dans des algos génériques...) | |
216 | + */ | |
217 | + if ( | |
218 | + ($entity instanceof GroupesThematique || $entity instanceof GroupesMetier) | |
219 | + && | |
220 | + $child_controller_name == 'Users' | |
221 | + ) { | |
222 | + $f_isresp_name = ($entity instanceof GroupesThematique) ? 'is_resp_groupes_thematique' : 'is_resp_groupes_metier'; | |
223 | + foreach ($entity->$fk_contained_name as $user) | |
224 | + if ($user->$f_isresp_name) $user->nom = $user->nom.' (responsable)'; | |
225 | + } | |
226 | + | |
208 | 227 | $this->MyHelper->displayAssociatedEntitiesAsSectionShowHide( |
209 | 228 | //$es['controller_name'], |
210 | - $controller_name, | |
229 | + $child_controller_name, | |
211 | 230 | $es['entity_type_name_singular'], |
212 | 231 | $es['entity_title'], |
213 | 232 | //$es['id_name'], | ... | ... |