forked from ZwiiCMS-Team/ZwiiCampus
Manage Course
This commit is contained in:
parent
104e3d408c
commit
011d435ac5
@ -50,7 +50,7 @@ class common
|
|||||||
const ACCESS_TIMER = 1800;
|
const ACCESS_TIMER = 1800;
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '1.4.06';
|
const ZWII_VERSION = '1.4.07';
|
||||||
|
|
||||||
// URL autoupdate
|
// URL autoupdate
|
||||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
||||||
|
@ -22,6 +22,7 @@ class course extends common
|
|||||||
'unsuscribe' => self::GROUP_MEMBER,
|
'unsuscribe' => self::GROUP_MEMBER,
|
||||||
'index' => self::GROUP_EDITOR,
|
'index' => self::GROUP_EDITOR,
|
||||||
'edit' => self::GROUP_EDITOR,
|
'edit' => self::GROUP_EDITOR,
|
||||||
|
'manage' => self::GROUP_EDITOR,
|
||||||
'add' => self::GROUP_ADMIN,
|
'add' => self::GROUP_ADMIN,
|
||||||
'delete' => self::GROUP_ADMIN,
|
'delete' => self::GROUP_ADMIN,
|
||||||
'category' => self::GROUP_ADMIN,
|
'category' => self::GROUP_ADMIN,
|
||||||
@ -91,35 +92,16 @@ class course extends common
|
|||||||
: '';
|
: '';
|
||||||
$categorieUrl = helper::baseUrl() . 'course/swap/' . $courseId;
|
$categorieUrl = helper::baseUrl() . 'course/swap/' . $courseId;
|
||||||
$info = sprintf('<strong>%s<br /></strong>Auteur : %s<br />Id : <a href="%s" target="_blank">%s<br />', $this->getData(['course', $courseId, 'title']), $author, $categorieUrl, $courseId);
|
$info = sprintf('<strong>%s<br /></strong>Auteur : %s<br />Id : <a href="%s" target="_blank">%s<br />', $this->getData(['course', $courseId, 'title']), $author, $categorieUrl, $courseId);
|
||||||
$access = self::$courseAccess[$this->getData(['course', $courseId, 'access'])];
|
$enrolment = sprintf('Accès : %s<br />Inscription : %s<br />', self::$courseAccess[$this->getData(['course', $courseId, 'access'])], self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])]);
|
||||||
$enrolment = self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])];
|
|
||||||
$description = sprintf('<strong>%s</strong><br />Accès : %s<br />Inscription : %s<br />', $this->getData(['course', $courseId, 'description']), $access, $enrolment);
|
|
||||||
self::$courses[] = [
|
self::$courses[] = [
|
||||||
$info,
|
$info,
|
||||||
//$author,
|
$this->getData(['course', $courseId, 'description']),
|
||||||
$description,
|
$enrolment,
|
||||||
template::button('categoryUser' . $courseId, [
|
template::button('categoryUser' . $courseId, [
|
||||||
'href' => helper::baseUrl() . 'course/users/' . $courseId,
|
'href' => helper::baseUrl() . 'course/manage/' . $courseId,
|
||||||
'value' => template::ico('users'),
|
'value' => template::ico('eye'),
|
||||||
'help' => 'Participants'
|
'help' => 'Gérer'
|
||||||
]),
|
|
||||||
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'
|
|
||||||
])
|
])
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +205,7 @@ class course extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edite un contenu
|
* Edite un espace
|
||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
@ -255,7 +237,7 @@ class course extends common
|
|||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'course',
|
'redirect' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2),
|
||||||
'notification' => helper::translate('Espace modifié'),
|
'notification' => helper::translate('Espace modifié'),
|
||||||
'state' => true
|
'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()
|
public function delete()
|
||||||
{
|
{
|
||||||
$courseId = $this->getUrl(2);
|
$courseId = $this->getUrl(2);
|
||||||
@ -321,7 +340,7 @@ class course extends common
|
|||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'course',
|
'redirect' => helper::baseUrl() . 'course/manage',
|
||||||
'notification' => $success ? helper::translate('Espace supprimé') : helper::translate('Erreur de suppression'),
|
'notification' => $success ? helper::translate('Espace supprimé') : helper::translate('Erreur de suppression'),
|
||||||
'state' => $success
|
'state' => $success
|
||||||
]);
|
]);
|
||||||
@ -1376,7 +1395,7 @@ class course extends common
|
|||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'course',
|
'redirect' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2),
|
||||||
'state' => $success,
|
'state' => $success,
|
||||||
'notification' => $message,
|
'notification' => $message,
|
||||||
]);
|
]);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('courseEditBack', [
|
<?php echo template::button('courseEditBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
'href' => helper::baseUrl() . 'course',
|
'href' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2),
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,16 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
/**
|
|
||||||
* Confirmation de suppression
|
|
||||||
*/
|
|
||||||
$(".courseDelete").on("click", function () {
|
|
||||||
var _this = $(this);
|
|
||||||
var message = "<?php echo helper::translate('Supprimer cet espace et les documents du gestionnaire de fichier ?'); ?>";
|
|
||||||
return core.confirm(message, function () {
|
|
||||||
$(location).attr("href", _this.attr("href"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
$('#dataTables').DataTable({
|
$('#dataTables').DataTable({
|
||||||
language: {
|
language: {
|
||||||
url: "core/vendor/datatables/french.json"
|
url: "core/vendor/datatables/french.json"
|
||||||
@ -32,21 +22,6 @@ $(document).ready(function () {
|
|||||||
target: 2,
|
target: 2,
|
||||||
orderable: false,
|
orderable: false,
|
||||||
searchable: false
|
searchable: false
|
||||||
},
|
|
||||||
{
|
|
||||||
target: 3,
|
|
||||||
orderable: false,
|
|
||||||
searchable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
target: 4,
|
|
||||||
orderable: false,
|
|
||||||
searchable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
target: 5,
|
|
||||||
orderable: false,
|
|
||||||
searchable: false
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($module::$courses): ?>
|
<?php if ($module::$courses): ?>
|
||||||
<?php echo template::table([3, 4, 1, 1, 1, 1], $module::$courses, ['Titre court', 'Description', '', '', '', ''], ['id' => 'dataTables']); ?>
|
<?php echo template::table([4, 4, 3, 1 ], $module::$courses, ['Titre court', 'Description', 'Inscription', '',], ['id' => 'dataTables']); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Aucun espace'); ?>
|
<?php echo template::speech('Aucun espace'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
18
core/module/course/view/manage/manage.css
Normal file
18
core/module/course/view/manage/manage.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
|
||||||
|
*/
|
23
core/module/course/view/manage/manage.js.php
Normal file
23
core/module/course/view/manage/manage.js.php
Normal file
@ -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 <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/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirmation de suppression
|
||||||
|
*/
|
||||||
|
$(".courseDelete").on("click", function () {
|
||||||
|
var _this = $(this);
|
||||||
|
var message = "<?php echo helper::translate('Supprimer cet espace et les documents du gestionnaire de fichier ?'); ?>";
|
||||||
|
return core.confirm(message, function () {
|
||||||
|
$(location).attr("href", _this.attr("href"));
|
||||||
|
});
|
||||||
|
});
|
149
core/module/course/view/manage/manage.php
Normal file
149
core/module/course/view/manage/manage.php
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col1">
|
||||||
|
<?php echo template::button('courseManageBack', [
|
||||||
|
'class' => 'buttonGrey',
|
||||||
|
'href' => helper::baseUrl() . 'course',
|
||||||
|
'value' => template::ico('left')
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col1 offset7">
|
||||||
|
<?php echo template::button('categoryUser' . $this->getUrl(2), [
|
||||||
|
'href' => helper::baseUrl() . 'course/users/' . $this->getUrl(2),
|
||||||
|
'value' => template::ico('users'),
|
||||||
|
'help' => 'Participants'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col1">
|
||||||
|
<?php echo
|
||||||
|
template::button('courseManageEdit' . $this->getUrl(2), [
|
||||||
|
'href' => helper::baseUrl() . 'course/edit/' . $this->getUrl(2),
|
||||||
|
'value' => template::ico('pencil'),
|
||||||
|
'help' => 'Éditer'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col1">
|
||||||
|
<?php echo
|
||||||
|
template::button('courseManageDownload' . $this->getUrl(2), [
|
||||||
|
'href' => helper::baseUrl() . 'course/backup/' . $this->getUrl(2),
|
||||||
|
'value' => template::ico('download-cloud'),
|
||||||
|
'help' => 'Sauvegarder'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col1 ">
|
||||||
|
<?php echo
|
||||||
|
template::button('courseManageDelete' . $this->getUrl(2), [
|
||||||
|
'class' => 'courseDelete buttonRed',
|
||||||
|
'href' => helper::baseUrl() . 'course/delete/' . $this->getUrl(2),
|
||||||
|
'value' => template::ico('trash'),
|
||||||
|
'help' => 'Supprimer'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<div class="block">
|
||||||
|
<h4>
|
||||||
|
<?php echo helper::translate('Paramètres'); ?>
|
||||||
|
</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col7">
|
||||||
|
<?php echo template::text('courseManageShortTitle', [
|
||||||
|
'label' => 'Titre',
|
||||||
|
'value' => $this->getdata(['course', $this->getUrl(2), 'title']),
|
||||||
|
'readonly' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col5">
|
||||||
|
<?php echo template::select('courseManageAuthor', $module::$courseTeachers, [
|
||||||
|
'label' => 'Auteur',
|
||||||
|
'value' => $this->getdata(['course', $this->getUrl(2), 'author']),
|
||||||
|
'disabled' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col6">
|
||||||
|
<?php echo template::select('courseManageHomePageId', helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC'), [
|
||||||
|
'label' => 'Page d\'accueil',
|
||||||
|
'selected' => $this->getdata(['course', $this->getUrl(2), 'homePageId']),
|
||||||
|
'disabled' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col6">
|
||||||
|
<?php echo template::select('courseManageCategorie', $module::$courseCategories, [
|
||||||
|
'label' => 'Catégorie',
|
||||||
|
'selected' => $this->getdata(['course', $this->getUrl(2), 'category']),
|
||||||
|
'disabled' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<?php echo template::textarea('courseManageDescription', [
|
||||||
|
'label' => 'Description',
|
||||||
|
'value' => $this->getdata(['course', $this->getUrl(2), 'description']),
|
||||||
|
'readonly' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('courseManageAccess', $module::$courseAccess, [
|
||||||
|
'label' => 'Disponibilité',
|
||||||
|
'selected' => $this->getdata(['course', $this->getUrl(2), 'access']),
|
||||||
|
'disabled' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::date('courseOpeningDate', [
|
||||||
|
'type' => '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,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::date('courseClosingDate', [
|
||||||
|
'type' => 'datetime-local',
|
||||||
|
'label' => 'Fermeture',
|
||||||
|
'value' => is_null($this->getdata(['course', $this->getUrl(2), 'closingDate'])) ? '' : floor($this->getdata(['course', $this->getUrl(2), 'closingDate']) / 60) * 60,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('courseManageEnrolment', $module::$courseEnrolment, [
|
||||||
|
'label' => 'Participation',
|
||||||
|
'selected' => $this->getdata(['course', $this->getUrl(2), 'enrolment']),
|
||||||
|
'disabled' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::text('courseManageEnrolmentKey', [
|
||||||
|
'label' => 'Clé',
|
||||||
|
'value' => $this->getdata(['course', $this->getUrl(2), 'enrolmentKey']),
|
||||||
|
'readonly' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::checkbox('courseManageEnrolmentLimit', true, 'Date de fin d\'inscription', [
|
||||||
|
'checked' => $this->getdata(['course', $this->getUrl(2), 'limitEnrolment']),
|
||||||
|
'help' => 'Ne s\'applique pas à l\'inscription anonyme',
|
||||||
|
'disabled' => true,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::date('courseManageEnrolmentLimitDate', [
|
||||||
|
'type' => '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,
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -2,7 +2,7 @@
|
|||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('courseUserBack', [
|
<?php echo template::button('courseUserBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
'href' => helper::baseUrl() . 'course',
|
'href' => helper::baseUrl() . 'course/manage/' . $this->getUrl(2),
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user