4 require_once
'Services/Tracking/classes/class.ilLPStatus.php';
5 require_once
'Services/Tracking/classes/class.ilLearningProgress.php';
18 if (is_array($status_info[
"user_status"][
"in_progress"])) {
19 $users = $status_info[
"user_status"][
"in_progress"];
29 if (is_array($status_info[
"user_status"][
"completed"])) {
30 $users = $status_info[
"user_status"][
"completed"];
44 $coll_items = self::getCollectionItems($a_parent_obj_id,
true);
46 $res[
"items"] = array_keys($coll_items);
47 if (
sizeof(
$res[
"items"])) {
49 foreach ($coll_items as $mob_id => $item) {
50 $res[
"item_titles"][$mob_id] = $item[
"title"];
54 foreach (
$res[
"items"] as $mob_id) {
55 $res[
"completed"][$mob_id] = array();
56 $res[
"in_progress"][$mob_id] = array();
59 $set =
$ilDB->query(
"SELECT obj_id, usr_id FROM read_event" .
60 " WHERE " .
$ilDB->in(
"obj_id",
$res[
"items"],
"",
"integer"));
62 $res[
"completed"][
$row[
"obj_id"]][] = $row[
"usr_id"];
67 foreach (
$res[
"items"] as $mob_id) {
68 foreach (
$res[
"completed"][$mob_id] as $user_id) {
69 $tmp[$user_id][] = $mob_id;
72 foreach ($tmp as $user_id => $completed_items) {
73 if (
sizeof($completed_items) ==
sizeof(
$res[
"items"])) {
74 $res[
"user_status"][
"completed"][] = $user_id;
76 $res[
"user_status"][
"in_progress"][] = $user_id;
81 include_once
'./Services/Tracking/classes/class.ilChangeEvent.php';
83 foreach (
$users as $user_id) {
84 if ((!is_array(
$res[
"user_status"][
"in_progress"]) || !in_array($user_id,
$res[
"user_status"][
"in_progress"])) &&
85 (!is_array(
$res[
"user_status"][
"completed"]) || !in_array($user_id,
$res[
"user_status"][
"completed"]))) {
86 $res[
"user_status"][
"in_progress"][] = $user_id;
97 include_once
'./Services/Object/classes/class.ilObjectLP.php';
99 $collection = $olp->getCollectionInstance();
101 $possible = $collection->getPossibleItems();
105 $collection->getItems(),
106 array_keys($possible)
109 if ($a_include_titles) {
110 foreach (
$valid as $item_id) {
111 $res[$item_id] = $possible[$item_id];
125 $ilDB = $DIC[
'ilDB'];
127 $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
130 $status = self::LP_STATUS_IN_PROGRESS_NUM;
134 $items = self::getCollectionItems($a_obj_id);
135 if (
sizeof($items)) {
140 $set =
$ilDB->query(
"SELECT obj_id FROM read_event" .
141 " WHERE usr_id = " .
$ilDB->quote($a_user_id,
"integer") .
142 " AND " .
$ilDB->in(
"obj_id", $items,
"",
"integer"));
144 $found[] =
$row[
"obj_id"];
147 if (
sizeof($found)) {
148 $status = self::LP_STATUS_IN_PROGRESS_NUM;
150 if (
sizeof($found) ==
sizeof($items)) {
151 $status = self::LP_STATUS_COMPLETED_NUM;
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
static _getCompleted($a_obj_id)
static getCollectionItems($a_obj_id, $a_include_titles=false)
foreach($_POST as $key=> $value) $res
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
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 ...
static _getStatusInfo($a_parent_obj_id)
static _getInProgress($a_obj_id)
static getInstance($a_obj_id)
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.