ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCourseAppEventListener Class Reference

Course Pool listener. More...

+ Collaboration diagram for ilCourseAppEventListener:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getLogger ()
 

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_parameter)
 Handle an event in a listener. More...
 
static setBlockedForLP ($a_status)
 Toggle LP blocking property status. More...
 

Protected Member Functions

 handleUserAssignments ($a_event, $a_parameters)
 handle user assignments More...
 

Static Protected Member Functions

static doAutoFill ($a_obj_id)
 Trigger autofill from waiting list. More...
 

Static Protected Attributes

static $course_mode = array()
 
static $blocked_for_lp
 

Private Attributes

 $logger = null
 

Detailed Description

Course Pool listener.

Listens to events of other components.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 12 of file class.ilCourseAppEventListener.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseAppEventListener::__construct ( )

Constructor.

Definition at line 22 of file class.ilCourseAppEventListener.php.

23 {
24 $this->logger = ilLoggerFactory::getInstance()->getLogger('crs');
25
26 }

References ilLoggerFactory\getInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ doAutoFill()

static ilCourseAppEventListener::doAutoFill (   $a_obj_id)
staticprotected

Trigger autofill from waiting list.

Parameters
int$a_obj_id

Definition at line 82 of file class.ilCourseAppEventListener.php.

83 {
84 // #16694
85 include_once("./Modules/Course/classes/class.ilObjCourse.php");
86 $ref_id = array_pop(ilObject::_getAllReferences($a_obj_id));
87 $course = new ilObjCourse($ref_id);
88 $course->handleAutoFill();
89 }
Class ilObjCourse.
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39

References $ref_id, and ilObject\_getAllReferences().

Referenced by handleUserAssignments().

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

◆ getLogger()

ilCourseAppEventListener::getLogger ( )
Returns
ilLogger

Definition at line 31 of file class.ilCourseAppEventListener.php.

References $logger.

Referenced by handleUserAssignments().

+ Here is the caller graph for this function:

◆ handleEvent()

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

Handle an event in a listener.

Parameters
string$a_componentcomponent, e.g. "Modules/Forum" or "Services/User"
string$a_eventevent e.g. "createUser", "updateUser", "deleteUser", ...
array$a_parameterparameter array (assoc), array("name" => ..., "phone_office" => ...)

Definition at line 98 of file class.ilCourseAppEventListener.php.

99 {
100 if($a_component == 'Services/AccessControl')
101 {
102 $listener = new self();
103 $listener->handleUserAssignments($a_event, $a_parameter);
104 }
105
106 if($a_component == "Services/Tracking" && $a_event == "updateStatus")
107 {
108 // see ilObjCourseGUI::updateLPFromStatus()
109 if((bool)self::$blocked_for_lp)
110 {
111 return;
112 }
113
114 // #13905
115 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
117 {
118 return;
119 }
120
121 $obj_id = $a_parameter["obj_id"];
122 $user_id = $a_parameter["usr_id"];
123 $status = $a_parameter["status"];
124
125 if($obj_id && $user_id)
126 {
127 if (ilObject::_lookupType($obj_id) != "crs")
128 {
129 return;
130 }
131
132 // determine couse setting only once
133 if(!isset(self::$course_mode[$obj_id]))
134 {
135 include_once("./Modules/Course/classes/class.ilObjCourse.php");
136 $crs = new ilObjCourse($obj_id, false);
137 if($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
138 {
139 include_once './Services/Object/classes/class.ilObjectLP.php';
140 $olp = ilObjectLP::getInstance($obj_id);
141 $mode = $olp->getCurrentMode();
142 }
143 else
144 {
145 $mode = false;
146 }
147 self::$course_mode[$obj_id] = $mode;
148 }
149
150 $is_completed = ($status == ilLPStatus::LP_STATUS_COMPLETED_NUM);
151
152 // we are NOT using the members object because of performance issues
153 switch(self::$course_mode[$obj_id])
154 {
156 // #11600
157 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
158 ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, true);
159 break;
160
163 // overwrites course passed status if it was set automatically (full sync)
164 // or toggle manually set passed status to completed (1-way-sync)
165 $do_update = $is_completed;
166 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
167 if(!$do_update)
168 {
169 $part = new ilCourseParticipants($obj_id);
170 $passed = $part->getPassedInfo($user_id);
171 if(!is_array($passed) ||
172 $passed["user_id"] == -1)
173 {
174 $do_update = true;
175 }
176 }
177 if($do_update)
178 {
179 ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed);
180 }
181 break;
182 }
183 }
184 }
185 }
static _updatePassed($a_obj_id, $a_usr_id, $a_passed, $a_manual=false, $a_no_origin=false)
Update passed status (static)
const LP_STATUS_COMPLETED_NUM
const STATUS_DETERMINATION_LP
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getInstance($a_obj_id)
static _lookupType($a_id, $a_reference=false)
lookup object type

References $blocked_for_lp, ilObjUserTracking\_enabledLearningProgress(), ilObject\_lookupType(), ilCourseParticipants\_updatePassed(), ilObjectLP\getInstance(), ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPObjSettings\LP_MODE_OBJECTIVES, ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilObjCourse\STATUS_DETERMINATION_LP.

+ Here is the call graph for this function:

◆ handleUserAssignments()

ilCourseAppEventListener::handleUserAssignments (   $a_event,
  $a_parameters 
)
protected

handle user assignments

Parameters
type$a_event
type$a_parameters

Definition at line 41 of file class.ilCourseAppEventListener.php.

42 {
43 if($a_parameters['type'] != 'crs')
44 {
45 $this->getLogger()->debug('Ignoring event for type '. $a_parameters['type']);
46 return TRUE;
47 }
48
49 if($a_event == 'assignUser')
50 {
51 $this->getLogger()->debug('Handling assign user event for type crs.');
52 $new_status = 1;
53 }
54 elseif($a_event == 'deassignUser')
55 {
56 $this->getLogger()->debug('Handling assign user event for type crs.');
57 $new_status = 0;
58 }
59
60 ilLoggerFactory::getInstance()->getLogger('crs')->debug(print_r($a_parameters,TRUE));
61 ilLoggerFactory::getInstance()->getLogger('crs')->debug(print_r($new_status,TRUE));
62
63 include_once './Modules/Course/classes/class.ilCourseParticipant.php';
65 $a_parameters['obj_id'],
66 $a_parameters['usr_id'],
67 $a_parameters['role_id'],
68 $new_status
69 );
70
71 if($a_event == 'deassignUser')
72 {
73 self::doAutoFill($a_parameters['obj_id']);
74 }
75 }
static doAutoFill($a_obj_id)
Trigger autofill from waiting list.
static updateMemberRoles($a_obj_id, $a_usr_id, $a_role_id, $a_status)
Update member roles @global ilDB $ilDB.

References doAutoFill(), ilLoggerFactory\getInstance(), getLogger(), and ilParticipant\updateMemberRoles().

+ Here is the call graph for this function:

◆ setBlockedForLP()

static ilCourseAppEventListener::setBlockedForLP (   $a_status)
static

Toggle LP blocking property status.

Parameters
bool$a_status

Definition at line 192 of file class.ilCourseAppEventListener.php.

193 {
194 self::$blocked_for_lp = (bool)$a_status;
195 }

Referenced by ilObjCourseGUI\updateLPFromStatus().

+ Here is the caller graph for this function:

Field Documentation

◆ $blocked_for_lp

ilCourseAppEventListener::$blocked_for_lp
staticprotected

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

Referenced by handleEvent().

◆ $course_mode

ilCourseAppEventListener::$course_mode = array()
staticprotected

Definition at line 16 of file class.ilCourseAppEventListener.php.

◆ $logger

ilCourseAppEventListener::$logger = null
private

Definition at line 14 of file class.ilCourseAppEventListener.php.

Referenced by getLogger().


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