ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStudyProgrammeAppEventListener Class Reference

Event listener for study programs. More...

+ Collaboration diagram for ilStudyProgrammeAppEventListener:

Static Public Member Functions

static handleEvent (string $component, string $event, array $parameter)
 

Static Private Member Functions

static onServiceUserDeleteUser (array $parameter)
 
static onServiceTrackingUpdateStatus (array $parameter)
 
static onServiceTreeInsertNode (array $parameter)
 
static onServiceTreeMoveTree (array $parameter)
 
static onServiceObjectDeleteOrToTrash (array $parameter)
 
static getStudyProgramme (int $ref_id)
 
static adjustProgrammeLPMode (int $ref_id)
 
static addMissingProgresses (int $ref_id)
 
static addCrsToProgrammes (int $crs_ref_id, int $cat_ref_id)
 
static removeCrsFromProgrammes (int $crs_ref_id, int $cat_ref_id)
 
static addMemberToProgrammes (string $src_type, array $params)
 
static removeMemberFromProgrammes (string $src_type, array $params)
 

Detailed Description

Event listener for study programs.

Has the following tasks:

  • Remove all assignments of a user on all study programms when the user is removed.
  • Add/Remove courses to/from study programms, if upper category is under surveillance
Author
Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de

Definition at line 32 of file class.ilStudyProgrammeAppEventListener.php.

Member Function Documentation

◆ addCrsToProgrammes()

static ilStudyProgrammeAppEventListener::addCrsToProgrammes ( int  $crs_ref_id,
int  $cat_ref_id 
)
staticprivate

Definition at line 279 of file class.ilStudyProgrammeAppEventListener.php.

279 : void
280 {
281 ilObjStudyProgramme::addCrsToProgrammes($crs_ref_id, $cat_ref_id);
282 }
static addCrsToProgrammes(int $crs_ref_id, int $cat_ref_id)
Check, if a category is under surveilllance and automatically add the course.

References ilObjStudyProgramme\addCrsToProgrammes().

Referenced by onServiceTreeInsertNode(), and onServiceTreeMoveTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMemberToProgrammes()

static ilStudyProgrammeAppEventListener::addMemberToProgrammes ( string  $src_type,
array  $params 
)
staticprivate

Definition at line 289 of file class.ilStudyProgrammeAppEventListener.php.

289 : void
290 {
291 $usr_id = $params['usr_id'];
292 $id = $params['obj_id'];
293 if (
296 ) {
298 $id = array_shift($ref_ids);
299 }
301 $id = $params['role_id'];
302 }
303
305 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static addMemberToProgrammes(string $src_type, int $src_id, int $usr_id)
static _getAllReferences(int $id)
get all reference ids for object ID
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31

References $id, $params, ilObject\_getAllReferences(), ilObjStudyProgramme\addMemberToProgrammes(), ilStudyProgrammeAutoMembershipSource\TYPE_COURSE, ilStudyProgrammeAutoMembershipSource\TYPE_GROUP, and ilStudyProgrammeAutoMembershipSource\TYPE_ROLE.

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMissingProgresses()

static ilStudyProgrammeAppEventListener::addMissingProgresses ( int  $ref_id)
staticprivate

Definition at line 273 of file class.ilStudyProgrammeAppEventListener.php.

273 : void
274 {
276 $obj->addMissingProgresses();
277 }
$ref_id
Definition: ltiauth.php:66

References $ref_id, and getStudyProgramme().

Referenced by onServiceTreeInsertNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustProgrammeLPMode()

static ilStudyProgrammeAppEventListener::adjustProgrammeLPMode ( int  $ref_id)
staticprivate

Definition at line 267 of file class.ilStudyProgrammeAppEventListener.php.

267 : void
268 {
270 $obj->adjustLPMode();
271 }

References $ref_id, and getStudyProgramme().

Referenced by onServiceObjectDeleteOrToTrash(), onServiceTreeInsertNode(), and onServiceTreeMoveTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStudyProgramme()

static ilStudyProgrammeAppEventListener::getStudyProgramme ( int  $ref_id)
staticprivate

Definition at line 262 of file class.ilStudyProgrammeAppEventListener.php.

References $ref_id, and ilObjStudyProgramme\getInstanceByRefId().

Referenced by addMissingProgresses(), and adjustProgrammeLPMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleEvent()

static ilStudyProgrammeAppEventListener::handleEvent ( string  $component,
string  $event,
array  $parameter 
)
static
Exceptions
ilException

Definition at line 37 of file class.ilStudyProgrammeAppEventListener.php.

37 : void
38 {
39 global $DIC;
40
41 switch ($component) {
42 case "components/ILIAS/User":
43 switch ($event) {
44 case "deleteUser":
46 break;
47 }
48 break;
49 case "components/ILIAS/Tracking":
50 switch ($event) {
51 case "updateStatus":
53 break;
54 }
55 break;
56 case "components/ILIAS/Tree":
57 switch ($event) {
58 case "insertNode":
60 break;
61 case "moveTree":
63 break;
64 }
65 break;
66 case "components/ILIAS/ILIASObject":
67 switch ($event) {
68 case "delete":
69 case "toTrash":
71 break;
72 }
73 break;
74 case "components/ILIAS/ContainerReference":
75 switch ($event) {
76 case "deleteReference":
78 break;
79 }
80 break;
81
82 case "components/ILIAS/Course":
83 switch ($event) {
84 case "addParticipant":
87 $parameter
88 );
89 break;
90 case "deleteParticipant":
93 $parameter
94 );
95 break;
96 }
97 break;
98 case "components/ILIAS/Group":
99 switch ($event) {
100 case "addParticipant":
103 $parameter
104 );
105 break;
106 case "deleteParticipant":
109 $parameter
110 );
111 break;
112 }
113 break;
114 case "components/ILIAS/AccessControl":
115 switch ($event) {
116 case "assignUser":
119 $parameter
120 );
121 break;
122 case "deassignUser":
125 $parameter
126 );
127 break;
128 }
129 break;
130 case "components/ILIAS/OrgUnit":
131 switch ($event) {
132 case "assignUserToPosition":
135 $parameter
136 );
137 break;
138 case "deassignUserFromPosition":
141 $parameter
142 );
143 break;
144 }
145 break;
146
147 case 'components/ILIAS/StudyProgramme':
148 switch ($event) {
149 case 'userSuccessful':
150 try {
151 $DIC->certificate()->userCertificates()->certificateCriteriaMet(
152 (int) $parameter['usr_id'],
153 (int) $parameter['prg_id']
154 );
156 }
157 break;
158 }
159 break;
160
161 default:
162 throw new ilException(
163 "ilStudyProgrammeAppEventListener::handleEvent: Won't handle events of '$component'."
164 );
165 }
166 }
Base class for ILIAS Exception handling.
static removeMemberFromProgrammes(string $src_type, array $params)
static addMemberToProgrammes(string $src_type, array $params)
global $DIC
Definition: shib_login.php:26

References $DIC, Vendor\Package\$e, addMemberToProgrammes(), onServiceObjectDeleteOrToTrash(), onServiceTrackingUpdateStatus(), onServiceTreeInsertNode(), onServiceTreeMoveTree(), onServiceUserDeleteUser(), removeMemberFromProgrammes(), ilStudyProgrammeAutoMembershipSource\TYPE_COURSE, ilStudyProgrammeAutoMembershipSource\TYPE_GROUP, ilStudyProgrammeAutoMembershipSource\TYPE_ORGU, and ilStudyProgrammeAutoMembershipSource\TYPE_ROLE.

+ Here is the call graph for this function:

◆ onServiceObjectDeleteOrToTrash()

static ilStudyProgrammeAppEventListener::onServiceObjectDeleteOrToTrash ( array  $parameter)
staticprivate

Definition at line 249 of file class.ilStudyProgrammeAppEventListener.php.

249 : void
250 {
251 $old_parent_ref_id = (int) $parameter["old_parent_ref_id"];
252
253 $old_parent_type = ilObject::_lookupType($old_parent_ref_id, true);
254
255 if ($old_parent_type !== "prg") {
256 return;
257 }
258
259 self::adjustProgrammeLPMode($old_parent_ref_id);
260 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType(), adjustProgrammeLPMode(), and ILIAS\Repository\int().

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onServiceTrackingUpdateStatus()

static ilStudyProgrammeAppEventListener::onServiceTrackingUpdateStatus ( array  $parameter)
staticprivate

Definition at line 178 of file class.ilStudyProgrammeAppEventListener.php.

178 : void
179 {
180 if ((int) $parameter["status"] !== ilLPStatus::LP_STATUS_COMPLETED_NUM) {
181 return;
182 }
183
184 $crs_reference_obj_ids = ilContainerReference::_lookupSourceIds((int) $parameter["obj_id"]);
185 foreach ($crs_reference_obj_ids as $crsr_obj_id) {
186 foreach (ilObject::_getAllReferences($crsr_obj_id) as $crsr_ref_id) {
188 $crsr_ref_id,
189 (int) $parameter["obj_id"],
190 (int) $parameter["usr_id"]
191 );
192 }
193 }
194 }
static _lookupSourceIds(int $a_target_id)
Get ids of all container references that target the object with the given id.
const LP_STATUS_COMPLETED_NUM
static setProgressesCompletedIfParentIsProgrammeInLPCompletedMode(int $ref_id, int $obj_id, int $user_id)

References ilObject\_getAllReferences(), ilContainerReference\_lookupSourceIds(), ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilObjStudyProgramme\setProgressesCompletedIfParentIsProgrammeInLPCompletedMode().

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onServiceTreeInsertNode()

static ilStudyProgrammeAppEventListener::onServiceTreeInsertNode ( array  $parameter)
staticprivate

Definition at line 196 of file class.ilStudyProgrammeAppEventListener.php.

196 : void
197 {
198 $node_ref_id = (int) $parameter["node_id"];
199 $parent_ref_id = (int) $parameter["parent_id"];
200
201 $node_type = ilObject::_lookupType($node_ref_id, true);
202 $parent_type = ilObject::_lookupType($parent_ref_id, true);
203
204 if ($node_type === "crsr" && $parent_type === "prg") {
205 self::adjustProgrammeLPMode($parent_ref_id);
206 }
207 if ($parent_type === "prg" && in_array($node_type, ["prg", "prgr"])) {
208 self::addMissingProgresses($parent_ref_id);
209 }
210 if ($node_type === "crs" && $parent_type === "cat") {
211 self::addCrsToProgrammes($node_ref_id, $parent_ref_id);
212 }
213 }
static addCrsToProgrammes(int $crs_ref_id, int $cat_ref_id)

References ilObject\_lookupType(), addCrsToProgrammes(), addMissingProgresses(), adjustProgrammeLPMode(), and ILIAS\Repository\int().

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onServiceTreeMoveTree()

static ilStudyProgrammeAppEventListener::onServiceTreeMoveTree ( array  $parameter)
staticprivate

Definition at line 215 of file class.ilStudyProgrammeAppEventListener.php.

215 : void
216 {
217 $node_ref_id = (int) $parameter["source_id"];
218 $new_parent_ref_id = (int) $parameter["target_id"];
219 $old_parent_ref_id = (int) $parameter["old_parent_id"];
220
221 $node_type = ilObject::_lookupType($node_ref_id, true);
222 $new_parent_type = ilObject::_lookupType($new_parent_ref_id, true);
223 $old_parent_type = ilObject::_lookupType($old_parent_ref_id, true);
224
225 if (!in_array($node_type, ["crsr","crs"])
226 || (
227 ($new_parent_type !== "prg" && $old_parent_type !== "prg")
228 &&
229 $old_parent_type !== "cat"
230 )
231 ) {
232 return;
233 }
234
235 if ($node_type === 'crs') {
236 self::removeCrsFromProgrammes($node_ref_id, $old_parent_ref_id);
237 if ($new_parent_type === 'cat') {
238 self::addCrsToProgrammes($node_ref_id, $new_parent_ref_id);
239 }
240 }
241
242 if ($new_parent_type === "prg") {
243 self::adjustProgrammeLPMode($new_parent_ref_id);
244 } elseif ($old_parent_type === "prg") {
245 self::adjustProgrammeLPMode($old_parent_ref_id);
246 }
247 }
static removeCrsFromProgrammes(int $crs_ref_id, int $cat_ref_id)

References ilObject\_lookupType(), addCrsToProgrammes(), adjustProgrammeLPMode(), ILIAS\Repository\int(), and removeCrsFromProgrammes().

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onServiceUserDeleteUser()

static ilStudyProgrammeAppEventListener::onServiceUserDeleteUser ( array  $parameter)
staticprivate

Definition at line 168 of file class.ilStudyProgrammeAppEventListener.php.

168 : void
169 {
170 $repo = ilStudyProgrammeDIC::dic()['repo.assignment'];
171 $assignments = $repo->getForUser((int) $parameter["usr_id"]);
172
173 foreach ($assignments as $ass) {
174 $repo->delete($ass);
175 }
176 }

References ilStudyProgrammeDIC\dic().

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeCrsFromProgrammes()

static ilStudyProgrammeAppEventListener::removeCrsFromProgrammes ( int  $crs_ref_id,
int  $cat_ref_id 
)
staticprivate

Definition at line 284 of file class.ilStudyProgrammeAppEventListener.php.

284 : void
285 {
286 ilObjStudyProgramme::removeCrsFromProgrammes($crs_ref_id, $cat_ref_id);
287 }
static removeCrsFromProgrammes(int $crs_ref_id, int $cat_ref_id)
Check, if a category is under surveillance and automatically remove the deleted course.

References ilObjStudyProgramme\removeCrsFromProgrammes().

Referenced by onServiceTreeMoveTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeMemberFromProgrammes()

static ilStudyProgrammeAppEventListener::removeMemberFromProgrammes ( string  $src_type,
array  $params 
)
staticprivate

Definition at line 307 of file class.ilStudyProgrammeAppEventListener.php.

307 : void
308 {
309 $usr_id = $params['usr_id'];
310 $id = $params['obj_id'];
311 if (
314 ) {
316 $id = array_shift($ref_ids);
317 }
319 $id = $params['role_id'];
320 }
321
322 ilObjStudyProgramme::removeMemberFromProgrammes($src_type, $id, (int) $usr_id);
323 }
static removeMemberFromProgrammes(string $src_type, int $src_id, int $usr_id)

References $id, $params, ilObject\_getAllReferences(), ilObjStudyProgramme\removeMemberFromProgrammes(), ilStudyProgrammeAutoMembershipSource\TYPE_COURSE, ilStudyProgrammeAutoMembershipSource\TYPE_GROUP, and ilStudyProgrammeAutoMembershipSource\TYPE_ROLE.

Referenced by handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: