13 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
23 if(is_array($status_info[
'completed']))
25 foreach($status_info[
'completed'] as $in_progress)
27 $users = array_merge($users,$in_progress);
29 $users = array_unique($users);
44 foreach($status_info[
'items'] as $item_id)
46 $tmp_users = $status_info[
'completed'][$item_id];
54 $users = array_intersect($users,$tmp_users);
57 $users = array_unique($users);
64 $status_info =
array();
66 include_once
"Services/Object/classes/class.ilObjectLP.php";
68 $collection = $olp->getCollectionInstance();
71 $status_info[
"items"] = $collection->getItems($a_obj_id);
73 foreach($status_info[
"items"] as $item_id)
75 $status_info[
"completed"][$item_id] =
array();
80 $possible_items = $collection->getPossibleItems(
$ref_id);
81 $chapter_ids = array_intersect(array_keys($possible_items),
82 $status_info[
"items"]);
85 $status_info[
"items"] = $chapter_ids;
89 $status = self::_getObjectStatus($a_obj_id);
91 foreach($chapter_ids as $item_id)
93 $status_info[
"item_titles"][$item_id] = $possible_items[$item_id][
"title"];
95 if(isset($status[$item_id]))
97 foreach($status[$item_id] as $user_id => $user_status)
101 $status_info[
"completed"][$item_id][] = $user_id;
114 $info = self::_getStatusInfo($a_obj_id);
116 if(is_array(
$info[
"completed"]))
119 $in_progress =
false;
120 foreach(
$info[
"completed"] as $user_ids)
123 if(in_array($a_user_id, $user_ids))
135 return self::LP_STATUS_COMPLETED_NUM;
139 return self::LP_STATUS_IN_PROGRESS_NUM;
143 return self::LP_STATUS_NOT_ATTEMPTED_NUM;
152 $sql =
"SELECT subitem_id, completed, usr_id, last_change".
153 " FROM ut_lp_coll_manual".
154 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
157 $sql .=
" AND usr_id = ".$ilDB->quote($a_user_id,
"integer");
159 $set = $ilDB->query($sql);
160 while(
$row = $ilDB->fetchAssoc($set))
164 $res[
$row[
"subitem_id"]][
$row[
"usr_id"]] = $row[
"completed"];
168 $res[
$row[
"subitem_id"]] =
array($row[
"completed"], $row[
"last_change"]);
183 $a_completed =
array();
186 include_once
'./Services/Object/classes/class.ilObjectLP.php';
188 $collection = $olp->getCollectionInstance();
191 $existing = self::_getObjectStatus($a_obj_id, $a_user_id);
193 foreach($collection->getItems() as $item_id)
195 if(isset($existing[$item_id]))
198 if((!$existing[$item_id][0] && in_array($item_id, $a_completed)) ||
199 ($existing[$item_id][0] && !in_array($item_id, $a_completed)))
201 $ilDB->manipulate(
"UPDATE ut_lp_coll_manual SET ".
202 " completed = ".$ilDB->quote(in_array($item_id, $a_completed),
"integer").
203 " , last_change = ".$ilDB->quote($now,
"integer").
204 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
205 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer").
206 " AND subitem_id = ".$ilDB->quote($item_id,
"integer"));
209 else if(in_array($item_id, $a_completed))
211 $ilDB->manipulate(
"INSERT INTO ut_lp_coll_manual".
212 "(obj_id,usr_id,subitem_id,completed,last_change)".
213 " VALUES (".$ilDB->quote($a_obj_id,
"integer").
214 " , ".$ilDB->quote($a_user_id,
"integer").
215 " , ".$ilDB->quote($item_id,
"integer").
216 " , ".$ilDB->quote(1,
"integer").
217 " , ".$ilDB->quote($now,
"integer").
")");
222 include_once
"Services/Tracking/classes/class.ilLPStatusWrapper.php";
static _getCompleted($a_obj_id)
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getAllReferences($a_id)
get all reference ids of object
static _setObjectStatus($a_obj_id, $a_user_id, array $a_completed=null)
static _getStatusInfo($a_obj_id)
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
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.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static _getObjectStatus($a_obj_id, $a_user_id=null)
static getInstance($a_obj_id)
static _getInProgress($a_obj_id)