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

Public Member Functions

 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 
- 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 _getInProgress ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getStatusInfo ($a_obj_id, $a_include_tlt_data=false)
 
- 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)
 

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
 
- 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...
 

Detailed Description

Definition at line 15 of file class.ilLPStatusCollectionTLT.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollectionTLT::_getCompleted (   $a_obj_id)
static

Definition at line 34 of file class.ilLPStatusCollectionTLT.php.

References $counter, $users, ilLPStatusWrapper\_getStatusInfo(), and array.

35  {
36  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
37 
38  $counter = 0;
39  $users = array();
40  foreach ($status_info['items'] as $item_id) {
41  $tmp_users = $status_info['completed'][$item_id];
42 
43  if (!$counter++) {
44  $users = $tmp_users;
45  } else {
46  $users = array_intersect($users, $tmp_users);
47  }
48  }
49  $users = array_unique($users);
50 
51  return $users;
52  }
$counter
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.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusCollectionTLT::_getInProgress (   $a_obj_id)
static

Definition at line 17 of file class.ilLPStatusCollectionTLT.php.

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

18  {
19  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
20 
21  $users = array();
22  if (is_array($status_info['in_progress'])) {
23  foreach ($status_info['in_progress'] as $in_progress) {
24  $users = array_merge($users, $in_progress);
25  }
26  $users = array_unique($users);
27  }
28 
29  $users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
30 
31  return $users;
32  }
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
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.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusCollectionTLT::_getStatusInfo (   $a_obj_id,
  $a_include_tlt_data = false 
)
static

Definition at line 54 of file class.ilLPStatusCollectionTLT.php.

References $ilDB, $row, ilObject\_getAllReferences(), ilMDEducational\_getTypicalLearningTimeSeconds(), array, and ilObjectLP\getInstance().

55  {
56  global $ilDB;
57 
58  $status_info = array();
59 
60  include_once "Services/Object/classes/class.ilObjectLP.php";
61  $olp = ilObjectLP::getInstance($a_obj_id);
62  $collection = $olp->getCollectionInstance();
63  if ($collection) {
64  $status_info["items"] = $collection->getItems($a_obj_id);
65 
66  include_once './Services/MetaData/classes/class.ilMDEducational.php';
67  foreach ($status_info["items"] as $item_id) {
68  $status_info["in_progress"][$item_id] = array();
69  $status_info["completed"][$item_id] = array();
70 
71  $status_info["tlt"][$item_id] = ilMDEducational::_getTypicalLearningTimeSeconds($a_obj_id, $item_id);
72  }
73 
74  $ref_ids = ilObject::_getAllReferences($a_obj_id);
75  $ref_id = end($ref_ids);
76  $possible_items = $collection->getPossibleItems($ref_id);
77  $chapter_ids = array_intersect(
78  array_keys($possible_items),
79  $status_info["items"]
80  );
81 
82  // fix order (adapt from possible items)
83  $status_info["items"] = $chapter_ids;
84 
85  if ($chapter_ids) {
86  foreach ($chapter_ids as $item_id) {
87  $status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
88  }
89 
90  $set = $ilDB->query("SELECT obj_id,usr_id,spent_seconds" .
91  " FROM lm_read_event" .
92  " WHERE " . $ilDB->in("obj_id", $chapter_ids, "", "integer"));
93  while ($row = $ilDB->fetchAssoc($set)) {
94  if ($row["spent_seconds"] < $status_info["tlt"][$row["obj_id"]]) {
95  $status_info["in_progress"][$row["obj_id"]][] = $row["usr_id"];
96  } else {
97  $status_info["completed"][$row["obj_id"]][] = $row["usr_id"];
98  }
99 
100  if ($a_include_tlt_data) {
101  $status_info["tlt_users"][$row["obj_id"]][$row["usr_id"]] = $row["spent_seconds"];
102  }
103  }
104  }
105  }
106 
107  if (!$a_include_tlt_data) {
108  unset($status_info["tlt"]);
109  }
110 
111  return $status_info;
112  }
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
global $ilDB
static getInstance($a_obj_id)
+ Here is the call graph for this function:

◆ determineStatus()

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

Definition at line 114 of file class.ilLPStatusCollectionTLT.php.

References $info.

115  {
116  $info = self::_getStatusInfo($a_obj_id);
117 
118  $completed_once = false;
119 
120  if (is_array($info["completed"])) {
121  $completed = true;
122  foreach ($info["completed"] as $user_ids) {
123  // must have completed all items to complete collection
124  if (!in_array($a_user_id, $user_ids)) {
125  $completed = false;
126  break;
127  } else {
128  $completed_once = true;
129  }
130  }
131  if ($completed) {
132  return self::LP_STATUS_COMPLETED_NUM;
133  }
134  }
135 
136  // #14997
137  if ($completed_once) {
138  return self::LP_STATUS_IN_PROGRESS_NUM;
139  }
140 
141  if (is_array($info["in_progress"])) {
142  foreach ($info["in_progress"] as $user_ids) {
143  if (in_array($a_user_id, $user_ids)) {
144  return self::LP_STATUS_IN_PROGRESS_NUM;
145  }
146  }
147  }
148 
149  return self::LP_STATUS_NOT_ATTEMPTED_NUM;
150  }
$info
Definition: index.php:5

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