From 9dba1b8e794c4c31fa27a0a95a247a09d80313c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Fri, 6 Dec 2024 18:58:49 +0100 Subject: [PATCH] =?UTF-8?q?1.15=20Nouvelle=20focntionnalit=C3=A9=20pour=20?= =?UTF-8?q?activer=20ou=20d=C3=A9sactiver=20l'enregistrement=20des=20rappo?= =?UTF-8?q?rts=20individuels.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/router.class.php | 12 ++++--- core/module/course/course.php | 31 +++++++++++-------- core/module/course/view/edit/edit.php | 8 ++++- core/module/course/view/manage/manage.php | 9 +++++- .../course/view/userReport/userReport.php | 2 +- core/module/course/view/users/users.php | 2 +- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/core/class/router.class.php b/core/class/router.class.php index d3cf0d2..ef51934 100644 --- a/core/class/router.class.php +++ b/core/class/router.class.php @@ -435,15 +435,17 @@ class core extends common $course = new course(); // Met à jour la progression de l'utisateur et obtient le nombre de pages vues - $userProgress = $course->setUserProgress(self::$siteContent, $this->getUser('id')); - + $userProgress = $course->setUserProgress(self::$siteContent, $this->getUser('id')); + // Stockage dans les données d'inscription du membre $this->setData(['enrolment', self::$siteContent, $this->getUser('id'), 'progress', $userProgress], false); + // Les rapports sont activés // Stocke la dernière page vue et sa date de consultation - $this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'lastPageView', $this->getUrl(0)], false); - $this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'datePageView', time()]); - + if ($this->getdata(['course', common::$siteContent, 'report']) === true) { + $this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'lastPageView', $this->getUrl(0)], false); + $this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'datePageView', time()]); + } } // Journalisation diff --git a/core/module/course/course.php b/core/module/course/course.php index d0c0c27..35096fa 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -289,6 +289,7 @@ class course extends common 'enrolmentKey' => $this->getInput('courseEditEnrolmentKey'), 'limitEnrolment' => $this->getInput('courseEditEnrolmentLimit', helper::FILTER_BOOLEAN), 'limitEnrolmentDate' => $this->getInput('courseEditEnrolmentLimitDate', helper::FILTER_DATETIME), + 'report' => $this->getInput('courseEditEnrolmentReport', helper::FILTER_BOOLEAN), ] ]); @@ -719,6 +720,22 @@ class course extends common 0; // Construction du tableau + + if ($this->getdata(['course', $courseId, 'report']) === true) { + $reportButton = template::button('userReport' . $userId, [ + 'href' => helper::baseUrl() . 'course/userReport/' . $courseId . '/' . $userId, + 'value' => (array_key_exists('progress', $userValue) && is_int($userValue['progress'])) + ? number_format($userValue['progress']) . ' %' + : ($viewPages ? min(round(($viewPages * 100) / $sumPages, 1), 100) . ' %' : '0%'), + 'disable' => empty($userValue['datePageView']), + ]); + } else { + $reportButton = template::button('userReport' . $userId, [ + 'value' =>'-', + 'disable' => true, + 'help' => 'Rapport désactivé', + ]); + } self::$courseUsers[] = [ //$userId, $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']), @@ -732,19 +749,7 @@ class course extends common ? helper::dateUTF8('%H:%M', $userValue['datePageView']) : '', $this->getData(['user', $userId, 'tags']), - template::button('userReport' . $userId, [ - 'href' => helper::baseUrl() . 'course/userReport/' . $courseId . '/' . $userId, - /** La lecture de la progression s'effectue selon la nouvelle méthode (progression dans la base des enrolements) - * Soit avec l'ancienne méthode qui consiste à recalculer la progression. - * - * Le pourcentage de progression est-il renseigné au format INT sinon il est recalculé - * - **/ - 'value' => (array_key_exists('progress', $userValue) and is_int($userValue['progress'])) - ? number_format($userValue['progress']) . ' %' - : ($viewPages ? min(round(($viewPages * 100) / $sumPages, 1), 100) . ' %' : '0%'), - 'disable' => empty($userValue['datePageView']), - ]), + $reportButton, template::button('userDelete' . $userId, [ 'class' => 'userDelete buttonRed', 'href' => helper::baseUrl() . 'course/userDelete/' . $courseId . '/' . $userId, diff --git a/core/module/course/view/edit/edit.php b/core/module/course/view/edit/edit.php index f693803..6487662 100644 --- a/core/module/course/view/edit/edit.php +++ b/core/module/course/view/edit/edit.php @@ -90,6 +90,12 @@
+
+ $this->getdata(['course', $this->getUrl(2), 'report']), + 'help' => 'Ne s\'applique pas à l\'inscription anonyme', + ]); ?> +
$this->getdata(['course', $this->getUrl(2), 'limitEnrolment']), @@ -99,7 +105,7 @@
'datetime-local', - 'label' => 'Fermeture', + 'label' => 'Fin d\'inscription', 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60 ]); ?>
diff --git a/core/module/course/view/manage/manage.php b/core/module/course/view/manage/manage.php index bc01676..046ccea 100644 --- a/core/module/course/view/manage/manage.php +++ b/core/module/course/view/manage/manage.php @@ -161,6 +161,13 @@
+
+ $this->getdata(['course', $this->getUrl(2), 'report']), + 'help' => 'Ne s\'applique pas à l\'inscription anonyme', + 'disabled' => true, + ]); ?> +
$this->getdata(['course', $this->getUrl(2), 'limitEnrolment']), @@ -171,7 +178,7 @@
'datetime-local', - 'label' => 'Fermeture', + 'label' => 'Fin d\'inscription', 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60, 'readonly' => true, ]); ?> diff --git a/core/module/course/view/userReport/userReport.php b/core/module/course/view/userReport/userReport.php index 908af98..0d0d390 100644 --- a/core/module/course/view/userReport/userReport.php +++ b/core/module/course/view/userReport/userReport.php @@ -10,7 +10,7 @@ helper::baseUrl() . 'course/userReportExport/' . $this->getUrl(2) . '/' . $this->getUrl(3), 'value' => template::ico('download'), - 'help' => 'Exporter', + 'help' => 'Exporter rapport', ]) ?>
diff --git a/core/module/course/view/users/users.php b/core/module/course/view/users/users.php index ed5fe90..981a09c 100644 --- a/core/module/course/view/users/users.php +++ b/core/module/course/view/users/users.php @@ -10,7 +10,7 @@ helper::baseUrl() . 'course/usersReportExport/' . $this->getUrl(2), 'value' => template::ico('download'), - 'help' => 'Exporter', + 'help' => 'Exporter rapports', ]) ?>