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)
60 $status_info = array();
62 include_once
"Services/Object/classes/class.ilObjectLP.php";
64 $collection = $olp->getCollectionInstance();
66 $status_info[
"items"] = $collection->getItems($a_obj_id);
68 include_once
'./Services/MetaData/classes/class.ilMDEducational.php';
69 foreach ($status_info[
"items"] as $item_id) {
70 $status_info[
"in_progress"][$item_id] = array();
71 $status_info[
"completed"][$item_id] = array();
77 $ref_id = end($ref_ids);
78 $possible_items = $collection->getPossibleItems($ref_id);
79 $chapter_ids = array_intersect(
80 array_keys($possible_items),
85 $status_info[
"items"] = $chapter_ids;
88 foreach ($chapter_ids as $item_id) {
89 $status_info[
"item_titles"][$item_id] = $possible_items[$item_id][
"title"];
92 $set =
$ilDB->query(
"SELECT obj_id,usr_id,spent_seconds" .
93 " FROM lm_read_event" .
94 " WHERE " .
$ilDB->in(
"obj_id", $chapter_ids,
"",
"integer"));
96 if (
$row[
"spent_seconds"] < $status_info[
"tlt"][
$row[
"obj_id"]]) {
97 $status_info[
"in_progress"][$row[
"obj_id"]][] = $row[
"usr_id"];
99 $status_info[
"completed"][$row[
"obj_id"]][] = $row[
"usr_id"];
102 if ($a_include_tlt_data) {
103 $status_info[
"tlt_users"][$row[
"obj_id"]][$row[
"usr_id"]] = $row[
"spent_seconds"];
109 if (!$a_include_tlt_data) {
110 unset($status_info[
"tlt"]);
118 $info = self::_getStatusInfo($a_obj_id);
120 $completed_once =
false;
122 if (is_array(
$info[
"completed"])) {
124 foreach (
$info[
"completed"] as $user_ids) {
126 if (!in_array($a_user_id, $user_ids)) {
130 $completed_once =
true;
134 return self::LP_STATUS_COMPLETED_NUM;
139 if ($completed_once) {
140 return self::LP_STATUS_IN_PROGRESS_NUM;
143 if (is_array(
$info[
"in_progress"])) {
144 foreach (
$info[
"in_progress"] as $user_ids) {
145 if (in_array($a_user_id, $user_ids)) {
146 return self::LP_STATUS_IN_PROGRESS_NUM;
151 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
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)