13 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
23 if (is_array($status_info[
'completed'])) {
24 foreach ($status_info[
'completed'] as $in_progress) {
42 foreach ($status_info[
'items'] as $item_id) {
43 $tmp_users = $status_info[
'completed'][$item_id];
58 $status_info =
array();
60 include_once
"Services/Object/classes/class.ilObjectLP.php";
62 $collection = $olp->getCollectionInstance();
64 $status_info[
"items"] = $collection->getItems($a_obj_id);
66 foreach ($status_info[
"items"] as $item_id) {
67 $status_info[
"completed"][$item_id] =
array();
71 $ref_id = end($ref_ids);
72 $possible_items = $collection->getPossibleItems($ref_id);
73 $chapter_ids = array_intersect(
74 array_keys($possible_items),
79 $status_info[
"items"] = $chapter_ids;
82 $status = self::_getObjectStatus($a_obj_id);
84 foreach ($chapter_ids as $item_id) {
85 $status_info[
"item_titles"][$item_id] = $possible_items[$item_id][
"title"];
87 if (isset($status[$item_id])) {
88 foreach ($status[$item_id] as $user_id => $user_status) {
90 $status_info[
"completed"][$item_id][] = $user_id;
103 $info = self::_getStatusInfo($a_obj_id);
105 if (is_array(
$info[
"completed"])) {
107 $in_progress =
false;
108 foreach (
$info[
"completed"] as $user_ids) {
110 if (in_array($a_user_id, $user_ids)) {
119 return self::LP_STATUS_COMPLETED_NUM;
122 return self::LP_STATUS_IN_PROGRESS_NUM;
126 return self::LP_STATUS_NOT_ATTEMPTED_NUM;
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");
139 $sql .=
" AND usr_id = " . $ilDB->quote($a_user_id,
"integer");
141 $set = $ilDB->query($sql);
142 while (
$row = $ilDB->fetchAssoc($set)) {
144 $res[
$row[
"subitem_id"]][
$row[
"usr_id"]] = $row[
"completed"];
146 $res[
$row[
"subitem_id"]] =
array($row[
"completed"], $row[
"last_change"]);
160 $a_completed =
array();
163 include_once
'./Services/Object/classes/class.ilObjectLP.php';
165 $collection = $olp->getCollectionInstance();
167 $existing = self::_getObjectStatus($a_obj_id, $a_user_id);
169 foreach ($collection->getItems() as $item_id) {
170 if (isset($existing[$item_id])) {
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"));
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") .
")");
193 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)
foreach($_POST as $key=> $value) $res
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)