forked from ZwiiCMS-Team/ZwiiCampus
v26 désinscription
This commit is contained in:
parent
d76b0295df
commit
b85327491d
@ -50,7 +50,7 @@ class common
|
||||
const ACCESS_TIMER = 1800;
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_VERSION = '1.0.25';
|
||||
const ZWII_VERSION = '1.0.26';
|
||||
|
||||
// URL autoupdate
|
||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/';
|
||||
|
@ -28,6 +28,7 @@ class course extends common
|
||||
'categoryDelete' => self::GROUP_ADMIN,
|
||||
'user' => self::GROUP_ADMIN,
|
||||
'userAdd' => self::GROUP_ADMIN,
|
||||
'userDelete' => self::GROUP_ADMIN,
|
||||
];
|
||||
|
||||
public static $courseAccess = [
|
||||
@ -340,6 +341,15 @@ class course extends common
|
||||
public function categoryDelete()
|
||||
{
|
||||
|
||||
// Accès refusé
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} else {
|
||||
$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');
|
||||
@ -359,6 +369,8 @@ class course extends common
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
$users = $this->getData(['enrolment', $this->getUrl(2)]);
|
||||
@ -369,11 +381,11 @@ class course extends common
|
||||
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
$userValue['lastPageId'],
|
||||
helper::dateUTF8('%d %B %Y - %H:%M', $userValue['dateVisit']),
|
||||
template::button('courseDelete' . $userId, [
|
||||
'class' => 'categoryDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'course/userDelete/' . $userId,
|
||||
'value' => template::ico('trash'),
|
||||
'help' => 'Supprimer'
|
||||
template::button('userDelete' . $userId, [
|
||||
'class' => 'userDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'course/userDelete/'. $this->getUrl(2) . '/' . $userId,
|
||||
'value' => template::ico('minus'),
|
||||
'help' => 'Désinscrire'
|
||||
])
|
||||
];
|
||||
}
|
||||
@ -394,6 +406,30 @@ class course extends common
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Désinscription d'un utilisateur
|
||||
*/
|
||||
public function userDelete()
|
||||
{
|
||||
// Accès refusé
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
} else {
|
||||
$this->deleteData(['enrolment', $this->getUrl(2), $this->getUrl(3)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'course/user/' . $this->getUrl(2),
|
||||
'notification' => sprintf(helper::translate('%s est désinscrit'), $this->getUrl(3)),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langue
|
||||
*/
|
||||
|
13
core/module/course/view/user/user.js.php
Normal file
13
core/module/course/view/user/user.js.php
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
$(".userDelete").on("click", (function () { var _this = $(this); return message = "<?php echo helper::translate('Confirmer la désinscription de cet utilisateur');?>", core.confirm(message, (function () { $(location).attr("href", _this.attr("href")) })) }));
|
@ -7,11 +7,11 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset10">
|
||||
<?php echo template::button('courseUserAdd', [
|
||||
<?php /*echo template::button('courseUserAdd', [
|
||||
'class' => 'buttonGreen',
|
||||
'href' => helper::baseUrl() . 'course/userAdd',
|
||||
'value' => template::ico('plus')
|
||||
]); ?>
|
||||
]); */?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user