ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilLPStatusObjectives Class Reference
+ Inheritance diagram for ilLPStatusObjectives:
+ Collaboration diagram for ilLPStatusObjectives:

Public Member Functions

 ilLPStatusObjectives ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getStatusInfo ($a_obj_id)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
- Public Member Functions inherited from ilLPStatus
 ilLPStatus ($a_obj_id)
 
 _getCountNotAttempted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getCountInProgress ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCountCompleted ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getCountFailed ()
 
 _getStatusInfo ($a_obj_id)
 
 _getTypicalLearningTime ($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...
 
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 

Static Public Member Functions

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 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 _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)
 

Static Protected Member Functions

static getMembers ($a_obj_id)
 Get members for object. More...
 
- Static Protected Member Functions inherited from ilLPStatus
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
 
- Protected Member Functions inherited from ilLPStatus
 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 

Detailed Description

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

Member Function Documentation

◆ _getCompleted()

ilLPStatusObjectives::_getCompleted (   $a_obj_id)

Definition at line 66 of file class.ilLPStatusObjectives.php.

References ilLPStatusWrapper\_getStatusInfo().

67  {
68  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
69  $usr_ids = (array)$objective_results['user_status'][self::LP_STATUS_COMPLETED_NUM];
70 
71  if($usr_ids)
72  {
73  // Exclude all non members
74  $usr_ids = array_intersect(self::getMembers($a_obj_id), (array)$usr_ids);
75  }
76 
77  return $usr_ids ? $usr_ids : array();
78  }
_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:

◆ _getFailed()

ilLPStatusObjectives::_getFailed (   $a_obj_id)

Definition at line 80 of file class.ilLPStatusObjectives.php.

References ilLPStatusWrapper\_getStatusInfo().

81  {
82  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
83  $usr_ids = (array)$objective_results['user_status'][self::LP_STATUS_FAILED_NUM];
84 
85  if($usr_ids)
86  {
87  // Exclude all non members
88  $usr_ids = array_intersect(self::getMembers($a_obj_id), (array)$usr_ids);
89  }
90 
91  return $usr_ids ? $usr_ids : array();
92  }
_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()

ilLPStatusObjectives::_getInProgress (   $a_obj_id)

Definition at line 43 of file class.ilLPStatusObjectives.php.

References ilLPStatusWrapper\_getStatusInfo().

44  {
45  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
46  $usr_ids = (array)$objective_results['user_status'][self::LP_STATUS_IN_PROGRESS_NUM];
47 
48  /* change_event is of no use when no objective has been tried yet
49  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
50  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
51 
52  // Exclude all users with status completed/failed.
53  $users = array_diff((array) $users,ilLPStatusWrapper::_getCompleted($a_obj_id));
54  $users = array_diff((array) $users,ilLPStatusWrapper::_getFailed($a_obj_id));
55  */
56 
57  if($usr_ids)
58  {
59  // Exclude all non members
60  $usr_ids = array_intersect(self::getMembers($a_obj_id), (array)$usr_ids);
61  }
62 
63  return $usr_ids ? $usr_ids : array();
64  }
_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()

ilLPStatusObjectives::_getNotAttempted (   $a_obj_id)

Definition at line 27 of file class.ilLPStatusObjectives.php.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), and ilLPStatusWrapper\_getInProgress().

28  {
29  $users = array();
30 
31  $members = self::getMembers($a_obj_id);
32  if($members)
33  {
34  // diff in progress, completed and failed (use stored result in LPStatusWrapper)
35  $users = array_diff((array) $members, ilLPStatusWrapper::_getInProgress($a_obj_id));
36  $users = array_diff((array) $members, ilLPStatusWrapper::_getCompleted($a_obj_id));
37  $users = array_diff((array) $members, ilLPStatusWrapper::_getFailed($a_obj_id));
38  }
39 
40  return $users;
41  }
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
_getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
+ Here is the call graph for this function:

◆ _getStatusInfo()

ilLPStatusObjectives::_getStatusInfo (   $a_obj_id)

Definition at line 94 of file class.ilLPStatusObjectives.php.

References $ilDB, $in, $query, $res, $row, ilCourseObjective\_getObjectiveIds(), DB_FETCHMODE_OBJECT, ilLOUserResults\getSummarizedObjectiveStatusForLP(), ilChangeEvent\lookupUsersInProgress(), and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

95  {
96  global $ilDB;
97 
98  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
99 
100  $status_info = array();
101  $status_info['user_status'] = array();
102  $status_info['objectives'] = ilCourseObjective::_getObjectiveIds($a_obj_id,true);
103  $status_info['num_objectives'] = count($status_info['objectives']);
104 
105  if($status_info['num_objectives'])
106  {
107  $in = $ilDB->in('objective_id',$status_info['objectives'],false,'integer');
108 
109  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
110  foreach(ilLOUserResults::getSummarizedObjectiveStatusForLP($a_obj_id, $status_info['objectives']) as $user_id => $user_status)
111  {
112  $status_info['user_status'][$user_status][] = $user_id;
113  }
114 
115  // change event should lead to "in progress" - see determineStatus()
116  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
117  foreach(ilChangeEvent::lookupUsersInProgress($a_obj_id) as $user_id)
118  {
119  if(!is_array($status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]) ||
120  !in_array($user_id, $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]))
121  {
122  $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM][] = $user_id;
123  }
124  }
125 
126  // Read title/description
127  $query = "SELECT * FROM crs_objectives WHERE ".$in;
128  $res = $ilDB->query($query);
129  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
130  {
131  $status_info['objective_title'][$row->objective_id] = $row->title;
132  $status_info['objective_description'][$row->objective_id] = $row->description;
133  }
134  }
135 
136  return $status_info;
137  }
static getSummarizedObjectiveStatusForLP($a_obj_id, array $a_objective_ids, $a_user_id=null)
const LP_STATUS_IN_PROGRESS_NUM
static _getObjectiveIds($course_id, $a_activated_only=false)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.
+ Here is the call graph for this function:

◆ _lookupCompletedForObject()

static ilLPStatusObjectives::_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 208 of file class.ilLPStatusObjectives.php.

209  {
210  if(!$a_user_ids)
211  {
212  $a_user_ids = self::getMembers($a_obj_id);
213  if(!$a_user_ids)
214  {
215  return array();
216  }
217  }
218  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
219  }

◆ _lookupFailedForObject()

static ilLPStatusObjectives::_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 228 of file class.ilLPStatusObjectives.php.

229  {
230  return array();
231  }

◆ _lookupInProgressForObject()

static ilLPStatusObjectives::_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 240 of file class.ilLPStatusObjectives.php.

241  {
242  if(!$a_user_ids)
243  {
244  $a_user_ids = self::getMembers($a_obj_id);
245  if(!$a_user_ids)
246  {
247  return array();
248  }
249  }
250  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
251  }

◆ determineStatus()

ilLPStatusObjectives::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 147 of file class.ilLPStatusObjectives.php.

References $ilDB, ilCourseObjective\_getObjectiveIds(), ilLOUserResults\getSummarizedObjectiveStatusForLP(), and ilChangeEvent\hasAccessed().

148  {
149  global $ilObjDataCache, $ilDB;
150 
151  // the status completed depends on:
152  // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
153  // - ilCourseObjective::_getObjectiveIds($a_obj_id);
154  // - table crs_objectives manipulated in
155  // - ilCourseObjective
156 
157  // $status_info['objective_result'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
158  // table crs_objective_status (must not contain a dataset)
159  // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
160 
161  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
162  switch ($ilObjDataCache->lookupType($a_obj_id))
163  {
164  case "crs":
165  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
166  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
167  {
168  // an initial test (only) should also lead to "in progress"
169  $status = self::LP_STATUS_IN_PROGRESS_NUM;
170 
171  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
172  $objectives = ilCourseObjective::_getObjectiveIds($a_obj_id, true);
173  if ($objectives)
174  {
175  // #14051 - getSummarizedObjectiveStatusForLP() might return null
176  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
177  $objtv_status = ilLOUserResults::getSummarizedObjectiveStatusForLP($a_obj_id, $objectives, $a_user_id);
178  if($objtv_status !== null)
179  {
180  $status = $objtv_status;
181  }
182  }
183  }
184  break;
185  }
186  return $status;
187  }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
static getSummarizedObjectiveStatusForLP($a_obj_id, array $a_objective_ids, $a_user_id=null)
static _getObjectiveIds($course_id, $a_activated_only=false)
global $ilDB
+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusObjectives::getMembers (   $a_obj_id)
staticprotected

Get members for object.

Parameters
int$a_obj_id
Returns
array

Definition at line 194 of file class.ilLPStatusObjectives.php.

References ilCourseParticipants\_getInstanceByObjId().

195  {
196  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
197  $member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
198  return $member_obj->getMembers();
199  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

◆ ilLPStatusObjectives()

ilLPStatusObjectives::ilLPStatusObjectives (   $a_obj_id)

Definition at line 19 of file class.ilLPStatusObjectives.php.

References $ilDB.

20  {
21  global $ilDB;
22 
23  parent::ilLPStatus($a_obj_id);
24  $this->db =& $ilDB;
25  }
global $ilDB

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