diff --git a/core/core.php b/core/core.php index dfbaacc..f09919f 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.4.06'; + const ZWII_VERSION = '1.4.07'; // 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 31d493b..76c0a0a 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -22,6 +22,7 @@ class course extends common 'unsuscribe' => self::GROUP_MEMBER, 'index' => self::GROUP_EDITOR, 'edit' => self::GROUP_EDITOR, + 'manage' => self::GROUP_EDITOR, 'add' => self::GROUP_ADMIN, 'delete' => self::GROUP_ADMIN, 'category' => self::GROUP_ADMIN, @@ -91,35 +92,16 @@ class course extends common : ''; $categorieUrl = helper::baseUrl() . 'course/swap/' . $courseId; $info = sprintf('%s
Auteur : %s
Id : %s
', $this->getData(['course', $courseId, 'title']), $author, $categorieUrl, $courseId); - $access = self::$courseAccess[$this->getData(['course', $courseId, 'access'])]; - $enrolment = self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])]; - $description = sprintf('%s
Accès : %s
Inscription : %s
', $this->getData(['course', $courseId, 'description']), $access, $enrolment); + $enrolment = sprintf('Accès : %s
Inscription : %s
', self::$courseAccess[$this->getData(['course', $courseId, 'access'])], self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])]); self::$courses[] = [ $info, - //$author, - $description, + $this->getData(['course', $courseId, 'description']), + $enrolment, template::button('categoryUser' . $courseId, [ - 'href' => helper::baseUrl() . 'course/users/' . $courseId, - 'value' => template::ico('users'), - 'help' => 'Participants' - ]), - template::button('courseEdit' . $courseId, [ - 'href' => helper::baseUrl() . 'course/edit/' . $courseId, - 'value' => template::ico('pencil'), - 'help' => 'Éditer' - ]), - template::button('courseDownload' . $courseId, [ - 'href' => helper::baseUrl() . 'course/backup/' . $courseId, - 'value' => template::ico('download-cloud'), - 'help' => 'Sauvegarder' - ]), - template::button('courseDelete' . $courseId, [ - 'class' => 'courseDelete buttonRed', - 'href' => helper::baseUrl() . 'course/delete/' . $courseId, - 'value' => template::ico('trash'), - 'help' => 'Supprimer' + 'href' => helper::baseUrl() . 'course/manage/' . $courseId, + 'value' => template::ico('eye'), + 'help' => 'Gérer' ]) - ]; } } @@ -223,7 +205,7 @@ class course extends common } /** - * Edite un contenu + * Edite un espace */ public function edit() { @@ -255,7 +237,7 @@ class course extends common // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . 'course', + 'redirect' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2), 'notification' => helper::translate('Espace modifié'), 'state' => true ]); @@ -291,6 +273,43 @@ class course extends common ]); } + /** + * Affiche un contenu et pointe vers les utilitaires + */ + public function manage() + { + + // Liste des enseignants pour le sélecteur d'auteurs + $teachers = $this->getData(['user']); + foreach ($teachers as $teacherId => $teacherInfo) { + if ($teacherInfo["group"] >= 2) { + self::$courseTeachers[$teacherId] = $teacherInfo["firstname"] . ' ' . $teacherInfo["lastname"]; + } + } + + // Liste des catégories de contenu + self::$courseCategories = $this->getData(['category']); + + // Liste des pages disponibles + $this->initDB('page', $this->getUrl(2)); + self::$pagesList = $this->getData(['page']); + foreach (self::$pagesList as $page => $pageId) { + if ( + $this->getData(['page', $page, 'block']) === 'bar' || + $this->getData(['page', $page, 'disable']) === true + ) { + unset(self::$pagesList[$page]); + } + } + + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Gérer un espace'), + 'view' => 'manage' + ]); + } + + public function delete() { $courseId = $this->getUrl(2); @@ -321,7 +340,7 @@ class course extends common // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . 'course', + 'redirect' => helper::baseUrl() . 'course/manage', 'notification' => $success ? helper::translate('Espace supprimé') : helper::translate('Erreur de suppression'), 'state' => $success ]); @@ -1376,7 +1395,7 @@ class course extends common // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . 'course', + 'redirect' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2), 'state' => $success, 'notification' => $message, ]); diff --git a/core/module/course/view/edit/edit.php b/core/module/course/view/edit/edit.php index e328646..f85c02b 100644 --- a/core/module/course/view/edit/edit.php +++ b/core/module/course/view/edit/edit.php @@ -3,7 +3,7 @@
'buttonGrey', - 'href' => helper::baseUrl() . 'course', + 'href' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2), 'value' => template::ico('left') ]); ?>
diff --git a/core/module/course/view/index/index.js.php b/core/module/course/view/index/index.js.php index 4a80d26..c1e8b33 100644 --- a/core/module/course/view/index/index.js.php +++ b/core/module/course/view/index/index.js.php @@ -12,16 +12,6 @@ */ $(document).ready(function () { - /** - * Confirmation de suppression - */ - $(".courseDelete").on("click", function () { - var _this = $(this); - var message = ""; - return core.confirm(message, function () { - $(location).attr("href", _this.attr("href")); - }); - }); $('#dataTables').DataTable({ language: { url: "core/vendor/datatables/french.json" @@ -32,21 +22,6 @@ $(document).ready(function () { target: 2, orderable: false, searchable: false - }, - { - target: 3, - orderable: false, - searchable: false - }, - { - target: 4, - orderable: false, - searchable: false - }, - { - target: 5, - orderable: false, - searchable: false } ] }); diff --git a/core/module/course/view/index/index.php b/core/module/course/view/index/index.php index 0556b30..85bc779 100644 --- a/core/module/course/view/index/index.php +++ b/core/module/course/view/index/index.php @@ -40,7 +40,7 @@ - 'dataTables']); ?> + 'dataTables']); ?> \ No newline at end of file diff --git a/core/module/course/view/manage/manage.css b/core/module/course/view/manage/manage.css new file mode 100644 index 0000000..ec84629 --- /dev/null +++ b/core/module/course/view/manage/manage.css @@ -0,0 +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/ + */ + + +/** NE PAS EFFACER +* admin.css +*/ \ No newline at end of file diff --git a/core/module/course/view/manage/manage.js.php b/core/module/course/view/manage/manage.js.php new file mode 100644 index 0000000..7fb0cc3 --- /dev/null +++ b/core/module/course/view/manage/manage.js.php @@ -0,0 +1,23 @@ +/** +* 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/ +*/ + +/** + * Confirmation de suppression + */ +$(".courseDelete").on("click", function () { + var _this = $(this); + var message = ""; + return core.confirm(message, function () { + $(location).attr("href", _this.attr("href")); + }); +}); \ No newline at end of file diff --git a/core/module/course/view/manage/manage.php b/core/module/course/view/manage/manage.php new file mode 100644 index 0000000..9fe5c7f --- /dev/null +++ b/core/module/course/view/manage/manage.php @@ -0,0 +1,149 @@ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . 'course', + 'value' => template::ico('left') + ]); ?> +
+ +
+ getUrl(2), [ + 'href' => helper::baseUrl() . 'course/users/' . $this->getUrl(2), + 'value' => template::ico('users'), + 'help' => 'Participants' + ]); ?> +
+
+ getUrl(2), [ + 'href' => helper::baseUrl() . 'course/edit/' . $this->getUrl(2), + 'value' => template::ico('pencil'), + 'help' => 'Éditer' + ]); ?> +
+
+ getUrl(2), [ + 'href' => helper::baseUrl() . 'course/backup/' . $this->getUrl(2), + 'value' => template::ico('download-cloud'), + 'help' => 'Sauvegarder' + ]); ?> +
+
+ getUrl(2), [ + 'class' => 'courseDelete buttonRed', + 'href' => helper::baseUrl() . 'course/delete/' . $this->getUrl(2), + 'value' => template::ico('trash'), + 'help' => 'Supprimer' + ]); ?> +
+
+
+
+

+ +

+
+
+ 'Titre', + 'value' => $this->getdata(['course', $this->getUrl(2), 'title']), + 'readonly' => true, + ]); ?> +
+
+ 'Auteur', + 'value' => $this->getdata(['course', $this->getUrl(2), 'author']), + 'disabled' => true, + ]); ?> +
+
+
+
+ 'Page d\'accueil', + 'selected' => $this->getdata(['course', $this->getUrl(2), 'homePageId']), + 'disabled' => true, + ]); ?> +
+
+ 'Catégorie', + 'selected' => $this->getdata(['course', $this->getUrl(2), 'category']), + 'disabled' => true, + ]); ?> +
+
+
+
+ 'Description', + 'value' => $this->getdata(['course', $this->getUrl(2), 'description']), + 'readonly' => true, + ]); ?> +
+
+
+
+ 'Disponibilité', + 'selected' => $this->getdata(['course', $this->getUrl(2), 'access']), + 'disabled' => true, + ]); ?> +
+
+ 'datetime-local', + 'label' => 'Ouverture', + 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'openingDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'openingDate']) / 60) * 60, + 'readonly' => true, + ]); ?> +
+
+ 'datetime-local', + 'label' => 'Fermeture', + 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'closingDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'closingDate']) / 60) * 60, + ]); ?> +
+
+
+
+
+ 'Participation', + 'selected' => $this->getdata(['course', $this->getUrl(2), 'enrolment']), + 'disabled' => true, + ]); ?> +
+
+
+ 'Clé', + 'value' => $this->getdata(['course', $this->getUrl(2), 'enrolmentKey']), + 'readonly' => true, + ]); ?> +
+
+
+
+ $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']), + 'help' => 'Ne s\'applique pas à l\'inscription anonyme', + 'disabled' => true, + ]); ?> +
+
+ 'datetime-local', + 'label' => 'Fermeture', + 'value' => is_null($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'limitEnrolmentDate']) / 60) * 60, + 'readonly' => true, + ]); ?> +
+
+
+
\ No newline at end of file diff --git a/core/module/course/view/users/users.php b/core/module/course/view/users/users.php index 6e0b736..f9ab55c 100644 --- a/core/module/course/view/users/users.php +++ b/core/module/course/view/users/users.php @@ -2,7 +2,7 @@
'buttonGrey', - 'href' => helper::baseUrl() . 'course', + 'href' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2), 'value' => template::ico('left') ]); ?>