ILIAS  release_4-4 Revision
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)
 
 _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_no_raise=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)
 Lookup status. 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...
 

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

References ilLPStatusWrapper\_getStatusInfo().

60  {
61  $usr_ids = array();
62 
63  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
64  foreach($status_info['objective_result'] as $user_id => $completed)
65  {
66  if(count($completed) == $status_info['num_objectives'])
67  {
68  $usr_ids[] = $user_id;
69  }
70  }
71 
72  if($usr_ids)
73  {
74  // Exclude all non members
75  $usr_ids = array_intersect(self::getMembers($a_obj_id), (array)$usr_ids);
76  }
77 
78  return $usr_ids ? $usr_ids : array();
79  }
_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 42 of file class.ilLPStatusObjectives.php.

References ilLPStatusWrapper\_getCompleted(), and ilChangeEvent\lookupUsersInProgress().

43  {
44  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
45  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
46 
47  // Exclude all users with status completed.
48  $users = array_diff((array) $users,ilLPStatusWrapper::_getCompleted($a_obj_id));
49 
50  if($users)
51  {
52  // Exclude all non members
53  $users = array_intersect(self::getMembers($a_obj_id), (array)$users);
54  }
55 
56  return $users;
57  }
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.
+ 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(), and ilLPStatusWrapper\_getInProgress().

28  {
29  $users = array();
30 
31  $members = self::getMembers($a_obj_id);
32  if($members)
33  {
34  // diff in progress and completed (use stored result in LPStatusWrapper)
35  $users = array_diff((array) $members, ilLPStatusWrapper::_getInProgress($a_obj_id));
36  $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
37  }
38 
39  return $users;
40  }
_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 82 of file class.ilLPStatusObjectives.php.

References $in, $query, $res, $row, ilCourseObjective\_getObjectiveIds(), and DB_FETCHMODE_OBJECT.

83  {
84  global $ilDB;
85 
86  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
87 
88  $status_info = array();
89  $status_info['objective_result'] = array();
90  $status_info['objectives'] = ilCourseObjective::_getObjectiveIds($a_obj_id);
91  $status_info['num_objectives'] = count($status_info['objectives']);
92 
93  if($status_info['num_objectives'])
94  {
95  $in = $ilDB->in('objective_id',$status_info['objectives'],false,'integer');
96 
97  $query = "SELECT * FROM crs_objective_status WHERE ".$in;
98  $res = $ilDB->query($query);
99  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
100  {
101  $status_info['completed'][$row->objective_id][] = $row->user_id;
102  $status_info['objective_result'][$row->user_id][$row->objective_id] = $row->objective_id;
103  }
104 
105  // Read title/description
106  $query = "SELECT * FROM crs_objectives WHERE ".$in;
107  $res = $ilDB->query($query);
108  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
109  {
110  $status_info['objective_title'][$row->objective_id] = $row->title;
111  $status_info['objective_description'][$row->objective_id] = $row->description;
112  }
113  }
114 
115  return $status_info;
116  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ 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 189 of file class.ilLPStatusObjectives.php.

190  {
191  if(!$a_user_ids)
192  {
193  $a_user_ids = self::getMembers($a_obj_id);
194  if(!$a_user_ids)
195  {
196  return array();
197  }
198  }
199  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
200  }

◆ _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 209 of file class.ilLPStatusObjectives.php.

210  {
211  return array();
212  }

◆ _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 221 of file class.ilLPStatusObjectives.php.

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

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

References ilCourseObjective\_getObjectiveIds(), and ilChangeEvent\hasAccessed().

127  {
128  global $ilObjDataCache, $ilDB;
129 
130  // the status completed depends on:
131  // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
132  // - ilCourseObjective::_getObjectiveIds($a_obj_id);
133  // - table crs_objectives manipulated in
134  // - ilCourseObjective
135 
136  // $status_info['objective_result'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
137  // table crs_objective_status (must not contain a dataset)
138  // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
139 
140  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
141  switch ($ilObjDataCache->lookupType($a_obj_id))
142  {
143  case "crs":
144  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
145  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
146  {
147  $status = self::LP_STATUS_IN_PROGRESS_NUM;
148 
149  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
150  $objectives = ilCourseObjective::_getObjectiveIds($a_obj_id);
151  if ($objectives)
152  {
153  $set = $ilDB->query("SELECT count(objective_id) cnt FROM crs_objective_status ".
154  "WHERE ".$ilDB->in('objective_id',$objectives, false,'integer').
155  " AND user_id = ".$ilDB->quote($a_user_id, "integer"));
156  if ($rec = $ilDB->fetchAssoc($set))
157  {
158  if ($rec["cnt"] == count($objectives))
159  {
160  $status = self::LP_STATUS_COMPLETED_NUM;
161  }
162  }
163  }
164  }
165  break;
166  }
167  return $status;
168  }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
+ 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 175 of file class.ilLPStatusObjectives.php.

References ilCourseParticipants\_getInstanceByObjId().

176  {
177  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
178  $member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
179  return $member_obj->getMembers();
180  }
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.

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

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