v70 Edition de catégorie

This commit is contained in:
Fred Tempez 2023-11-08 18:06:33 +01:00
parent 98a08b0362
commit a8d2acd17c
5 changed files with 81 additions and 4 deletions

View File

@ -50,7 +50,7 @@ class common
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '1.0.69';
const ZWII_VERSION = '1.0.70';
// URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';

View File

@ -26,6 +26,7 @@ class course extends common
'delete' => self::GROUP_ADMIN,
'category' => self::GROUP_ADMIN,
'categoryAdd' => self::GROUP_ADMIN,
'categoryEdit' => self::GROUP_ADMIN,
'categoryDelete' => self::GROUP_ADMIN,
'user' => self::GROUP_ADMIN,
'userAdd' => self::GROUP_ADMIN,
@ -312,13 +313,11 @@ class course extends common
self::$courseCategories[] = [
$categoryId,
$categoryTitle,
/**
template::button('categoryEdit' . $categoryId, [
'href' => helper::baseUrl() . 'course/categoryEdit/' . $categoryId,
'value' => template::ico('pencil'),
'help' => 'Éditer'
]),
*/
template::button('courseDelete' . $categoryId, [
'class' => 'categoryDelete buttonRed',
'href' => helper::baseUrl() . 'course/categoryDelete/' . $categoryId,
@ -363,6 +362,35 @@ class course extends common
]);
}
public function categoryEdit()
{
// Soumission du formulaire
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
$this->isPost()
) {
$categoryId = $this->getUrl(2);
$this->setData([
'category',
$categoryId,
$this->getInput('categoryEditTitle', helper::FILTER_STRING_SHORT, true)
]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'course/category',
'notification' => helper::translate('Catégorie éditée'),
'state' => true
]);
}
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Éditer une catégorie'),
'view' => 'categoryEdit'
]);
}
public function categoryDelete()
{

View File

@ -16,7 +16,7 @@
</div>
<?php if($module::$courseCategories): ?>
<?php echo template::table([5,6,1], $module::$courseCategories, ['Id', 'Titre', '']); ?>
<?php echo template::table([5,5,1,1], $module::$courseCategories, ['Id', 'Titre', '','']); ?>
<?php else: ?>
<?php echo template::speech('Aucune catégorie'); ?>
<?php endif; ?>

View 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
*/

View File

@ -0,0 +1,31 @@
<?php echo template::formOpen('categoryEditForm'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('categoryEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'course/category',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('categoryEditSubmit'); ?>
</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('categoryEditTitle', [
'label' => 'Nom de la catégorie',
'value' => $this->getData(['category',$this->getUrl(2)])
]); ?>
</div>
</div>
</div>
</div>
</div>