Catégorie WIP

This commit is contained in:
Fred Tempez 2023-09-29 04:49:13 +02:00
parent e3286aee8e
commit d8b551e8a0
6 changed files with 52 additions and 39 deletions

View File

@ -210,7 +210,7 @@ class common
'language' => '', 'language' => '',
'profil' => '', 'profil' => '',
'enrolment' => '', 'enrolment' => '',
'categorie' => '', 'category' => '',
]; ];
private $configFiles = [ private $configFiles = [
@ -225,7 +225,7 @@ class common
'language' => '', 'language' => '',
'profil' => '', 'profil' => '',
'enrolment' => '', 'enrolment' => '',
'categorie' => '', 'category' => '',
]; ];
private $contentFiles = [ private $contentFiles = [

View File

@ -17,12 +17,14 @@ class course extends common
{ {
public static $actions = [ public static $actions = [
'swap' => self::GROUP_VISITOR,
'enrol' => self::GROUP_VISITOR,
'index' => self::GROUP_ADMIN, 'index' => self::GROUP_ADMIN,
'edit' => self::GROUP_ADMIN, 'edit' => self::GROUP_ADMIN,
'add' => self::GROUP_ADMIN, 'add' => self::GROUP_ADMIN,
'delete' => self::GROUP_ADMIN, 'delete' => self::GROUP_ADMIN,
'swap' => self::GROUP_VISITOR, 'category' => self::GROUP_ADMIN,
'enrol' => self::GROUP_VISITOR, 'categoryAdd' => self::GROUP_ADMIN,
]; ];
public static $courseAccess = [ public static $courseAccess = [
@ -70,7 +72,7 @@ class course extends common
]; ];
} }
//var_dump($this->getCourseHierarchy(1, 1));
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => helper::translate('Cours'), '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 // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => helper::translate('Ajouter un cours'), 'title' => helper::translate('Ajouter un cours'),
@ -144,7 +149,6 @@ class course extends common
]); ]);
} }
/** /**
* Edite un cours * Edite un cours
*/ */
@ -189,7 +193,9 @@ class course extends common
self::$courseTeachers[$teacherId] = $teacherInfo["firstname"] . ' ' . $teacherInfo["lastname"]; 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 // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -230,41 +236,22 @@ class course extends common
} }
/**
/* * Liste les catégories d'un cours
* Affiche un écran de connexion à un cours
*/ */
public function category()
public function change()
{ {
// Soumission du formulaire self::$courseCategories = $this->getData(['category']);
if ( var_dump(self::$courseCategories);
$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
: '';
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle'])), 'title' => helper::translate('Catégorie'),
'view' => 'change', 'view' => 'category'
'display' => self::DISPLAY_LAYOUT_LIGHT,
]); ]);
} }
/* /*
* Traitement du changement de langue * Traitement du changement de langue
* Fonction utilisée par le noyau
*/ */
public function swap() public function swap()
{ {
@ -319,7 +306,7 @@ class course extends common
$state = true; $state = true;
} else { } else {
$message = helper::translate('Vous devez disposer d\'un compte pour accéder à ce cours'); $message = helper::translate('Vous devez disposer d\'un compte pour accéder à ce cours');
$state = false; $state = false;
} }
break; break;

View File

@ -1,16 +1,18 @@
/** /**
* This file is part of Zwii. * This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE * For full copyright and license information, please see the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
* *
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com> * @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez * @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/ * @link http://zwiicms.fr/
*/ */
/** @import url("site/data/admin.css"); */
/** NE PAS EFFACER /** NE PAS EFFACER
* admin.css * admin.css
*/ */

View File

@ -0,0 +1,17 @@
<div class="row">
<div class="col1">
<?php echo template::button('courseCategoryModulesBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(2),
'value' => template::ico('left')
]); ?>
</div>
<div class="col1 offset10">
<?php echo template::button('courseCategoryModulesAdd', [
'class' => 'buttonGreen',
'href' => helper::baseUrl() . 'courseCategoryadd',
'value' => template::ico('plus')
]); ?>
</div>
</div>
<?php echo template::table([12], $module::$courseCategories, ['Titre']); ?>

View File

@ -6,7 +6,14 @@
'value' => template::ico('left') 'value' => template::ico('left')
]); ?> ]); ?>
</div> </div>
<div class="col1 offset10"> <div class="col1 offset9">
<?php echo template::button('courseGroup', [
'href' => helper::baseUrl() . 'course/category',
'value' => template::ico('table'),
'help' => 'Catégories de cours'
]); ?>
</div>
<div class="col1 ">
<?php echo template::button('courseModulesAdd', [ <?php echo template::button('courseModulesAdd', [
'class' => 'buttonGreen', 'class' => 'buttonGreen',
'href' => helper::baseUrl() . 'course/add', 'href' => helper::baseUrl() . 'course/add',

View File

@ -669,8 +669,8 @@ class init extends common
], ],
'course' => [], 'course' => [],
'enrolment' => [], 'enrolment' => [],
'categorie' => [ 'category' => [
'Générale' 'general' => 'Générale'
] ]
]; ];