ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 136 of file class.ilStudyProgrammeAppEventListener.php.

136 {
137 $obj = self::getStudyProgramme($a_ref_id);
138 $obj->addMissingProgresses();
139 }

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

131 {
132 $obj = self::getStudyProgramme($a_ref_id);
133 $obj->adjustLPMode();
134 }

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

126 {
127 require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
129 }
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 default:
53 throw new ilException("ilStudyProgrammeAppEventListener::handleEvent: "
54 ."Won't handle events of '$a_component'.");
55 }
56 }
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 112 of file class.ilStudyProgrammeAppEventListener.php.

112 {
113 $node_ref_id = $a_parameter["ref_id"];
114 $old_parent_ref_id = $a_parameter["old_parent_ref_id"];
115
116 $node_type = $a_parameter["type"];
117 $old_parent_type = ilObject::_lookupType($old_parent_ref_id, true);
118
119 if ($old_parent_type != "prg") {
120 return;
121 }
122
123 self::adjustProgrammeLPMode($old_parent_ref_id);
124 }
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 66 of file class.ilStudyProgrammeAppEventListener.php.

66 {
67 require_once("./Services/Tracking/classes/class.ilLPStatus.php");
68 if ($a_par["status"] != ilLPStatus::LP_STATUS_COMPLETED_NUM) {
69 return;
70 }
71
72 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
73 ilObjStudyProgramme::setProgressesCompletedFor($a_par["obj_id"], $a_par["usr_id"]);
74 }
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 76 of file class.ilStudyProgrammeAppEventListener.php.

76 {
77 $node_ref_id = $a_parameter["node_id"];
78 $parent_ref_id = $a_parameter["parent_id"];
79
80 $node_type = ilObject::_lookupType($node_ref_id, true);
81 $parent_type = ilObject::_lookupType($parent_ref_id, true);
82
83 if ($node_type == "crsr" && $parent_type == "prg") {
84 self::adjustProgrammeLPMode($parent_ref_id);
85 }
86 if ($node_type == "prg" && $parent_type == "prg") {
87 self::addMissingProgresses($parent_ref_id);
88 }
89 }

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

91 {
92 $node_ref_id = $a_parameter["source_id"];
93 $new_parent_ref_id = $a_parameter["target_id"];
94 $old_parent_ref_id = $a_parameter["old_parent_id"];
95
96 $node_type = ilObject::_lookupType($node_ref_id, true);
97 $new_parent_type = ilObject::_lookupType($new_parent_ref_id, true);
98 $old_parent_type = ilObject::_lookupType($old_parent_ref_id, true);
99
100 if ($node_type != "crsr" || ($new_parent_type != "prg" && $old_parent_type != "prg")) {
101 return;
102 }
103
104 if ($new_parent_type == "prg") {
105 self::adjustProgrammeLPMode($new_parent_ref_id);
106 }
107 else if ($old_parent_type == "prg") {
108 self::adjustProgrammeLPMode($old_parent_ref_id);
109 }
110 }

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

58 {
59 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
60 $assignments = ilStudyProgrammeUserAssignment::getInstancesOfUser($a_parameter["usr_id"]);
61 foreach ($assignments as $ass) {
62 $ass->deassign();
63 }
64 }
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: