ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLPStatusEvent Class Reference
+ Inheritance diagram for ilLPStatusEvent:
+ Collaboration diagram for ilLPStatusEvent:

Public Member Functions

 __construct ($a_obj_id)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
- Public Member Functions inherited from ilLPStatus
 __construct ($a_obj_id)
 
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) More...
 
 determinePercentage ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine percentage. More...
 
 determineStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine status. More...
 
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh status. More...
 

Static Public Member Functions

static _getNotAttempted ($a_obj_id)
 
static _getInProgress ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getStatusInfo ($a_obj_id)
 
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
static _getCountInProgress ($a_obj_id)
 
static _getInProgress ($a_obj_id)
 
static _getCountCompleted ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
static _getCountFailed ()
 
static _getStatusInfo ($a_obj_id)
 
static _getTypicalLearningTime ($a_obj_id)
 
static checkStatusForObject ($a_obj_id, $a_users=false)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus ($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted ($a_obj_id, $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty ($a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus ($a_obj_id, $a_user_id, $a_create=true)
 Lookup status. More...
 
static _lookupPercentage ($a_obj_id, $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion. More...
 
static _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData ($a_obj_ids)
 
static getListGUIStatus ($a_obj_id, $a_image_only=true)
 

Static Protected Member Functions

static getMembers ($a_obj_id, $a_is_crs_id=false)
 Get members for object. More...
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects ($a_user_id, $a_obj_ids, $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects ($a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects ($a_user_id, $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
 $obj_id = null
 
 $db = null
 
const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted'
 
const LP_STATUS_IN_PROGRESS = 'trac_in_progress'
 
const LP_STATUS_COMPLETED = 'trac_completed'
 
const LP_STATUS_FAILED = 'trac_failed'
 
const LP_STATUS_NOT_ATTEMPTED_NUM = 0
 
const LP_STATUS_IN_PROGRESS_NUM = 1
 
const LP_STATUS_COMPLETED_NUM = 2
 
const LP_STATUS_FAILED_NUM = 3
 
const LP_STATUS_REGISTERED = 'trac_registered'
 
const LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
 
const LP_STATUS_PARTICIPATED = 'trac_participated'
 
const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
 
- Static Public Attributes inherited from ilLPStatus
static $list_gui_cache
 

Detailed Description

Definition at line 36 of file class.ilLPStatusEvent.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusEvent::__construct (   $a_obj_id)

Definition at line 38 of file class.ilLPStatusEvent.php.

References $DIC, and $ilDB.

39  {
40  global $DIC;
41 
42  $ilDB = $DIC['ilDB'];
43 
44  parent::__construct($a_obj_id);
45  $this->db = $ilDB;
46  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ _getCompleted()

static ilLPStatusEvent::_getCompleted (   $a_obj_id)
static

Definition at line 81 of file class.ilLPStatusEvent.php.

References ilLPStatusWrapper\_getStatusInfo().

82  {
83  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
84  return $status_info['participated_users'] ? $status_info['participated_users'] : array();
85  }
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusEvent::_getInProgress (   $a_obj_id)
static

Definition at line 64 of file class.ilLPStatusEvent.php.

References ilLPStatusWrapper\_getStatusInfo().

65  {
66  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
67 
68  // If registration is disabled in_progress is not available
69  if (!$status_info['registration']) {
70  return array();
71  }
72  // If event has occured in_progress is impossible
73  if ($status_info['starting_time'] < time()) {
74  return array();
75  }
76 
77  // Otherwise all users who registered will get the status in progress
78  return $status_info['registered_users'] ? $status_info['registered_users'] : array();
79  }
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusEvent::_getNotAttempted (   $a_obj_id)
static

Definition at line 48 of file class.ilLPStatusEvent.php.

References $users, ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getInProgress(), and ilLPStatusWrapper\_getStatusInfo().

49  {
50  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
51 
52  $users = array();
53 
54  $members = self::getMembers($status_info['crs_id'], true);
55  if ($members) {
56  // diff in progress and completed (use stored result in LPStatusWrapper)
57  $users = array_diff((array) $members, ilLPStatusWrapper::_getInProgress($a_obj_id));
58  $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
59  }
60 
61  return $users;
62  }
static _getInProgress($a_obj_id)
Static function to read users who have the status &#39;in_progress&#39;.
static _getCompleted($a_obj_id)
Static function to read the users who have the status &#39;completed&#39;.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusEvent::_getStatusInfo (   $a_obj_id)
static

Definition at line 87 of file class.ilLPStatusEvent.php.

References $GLOBALS, $id, $tree, ilObject\_getAllReferences(), ilEventParticipants\_getParticipated(), ilEventParticipants\_getRegistered(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupDescription(), ilObject\_lookupObjId(), ilObjSession\_lookupRegistrationEnabled(), and ilObject\_lookupTitle().

88  {
89  $tree = $GLOBALS['DIC']->repositoryTree();
90 
91  $references = ilObject::_getAllReferences($a_obj_id);
92  $ref_id = end($references);
93 
94  $member_ref_id = null;
95  if ($id = $tree->checkForParentType($ref_id, 'grp')) {
96  $member_ref_id = $id;
97  } elseif ($id = $tree->checkForParentType($ref_id, 'crs')) {
98  $member_ref_id = $id;
99  }
100 
101  $status_info = array();
102  $status_info['crs_id'] = ilObject::_lookupObjId($member_ref_id);
103  $status_info['registration'] = ilObjSession::_lookupRegistrationEnabled($a_obj_id);
104  $status_info['title'] = ilObject::_lookupTitle($a_obj_id);
105  $status_info['description'] = ilObject::_lookupDescription($a_obj_id);
106 
107  $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id);
108  $status_info['starting_time'] = $time_info['start'];
109  $status_info['ending_time'] = $time_info['end'];
110  $status_info['fullday'] = $time_info['fullday'];
111 
112  $status_info['registered_users'] = ilEventParticipants::_getRegistered($a_obj_id);
113  $status_info['participated_users'] = ilEventParticipants::_getParticipated($a_obj_id);
114 
115  return $status_info;
116  }
static _getRegistered($a_event_id)
static _getParticipated($a_event_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupRegistrationEnabled($a_obj_id)
lookup registration enabled
static _lookupDescription($a_id)
lookup object description
static _lookupObjId($a_id)
static _lookupAppointment($a_obj_id)
lookup appointment
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ _lookupCompletedForObject()

static ilLPStatusEvent::_lookupCompletedForObject (   $a_obj_id,
  $a_user_ids = null 
)
static

Get completed users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Definition at line 195 of file class.ilLPStatusEvent.php.

196  {
197  if (!$a_user_ids) {
198  $a_user_ids = self::getMembers($a_obj_id);
199  if (!$a_user_ids) {
200  return array();
201  }
202  }
203  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
204  }

◆ _lookupFailedForObject()

static ilLPStatusEvent::_lookupFailedForObject (   $a_obj_id,
  $a_user_ids = null 
)
static

Get failed users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Definition at line 213 of file class.ilLPStatusEvent.php.

214  {
215  return array();
216  }

◆ _lookupInProgressForObject()

static ilLPStatusEvent::_lookupInProgressForObject (   $a_obj_id,
  $a_user_ids = null 
)
static

Get in progress users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Definition at line 225 of file class.ilLPStatusEvent.php.

226  {
227  if (!$a_user_ids) {
228  $a_user_ids = self::getMembers($a_obj_id);
229  if (!$a_user_ids) {
230  return array();
231  }
232  }
233  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
234  }

◆ determineStatus()

ilLPStatusEvent::determineStatus (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine status.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer status

Definition at line 126 of file class.ilLPStatusEvent.php.

References $DIC, ilEventParticipants\_hasParticipated(), ilEventParticipants\_isRegistered(), ilSessionAppointment\_lookupAppointment(), and ilObjSession\_lookupRegistrationEnabled().

127  {
128  global $DIC;
129 
130  $ilObjDataCache = $DIC['ilObjDataCache'];
131 
132  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
133  switch ($ilObjDataCache->lookupType($a_obj_id)) {
134  case 'sess':
135  include_once './Modules/Session/classes/class.ilEventParticipants.php';
136  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
137  include_once('./Modules/Session/classes/class.ilObjSession.php');
138 
139  $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id);
140  $registration = ilObjSession::_lookupRegistrationEnabled($a_obj_id);
141 
142  // If registration is disabled in_progress is not available
143  // If event has occured in_progress is impossible
144  if ($registration && $time_info['start'] >= time()) {
145  // is user registered -> in progress
146  if (ilEventParticipants::_isRegistered($a_user_id, $a_obj_id)) {
147  $status = self::LP_STATUS_IN_PROGRESS_NUM;
148  }
149  }
150  if (ilEventParticipants::_hasParticipated($a_user_id, $a_obj_id)) {
151  $status = self::LP_STATUS_COMPLETED_NUM;
152  }
153  break;
154  }
155  return $status;
156  }
global $DIC
Definition: saml.php:7
static _isRegistered($a_usr_id, $a_event_id)
static _hasParticipated($a_usr_id, $a_event_id)
static _lookupRegistrationEnabled($a_obj_id)
lookup registration enabled
static _lookupAppointment($a_obj_id)
lookup appointment
+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusEvent::getMembers (   $a_obj_id,
  $a_is_crs_id = false 
)
staticprotected

Get members for object.

Parameters
int$a_obj_id
bool$a_is_crs_id
Returns
array

Definition at line 164 of file class.ilLPStatusEvent.php.

References $GLOBALS, $id, $tree, ilObject\_getAllReferences(), ilObject\_lookupObjId(), and ilParticipants\getInstanceByObjId().

165  {
166  if (!$a_is_crs_id) {
167  $tree = $GLOBALS['DIC']->repositoryTree();
168  $references = ilObject::_getAllReferences($a_obj_id);
169  $ref_id = end($references);
170 
171  $member_ref_id = null;
172  if ($id = $tree->checkForParentType($ref_id, 'grp')) {
173  $member_ref_id = $id;
174  } elseif ($id = $tree->checkForParentType($ref_id, 'crs')) {
175  $member_ref_id = $id;
176  } else {
177  return [];
178  }
179  $member_obj_id = ilObject::_lookupObjId($member_ref_id);
180  } else {
181  $member_obj_id = $a_obj_id;
182  }
183 
184  $member_obj = ilParticipants::getInstanceByObjId($member_obj_id);
185  return $member_obj->getMembers();
186  }
if(!array_key_exists('StateId', $_REQUEST)) $id
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjId($a_id)
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

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