Course delete all enrolled

This commit is contained in:
Fred Tempez 2023-10-08 14:46:44 +02:00
parent 67a78a46be
commit 9c4556586c
3 changed files with 53 additions and 10 deletions

View File

@ -29,6 +29,7 @@ class course extends common
'user' => self::GROUP_ADMIN,
'userAdd' => self::GROUP_ADMIN,
'userDelete' => self::GROUP_ADMIN,
'userDeleteAll' => self::GROUP_ADMIN,
];
public static $courseAccess = [
@ -430,6 +431,30 @@ class course extends common
}
}
/**
* Désinscription de tous les utilisateurs
*/
public function userDeleteAll()
{
// Accès refusé
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
$this->setData(['enrolment', $this->getUrl(2), array()]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'course/user/' . $this->getUrl(2),
'notification' => helper::translate('Cours réinitialisé'),
'state' => true
]);
}
}
/*
* Traitement du changement de langue
*/

View File

@ -10,4 +10,15 @@
* @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")) })) }));
(".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"))
}))
}));
(".userDeleteAll").on("click", (function() {
var _this = $(this);
return message = "<?php echo helper::translate('Confirmer la désinscription de tous les utilisateur');?>", core.confirm(message, (function() {
$(location).attr("href", _this.attr("href"))
}))
}));

View File

@ -6,14 +6,21 @@
'value' => template::ico('left')
]); ?>
</div>
<div class="col1 offset10">
<div class="col2 offset9">
<?php echo template::button('userDeleteAll', [
'class' => 'userDeleteAll buttonRed',
'href' => helper::baseUrl() . 'course/userDeleteAll/' . $this->getUrl(2),
'value' => helper::translate('Réinitialiser'),
'help' => 'Désinscrire tous les utilisateurs'
])
?>
</div>
<?php /*echo template::button('courseUserAdd', [
'class' => 'buttonGreen',
'href' => helper::baseUrl() . 'course/userAdd',
'value' => template::ico('plus')
]); */?>
</div>
</div>
<?php if ($module::$courseUsers): ?>
<?php echo template::table([2, 3, 3, 3, 1], $module::$courseUsers, ['Id', 'Nom Prénom', 'Id dernière page', 'Date - Heure', '']); ?>