From 93fc2f3aae703b4c8b588ae06e1bfa262f6aeaff Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 19 Oct 2023 11:41:54 +0200 Subject: [PATCH] modules courses WIP --- core/module/course/view/edit/edit.php | 2 +- module/courses/courses.php | 103 +++++++++++++++++++++ module/courses/view/config/config.css | 19 ++++ module/courses/view/config/config.php | 123 ++++++++++++++++++++++++++ module/courses/view/index/index.php | 30 +++++++ 5 files changed, 276 insertions(+), 1 deletion(-) create mode 100644 module/courses/courses.php create mode 100644 module/courses/view/config/config.css create mode 100644 module/courses/view/config/config.php create mode 100644 module/courses/view/index/index.php diff --git a/core/module/course/view/edit/edit.php b/core/module/course/view/edit/edit.php index 0bfac72..2be3892 100644 --- a/core/module/course/view/edit/edit.php +++ b/core/module/course/view/edit/edit.php @@ -64,7 +64,7 @@
'Accès', + 'label' => 'Modalités d\'ouverture', 'selected' => $this->getdata(['course', $this->getUrl(2), 'access']) ]); ?>
diff --git a/module/courses/courses.php b/module/courses/courses.php new file mode 100644 index 0000000..56ef3bf --- /dev/null +++ b/module/courses/courses.php @@ -0,0 +1,103 @@ + + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @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/ + */ + +class courses extends common +{ + const VERSION = '1.0'; + const REALNAME = 'Liste des cours'; + const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) + + public static $actions = [ + 'config' => self::GROUP_ADMIN, + 'index' => self::GROUP_VISITOR + ]; + + public static $courseCategories = [ + 'all' => 'Toutes les catégories' + ]; + + public static $coursesLayout = [ + 1 => 'Une colonne', + 2 => 'Deux colonnes', + 3 => 'Trois colonnes', + 4 => 'Quatre colonnes', + 5 => 'Cinq colonnes', + 6 => 'Six colonnes', + ]; + + public static $coursesDetails = []; + /** + * Configuration + */ + public function config() + { + // Soumission du formulaire + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) === true && + $this->isPost() + ) { + $this->setData([ + 'module', + $this->getUrl(0), + 'config', + [ + 'category' => $this->getInput('coursesConfigCategories'), + 'title' => $this->getInput('coursesConfigShowTitle', helper::FILTER_BOOLEAN), + 'shortTitle' => $this->getInput('coursesConfigShowShortTitle', helper::FILTER_BOOLEAN), + 'author' => $this->getInput('coursesConfigShowAuthor', helper::FILTER_BOOLEAN), + 'description' => $this->getInput('coursesConfigShowDescription', helper::FILTER_BOOLEAN), + 'access' => $this->getInput('coursesConfigShowAccess', helper::FILTER_BOOLEAN), + 'opening' => $this->getInput('coursesConfigShowOpening', helper::FILTER_BOOLEAN), + 'closing' => $this->getInput('coursesConfigShowClosing', helper::FILTER_BOOLEAN), + 'enrolment' => $this->getInput('coursesConfigShowEnrolment', helper::FILTER_BOOLEAN), + 'urlText' => $this->getInput('coursesConfigUrlText', helper::FILTER_STRING_SHORT), + 'layout' => $this->getInput('coursesConfigLayout', helper::FILTER_INT), + 'template' => $this->getInput('coursesConfigTemplate', helper::FILTER_BOOLEAN), + ] + ]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(), + 'notification' => helper::translate('Modifications enregistrées'), + 'state' => true + ]); + } + // Liste des catégories de cours + self::$courseCategories = array_merge(self::$courseCategories, $this->getData(['category'])); + + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Configuration du module'), + 'view' => 'config' + ]); + } + public function index() + { + // Valeurs en sortie + $this->addOutput([ + 'showBarEditButton' => true, + 'showPageContent' => true, + 'view' => 'index' + ]); + + + // Valeurs en sortie + $this->addOutput([ + 'showBarEditButton' => true, + 'showPageContent' => true, + 'view' => 'index', + ]); + } +} \ No newline at end of file diff --git a/module/courses/view/config/config.css b/module/courses/view/config/config.css new file mode 100644 index 0000000..8679be1 --- /dev/null +++ b/module/courses/view/config/config.css @@ -0,0 +1,19 @@ + +/** + * 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 Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @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/ + */ + +/** NE PAS EFFACER +* admin.css +*/ + diff --git a/module/courses/view/config/config.php b/module/courses/view/config/config.php new file mode 100644 index 0000000..6fa45f7 --- /dev/null +++ b/module/courses/view/config/config.php @@ -0,0 +1,123 @@ + +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), + 'value' => template::ico('left') + ]); ?> +
+
+ +
+
+
+
+
+

+ +

+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'title']) + ]); ?> +
+
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'shortTitle']) + ]); ?> +
+
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'author']) + ]); ?> +
+
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'description']) + ]); ?> +
+
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'access']) + ]); ?> +
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'opening']), + 'help' => 'Affiché si l\'accès est limité dans le temps', + ]); ?> +
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'closing']), + 'help' => 'Affiché si l\'accès est limité dans le temps', + ]); ?> +
+
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'enrolment']) + ]); ?> +
+
+
+
+ 'Texte du lien vers le cours', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'urlText']) + ]); ?> +
+
+
+
+
+
+

+ +

+
+
+ 'Catégorie à afficher', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'category']) + ]); ?> +
+
+
+
+ 'Présentation en colonnes', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout']), + 'help' => 'Chaque cours est présenté dans une colonne' + ]); ?> +
+
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'template']), + 'help' => 'Template bordure de TinyMCE, le titre en évidence' + ]); ?> +
+
+
+
+
+
+ + + +
Version n° + +
\ No newline at end of file diff --git a/module/courses/view/index/index.php b/module/courses/view/index/index.php new file mode 100644 index 0000000..40cd822 --- /dev/null +++ b/module/courses/view/index/index.php @@ -0,0 +1,30 @@ +getData(['course']) as $courseId => $courseValue): ?> + +
+ + + getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?> +
+

+ + + + getData(['module', $this->getUrl(0), 'config', 'title']) === true): ?> + + + + + + + getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?> +

+ + + + + + getData(['module', $this->getUrl(0), 'config', 'template']) === true): ?> +
+ +
+ \ No newline at end of file