ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLPStatusObjectives Class Reference
+ Inheritance diagram for ilLPStatusObjectives:
+ Collaboration diagram for ilLPStatusObjectives:

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 _getFailed ($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=false)
 

Static Protected Member Functions

static getMembers ($a_obj_id)
 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 16 of file class.ilLPStatusObjectives.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusObjectives::__construct (   $a_obj_id)

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

References $ilDB.

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

Member Function Documentation

◆ _getCompleted()

static ilLPStatusObjectives::_getCompleted (   $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo(), and array.

64  {
65  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
66  $usr_ids = (array) $objective_results['user_status'][self::LP_STATUS_COMPLETED_NUM];
67 
68  if ($usr_ids) {
69  // Exclude all non members
70  $usr_ids = array_intersect(self::getMembers($a_obj_id), (array) $usr_ids);
71  }
72 
73  return $usr_ids ? $usr_ids : array();
74  }
Create styles array
The data for the language used.
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:

◆ _getFailed()

static ilLPStatusObjectives::_getFailed (   $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo(), and array.

77  {
78  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
79  $usr_ids = (array) $objective_results['user_status'][self::LP_STATUS_FAILED_NUM];
80 
81  if ($usr_ids) {
82  // Exclude all non members
83  $usr_ids = array_intersect(self::getMembers($a_obj_id), (array) $usr_ids);
84  }
85 
86  return $usr_ids ? $usr_ids : array();
87  }
Create styles array
The data for the language used.
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 ilLPStatusObjectives::_getInProgress (   $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo(), and array.

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

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

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

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

◆ _getStatusInfo()

static ilLPStatusObjectives::_getStatusInfo (   $a_obj_id)
static

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

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

90  {
91  global $ilDB;
92 
93  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
94 
95  $status_info = array();
96  $status_info['user_status'] = array();
97  $status_info['objectives'] = ilCourseObjective::_getObjectiveIds($a_obj_id, true);
98  $status_info['num_objectives'] = count($status_info['objectives']);
99 
100  if ($status_info['num_objectives']) {
101  $in = $ilDB->in('objective_id', $status_info['objectives'], false, 'integer');
102 
103  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
104  foreach (ilLOUserResults::getSummarizedObjectiveStatusForLP($a_obj_id, $status_info['objectives']) as $user_id => $user_status) {
105  $status_info['user_status'][$user_status][] = $user_id;
106  }
107 
108  // change event should lead to "in progress" - see determineStatus()
109  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
110  foreach (ilChangeEvent::lookupUsersInProgress($a_obj_id) as $user_id) {
111  if (!is_array($status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]) ||
112  !in_array($user_id, $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM])) {
113  $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM][] = $user_id;
114  }
115  }
116 
117  // Read title/description
118  $query = "SELECT * FROM crs_objectives WHERE " . $in;
119  $res = $ilDB->query($query);
120  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
121  $status_info['objective_title'][$row->objective_id] = $row->title;
122  $status_info['objective_description'][$row->objective_id] = $row->description;
123  }
124  }
125 
126  return $status_info;
127  }
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)
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
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 194 of file class.ilLPStatusObjectives.php.

References array.

195  {
196  if (!$a_user_ids) {
197  $a_user_ids = self::getMembers($a_obj_id);
198  if (!$a_user_ids) {
199  return array();
200  }
201  }
202  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
203  }
Create styles array
The data for the language used.

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

References array.

213  {
214  return array();
215  }
Create styles array
The data for the language used.

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

References array.

225  {
226  if (!$a_user_ids) {
227  $a_user_ids = self::getMembers($a_obj_id);
228  if (!$a_user_ids) {
229  return array();
230  }
231  }
232  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
233  }
Create styles array
The data for the language used.

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

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

138  {
139  global $ilObjDataCache, $ilDB;
140 
141  // the status completed depends on:
142  // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
143  // - ilCourseObjective::_getObjectiveIds($a_obj_id);
144  // - table crs_objectives manipulated in
145  // - ilCourseObjective
146 
147  // $status_info['objective_result'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
148  // table crs_objective_status (must not contain a dataset)
149  // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
150 
151  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
152  switch ($ilObjDataCache->lookupType($a_obj_id)) {
153  case "crs":
154  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
155  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
156  // an initial test (only) should also lead to "in progress"
157  $status = self::LP_STATUS_IN_PROGRESS_NUM;
158 
159  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
160  $objectives = ilCourseObjective::_getObjectiveIds($a_obj_id, true);
161  if ($objectives) {
162  // #14051 - getSummarizedObjectiveStatusForLP() might return null
163  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
164  $objtv_status = ilLOUserResults::getSummarizedObjectiveStatusForLP($a_obj_id, $objectives, $a_user_id);
165  if ($objtv_status !== null) {
166  $status = $objtv_status;
167  }
168  }
169  }
170  break;
171  }
172  return $status;
173  }
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 180 of file class.ilLPStatusObjectives.php.

References ilCourseParticipants\_getInstanceByObjId().

181  {
182  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
183  $member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
184  return $member_obj->getMembers();
185  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

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