From d8b551e8a0f2349762ae5fecf839da6f0d8eae3a Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Fri, 29 Sep 2023 04:49:13 +0200 Subject: [PATCH] =?UTF-8?q?Cat=C3=A9gorie=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 4 +- core/module/course/course.php | 51 +++++++------------ .../enrol.css => category/category.css} | 6 ++- core/module/course/view/category/category.php | 17 +++++++ core/module/course/view/index/index.php | 9 +++- core/module/install/ressource/defaultdata.php | 4 +- 6 files changed, 52 insertions(+), 39 deletions(-) rename core/module/course/view/{enrol/enrol.css => category/category.css} (80%) create mode 100644 core/module/course/view/category/category.php diff --git a/core/core.php b/core/core.php index 0352ebe..abbe82d 100644 --- a/core/core.php +++ b/core/core.php @@ -210,7 +210,7 @@ class common 'language' => '', 'profil' => '', 'enrolment' => '', - 'categorie' => '', + 'category' => '', ]; private $configFiles = [ @@ -225,7 +225,7 @@ class common 'language' => '', 'profil' => '', 'enrolment' => '', - 'categorie' => '', + 'category' => '', ]; private $contentFiles = [ diff --git a/core/module/course/course.php b/core/module/course/course.php index 3e9c8ba..7addb61 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -17,12 +17,14 @@ class course extends common { public static $actions = [ + 'swap' => self::GROUP_VISITOR, + 'enrol' => self::GROUP_VISITOR, 'index' => self::GROUP_ADMIN, 'edit' => self::GROUP_ADMIN, 'add' => self::GROUP_ADMIN, 'delete' => self::GROUP_ADMIN, - 'swap' => self::GROUP_VISITOR, - 'enrol' => self::GROUP_VISITOR, + 'category' => self::GROUP_ADMIN, + 'categoryAdd' => self::GROUP_ADMIN, ]; public static $courseAccess = [ @@ -70,7 +72,7 @@ class course extends common ]; } - //var_dump($this->getCourseHierarchy(1, 1)); + // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Cours'), @@ -137,6 +139,9 @@ class course extends common } } + // Liste des catégories de cours + self::$courseCategories = $this->getData(['category']); + // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Ajouter un cours'), @@ -144,7 +149,6 @@ class course extends common ]); } - /** * Edite un cours */ @@ -189,7 +193,9 @@ class course extends common self::$courseTeachers[$teacherId] = $teacherInfo["firstname"] . ' ' . $teacherInfo["lastname"]; } } - self::$courseCategories = $this->getData(['categorie']); + + // Liste des catégories de cours + self::$courseCategories = $this->getData(['category']); // Valeurs en sortie $this->addOutput([ @@ -230,41 +236,22 @@ class course extends common } - - /* - * Affiche un écran de connexion à un cours + /** + * Liste les catégories d'un cours */ - - public function change() + public function category() { - // Soumission du formulaire - if ( - $this->isPost() || - $this->getUrl(2) === 'home' - - ) { - $this->swap(); - } - - // Bouton de connexion ou d'inscription - // C'est un prof ou un admin - self::$changeMessages = $this->getUser('group') >= self::GROUP_EDITOR - ? 'Se connecter' - // C'est un étudiant ou un visiteur - : ''; - + self::$courseCategories = $this->getData(['category']); + var_dump(self::$courseCategories); // 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, + 'title' => helper::translate('Catégorie'), + 'view' => 'category' ]); - } /* * Traitement du changement de langue - * Fonction utilisée par le noyau */ public function swap() { @@ -319,7 +306,7 @@ class course extends common $state = true; } else { $message = helper::translate('Vous devez disposer d\'un compte pour accéder à ce cours'); - $state = false; + $state = false; } break; diff --git a/core/module/course/view/enrol/enrol.css b/core/module/course/view/category/category.css similarity index 80% rename from core/module/course/view/enrol/enrol.css rename to core/module/course/view/category/category.css index e879c55..ec84629 100644 --- a/core/module/course/view/enrol/enrol.css +++ b/core/module/course/view/category/category.css @@ -1,16 +1,18 @@ /** * 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/ */ - /** @import url("site/data/admin.css"); */ /** NE PAS EFFACER * admin.css -*/ +*/ \ No newline at end of file diff --git a/core/module/course/view/category/category.php b/core/module/course/view/category/category.php new file mode 100644 index 0000000..21daaee --- /dev/null +++ b/core/module/course/view/category/category.php @@ -0,0 +1,17 @@ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(2), + 'value' => template::ico('left') + ]); ?> +
+
+ 'buttonGreen', + 'href' => helper::baseUrl() . 'courseCategoryadd', + 'value' => template::ico('plus') + ]); ?> +
+
+ \ No newline at end of file diff --git a/core/module/course/view/index/index.php b/core/module/course/view/index/index.php index 6cc940d..de38ef2 100644 --- a/core/module/course/view/index/index.php +++ b/core/module/course/view/index/index.php @@ -6,7 +6,14 @@ 'value' => template::ico('left') ]); ?> -
+
+ helper::baseUrl() . 'course/category', + 'value' => template::ico('table'), + 'help' => 'Catégories de cours' + ]); ?> +
+
'buttonGreen', 'href' => helper::baseUrl() . 'course/add', diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index ebb8eea..09416b3 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -669,8 +669,8 @@ class init extends common ], 'course' => [], 'enrolment' => [], - 'categorie' => [ - 'Générale' + 'category' => [ + 'general' => 'Générale' ] ];