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

Public Member Functions

 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 _getInProgress ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getStatusInfo ($a_obj_id)
 
static _getObjectStatus ($a_obj_id, $a_user_id=null)
 
static _setObjectStatus ($a_obj_id, $a_user_id, array $a_completed=null)
 
- 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.ilLPStatusCollectionManual.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollectionManual::_getCompleted (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

37 {
38 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
39
40 $counter = 0;
41 $users = array();
42 foreach ($status_info['items'] as $item_id) {
43 $tmp_users = $status_info['completed'][$item_id];
44
45 if (!$counter++) {
46 $users = $tmp_users;
47 } else {
48 $users = array_intersect($users, $tmp_users);
49 }
50 }
51 $users = array_unique($users);
52
53 return $users;
54 }
$users
Definition: authpage.php:44
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$counter

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

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusCollectionManual::_getInProgress (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

18 {
19 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
20
21 // find any completed item
22 $users = array();
23 if (is_array($status_info['completed'])) {
24 foreach ($status_info['completed'] as $in_progress) {
25 $users = array_merge($users, $in_progress);
26 }
27 $users = array_unique($users);
28 }
29
30 // remove all users which have completed ALL items
31 $users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
32
33 return $users;
34 }
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.

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

+ Here is the call graph for this function:

◆ _getObjectStatus()

static ilLPStatusCollectionManual::_getObjectStatus (   $a_obj_id,
  $a_user_id = null 
)
static

Definition at line 129 of file class.ilLPStatusCollectionManual.php.

130 {
131 global $ilDB;
132
133 $res = array();
134
135 $sql = "SELECT subitem_id, completed, usr_id, last_change" .
136 " FROM ut_lp_coll_manual" .
137 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
138 if ($a_user_id) {
139 $sql .= " AND usr_id = " . $ilDB->quote($a_user_id, "integer");
140 }
141 $set = $ilDB->query($sql);
142 while ($row = $ilDB->fetchAssoc($set)) {
143 if (!$a_user_id) {
144 $res[$row["subitem_id"]][$row["usr_id"]] = $row["completed"];
145 } else {
146 $res[$row["subitem_id"]] = array($row["completed"], $row["last_change"]);
147 }
148 }
149
150 return $res;
151 }
foreach($_POST as $key=> $value) $res
global $ilDB

References $ilDB, $res, and $row.

Referenced by _getStatusInfo(), and _setObjectStatus().

+ Here is the caller graph for this function:

◆ _getStatusInfo()

static ilLPStatusCollectionManual::_getStatusInfo (   $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 56 of file class.ilLPStatusCollectionManual.php.

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 foreach ($status_info["items"] as $item_id) {
67 $status_info["completed"][$item_id] = array();
68 }
69
70 $ref_ids = ilObject::_getAllReferences($a_obj_id);
71 $ref_id = end($ref_ids);
72 $possible_items = $collection->getPossibleItems($ref_id);
73 $chapter_ids = array_intersect(
74 array_keys($possible_items),
75 $status_info["items"]
76 );
77
78 // fix order (adapt from possible items)
79 $status_info["items"] = $chapter_ids;
80
81 if ($chapter_ids) {
82 $status = self::_getObjectStatus($a_obj_id);
83
84 foreach ($chapter_ids as $item_id) {
85 $status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
86
87 if (isset($status[$item_id])) {
88 foreach ($status[$item_id] as $user_id => $user_status) {
89 if ($user_status) {
90 $status_info["completed"][$item_id][] = $user_id;
91 }
92 }
93 }
94 }
95 }
96 }
97
98 return $status_info;
99 }
static _getObjectStatus($a_obj_id, $a_user_id=null)
static getInstance($a_obj_id)
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), _getObjectStatus(), and ilObjectLP\getInstance().

Referenced by determineStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _setObjectStatus()

static ilLPStatusCollectionManual::_setObjectStatus (   $a_obj_id,
  $a_user_id,
array  $a_completed = null 
)
static

Definition at line 153 of file class.ilLPStatusCollectionManual.php.

154 {
155 global $ilDB;
156
157 $now = time();
158
159 if (!$a_completed) {
160 $a_completed = array();
161 }
162
163 include_once './Services/Object/classes/class.ilObjectLP.php';
164 $olp = ilObjectLP::getInstance($a_obj_id);
165 $collection = $olp->getCollectionInstance();
166 if ($collection) {
167 $existing = self::_getObjectStatus($a_obj_id, $a_user_id);
168
169 foreach ($collection->getItems() as $item_id) {
170 if (isset($existing[$item_id])) {
171 // value changed
172 if ((!$existing[$item_id][0] && in_array($item_id, $a_completed)) ||
173 ($existing[$item_id][0] && !in_array($item_id, $a_completed))) {
174 $ilDB->manipulate("UPDATE ut_lp_coll_manual SET " .
175 " completed = " . $ilDB->quote(in_array($item_id, $a_completed), "integer") .
176 " , last_change = " . $ilDB->quote($now, "integer") .
177 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
178 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
179 " AND subitem_id = " . $ilDB->quote($item_id, "integer"));
180 }
181 } elseif (in_array($item_id, $a_completed)) {
182 $ilDB->manipulate("INSERT INTO ut_lp_coll_manual" .
183 "(obj_id,usr_id,subitem_id,completed,last_change)" .
184 " VALUES (" . $ilDB->quote($a_obj_id, "integer") .
185 " , " . $ilDB->quote($a_user_id, "integer") .
186 " , " . $ilDB->quote($item_id, "integer") .
187 " , " . $ilDB->quote(1, "integer") .
188 " , " . $ilDB->quote($now, "integer") . ")");
189 }
190 }
191 }
192
193 include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
194 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
195 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.

References $ilDB, _getObjectStatus(), ilLPStatusWrapper\_updateStatus(), and ilObjectLP\getInstance().

+ Here is the call graph for this function:

◆ determineStatus()

ilLPStatusCollectionManual::determineStatus (   $a_obj_id,
  $a_usr_id,
  $a_obj = null 
)

Determine status.

Parameters

return

Reimplemented from ilLPStatus.

Definition at line 101 of file class.ilLPStatusCollectionManual.php.

102 {
103 $info = self::_getStatusInfo($a_obj_id);
104
105 if (is_array($info["completed"])) {
106 $completed = true;
107 $in_progress = false;
108 foreach ($info["completed"] as $user_ids) {
109 // has completed at least 1 item
110 if (in_array($a_user_id, $user_ids)) {
111 $in_progress = true;
112 }
113 // must have completed all items to complete collection
114 else {
115 $completed = false;
116 }
117 }
118 if ($completed) {
120 }
121 if ($in_progress) {
123 }
124 }
125
127 }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
$info
Definition: index.php:5

References $info, _getStatusInfo(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

+ Here is the call graph for this function:

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