Désinscription okay

This commit is contained in:
Fred Tempez 2023-10-19 22:53:00 +02:00
parent 851f6421d6
commit a39024fe92

View File

@ -19,6 +19,7 @@ class course extends common
public static $actions = [
'swap' => self::GROUP_VISITOR,
'suscribe' => self::GROUP_VISITOR,
'unsuscribe' => self::GROUP_VISITOR,
'index' => self::GROUP_ADMIN,
'edit' => self::GROUP_ADMIN,
'add' => self::GROUP_ADMIN,
@ -770,6 +771,20 @@ class course extends common
}
}
public function unsuscribe()
{
$courseId = $this->getUrl(2);
$userId = $this->getUser('id');
$this->deleteData(['enrolment', $courseId, $userId]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl(),
'notification' => helper::translate('Désinscription'),
'state' => true,
]);
}
/**
* Autorise l'accès à un cours