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,6 +2,8 @@ | ||
2 | use App\Controller\SurCategoriesController; | 2 | use App\Controller\SurCategoriesController; |
3 | use App\Model\Entity\SurCategory; | 3 | use App\Model\Entity\SurCategory; |
4 | use Cake\ORM\Entity; | 4 | use Cake\ORM\Entity; |
5 | +use App\Model\Entity\GroupesThematique; | ||
6 | +use App\Model\Entity\GroupesMetier; | ||
5 | 7 | ||
6 | $DEBUG=false; | 8 | $DEBUG=false; |
7 | //$DEBUG=true; | 9 | //$DEBUG=true; |
@@ -11,6 +13,7 @@ $DEBUG=false; | @@ -11,6 +13,7 @@ $DEBUG=false; | ||
11 | $role = $role; | 13 | $role = $role; |
12 | 14 | ||
13 | $entity = $entity; | 15 | $entity = $entity; |
16 | +//debug($entity); | ||
14 | //$parent_entity_infos=$parent_entity_infos; | 17 | //$parent_entity_infos=$parent_entity_infos; |
15 | $parent_entities_infos = $parent_entities_infos; | 18 | $parent_entities_infos = $parent_entities_infos; |
16 | $fields_label = $fields_label; | 19 | $fields_label = $fields_label; |
@@ -198,16 +201,32 @@ $child_entities_list = $child_entities_list; | @@ -198,16 +201,32 @@ $child_entities_list = $child_entities_list; | ||
198 | <?php | 201 | <?php |
199 | //debug($entity); | 202 | //debug($entity); |
200 | //debug($child_entities_list); | 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 | //debug($es); | 205 | //debug($es); |
203 | // function displaySectionShowHide($controller_name, $entity_type_name, $title, $id_name, $is_masculine, $name_field_name, $entities) { | 206 | // function displaySectionShowHide($controller_name, $entity_type_name, $title, $id_name, $is_masculine, $name_field_name, $entities) { |
204 | $fk_contained_name = $es['fk_contained_name']; | 207 | $fk_contained_name = $es['fk_contained_name']; |
205 | //debug($entity->$fk_contained_name); | 208 | //debug($entity->$fk_contained_name); |
206 | //$entities = $entity->$fk_contained_name; | 209 | //$entities = $entity->$fk_contained_name; |
207 | //debug($entities); exit; | 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 | $this->MyHelper->displayAssociatedEntitiesAsSectionShowHide( | 227 | $this->MyHelper->displayAssociatedEntitiesAsSectionShowHide( |
209 | //$es['controller_name'], | 228 | //$es['controller_name'], |
210 | - $controller_name, | 229 | + $child_controller_name, |
211 | $es['entity_type_name_singular'], | 230 | $es['entity_type_name_singular'], |
212 | $es['entity_title'], | 231 | $es['entity_title'], |
213 | //$es['id_name'], | 232 | //$es['id_name'], |