diff --git a/core/module/course/course.php b/core/module/course/course.php index 4b3d095..98e785f 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -430,6 +430,10 @@ class course extends common $maxTime = max($history); $pageId = array_search($maxTime, $history); + + // Compte les rôles + $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + // Filtres if ($this->isPost()) { // Groupe et profils @@ -474,17 +478,14 @@ class course extends common ]) ]; - // Compte les rôles - $group = $this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil']); - $profils[$group]++; } // Ajoute les effectifs aux profils du sélecteur foreach (self::$courseGroups as $groupId => $groupValue) { - if($groupId === 'all') { + if ($groupId === 'all') { self::$courseGroups['all'] = self::$courseGroups['all'] . ' (' . array_sum($profils) . ')'; } else { - self::$courseGroups[$groupId] = self::$courseGroups[$groupId] . ' ('.$profils[$groupId].')'; + self::$courseGroups[$groupId] = self::$courseGroups[$groupId] . ' (' . $profils[$groupId] . ')'; } } diff --git a/core/module/user/user.php b/core/module/user/user.php index 9fc924b..88fede3 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -75,7 +75,7 @@ class user extends common public static $alphabet = []; - public static $courseGroups = [ + public static $usersGroups = [ 'all' => 'Tous' ]; @@ -437,20 +437,22 @@ class user extends common public function index() { // Liste des groupes et des profils - $courseGroups = $this->getData(['profil']); - foreach ($courseGroups as $groupId => $groupValue) { + $usersGroups = $this->getData(['profil']); + foreach ($usersGroups as $groupId => $groupValue) { switch ($groupId) { case "-1": case "0": break; case "3": - self::$courseGroups['30'] = 'Administrateur'; + self::$usersGroups['30'] = 'Administrateur'; + $profils['30'] = 0; break; case "1": case "2": foreach ($groupValue as $profilId => $profilValue) { if ($profilId) { - self::$courseGroups[$groupId . $profilId] = sprintf(helper::translate('Groupe %s - Profil %s'), self::$groupPublics[$groupId], $profilValue['name']); + self::$usersGroups[$groupId . $profilId] = sprintf(helper::translate('Groupe %s - Profil %s'), self::$groupPublics[$groupId], $profilValue['name']); + $profils[$groupId . $profilId] = 0; } } } @@ -467,6 +469,10 @@ class user extends common ksort($userIdsLastNames); foreach ($userIdsLastNames as $userId => $userLastNames) { if ($this->getData(['user', $userId, 'group'])) { + + // Compte les rôles + $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + // Filtres if ($this->isPost()) { // Groupe et profils @@ -493,6 +499,8 @@ class user extends common continue; } + + // Formatage de la liste self::$users[] = [ $userId, @@ -513,6 +521,16 @@ class user extends common 'help' => 'Supprimer' ]) ]; + + } + } + + // Ajoute les effectifs aux profils du sélecteur + foreach (self::$usersGroups as $groupId => $groupValue) { + if ($groupId === 'all') { + self::$usersGroups['all'] = self::$usersGroups['all'] . ' (' . array_sum($profils) . ')'; + } else { + self::$usersGroups[$groupId] = self::$usersGroups[$groupId] . ' (' . $profils[$groupId] . ')'; } } diff --git a/core/module/user/view/index/index.php b/core/module/user/view/index/index.php index 9b9f560..10783d0 100644 --- a/core/module/user/view/index/index.php +++ b/core/module/user/view/index/index.php @@ -41,7 +41,7 @@
- 'Groupes / Profils', 'selected' => isset($_POST['userFilterGroup']) ? $_POST['userFilterGroup'] : 'all', ]); ?>