forked from ZwiiCMS-Team/ZwiiCampus
v40 Décompte des rôles
This commit is contained in:
parent
3b4a3fc6c1
commit
5be2a5d6ed
@ -50,7 +50,7 @@ class common
|
|||||||
const ACCESS_TIMER = 1800;
|
const ACCESS_TIMER = 1800;
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '1.0.40';
|
const ZWII_VERSION = '1.0.41';
|
||||||
|
|
||||||
// URL autoupdate
|
// URL autoupdate
|
||||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/';
|
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/';
|
||||||
|
@ -390,12 +390,14 @@ class course extends common
|
|||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
self::$courseGroups['30'] = 'Administrateur';
|
self::$courseGroups['30'] = 'Administrateur';
|
||||||
|
$profils['30'] = 0;
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
case "2":
|
case "2":
|
||||||
foreach ($groupValue as $profilId => $profilValue) {
|
foreach ($groupValue as $profilId => $profilValue) {
|
||||||
if ($profilId) {
|
if ($profilId) {
|
||||||
self::$courseGroups[$groupId . $profilId] = sprintf(helper::translate('Groupe %s - Profil %s'), self::$groupPublics[$groupId], $profilValue['name']);
|
self::$courseGroups[$groupId . $profilId] = sprintf(helper::translate('Groupe %s - Profil %s'), self::$groupPublics[$groupId], $profilValue['name']);
|
||||||
|
$profils[$groupId . $profilId] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,6 +424,7 @@ class course extends common
|
|||||||
$users = $this->getData(['enrolment', $courseId]);
|
$users = $this->getData(['enrolment', $courseId]);
|
||||||
// Tri du tableau par défaut par $userId
|
// Tri du tableau par défaut par $userId
|
||||||
ksort($users);
|
ksort($users);
|
||||||
|
|
||||||
foreach ($users as $userId => $userValue) {
|
foreach ($users as $userId => $userValue) {
|
||||||
$history = $userValue['history'];
|
$history = $userValue['history'];
|
||||||
|
|
||||||
@ -455,7 +458,8 @@ class course extends common
|
|||||||
|
|
||||||
// Taux de parcours
|
// Taux de parcours
|
||||||
$viewPages = count($this->getData(['enrolment', $courseId, $userId, 'history']));
|
$viewPages = count($this->getData(['enrolment', $courseId, $userId, 'history']));
|
||||||
// Construction tu tableau
|
|
||||||
|
// Construction du tableau
|
||||||
self::$courseUsers[] = [
|
self::$courseUsers[] = [
|
||||||
$userId,
|
$userId,
|
||||||
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||||
@ -469,12 +473,28 @@ class course extends common
|
|||||||
'help' => 'Désinscrire'
|
'help' => 'Désinscrire'
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 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') {
|
||||||
|
self::$courseGroups['all'] = self::$courseGroups['all'] . ' (' . array_sum($profils) . ')';
|
||||||
|
} else {
|
||||||
|
self::$courseGroups[$groupId] = self::$courseGroups[$groupId] . ' ('.$profils[$groupId].')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Message selon les effectifs
|
||||||
|
$message = count(self::$courseUsers) > 0
|
||||||
|
? sprintf(helper::translate('%s inscrits dans le cours %s'), count(self::$courseUsers), $this->getData(['course', $courseId, 'title']))
|
||||||
|
: sprintf(helper::translate('Aucun inscrit dans le cours %s'), $this->getData(['course', $courseId, 'title']));
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => sprintf(helper::translate('%s inscrits dans le cours %s'), count(self::$courseUsers), $this->getData(['course', $courseId, 'title'])),
|
'title' => $message,
|
||||||
'view' => 'user',
|
'view' => 'user',
|
||||||
'vendor' => [
|
'vendor' => [
|
||||||
'datatables'
|
'datatables'
|
||||||
|
@ -554,6 +554,7 @@ class init extends common
|
|||||||
],
|
],
|
||||||
'3' => [
|
'3' => [
|
||||||
'name' => 'Administrateur',
|
'name' => 'Administrateur',
|
||||||
|
'group' => 0,
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
'comment' => 'Contrôle total',
|
'comment' => 'Contrôle total',
|
||||||
|
Loading…
Reference in New Issue
Block a user