ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseAppEventListener Class Reference

Course Pool listener. More...

+ Collaboration diagram for ilCourseAppEventListener:

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_parameter)
 Handle an event in a listener. More...
 

Static Protected Attributes

static $course_mode = array()
 

Detailed Description

Course Pool listener.

Listens to events of other components.

Author
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 11 of file class.ilCourseAppEventListener.php.

Member Function Documentation

◆ 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 22 of file class.ilCourseAppEventListener.php.

References $ilUser, 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.

23  {
24  global $ilUser;
25 
26  if($a_component == "Services/Tracking" && $a_event == "updateStatus")
27  {
28  // #13905
29  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
31  {
32  return;
33  }
34 
35  $obj_id = $a_parameter["obj_id"];
36  $user_id = $a_parameter["usr_id"];
37  $status = $a_parameter["status"];
38 
39  if($obj_id && $user_id)
40  {
41  if (ilObject::_lookupType($obj_id) != "crs")
42  {
43  return;
44  }
45 
46  // determine couse setting only once
47  if(!isset(self::$course_mode[$obj_id]))
48  {
49  include_once("./Modules/Course/classes/class.ilObjCourse.php");
50  $crs = new ilObjCourse($obj_id, false);
51  if($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
52  {
53  include_once './Services/Object/classes/class.ilObjectLP.php';
54  $olp = ilObjectLP::getInstance($obj_id);
55  $mode = $olp->getCurrentMode();
56  }
57  else
58  {
59  $mode = false;
60  }
61  self::$course_mode[$obj_id] = $mode;
62  }
63 
64  $is_completed = ($status == ilLPStatus::LP_STATUS_COMPLETED_NUM);
65 
66  // we are NOT using the members object because of performance issues
67  switch(self::$course_mode[$obj_id])
68  {
70  // #11600
71  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
72  ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, true);
73  break;
74 
77  // overwrites course passed status if it was set automatically (full sync)
78  // or toggle manually set passed status to completed (1-way-sync)
79  $do_update = $is_completed;
80  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
81  if(!$do_update)
82  {
83  $part = new ilCourseParticipants($obj_id);
84  $passed = $part->getPassedInfo($user_id);
85  if(!is_array($passed) ||
86  $passed["user_id"] == -1)
87  {
88  $do_update = true;
89  }
90  }
91  if($do_update)
92  {
93  ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed);
94  }
95  break;
96  }
97  }
98  }
99  }
const LP_STATUS_COMPLETED_NUM
const STATUS_DETERMINATION_LP
static _enabledLearningProgress()
check wether learing progress is enabled or not
Class ilObjCourse.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
static _updatePassed($a_obj_id, $a_usr_id, $a_passed, $a_manual=false, $a_no_origin=false)
Update passed status (static)
static getInstance($a_obj_id)
+ Here is the call graph for this function:

Field Documentation

◆ $course_mode

ilCourseAppEventListener::$course_mode = array()
staticprotected

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


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