ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilStudyProgrammeEvents.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4/* Copyright (c) 2019 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
5
6declare(strict_types=1);
7
9{
10 const COMPONENT = "Modules/StudyProgramme";
11
16
21
22 public function __construct(
25 ) {
26 $this->app_event_handler = $app_event_handler;
27 $this->assignment_repo = $assignment_repo;
28 }
29
30 public function raise($a_event, $a_parameter) : void
31 {
32 $this->app_event_handler->raise(self::COMPONENT, $a_event, $a_parameter);
33 }
34
38 public function userAssigned(ilStudyProgrammeAssignment $a_assignment) : void
39 {
40 $this->raise(
41 "userAssigned",
42 [
43 "root_prg_id" => $a_assignment->getRootId(),
44 "usr_id" => $a_assignment->getUserId(),
45 "ass_id" => $a_assignment->getId()
46 ]
47 );
48 }
49
53 public function userReAssigned(ilStudyProgrammeAssignment $a_assignment) : void
54 {
55 $this->raise(
56 "userReAssigned",
57 [
58 "root_prg_ref_id" => (int) ilObjStudyProgramme::getRefIdFor($a_assignment->getRootId()),
59 "usr_id" => (int) $a_assignment->getUserId()
60 ]
61 );
62 }
63
67 public function userDeassigned(ilStudyProgrammeAssignment $a_assignment) : void
68 {
69 $this->raise(
70 "userDeassigned",
71 [
72 "root_prg_id" => $a_assignment->getRootId(),
73 "usr_id" => $a_assignment->getUserId(),
74 "ass_id" => $a_assignment->getId()
75 ]
76 );
77 }
78
82 public function userSuccessful(ilStudyProgrammeProgress $a_progress) : void
83 {
84 $ass = $this->assignment_repo->get($a_progress->getAssignmentId());
85 $this->raise(
86 "userSuccessful",
87 [
88 "root_prg_id" => $ass->getRootId(),
89 "prg_id" => $a_progress->getNodeId(),
90 "usr_id" => $ass->getUserId(),
91 "ass_id" => $ass->getId()
92 ]
93 );
94 }
95
96 public function informUserByMailToRestart(ilStudyProgrammeProgress $progress) : void
97 {
98 $this->raise(
99 'informUserToRestart',
100 [
101 "usr_id" => (int) $progress->getUserId(),
102 "progress_id" => (int) $progress->getId(),
103 "ass_id" => (int) $progress->getAssignmentId()
104 ]
105 );
106 }
107
108 public function userRiskyToFail(ilStudyProgrammeProgress $progress) : void
109 {
110 $this->raise(
111 "userRiskyToFail",
112 [
113 "progress_id" => $progress->getId(),
114 "usr_id" => $progress->getUserId()
115 ]
116 );
117 }
118}
An exception for terminatinating execution or to throw for unit testing.
Global event handler.
static getRefIdFor(int $obj_id)
Represents one assignment of the user to a program tree.
userAssigned(ilStudyProgrammeAssignment $a_assignment)
informUserByMailToRestart(ilStudyProgrammeProgress $progress)
userReAssigned(ilStudyProgrammeAssignment $a_assignment)
__construct(\ilAppEventHandler $app_event_handler, \ilStudyProgrammeAssignmentRepository $assignment_repo)
userSuccessful(ilStudyProgrammeProgress $a_progress)
userDeassigned(ilStudyProgrammeAssignment $a_assignment)
userRiskyToFail(ilStudyProgrammeProgress $progress)
Class ilStudyProgrammeProgress.
getId()
Get the id of the progress.
getAssignmentId()
Get the assignment this progress belongs to.
getUserId()
Get the id of the user this progress is for.
getNodeId()
Get the obj_id of the program node this progress belongs to.