ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilStudyProgrammeAppEventListener Class Reference

Event listener for study programs. More...

+ Collaboration diagram for ilStudyProgrammeAppEventListener:

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_parameter)
 

Static Private Member Functions

static onServiceUserDeleteUser ($a_parameter)
 
static onServiceTrackingUpdateStatus ($a_par)
 
static onServiceTreeInsertNode ($a_parameter)
 
static onServiceTreeMoveTree ($a_parameter)
 
static onServiceObjectDeleteOrToTrash ($a_parameter)
 
static getStudyProgramme ($a_ref_id)
 
static adjustProgrammeLPMode ($a_ref_id)
 
static addMissingProgresses ($a_ref_id)
 

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.
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 15 of file class.ilStudyProgrammeAppEventListener.php.

Member Function Documentation

◆ addMissingProgresses()

static ilStudyProgrammeAppEventListener::addMissingProgresses (   $a_ref_id)
staticprivate

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

150 {
151 $obj = self::getStudyProgramme($a_ref_id);
152 $obj->addMissingProgresses();
153 }

References getStudyProgramme().

Referenced by onServiceTreeInsertNode().

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

◆ adjustProgrammeLPMode()

static ilStudyProgrammeAppEventListener::adjustProgrammeLPMode (   $a_ref_id)
staticprivate

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

144 {
145 $obj = self::getStudyProgramme($a_ref_id);
146 $obj->adjustLPMode();
147 }

References 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 (   $a_ref_id)
staticprivate

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

138 {
139 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
141 }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.

References 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 (   $a_component,
  $a_event,
  $a_parameter 
)
static

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

18 {
19 switch ($a_component) {
20 case "Services/User":
21 switch ($a_event) {
22 case "deleteUser":
24 break;
25 }
26 break;
27 case "Services/Tracking":
28 switch ($a_event) {
29 case "updateStatus":
31 break;
32 }
33 break;
34 case "Services/Tree":
35 switch ($a_event) {
36 case "insertNode":
38 break;
39 case "moveTree":
40 self::onServiceTreeMoveTree($a_parameter);
41 break;
42 }
43 break;
44 case "Services/Object":
45 switch ($a_event) {
46 case "delete":
47 case "toTrash":
49 break;
50 }
51 break;
52 case "Services/ContainerReference":
53 switch ($a_event) {
54 case "deleteReference":
56 break;
57 }
58 break;
59 default:
60 throw new ilException("ilStudyProgrammeAppEventListener::handleEvent: "
61 . "Won't handle events of '$a_component'.");
62 }
63 }
Base class for ILIAS Exception handling.

References onServiceObjectDeleteOrToTrash(), onServiceTrackingUpdateStatus(), onServiceTreeInsertNode(), onServiceTreeMoveTree(), and onServiceUserDeleteUser().

+ Here is the call graph for this function:

◆ onServiceObjectDeleteOrToTrash()

static ilStudyProgrammeAppEventListener::onServiceObjectDeleteOrToTrash (   $a_parameter)
staticprivate

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

123 {
124 $node_ref_id = $a_parameter["ref_id"];
125 $old_parent_ref_id = $a_parameter["old_parent_ref_id"];
126
127 $node_type = $a_parameter["type"];
128 $old_parent_type = ilObject::_lookupType($old_parent_ref_id, true);
129
130 if ($old_parent_type != "prg") {
131 return;
132 }
133
134 self::adjustProgrammeLPMode($old_parent_ref_id);
135 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject\_lookupType(), and adjustProgrammeLPMode().

Referenced by handleEvent().

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

◆ onServiceTrackingUpdateStatus()

static ilStudyProgrammeAppEventListener::onServiceTrackingUpdateStatus (   $a_par)
staticprivate

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

75 {
76 require_once("./Services/Tracking/classes/class.ilLPStatus.php");
77 if ($a_par["status"] != ilLPStatus::LP_STATUS_COMPLETED_NUM) {
78 return;
79 }
80
81 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
82 ilObjStudyProgramme::setProgressesCompletedFor($a_par["obj_id"], $a_par["usr_id"]);
83 }
const LP_STATUS_COMPLETED_NUM
static setProgressesCompletedFor($a_obj_id, $a_user_id)
Set all progresses to completed where the object with given id is a leaf and that belong to the user.

References ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilObjStudyProgramme\setProgressesCompletedFor().

Referenced by handleEvent().

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

◆ onServiceTreeInsertNode()

static ilStudyProgrammeAppEventListener::onServiceTreeInsertNode (   $a_parameter)
staticprivate

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

86 {
87 $node_ref_id = $a_parameter["node_id"];
88 $parent_ref_id = $a_parameter["parent_id"];
89
90 $node_type = ilObject::_lookupType($node_ref_id, true);
91 $parent_type = ilObject::_lookupType($parent_ref_id, true);
92
93 if ($node_type == "crsr" && $parent_type == "prg") {
94 self::adjustProgrammeLPMode($parent_ref_id);
95 }
96 if ($node_type == "prg" && $parent_type == "prg") {
97 self::addMissingProgresses($parent_ref_id);
98 }
99 }

References ilObject\_lookupType(), addMissingProgresses(), and adjustProgrammeLPMode().

Referenced by handleEvent().

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

◆ onServiceTreeMoveTree()

static ilStudyProgrammeAppEventListener::onServiceTreeMoveTree (   $a_parameter)
staticprivate

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

102 {
103 $node_ref_id = $a_parameter["source_id"];
104 $new_parent_ref_id = $a_parameter["target_id"];
105 $old_parent_ref_id = $a_parameter["old_parent_id"];
106
107 $node_type = ilObject::_lookupType($node_ref_id, true);
108 $new_parent_type = ilObject::_lookupType($new_parent_ref_id, true);
109 $old_parent_type = ilObject::_lookupType($old_parent_ref_id, true);
110
111 if ($node_type != "crsr" || ($new_parent_type != "prg" && $old_parent_type != "prg")) {
112 return;
113 }
114
115 if ($new_parent_type == "prg") {
116 self::adjustProgrammeLPMode($new_parent_ref_id);
117 } elseif ($old_parent_type == "prg") {
118 self::adjustProgrammeLPMode($old_parent_ref_id);
119 }
120 }

References ilObject\_lookupType(), and adjustProgrammeLPMode().

Referenced by handleEvent().

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

◆ onServiceUserDeleteUser()

static ilStudyProgrammeAppEventListener::onServiceUserDeleteUser (   $a_parameter)
staticprivate

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

66 {
67 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
68 $assignments = ilStudyProgrammeUserAssignment::getInstancesOfUser($a_parameter["usr_id"]);
69 foreach ($assignments as $ass) {
70 $ass->deassign();
71 }
72 }
static getInstancesOfUser($a_user_id)
Get all instances for a given user.

References ilStudyProgrammeUserAssignment\getInstancesOfUser().

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: