4 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
22 if (is_array($status_info[
'in_progress'])) {
23 foreach ($status_info[
'in_progress'] as $in_progress) {
40 foreach ($status_info[
'items'] as $item_id) {
41 $tmp_users = $status_info[
'completed'][$item_id];
54 public static function _getStatusInfo($a_obj_id, $a_include_tlt_data =
false)
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 include_once
'./Services/MetaData/classes/class.ilMDEducational.php';
67 foreach ($status_info[
"items"] as $item_id) {
68 $status_info[
"in_progress"][$item_id] =
array();
69 $status_info[
"completed"][$item_id] =
array();
75 $ref_id = end($ref_ids);
76 $possible_items = $collection->getPossibleItems($ref_id);
77 $chapter_ids = array_intersect(
78 array_keys($possible_items),
83 $status_info[
"items"] = $chapter_ids;
86 foreach ($chapter_ids as $item_id) {
87 $status_info[
"item_titles"][$item_id] = $possible_items[$item_id][
"title"];
90 $set = $ilDB->query(
"SELECT obj_id,usr_id,spent_seconds" .
91 " FROM lm_read_event" .
92 " WHERE " . $ilDB->in(
"obj_id", $chapter_ids,
"",
"integer"));
93 while (
$row = $ilDB->fetchAssoc($set)) {
94 if (
$row[
"spent_seconds"] < $status_info[
"tlt"][
$row[
"obj_id"]]) {
95 $status_info[
"in_progress"][$row[
"obj_id"]][] = $row[
"usr_id"];
97 $status_info[
"completed"][$row[
"obj_id"]][] = $row[
"usr_id"];
100 if ($a_include_tlt_data) {
101 $status_info[
"tlt_users"][$row[
"obj_id"]][$row[
"usr_id"]] = $row[
"spent_seconds"];
107 if (!$a_include_tlt_data) {
108 unset($status_info[
"tlt"]);
116 $info = self::_getStatusInfo($a_obj_id);
118 $completed_once =
false;
120 if (is_array(
$info[
"completed"])) {
122 foreach (
$info[
"completed"] as $user_ids) {
124 if (!in_array($a_user_id, $user_ids)) {
128 $completed_once =
true;
132 return self::LP_STATUS_COMPLETED_NUM;
137 if ($completed_once) {
138 return self::LP_STATUS_IN_PROGRESS_NUM;
141 if (is_array(
$info[
"in_progress"])) {
142 foreach (
$info[
"in_progress"] as $user_ids) {
143 if (in_array($a_user_id, $user_ids)) {
144 return self::LP_STATUS_IN_PROGRESS_NUM;
149 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)