New suppression de catégorie
This commit is contained in:
parent
b4fafd6891
commit
e7129e3c66
@ -25,6 +25,8 @@ class course extends common
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'category' => self::GROUP_ADMIN,
|
||||
'categoryAdd' => self::GROUP_ADMIN,
|
||||
'categoryDelete' => self::GROUP_ADMIN,
|
||||
'user' => self::GROUP_ADMIN,
|
||||
];
|
||||
|
||||
public static $courseAccess = [
|
||||
@ -278,13 +280,13 @@ class course extends common
|
||||
self::$courseCategories[] = [
|
||||
$categoryId,
|
||||
$categoryTitle,
|
||||
template::button('courseEdit' . $categoryId, [
|
||||
template::button('categoryEdit' . $categoryId, [
|
||||
'href' => helper::baseUrl() . 'course/categoryEdit/' . $categoryId,
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Éditer'
|
||||
]),
|
||||
template::button('courseDelete' . $categoryId, [
|
||||
'class' => 'courseDelete buttonRed',
|
||||
'class' => 'categoryDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'course/categoryDelete/' . $categoryId,
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer'
|
||||
@ -298,6 +300,57 @@ class course extends common
|
||||
]);
|
||||
}
|
||||
|
||||
public function categoryAdd()
|
||||
{
|
||||
|
||||
// Soumission du formulaire
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$categoryId = $this->getInput('categoryAddTitle', helper::FILTER_ID, true);
|
||||
$this->setData([
|
||||
'category',
|
||||
$categoryId,
|
||||
$this->getInput('categoryAddTitle', helper::FILTER_STRING_SHORT, true)
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'course/category',
|
||||
'notification' => helper::translate('Catégorie créée'),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => helper::translate('Ajouter une catégorie'),
|
||||
'view' => 'categoryAdd'
|
||||
]);
|
||||
}
|
||||
|
||||
public function categoryDelete()
|
||||
{
|
||||
|
||||
$categories = helper::arrayColumn($this->getData(['course']), 'category', 'SORT_ASC');
|
||||
$courseId = $this->getUrl(2);
|
||||
$message = helper::translate('Une catégorie affectée ne peut pas être effacée');
|
||||
$state = false;
|
||||
if (in_array($courseId, $categories) === false) {
|
||||
$this->deleteData(['category', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$message = helper::translate('Catégorie effacée');
|
||||
$state = true;
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'course/category',
|
||||
'notification' => $message,
|
||||
'state' => $state
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langue
|
||||
*/
|
||||
|
25
core/module/course/view/category/category.js.php
Normal file
25
core/module/course/view/category/category.js.php
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".categoryDelete").on("click", function () {
|
||||
var _this = $(this);
|
||||
var message = "<?php echo helper::translate('Supprimer cette catégorie ?'); ?>";
|
||||
return core.confirm(message, function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
});
|
@ -9,7 +9,7 @@
|
||||
<div class="col1 offset10">
|
||||
<?php echo template::button('courseCategoryModulesAdd', [
|
||||
'class' => 'buttonGreen',
|
||||
'href' => helper::baseUrl() . 'courseCategoryadd',
|
||||
'href' => helper::baseUrl() . 'course/categoryAdd',
|
||||
'value' => template::ico('plus')
|
||||
]); ?>
|
||||
</div>
|
||||
|
18
core/module/course/view/categoryAdd/categoryAdd.css
Normal file
18
core/module/course/view/categoryAdd/categoryAdd.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
|
||||
*/
|
29
core/module/course/view/categoryAdd/categoryAdd.php
Normal file
29
core/module/course/view/categoryAdd/categoryAdd.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php echo template::formOpen('categoryAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('categoryAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'course/category',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('categoryAddSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>
|
||||
<?php echo helper::translate('Paramètres'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('categoryAddTitle', [
|
||||
'label' => 'Nom de la catégorie'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,20 +1,27 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('courseModulesBack', [
|
||||
<?php echo template::button('courseBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(2),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset9">
|
||||
<?php echo template::button('courseGroup', [
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('courseUser', [
|
||||
'href' => helper::baseUrl() . 'course/user',
|
||||
'value' => template::ico('users'),
|
||||
'help' => 'Etudiants inscrits'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('courseCategory', [
|
||||
'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('courseAdd', [
|
||||
'class' => 'buttonGreen',
|
||||
'href' => helper::baseUrl() . 'course/add',
|
||||
'value' => template::ico('plus')
|
||||
|
18
core/module/course/view/user/user.css
Normal file
18
core/module/course/view/user/user.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
|
||||
*/
|
0
core/module/course/view/user/user.php
Normal file
0
core/module/course/view/user/user.php
Normal file
Loading…
Reference in New Issue
Block a user