Skip to content

Commit

Permalink
PRG: raise event 'userReAssigned'
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen authored and klees committed Dec 6, 2024
1 parent 32e2593 commit 6db1ce9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@

class ilStudyProgrammeEvents implements StudyProgrammeEvents
{
public const PUBLIC_EVENTS = [
self::EVENT_USER_ASSIGNED,
self::EVENT_USER_DEASSIGNED,
self::EVENT_USER_REASSIGNED,
];
/*
self::EVENT_USER_SUCCESSFUL,
self::EVENT_USER_NOT_SUCCESSFUL,
self::EVENT_VALIDITY_CHANGE,
self::EVENT_SCORE_CHANGE
will all trigger self::EVENT_USER_SUCCESSFUL on ilAppEventHandler,
but only once! and for root-prg only.
This prevents e.g. certificate to rebuild on every (sucessive) change
*/

public function __construct(
protected ilLogger $logger,
protected ilAppEventHandler $app_event_handler,
Expand Down Expand Up @@ -80,20 +96,16 @@ public function raise(string $event, array $parameter): void
if ($event === self::EVENT_USER_REASSIGNED) {
$this->prg_event_handler->sendReAssignedMail($parameter['ass_id'], $parameter['root_prg_id']);
}

if (in_array($event, [
self::EVENT_USER_ASSIGNED,
self::EVENT_USER_DEASSIGNED
])) {
$this->app_event_handler->raise(self::COMPONENT, $event, $parameter);
}

if ($event === self::EVENT_VALIDITY_CHANGE) {
$this->prg_event_handler->resetMailFlagValidity($parameter['ass_id'], $parameter['root_prg_id']);
}
if ($event === self::EVENT_DEADLINE_CHANGE) {
$this->prg_event_handler->resetMailFlagDeadline($parameter['ass_id'], $parameter['root_prg_id']);
}

if (in_array($event, self::PUBLIC_EVENTS)) {
$this->app_event_handler->raise(self::COMPONENT, $event, $parameter);
}
}

public function userAssigned(ilPRGAssignment $assignment): void
Expand Down
1 change: 1 addition & 0 deletions Modules/StudyProgramme/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

<event type="raise" id="userAssigned" />
<event type="raise" id="userDeassigned" />
<event type="raise" id="userReAssigned" />
<event type="raise" id="userSuccessful" />
</events>
<crons>
Expand Down

0 comments on commit 6db1ce9

Please sign in to comment.