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;
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;
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))
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();
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";