From 3c4e5f7d0573e9024e03e46c8ab21ff4a69ef66e Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 18 Nov 2023 16:14:19 +0100 Subject: [PATCH] Limitation de date d'nscription --- core/core.php | 2 +- core/module/course/course.php | 19 +++++++++++++------ core/module/course/view/add/add.php | 13 +++++++++++++ core/module/course/view/edit/edit.php | 19 +++++++++++++++++-- core/module/course/view/suscribe/suscribe.php | 18 ++++++++++++++---- 5 files changed, 58 insertions(+), 13 deletions(-) diff --git a/core/core.php b/core/core.php index d67b896..535d427 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.1.03'; + const ZWII_VERSION = '1.1.04'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/'; diff --git a/core/module/course/course.php b/core/module/course/course.php index 2f33e54..d05ce78 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -162,6 +162,8 @@ class course extends common 'closingDate' => $this->getInput('courseAddClosingDate', helper::FILTER_DATETIME), 'enrolment' => $this->getInput('courseAddEnrolment', helper::FILTER_INT), 'enrolmentKey' => $this->getInput('courseAddEnrolmentKey'), + 'limitEnrolment' => $this->getInput('courseAddEnrolmentLimit', helper::FILTER_BOOLEAN), + 'limitEnrolmentDate' => $this->getInput('courseAddEnrolmentLimitDate', helper::FILTER_DATETIME), ] ]); @@ -227,6 +229,8 @@ class course extends common 'closingDate' => $this->getInput('courseClosingDate', helper::FILTER_DATETIME), 'enrolment' => $this->getInput('courseEditEnrolment', helper::FILTER_INT), 'enrolmentKey' => $this->getInput('courseEditEnrolmentKey'), + 'limitEnrolment' => $this->getInput('courseEditEnrolmentLimit', helper::FILTER_BOOLEAN), + 'limitEnrolmentDate' => $this->getInput('courseEditEnrolmentLimitDate', helper::FILTER_DATETIME), ] ]); @@ -863,12 +867,15 @@ class course extends common } $file = fopen($filename, 'w'); foreach ($history['history'] as $pageId => $time) { - $data = array_map('html_entity_decode', array( - $pageId, - $pages[$pageId]['title'], - $pages[$pageId]['number'], - helper::dateUTF8('%d %B %Y - %H:%M:%S', $time), - )); + $data = array_map( + 'html_entity_decode', + array( + $pageId, + $pages[$pageId]['title'], + $pages[$pageId]['number'], + helper::dateUTF8('%d %B %Y - %H:%M:%S', $time), + ) + ); // Écrire la ligne dans le fichier CSV fputcsv($file, $data, ';'); diff --git a/core/module/course/view/add/add.php b/core/module/course/view/add/add.php index 24b44dd..5589be4 100644 --- a/core/module/course/view/add/add.php +++ b/core/module/course/view/add/add.php @@ -86,6 +86,19 @@ ]); ?> +
+
+ 'Ne s\'applique pas à l\'inscription anonyme', + ]); ?> +
+
+ 'datetime-local', + 'label' => 'Fermeture', + ]); ?> +
+
\ No newline at end of file diff --git a/core/module/course/view/edit/edit.php b/core/module/course/view/edit/edit.php index d0b7c25..a5fa461 100644 --- a/core/module/course/view/edit/edit.php +++ b/core/module/course/view/edit/edit.php @@ -76,19 +76,34 @@
-
+
'Inscription', 'selected' => $this->getdata(['course', $this->getUrl(2), 'enrolment']) ]); ?>
-
+
'Clé', 'value' => $this->getdata(['course', $this->getUrl(2), 'enrolmentKey']) ]); ?>
+
+
+ $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']), + 'help' => 'Ne s\'applique pas à l\'inscription anonyme', + ]); ?> +
+
+ 'datetime-local', + 'label' => 'Fermeture', + 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60 + ]); ?> +
+
\ No newline at end of file diff --git a/core/module/course/view/suscribe/suscribe.php b/core/module/course/view/suscribe/suscribe.php index 874c0fc..a821150 100644 --- a/core/module/course/view/suscribe/suscribe.php +++ b/core/module/course/view/suscribe/suscribe.php @@ -1,15 +1,23 @@
- Auteur : " . $this->signature($this->getData(['course', $this->getUrl(2), 'author'])). ""; ?> + Auteur : " . $this->signature($this->getData(['course', $this->getUrl(2), 'author'])) . ""; ?> Description : " . $this->getData(['course', $this->getUrl(2), 'description']) . "

"; ?> + Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access'])]; ?> getData(['course', $this->getUrl(2), 'access']) === $module::COURSE_ACCESS_DATE): ?> getData(['course', $this->getUrl(2), 'openingDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $this->getUrl(2), 'openingDate']), self::$i18nUI); ?> getData(['course', $this->getUrl(2), 'closingDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $this->getUrl(2), 'closingDate']), self::$i18nUI); ?> -

Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment'])] . "

"; ?> + '; ?> + Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment'])] . '.'; ?> + + getData(['course', $this->getUrl(2), 'limitEnrolment']) === true && $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']) <= time()):?> + + getData(['course', $this->getUrl(2), 'limitEnrolmentDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']), self::$i18nUI); ?> + + '; ?>
@@ -44,8 +52,10 @@
$module::$swapMessage['submitLabel'], - 'disabled' => !$module->courseIsAvailable($this->getUrl(2)), - 'ico' => '' + 'disabled' => !($module->courseIsAvailable($this->getUrl(2)) + && !($this->getData(['course', $this->getUrl(2), 'limitEnrolment']) === true + && $this->getData(['course', $this->getUrl(2), 'limitEnrolmentDate']) <= time()) + ), ]); ?>