From c54da11107085d7ab2bc4537c3de3b95da426c82 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 9 Oct 2023 19:56:49 +0200 Subject: [PATCH] v29 pourcentage de progression --- core/core.php | 2 +- core/module/course/course.php | 37 +++++++++++++++++++++------ core/module/course/view/user/user.php | 2 +- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/core/core.php b/core/core.php index af5c311..ef81293 100644 --- a/core/core.php +++ b/core/core.php @@ -50,7 +50,7 @@ class common const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '1.0.28'; + const ZWII_VERSION = '1.0.29'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/'; diff --git a/core/module/course/course.php b/core/module/course/course.php index ca7360e..488c289 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -398,13 +398,23 @@ class course extends common } } } + // Liste alphabétique self::$alphabet = range('A', 'Z'); $alphabet = range('A', 'Z'); self::$alphabet = array_combine($alphabet, self::$alphabet); - self::$alphabet = array_merge(['all'=>'Tout'], self::$alphabet ); - // Liste des inscrits dans le cours sélectionné. + self::$alphabet = array_merge(['all' => 'Tout'], self::$alphabet); + + // Cours sélectionné $courseId = $this->getUrl(2); + + // Statistiques du cours sélectionné calcul du nombre de pages + $currentSite = self::$siteContent; + $this->initDB('page', $courseId); + $sumPages = count($this->getData(['page'])); + self::$siteContent = $currentSite; + + // Liste des inscrits dans le cours sélectionné. $users = $this->getData(['enrolment', $courseId]); ksort($users); foreach ($users as $userId => $userValue) { @@ -418,23 +428,34 @@ class course extends common $profil = (string) $this->getData(['user', $userId, 'profil']); $firstName = $this->getData(['user', $userId, 'firstname']); $lastName = $this->getData(['user', $userId, 'lastname']); - if ( $this->getInput('courseFilterGroup', helper::FILTER_INT) > 0 - && $this->getInput('courseFilterGroup', helper::FILTER_STRING_SHORT) !== $group . $profil ) + if ( + $this->getInput('courseFilterGroup', helper::FILTER_INT) > 0 + && $this->getInput('courseFilterGroup', helper::FILTER_STRING_SHORT) !== $group . $profil + ) continue; // Première lettre du prénom - if ($this->getInput('courseFilterFirstName', helper::FILTER_STRING_SHORT) !== 'all' - && $this->getInput('courseFilterFirstName', helper::FILTER_STRING_SHORT) !== strtoupper(substr($firstName, 0, 1))) + if ( + $this->getInput('courseFilterFirstName', helper::FILTER_STRING_SHORT) !== 'all' + && $this->getInput('courseFilterFirstName', helper::FILTER_STRING_SHORT) !== strtoupper(substr($firstName, 0, 1)) + ) continue; // Première lettre du nom - if ($this->getInput('courseFilterLastName', helper::FILTER_STRING_SHORT) !== 'all' - && $this->getInput('courseFilterLastName', helper::FILTER_STRING_SHORT) !== strtoupper(substr($lastName, 0, 1))) + if ( + $this->getInput('courseFilterLastName', helper::FILTER_STRING_SHORT) !== 'all' + && $this->getInput('courseFilterLastName', helper::FILTER_STRING_SHORT) !== strtoupper(substr($lastName, 0, 1)) + ) continue; } + + // Taux de parcours + $viewPages = count($this->getData(['enrolment', $courseId, $userId, 'history'])); + // Construction tu tableau self::$courseUsers[] = [ $userId, $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']), $pageId, helper::dateUTF8('%d %B %Y - %H:%M', $maxTime), + ($viewPages * 100)/ $sumPages . ' %', template::button('userDelete' . $userId, [ 'class' => 'userDelete buttonRed', 'href' => helper::baseUrl() . 'course/userDelete/' . $courseId . '/' . $userId, diff --git a/core/module/course/view/user/user.php b/core/module/course/view/user/user.php index 5a9ba01..2f38cfa 100644 --- a/core/module/course/view/user/user.php +++ b/core/module/course/view/user/user.php @@ -55,7 +55,7 @@ - + \ No newline at end of file