From 0e6b843b1d6a760502db141c6fe553cb7f3cefbc Mon Sep 17 00:00:00 2001 From: F TEMPEZ Date: Thu, 21 Sep 2023 15:34:03 +0200 Subject: [PATCH] =?UTF-8?q?Fonction=20avec=20formulaire=20change=20pour=20?= =?UTF-8?q?se=20connecter=20ou=20s'inscrire=20=C3=A0=20un=20cours=20+=20fi?= =?UTF-8?q?x=20type=20access=20et=20enrolment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/course/course.php | 33 ++++++++++++++++++++--- core/module/course/view/change/change.css | 16 +++++++++++ core/module/course/view/change/change.php | 26 ++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 core/module/course/view/change/change.css create mode 100644 core/module/course/view/change/change.php diff --git a/core/module/course/course.php b/core/module/course/course.php index 027a30c..9e494d8 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -22,6 +22,7 @@ class course extends common 'add' => self::GROUP_ADMIN, 'delete' => self::GROUP_ADMIN, 'swap' => self::GROUP_VISITOR, + 'change' => self::GROUP_VISITOR, ]; public static $courseAccess = [ @@ -95,10 +96,10 @@ class course extends common 'shortTitle' => $this->getInput('courseAddShortTitle', helper::FILTER_STRING_SHORT, true), 'author' => $author, 'description' => $this->getInput('courseAddDescription', helper::FILTER_STRING_SHORT, true), - 'access' => $this->getInput('courseAddAccess'), + 'access' => $this->getInput('courseAddAccess', helper::FILTER_INT), 'openingDate' => $this->getInput('courseOpeningDate', helper::FILTER_DATETIME), 'closingDate' => $this->getInput('courseClosingDate', helper::FILTER_DATETIME), - 'enrolment' => $this->getInput('courseAddEnrolment'), + 'enrolment' => $this->getInput('courseAddEnrolment', helper::FILTER_INT), 'enrolmentKey' => $this->getInput('courseAddEnrolmentKey'), ] ]); @@ -238,6 +239,30 @@ class course extends common ]); } + /* + * Affiche un écran de connexion à un cours + */ + + public function change() + { + // Soumission du formulaire + if ( + $this->isPost() || + $this->getUrl(2) === 'home' + + ) { + $this->swap(); + } + + // Valeurs en sortie + $this->addOutput([ + 'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle' ])), + 'view' => 'change', + 'display' => self::DISPLAY_LAYOUT_LIGHT, + ]); + + } + /* * Traitement du changement de langue * Fonction utilisée par le noyau @@ -248,7 +273,7 @@ class course extends common $courseId = $this->getUrl(2); if ( - // home n'est pas présent dans la base de donénes des cours + // home n'est pas présent dans la base de données des cours $courseId === 'home' || // Contrôle la validité du cours demandé (is_dir(self::DATA_DIR . $courseId) && @@ -264,4 +289,6 @@ class course extends common ]); } + + } \ No newline at end of file diff --git a/core/module/course/view/change/change.css b/core/module/course/view/change/change.css new file mode 100644 index 0000000..f28e78e --- /dev/null +++ b/core/module/course/view/change/change.css @@ -0,0 +1,16 @@ +/** + * This file is part of Zwii. + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2023, Frédéric Tempez + * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International + * @link http://zwiicms.fr/ + */ + + /** @import url("site/data/admin.css"); */ + +/** NE PAS EFFACER +* admin.css +*/ diff --git a/core/module/course/view/change/change.php b/core/module/course/view/change/change.php new file mode 100644 index 0000000..bd10ef4 --- /dev/null +++ b/core/module/course/view/change/change.php @@ -0,0 +1,26 @@ + +
+
+ Auteur : " . $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' ])]. "

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

";?> + +
+
+
+
+ helper::baseUrl(), + 'value' => template::ico('left') + ]); ?> +
+
+ 'Se connecter', + 'ico' => '' + ]); ?> +
+
+ + \ No newline at end of file