Création d'un cours
This commit is contained in:
parent
2ba4437ecf
commit
65b39f116f
@ -197,6 +197,7 @@ class common
|
||||
'blacklist' => '',
|
||||
'config' => '',
|
||||
'core' => '',
|
||||
'course' => '',
|
||||
'font' => '',
|
||||
'module' => '',
|
||||
'page' => '',
|
||||
@ -210,6 +211,7 @@ class common
|
||||
'admin' => '',
|
||||
'blacklist' => '',
|
||||
'config' => '',
|
||||
'course' => '',
|
||||
'core' => '',
|
||||
'font' => '',
|
||||
'theme' => '',
|
||||
|
@ -13,17 +13,81 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class dashboard extends common
|
||||
class course extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_TEACHER,
|
||||
'add' => self::GROUP_ADMIN,
|
||||
];
|
||||
|
||||
public static $courseAccess = [
|
||||
0 => 'Ouvert',
|
||||
1 => 'Période d\'ouverture',
|
||||
2 => 'Fermé',
|
||||
];
|
||||
|
||||
public static $courseEnrolment = [
|
||||
0 => 'Anonyme',
|
||||
1 => 'Auto-inscrition',
|
||||
2 => 'Auto-inscription avec clé',
|
||||
3 => 'Manuelle'
|
||||
];
|
||||
|
||||
public static $courseTeachers = [];
|
||||
|
||||
public function index()
|
||||
{
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => helper::translate('Cours'),
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'course',
|
||||
uniqid(),
|
||||
[
|
||||
'title' => $this->getInput('courseAddTitle',helper::FILTER_STRING_SHORT, true),
|
||||
'mentor' => $this->getInput('courseAddMentor'),
|
||||
'description' => $this->getInput('courseAddDescription', helper::FILTER_STRING_SHORT, true),
|
||||
'access' => $this->getInput('courseAddAccess'),
|
||||
'openingDate' => $this->getInput('courseOpeningDate', helper::FILTER_DATETIME),
|
||||
'closingDate' => $this->getInput('courseClosingDate', helper::FILTER_DATETIME),
|
||||
'enrolment' => $this->getInput('courseAddEnrolment'),
|
||||
'enrolmentKey' => $this->getInput('courseAddEnrolmentKey'),
|
||||
]
|
||||
]);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'course',
|
||||
'notification' => helper::translate('Cours créé'),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
$teachers = $this->getData(['user']);
|
||||
foreach ($teachers as $teacherId => $teacherInfo) {
|
||||
if ( $teacherInfo["group"] >= 2 ) {
|
||||
self::$courseTeachers[$teacherId] = $teacherInfo["firstname"] . ' ' . $teacherInfo["lastname"];
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => helper::translate('Ajouter un cours'),
|
||||
'view' => 'add'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
18
core/module/course/view/add/add.css
Normal file
18
core/module/course/view/add/add.css
Normal file
@ -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 <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @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
|
||||
*/
|
72
core/module/course/view/add/add.php
Normal file
72
core/module/course/view/add/add.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php echo template::formOpen('courseAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('courseAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'course',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('courseAddSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo helper::translate('Paramètres'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col8">
|
||||
<?php echo template::text('courseAddTitle', [
|
||||
'label' => 'Titre'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('courseAddAccess', $module::$courseTeachers, [
|
||||
'label' => 'Mentor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('courseAddDescription', [
|
||||
'label' => 'Description'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('courseAddAccess', $module::$courseAccess, [
|
||||
'label' => 'Accès'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('courseOpeningDate', [
|
||||
'type' => 'date',
|
||||
'label' => 'Ouverture',
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('courseClosingDate', [
|
||||
'type' => 'date',
|
||||
'label' => 'Fermeture',
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('courseAddEnrolment', $module::$courseEnrolment, [
|
||||
'label' => 'Inscription'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('courseAddEnrolmentKey', [
|
||||
'label' => 'Clé'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
18
core/module/course/view/index/index.css
Normal file
18
core/module/course/view/index/index.css
Normal file
@ -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 <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @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
|
||||
*/
|
16
core/module/course/view/index/index.php
Normal file
16
core/module/course/view/index/index.php
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('courseModulesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(2),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset10">
|
||||
<?php echo template::button('courseModulesAdd', [
|
||||
'class' => 'buttonGreen',
|
||||
'href' => helper::baseUrl() . 'course/add',
|
||||
'value' => template::ico('plus')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
@ -666,7 +666,8 @@ class init extends common
|
||||
'permanent' => true,
|
||||
'comment' => 'Contrôle total',
|
||||
]
|
||||
]
|
||||
],
|
||||
'course' => []
|
||||
];
|
||||
public static $siteTemplate = [
|
||||
'page' => [
|
||||
@ -877,9 +878,6 @@ class init extends common
|
||||
]
|
||||
]
|
||||
],
|
||||
'course' => [],
|
||||
'enrolment' => [],
|
||||
|
||||
];
|
||||
|
||||
public static $siteContent = [
|
||||
|
15
notes.txt
15
notes.txt
@ -5,16 +5,21 @@ userid, page, TS début, TS fin
|
||||
course/course.json
|
||||
BDD contenant les informations sur le cours
|
||||
- courseId identifiant du cours
|
||||
- title
|
||||
- mentor enseignant responsable
|
||||
- description
|
||||
- access
|
||||
- 0 le cours est ouvert
|
||||
- 1 le cours est fermé
|
||||
- 2 le cours est ouvert entre les dates
|
||||
- 1 le cours est ouvert entre les dates
|
||||
- 2 le cours est fermé
|
||||
|
||||
- openingDate
|
||||
- closingDate
|
||||
- enrolment
|
||||
- 0 l'accès est libre
|
||||
- 1 l'accès s'effectue avec une clé d'inscription
|
||||
- 2 l'accès se fait avec inscription par un enseignant
|
||||
- 0 accès est anonyme
|
||||
- 1 accès libre
|
||||
- 2 accès avec clé
|
||||
- 3 manuel, le prof inscrits
|
||||
- enrolmentKey clé d'inscription, si non vide
|
||||
|
||||
course/enrolment.json
|
||||
|
Loading…
Reference in New Issue
Block a user