This commit is contained in:
Jun Pataleta 2024-04-17 23:42:22 +08:00
commit 9966241efb
No known key found for this signature in database
GPG key ID: F83510526D99E2C7
35 changed files with 127 additions and 204 deletions

View file

@ -28,7 +28,6 @@ use stdClass;
#[\core\attribute\label('Allows plugins or features to perform actions after the enrolment instance status is changed.')]
#[\core\attribute\tags('enrol')]
class after_enrol_instance_status_updated {
/**
* Constructor for the hook.
*
@ -36,7 +35,9 @@ class after_enrol_instance_status_updated {
* @param int $newstatus The new status.
*/
public function __construct(
/** @var stdClass The enrol instance */
public readonly stdClass $enrolinstance,
/** @var int The new status */
public readonly int $newstatus,
) {
}

View file

@ -28,7 +28,6 @@ use stdClass;
#[\core\attribute\label('Allows plugins or features to perform actions after a user is enrolled in a course.')]
#[\core\attribute\tags('enrol', 'user')]
class after_user_enrolled {
/**
* Constructor for the hook.
*
@ -36,7 +35,9 @@ class after_user_enrolled {
* @param stdClass $userenrolmentinstance The user enrolment instance.
*/
public function __construct(
/** @var stdClass The enrol instance */
public readonly stdClass $enrolinstance,
/** @var stdClass The user enrolment instance */
public readonly stdClass $userenrolmentinstance,
) {
}

View file

@ -27,14 +27,11 @@ use Psr\EventDispatcher\StoppableEventInterface;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
#[\core\attribute\label('Allows plugins or features to perform actions before the enrolment instance is deleted.')]
#[\core\attribute\tags('enrol')]
class before_enrol_instance_delete implements
StoppableEventInterface {
/**
* @var bool Whether the propagation of this event has been stopped.
*/
protected bool $stopped = false;
#[\core\attribute\tags('enrol', 'user')]
class before_enrol_instance_deleted implements
StoppableEventInterface
{
use \core\hook\stoppable_trait;
/**
* Constructor for the hook.
@ -42,18 +39,8 @@ class before_enrol_instance_delete implements
* @param stdClass $enrolinstance The enrol instance.
*/
public function __construct(
/** @var stdClass The enrol instance */
public readonly stdClass $enrolinstance,
) {
}
public function isPropagationStopped(): bool {
return $this->stopped;
}
/**
* Stop the propagation of this event.
*/
public function stop(): void {
$this->stopped = true;
}
}

View file

@ -21,14 +21,13 @@ use stdClass;
/**
* Hook before a user is un-enrolled from a course for an enrolment instance.
*
* @package core
* @package core_enrol
* @copyright 2024 Safat Shahin <safat.shahin@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
#[\core\attribute\label('Allows plugins or features to perform actions before a user enrolment is removed.')]
#[\core\attribute\tags('enrol', 'user')]
class before_user_enrolment_remove {
class before_user_enrolment_removed {
/**
* Constructor for the hook.
*
@ -36,7 +35,9 @@ class before_user_enrolment_remove {
* @param stdClass $userenrolmentinstance The user enrolment instance.
*/
public function __construct(
/** @var stdClass The enrol instance */
public readonly stdClass $enrolinstance,
/** @var stdClass The user enrolment instance */
public readonly stdClass $userenrolmentinstance,
) {
}

View file

@ -27,8 +27,7 @@ use stdClass;
*/
#[\core\attribute\label('Allows plugins or features to perform actions before a user enrolment is updated.')]
#[\core\attribute\tags('enrol', 'user')]
class before_user_enrolment_update {
class before_user_enrolment_updated {
/**
* Constructor for the hook.
*
@ -38,9 +37,13 @@ class before_user_enrolment_update {
* @param bool $timeendmodified Whether the time end of the enrolment has been modified.
*/
public function __construct(
/** @var stdClass The enrol instance */
public readonly stdClass $enrolinstance,
/** @var stdClass The user enrolment instance */
public readonly stdClass $userenrolmentinstance,
/** @var bool Whether the status of the enrolment has been modified */
public readonly bool $statusmodified,
/** @var bool Whether the time end of the enrolment has been modified */
public readonly bool $timeendmodified,
) {
}