diff --git a/core/core.php b/core/core.php index 5ff19a4..0352ebe 100644 --- a/core/core.php +++ b/core/core.php @@ -210,6 +210,7 @@ class common 'language' => '', 'profil' => '', 'enrolment' => '', + 'categorie' => '', ]; private $configFiles = [ @@ -224,6 +225,7 @@ class common 'language' => '', 'profil' => '', 'enrolment' => '', + 'categorie' => '', ]; private $contentFiles = [ diff --git a/core/module/course/course.php b/core/module/course/course.php index 207cfac..3e9c8ba 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -40,6 +40,8 @@ class course extends common public static $courseTeachers = []; + public static $courseCategories = []; + public static $courses = []; public static $swapMessage = []; @@ -142,38 +144,7 @@ class course extends common ]); } - public function delete() - { - - if ( - $this->getUser('permission', __CLASS__, __FUNCTION__) !== true || - // Le cours n'existe pas - $this->getData(['course', $this->getUrl(2)]) === null - // Groupe insuffisant - and ($this->getUrl('group') < self::GROUP_EDITOR) - ) { - // Valeurs en sortie - $this->addOutput([ - 'access' => false - ]); - // Suppression - } else { - $this->deleteData(['course', $this->getUrl(2)]); - $this->deleteData(['enrolment', $this->getUrl(2)]); - if (is_dir(self::DATA_DIR . $this->getUrl(2))) { - $this->deleteDir(self::DATA_DIR . $this->getUrl(2)); - } - - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . 'course', - 'notification' => helper::translate('Cours supprimé'), - 'state' => true - ]); - } - - } - + /** * Edite un cours */ @@ -218,6 +189,7 @@ class course extends common self::$courseTeachers[$teacherId] = $teacherInfo["firstname"] . ' ' . $teacherInfo["lastname"]; } } + self::$courseCategories = $this->getData(['categorie']); // Valeurs en sortie $this->addOutput([ @@ -226,6 +198,39 @@ class course extends common ]); } + public function delete() + { + + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) !== true || + // Le cours n'existe pas + $this->getData(['course', $this->getUrl(2)]) === null + // Groupe insuffisant + and ($this->getUrl('group') < self::GROUP_EDITOR) + ) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + // Suppression + } else { + $this->deleteData(['course', $this->getUrl(2)]); + $this->deleteData(['enrolment', $this->getUrl(2)]); + if (is_dir(self::DATA_DIR . $this->getUrl(2))) { + $this->deleteDir(self::DATA_DIR . $this->getUrl(2)); + } + + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . 'course', + 'notification' => helper::translate('Cours supprimé'), + 'state' => true + ]); + } + + } + + /* * Affiche un écran de connexion à un cours */ diff --git a/core/module/course/view/add/add.php b/core/module/course/view/add/add.php index dcc42c5..58dd73b 100644 --- a/core/module/course/view/add/add.php +++ b/core/module/course/view/add/add.php @@ -36,6 +36,14 @@ ]); ?> +