4 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
22 if(is_array($status_info[
'in_progress']))
24 foreach($status_info[
'in_progress'] as $in_progress)
26 $users = array_merge($users,$in_progress);
28 $users = array_unique($users);
42 foreach($status_info[
'items'] as $item_id)
44 $tmp_users = $status_info[
'completed'][$item_id];
52 $users = array_intersect($users,$tmp_users);
55 $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 include_once
'./Services/MetaData/classes/class.ilMDEducational.php';
74 foreach($status_info[
"items"] as $item_id)
76 $status_info[
"in_progress"][$item_id] =
array();
77 $status_info[
"completed"][$item_id] =
array();
84 $possible_items = $collection->getPossibleItems(
$ref_id);
85 $chapter_ids = array_intersect(array_keys($possible_items),
86 $status_info[
"items"]);
89 $status_info[
"items"] = $chapter_ids;
93 foreach($chapter_ids as $item_id)
95 $status_info[
"item_titles"][$item_id] = $possible_items[$item_id][
"title"];
98 $set = $ilDB->query(
"SELECT obj_id,usr_id,spent_seconds".
99 " FROM lm_read_event".
100 " WHERE ".$ilDB->in(
"obj_id", $chapter_ids,
"",
"integer"));
101 while(
$row = $ilDB->fetchAssoc($set))
103 if(
$row[
"spent_seconds"] < $status_info[
"tlt"][
$row[
"obj_id"]])
105 $status_info[
"in_progress"][$row[
"obj_id"]][] = $row[
"usr_id"];
109 $status_info[
"completed"][$row[
"obj_id"]][] = $row[
"usr_id"];
112 if($a_include_tlt_data)
114 $status_info[
"tlt_users"][$row[
"obj_id"]][$row[
"usr_id"]] = $row[
"spent_seconds"];
120 if(!$a_include_tlt_data)
122 unset($status_info[
"tlt"]);
130 $info = self::_getStatusInfo($a_obj_id);
132 $completed_once =
false;
134 if(is_array(
$info[
"completed"]))
137 foreach(
$info[
"completed"] as $user_ids)
140 if(!in_array($a_user_id, $user_ids))
147 $completed_once =
true;
152 return self::LP_STATUS_COMPLETED_NUM;
159 return self::LP_STATUS_IN_PROGRESS_NUM;
162 if(is_array(
$info[
"in_progress"]))
164 foreach(
$info[
"in_progress"] as $user_ids)
166 if(in_array($a_user_id, $user_ids))
168 return self::LP_STATUS_IN_PROGRESS_NUM;
173 return self::LP_STATUS_NOT_ATTEMPTED_NUM;
static _getCompleted($a_obj_id)
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
static _getAllReferences($a_id)
get all reference ids of object
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.
static _getStatusInfo($a_obj_id, $a_include_tlt_data=false)
static _getInProgress($a_obj_id)
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
static getInstance($a_obj_id)