19declare(strict_types=0);
31 if (
sizeof($obj_refs)) {
32 $obj_ids = array_keys($obj_refs);
36 $view_modes = array();
37 $query =
"SELECT obj_id, view_mode FROM crs_settings" .
38 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
false,
"integer");
39 $set =
$ilDB->query($query);
40 while ($rec =
$ilDB->fetchAssoc($set)) {
41 $view_modes[(
int) $rec[
"obj_id"]] = (
int) $rec[
"view_mode"];
47 " status_changed, percentage, read_count+childs_read_count AS read_count, spent_seconds+childs_spent_seconds AS spent_seconds," .
48 " u_mode, type, visits, mark, u_comment" .
50 " LEFT JOIN ut_lp_settings ON (ut_lp_settings.obj_id = object_data.obj_id)" .
51 " LEFT JOIN read_event ON (read_event.obj_id = object_data.obj_id AND read_event.usr_id = " .
$ilDB->quote(
55 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.obj_id = object_data.obj_id AND ut_lp_marks.usr_id = " .
$ilDB->quote(
60 " WHERE " .
$ilDB->in(
67 $set =
$ilDB->query($query);
69 while ($rec =
$ilDB->fetchAssoc($set)) {
70 $rec[
"comment"] = $rec[
"u_comment"];
71 unset($rec[
"u_comment"]);
73 $rec[
"ref_ids"] = $obj_refs[(
int) $rec[
"obj_id"]];
74 $rec[
"status"] = (
int) $rec[
"status"];
75 $rec[
"percentage"] = (
int) $rec[
"percentage"];
76 $rec[
"read_count"] = (
int) $rec[
"read_count"];
77 $rec[
"spent_seconds"] = (
int) $rec[
"spent_seconds"];
78 $rec[
"u_mode"] = (
int) $rec[
"u_mode"];
80 if ($rec[
"type"] ==
"sess") {
81 $session = $sessions[(
int) $rec[
"obj_id"]];
82 $rec[
"title"] = $session[
"title"];
89 } elseif (!$rec[
"u_mode"]) {
91 $rec[
"u_mode"] = $olp->getCurrentMode();
107 array $a_objective_ids
119 $query =
"SELECT crs_id, crs_objectives.objective_id AS obj_id, title," .
$ilDB->quote(
123 " FROM crs_objectives" .
124 " WHERE " .
$ilDB->in(
125 "crs_objectives.objective_id",
130 " AND active = " .
$ilDB->quote(1,
"integer") .
131 " ORDER BY position";
132 $set =
$ilDB->query($query);
134 while ($rec =
$ilDB->fetchAssoc($set)) {
135 $rec[
'crs_id'] = (
int) $rec[
'crs_id'];
136 $rec[
'obj_id'] = (
int) $rec[
'obj_id'];
137 if (array_key_exists($rec[
"obj_id"], $lo_lp_status)) {
138 $rec[
"status"] = $lo_lp_status[$rec[
"obj_id"]];
150 int $a_parent_obj_id,
153 self::refreshObjectsStatus(array($a_parent_obj_id), array($a_user_id));
156 $scores_raw = $scores = array();
163 $scores_raw = $module->getTrackingDataAgg($a_user_id);
171 $scores_raw = $module->getTrackingDataAgg($a_user_id);
175 foreach ($scores_raw as $item) {
176 $scores[$item[
"sco_id"]] = $item[
"score"];
185 foreach ($a_sco_ids as $sco_id) {
187 if (in_array($a_user_id, $status_info[
"failed"][$sco_id])) {
191 $status_info[
"completed"][$sco_id]
196 $status_info[
"in_progress"][$sco_id]
203 $items[$sco_id] = array(
204 "title" => $status_info[
"scos_title"][$sco_id],
207 "score" => (
int) ($scores[$sco_id] ?? 0)
218 int $a_parent_obj_id,
221 self::refreshObjectsStatus(array($a_parent_obj_id), array($a_user_id));
227 $collection = $olp->getCollectionInstance();
231 $item_data = $collection->getPossibleItems(
$ref_id);
242 foreach ($a_item_ids as $item_id) {
243 if (!isset($item_data[$item_id])) {
247 if (in_array($a_user_id, ($status_info[
"completed"][$item_id] ?? []))) {
249 } elseif (in_array($a_user_id, ($status_info[
"in_progress"][$item_id] ?? []))) {
255 $items[$item_id] = array(
256 "title" => ($item_data[$item_id][
"title"] ??
''),
257 "status" => (
int) $status,
258 "type" => self::getSubItemType($a_parent_obj_id)
267 string $a_order_field =
"",
268 string $a_order_dir =
"",
271 ?array $a_filters =
null,
272 ?array $a_additional_fields =
null,
273 ?
int $check_agreement =
null,
274 ?array $privacy_fields =
null
280 $fields = array(
"usr_data.usr_id",
"login",
"active");
281 $udf = self::buildColumns($fields, $a_additional_fields);
284 $where[] =
"usr_data.usr_id <> " .
$ilDB->quote(
291 $a_users = self::getParticipantsForObject($a_ref_id);
294 self::refreshObjectsStatus(array($obj_id), $a_users);
296 if (is_array($a_users)) {
298 $where[] =
$ilDB->in(
"usr_data.usr_id", $a_users,
false,
"integer");
301 $query =
" FROM usr_data " . $left .
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
302 " AND read_event.obj_id = " .
$ilDB->quote(
306 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
307 " AND ut_lp_marks.obj_id = " .
$ilDB->quote(
311 " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " .
$ilDB->quote(
315 self::buildFilters($where, $a_filters);
317 $queries = array(array(
"fields" => $fields,
"query" => $query));
320 if ($a_order_field ==
"language") {
321 $a_order_field =
"usr_pref.value";
326 if (!$a_order_field) {
327 $a_order_field =
"login";
328 } elseif (substr($a_order_field, 0, 4) ==
"udf_") {
329 $udf_order = $a_order_field;
332 $result = self::executeQueries(
340 self::getUDFAndHandlePrivacy(
366 ?array $a_udf =
null,
367 ?
int $a_check_agreement =
null,
368 ?array $a_privacy_fields =
null,
369 ?array $a_filters =
null
375 if (!$a_result[
"cnt"]) {
379 if (is_array($a_udf) && count($a_udf) > 0) {
380 $query =
"SELECT usr_id, field_id, value FROM udf_text WHERE " .
$ilDB->in(
386 $set =
$ilDB->query($query);
388 while ($row =
$ilDB->fetchAssoc($set)) {
389 $udf[(
int) $row[
"usr_id"]][
"udf_" . $row[
"field_id"]] = $row[
"value"];
394 if ($a_check_agreement) {
401 $query =
"SELECT usr_id FROM usr_pref WHERE keyword = " .
$ilDB->quote(
405 " AND value = " .
$ilDB->quote(
408 ) .
" OR value = " .
$ilDB->quote(
"g",
"text");
409 $set =
$ilDB->query($query);
410 $all_public = array();
411 while ($row =
$ilDB->fetchAssoc($set)) {
412 $all_public[] = $row[
"usr_id"];
414 $query =
"SELECT usr_id,keyword FROM usr_pref WHERE " .
$ilDB->like(
420 " AND value = " .
$ilDB->quote(
423 ) .
" AND " .
$ilDB->in(
429 $set =
$ilDB->query($query);
431 while ($row =
$ilDB->fetchAssoc($set)) {
432 $public[$row[
"usr_id"]][] = substr($row[
"keyword"], 7);
437 foreach ($a_result[
"set"] as $idx => $row) {
439 if (isset($udf[$row[
"usr_id"]])) {
440 $a_result[
"set"][$idx] = $row = array_merge(
447 if (
sizeof($a_privacy_fields) && $a_check_agreement && !in_array(
451 foreach ($a_privacy_fields as $field) {
453 if (isset($row[$field]) && (!isset($public[$row[
"usr_id"]]) ||
454 !in_array($field, $public[$row[
"usr_id"]]))) {
456 if (isset($a_filters[$field])) {
458 foreach (array_keys($row) as $col_id) {
459 $a_result[
"set"][$idx][$col_id] =
null;
461 $a_result[
"set"][$idx][
"privacy_conflict"] =
true;
466 $a_result[
"set"][$idx][$field] =
false;
480 int $a_parent_obj_id,
481 int $a_parent_ref_id,
482 string $a_order_field =
"",
483 string $a_order_dir =
"",
486 ?array $a_filters =
null,
487 ?array $a_additional_fields =
null,
488 bool $use_collection =
true
494 $fields = array(
"object_data.obj_id",
"title",
"type");
495 self::buildColumns($fields, $a_additional_fields);
497 $objects = self::getObjectIds(
505 $query =
" FROM object_data LEFT JOIN read_event ON (object_data.obj_id = read_event.obj_id AND" .
506 " read_event.usr_id = " .
$ilDB->quote(
510 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = " .
$ilDB->quote(
514 " ut_lp_marks.obj_id = object_data.obj_id)" .
515 " WHERE " .
$ilDB->in(
516 "object_data.obj_id",
517 $objects[
"object_ids"],
521 self::buildFilters(array(), $a_filters);
524 $queries[] = array(
"fields" => $fields,
"query" => $query);
526 if (!in_array($a_order_field, $fields)) {
527 $a_order_field =
"title";
530 $result = self::executeQueries(
537 if ($result[
"cnt"]) {
539 $sessions = self::getSessionData(
541 $objects[
"object_ids"]
544 foreach ($result[
"set"] as $idx => $item) {
545 if ($item[
"type"] ==
"sess") {
546 $session = $sessions[(
int) $item[
"obj_id"]];
547 $result[
"set"][$idx][
"title"] = $session[
"title"];
548 $result[
"set"][$idx][
"sort_title"] = $session[
"e_start"];
552 $result[
"set"][$idx][
"ref_id"] = $objects[
"ref_ids"][(
int) $item[
"obj_id"]];
556 $item[
'title'] ==
'' &&
557 ($item[
'type'] ==
'catr' ||
558 $item[
'type'] ==
'crsr' ||
559 $item[
'type'] ==
'grpr')
561 $result[
'set'][$idx][
'title'] =
563 (
int) $item[
"obj_id"]
569 if ($objects[
"scorm"]) {
573 if ($subtype ==
"scorm2004") {
578 $scos_tracking = $sobj->getTrackingDataAgg(
587 $scos_tracking = array();
588 foreach ($sobj->getTrackingDataAgg($a_user_id) as $item) {
591 $time = explode(
":", $item[
"time"]);
592 $item[
"time"] = $time[0] * 60 * 60 + $time[1] * 60 + $time[2];
594 $scos_tracking[(
int) $item[
"sco_id"]] = array(
"session_time" => $item[
"time"]);
598 foreach ($objects[
"scorm"][
"scos"] as $sco) {
599 $row = array(
"title" => $objects[
"scorm"][
"scos_title"][$sco],
606 $objects[
"scorm"][
"completed"][$sco]
611 $objects[
"scorm"][
"failed"][$sco]
616 $objects[
"scorm"][
"in_progress"][$sco]
620 $row[
"status"] = $status;
623 if (isset($scos_tracking[$sco])) {
624 if (isset($scos_tracking[$sco][
"last_access"])) {
626 $scos_tracking[$sco][
"last_access"],
631 $row[
"spent_seconds"] = $scos_tracking[$sco][
"session_time"];
634 $result[
"set"][] = $row;
635 $result[
"cnt"] = ($result[
"cnt"] ?? 0) + 1;
640 if ($objects[
"objectives_parent_id"]) {
642 $objects[
"objectives_parent_id"],
645 foreach (self::getObjectivesStatusForUser(
647 $objects[
"objectives_parent_id"],
650 $result[
"set"][] = $item;
651 $result[
"cnt"] = ($result[
"cnt"] ?? 0) + 1;
656 if ($objects[
"subitems"]) {
657 $sub_type = self::getSubItemType($a_parent_obj_id);
658 foreach ($objects[
"subitems"][
"items"] as $item_id) {
659 $row = array(
"title" => $objects[
"subitems"][
"item_titles"][$item_id],
666 $objects[
"subitems"][
"completed"][(
int) $item_id]
670 $row[
"status"] = $status;
672 $result[
"set"][] = $row;
673 $result[
"cnt"] = ($result[
"cnt"] ?? 0) + 1;
705 $query =
"SELECT obj_id, title, e_start, e_end, CASE WHEN participated = 1 THEN 2 WHEN registered = 1 THEN 1 ELSE NULL END AS status," .
708 " JOIN event_appointment ON (event.obj_id = event_appointment.event_id)" .
709 " LEFT JOIN event_participants ON (event_participants.event_id = event.obj_id AND usr_id = " .
$ilDB->quote(
713 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
false,
"integer");
714 $set =
$ilDB->query($query);
716 while ($rec =
$ilDB->fetchAssoc($set)) {
717 $rec[
"comment"] = $rec[
"e_comment"];
718 unset($rec[
"e_comment"]);
730 $rec[
"title"] = $date .
': ' . $rec[
"title"];
732 $rec[
"title"] = $date;
734 $sessions[(
int) $rec[
"obj_id"]] = $rec;
744 int $a_parent_obj_id,
745 int $a_parent_ref_id,
746 string $a_order_field =
"",
747 string $a_order_dir =
"",
750 ?array $a_filters =
null,
751 ?array $a_additional_fields =
null,
752 ?array $a_preselected_obj_ids =
null
759 self::buildColumns($fields, $a_additional_fields,
true);
762 if ($a_preselected_obj_ids ===
null) {
763 $objects = self::getObjectIds(
770 foreach ($a_preselected_obj_ids as $obj_id => $ref_ids) {
771 $objects[
"object_ids"][] = $obj_id;
772 $objects[
"ref_ids"][$obj_id] = array_pop($ref_ids);
781 "SELECT obj_id,title,type FROM object_data" .
782 " WHERE " .
$ilDB->in(
784 $objects[
"object_ids"],
789 while ($rec =
$ilDB->fetchAssoc($set)) {
790 $object_data[(
int) $rec[
"obj_id"]] = $rec;
791 if ($a_preselected_obj_ids) {
792 $object_data[(
int) $rec[
"obj_id"]][
"ref_ids"] = $a_preselected_obj_ids[(
int) $rec[
"obj_id"]];
794 $object_data[(
int) $rec[
"obj_id"]][
"ref_ids"] = array($objects[
"ref_ids"][(
int) $rec[
"obj_id"]]);
798 foreach ($objects[
"ref_ids"] as $object_id =>
$ref_id) {
799 $object_result = self::getSummaryDataForObject(
804 if (
sizeof($object_result)) {
805 if ($object_data[$object_id]) {
806 $result[] = array_merge(
807 $object_data[$object_id],
816 return array(
"cnt" =>
sizeof($result),
"set" => $result);
822 ?array $a_filters =
null
829 $where[] =
"usr_data.usr_id <> " .
$ilDB->quote(
835 $a_users = self::getParticipantsForObject($a_ref_id);
838 if (is_array($a_users)) {
840 $where[] =
$ilDB->in(
"usr_data.usr_id", $a_users,
false,
"integer");
844 self::refreshObjectsStatus(array($obj_id), $a_users);
846 $query =
" FROM usr_data " . $left .
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
847 " AND obj_id = " .
$ilDB->quote($obj_id,
"integer") .
")" .
848 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
849 " AND ut_lp_marks.obj_id = " .
$ilDB->quote(
853 " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " .
$ilDB->quote(
857 self::buildFilters($where, $a_filters,
true);
859 $fields[] =
'COUNT(usr_data.usr_id) AS user_count';
862 $queries[] = array(
"fields" => $fields,
867 $result = self::executeQueries($queries);
868 $result = (array) ($result[
'set'][0] ?? []);
869 $users_no = $result[
"user_count"] ?? 0;
874 } elseif (isset($a_filters[
"user_total"])) {
875 if ($a_filters[
"user_total"][
"from"] && $users_no < $a_filters[
"user_total"][
"from"]) {
877 } elseif ($a_filters[
"user_total"][
"to"] && $users_no > $a_filters[
"user_total"][
"to"]) {
883 $result[
"country"] = self::getSummaryPercentages(
887 $result[
"city"] = self::getSummaryPercentages(
"city", $query);
888 $result[
"gender"] = self::getSummaryPercentages(
"gender", $query);
889 $result[
"language"] = self::getSummaryPercentages(
894 $result[
"status"] = self::getSummaryPercentages(
"status", $query);
895 $result[
"mark"] = self::getSummaryPercentages(
"mark", $query);
901 $result[
"user_total"] = $users_no;
913 ?
string $alias =
null
920 $field_alias = $field;
922 $field_alias = $alias;
923 $alias =
" AS " . $alias;
929 "/" . preg_quote(
" [[--HAVING") .
"(.+)" . preg_quote(
935 $having =
" HAVING " . $hits[1];
936 $base_query = str_replace($hits[0],
"", $base_query);
939 $query =
"SELECT COUNT(*) AS counter, " . $field . $alias .
" " . $base_query .
" GROUP BY " . $field . $having .
" ORDER BY counter DESC";
940 $set =
$ilDB->query($query);
942 while ($rec =
$ilDB->fetchAssoc($set)) {
943 $result[$rec[$field_alias]] = (
int) $rec[
"counter"];
957 $tree =
$DIC[
'tree'];
965 $members_read =
false;
968 $members_read =
true;
970 $members = $olp->getMembers();
975 $members_read =
true;
977 $members = $member_obj->getMembers();
984 $members_read =
true;
986 $members = $iass->loadMembers()->membersIds();
991 $path = $tree->getPathId($a_ref_id);
993 foreach (array_reverse(
$path) as $path_ref_id) {
995 if ($type ==
"crs" || $type ==
"grp") {
996 $members_read =
true;
997 $members = self::getParticipantsForObject($path_ref_id);
1004 if ($members_read) {
1006 $members = self::filterOutUsersWithoutData($members);
1009 )->filterUserIdsByRbacOrPositionOfCurrentUser(
1010 'read_learning_progress',
1011 'read_learning_progress',
1020 switch ($obj_type) {
1023 if ($subtype ==
"scorm2004") {
1026 $all = $mod->getTrackedUsers(
"");
1029 foreach ($all as $item) {
1030 $a_users[] = $item[
"user_id"];
1041 $a_users = $members->getMembers();
1049 $a_users = $class::getParticipants($obj_id);
1057 $a_users = $class::getParticipants($obj_id);
1062 $a_users = $prg->getIdsOfUsersWithRelevantProgress();
1069 if (is_null($a_users)) {
1074 $a_users = self::filterOutUsersWithoutData($a_users);
1078 )->filterUserIdsByRbacOrPositionOfCurrentUser(
1079 'read_learning_progress',
1080 'read_learning_progress',
1103 $DIC->logger()->trac()->info(
1104 'Excluded user with id ' .
$user_id .
1105 ' from participants, because they do not have an entry in usr_data.'
1113 ?array $a_filters =
null,
1114 bool $a_aggregate =
false
1122 if (is_array($a_filters) &&
sizeof($a_filters) > 0) {
1123 foreach ($a_filters as
$id => $value) {
1132 case "matriculation":
1135 $where[] =
$ilDB->like(
1145 $where[] =
"usr_data." .
$id .
" = " .
$ilDB->quote(
1152 $where[] =
$ilDB->like(
1153 "ut_lp_marks." .
$id,
1162 $where[] =
"(ut_lp_marks.status = " .
$ilDB->quote(
1166 " OR ut_lp_marks.status IS NULL)";
1173 $where[] =
"ut_lp_marks." .
$id .
" = " .
$ilDB->quote(
1180 if (!$a_aggregate) {
1181 if (isset($value[
"from"])) {
1182 $where[] =
"ut_lp_marks." .
$id .
" >= " .
$ilDB->quote(
1187 if (isset($value[
"to"])) {
1188 $where[] =
"(ut_lp_marks." .
$id .
" <= " .
$ilDB->quote(
1192 " OR ut_lp_marks." .
$id .
" IS NULL)";
1195 if (isset($value[
"from"])) {
1196 $having[] =
"ROUND(AVG(ut_lp_marks." .
$id .
")) >= " .
$ilDB->quote(
1201 if (isset($value[
"to"])) {
1202 $having[] =
"ROUND(AVG(ut_lp_marks." .
$id .
")) <= " .
$ilDB->quote(
1211 $where[] =
"usr_pref.value = " .
$ilDB->quote(
1219 if (isset($value[
"from"])) {
1220 $value[
"from"] = substr(
1229 $value[
"from"] = $value[
"from"]->get(
IL_CAL_UNIX);
1231 if (isset($value[
"to"])) {
1232 if (strlen($value[
"to"]) == 19) {
1233 $value[
"to"] = substr(
1248 case 'status_changed':
1251 case "registration":
1252 if (
$id ==
"registration") {
1253 $id =
"create_date";
1259 case "first_access":
1261 if (isset($value[
"from"])) {
1262 $where[] =
$id .
" >= " .
$ilDB->quote(
1267 if (isset($value[
"to"])) {
1268 if (strlen($value[
"to"]) == 19) {
1269 $value[
"to"] = substr(
1275 $where[] =
$id .
" <= " .
$ilDB->quote(
1283 if (!$a_aggregate) {
1284 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1285 $where[] =
"(read_event." .
$id .
"+read_event.childs_" .
$id .
") >= " .
$ilDB->quote(
1290 if (isset($value[
"to"])) {
1291 $where[] =
"((read_event." .
$id .
"+read_event.childs_" .
$id .
") <= " .
$ilDB->quote(
1295 " OR (read_event." .
$id .
"+read_event.childs_" .
$id .
") IS NULL)";
1298 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1299 $having[] =
"IFNULL(SUM(read_event." .
$id .
"+read_event.childs_" .
$id .
"),0) >= " .
$ilDB->quote(
1304 if (isset($value[
"to"])) {
1305 $having[] =
"IFNULL(SUM(read_event." .
$id .
"+read_event.childs_" .
$id .
"),0) <= " .
$ilDB->quote(
1313 case "spent_seconds":
1314 if (!$a_aggregate) {
1315 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1316 $where[] =
"(read_event." .
$id .
"+read_event.childs_" .
$id .
") >= " .
$ilDB->quote(
1321 if (isset($value[
"to"]) && $value[
"to"] > 0) {
1322 $where[] =
"((read_event." .
$id .
"+read_event.childs_" .
$id .
") <= " .
$ilDB->quote(
1326 " OR (read_event." .
$id .
"+read_event.childs_" .
$id .
") IS NULL)";
1329 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1330 $having[] =
"ROUND(AVG(read_event." .
$id .
"+read_event.childs_" .
$id .
")) >= " .
$ilDB->quote(
1335 if (isset($value[
"to"]) && $value[
"to"] > 0) {
1336 $having[] =
"ROUND(AVG(read_event." .
$id .
"+read_event.childs_" .
$id .
")) <= " .
$ilDB->quote(
1352 if (
sizeof($where)) {
1353 $sql .=
" WHERE " . implode(
" AND ", $where);
1355 if (
sizeof($having)) {
1357 $sql .=
" [[--HAVING " . implode(
" AND ", $having) .
" HAVING--]]";
1365 ?array $a_additional_fields =
null,
1366 bool $a_aggregate =
false
1368 if ($a_additional_fields === null || !count($a_additional_fields)) {
1372 foreach ($a_additional_fields as $field) {
1373 if (substr($field, 0, 4) !=
"udf_") {
1376 $pos = strrpos($field,
"_");
1377 if ($pos ===
false) {
1380 $function = strtoupper(substr($field, $pos + 1));
1381 $field = substr($field, 0, $pos);
1384 array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")
1396 $a_fields[] = $function .
"(value) " . $field .
"_" . strtolower(
1400 $a_fields[] =
"value as " . $field;
1405 case "spent_seconds":
1407 $a_fields[] =
"(" . $field .
"+childs_" . $field .
") " . $field;
1409 if ($function ==
"AVG") {
1410 $a_fields[] =
"ROUND(AVG(" . $field .
"+childs_" . $field .
"), 2) " . $field .
"_" . strtolower(
1414 $a_fields[] = $function .
"(COALESCE(" . $field .
", 0) + COALESCE(childs_" . $field .
", 0)) " . $field .
"_" . strtolower(
1421 case "read_count_spent_seconds":
1422 if ($function ==
"AVG") {
1423 $a_fields[] =
"ROUND(AVG((spent_seconds+childs_spent_seconds)/(read_count+childs_read_count)), 2) " . $field .
"_" . strtolower(
1431 if ($function ==
"AVG") {
1432 $a_fields[] =
"ROUND(AVG(" . $field .
"), 2) " . $field .
"_" . strtolower(
1436 $a_fields[] = $function .
"(" . $field .
") " . $field .
"_" . strtolower(
1441 $a_fields[] = $field;
1446 $udf[] = substr($field, 4);
1451 $a_fields = array_unique($a_fields);
1453 $udf = array_unique($udf);
1468 int $a_parent_obj_id,
1469 int $a_parent_ref_id,
1470 bool $use_collection =
true,
1471 bool $a_refresh_status =
true,
1472 ?array $a_user_ids =
null
1474 $object_ids = array($a_parent_obj_id);
1475 $ref_ids = array($a_parent_obj_id => $a_parent_ref_id);
1476 $objectives_parent_id = $scorm = $subitems =
false;
1479 $mode = $olp->getCurrentMode();
1483 $status_scorm = get_class(
1489 $scorm = $status_scorm::_getStatusInfo($a_parent_obj_id);
1494 $objectives_parent_id = $a_parent_obj_id;
1501 $status_coll_tlt = get_class(
1504 $subitems = $status_coll_tlt::_getStatusInfo($a_parent_obj_id);
1509 if ($use_collection) {
1510 $collection = $olp->getCollectionInstance();
1512 foreach ($collection->getItems() as $child_ref_id) {
1514 $object_ids[] = $child_id;
1515 $ref_ids[$child_id] = $child_ref_id;
1520 self::getSubTree($a_parent_ref_id, $object_ids, $ref_ids);
1521 $object_ids = array_unique($object_ids);
1524 foreach ($object_ids as $idx => $object_id) {
1526 unset($object_ids[$idx]);
1532 if ($a_refresh_status) {
1533 self::refreshObjectsStatus($object_ids, $a_user_ids);
1536 return array(
"object_ids" => $object_ids,
1537 "ref_ids" => $ref_ids,
1538 "objectives_parent_id" => $objectives_parent_id,
1540 "subitems" => $subitems
1548 int $a_parent_ref_id,
1549 array &$a_object_ids,
1554 $tree =
$DIC[
'tree'];
1556 $children = $tree->getChilds($a_parent_ref_id);
1558 foreach ($children as $child) {
1559 if ($child[
"type"] ==
"adm" || $child[
"type"] ==
"rolf") {
1567 $cmode = $olp->getCurrentMode();
1570 $a_object_ids[] = $child[
"obj_id"];
1571 $a_ref_ids[$child[
"obj_id"]] = $child[
"ref_id"];
1574 self::getSubTree($child[
"ref_id"], $a_object_ids, $a_ref_ids);
1590 string $a_order_field =
"",
1591 string $a_order_dir =
"",
1599 $subqueries = array();
1600 foreach ($queries as $item) {
1602 $item[
'query'] = str_replace(
"[[--HAVING",
"HAVING", $item[
'query']);
1603 $item[
'query'] = str_replace(
"HAVING--]]",
"", $item[
'query']);
1605 if (!isset($item[
"count"])) {
1606 $count_field = $item[
"fields"];
1607 $count_field = array_shift($count_field);
1609 $count_field = $item[
"count"];
1611 $count_query =
"SELECT COUNT(" . $count_field .
") AS cnt" . $item[
"query"];
1612 $set =
$ilDB->query($count_query);
1613 if ($rec =
$ilDB->fetchAssoc($set)) {
1614 $cnt += $rec[
"cnt"];
1617 $subqueries[] =
"SELECT " . implode(
1626 if (
sizeof($subqueries) > 1) {
1627 $base = array_shift($subqueries);
1628 $query = $base .
" UNION (" . implode(
1633 $query = $subqueries[0];
1636 if ($a_order_dir !=
"asc" && $a_order_dir !=
"desc") {
1637 $a_order_dir =
"asc";
1639 if ($a_order_field) {
1640 $query .=
" ORDER BY " . $a_order_field .
" " . strtoupper(
1645 $offset = $a_offset;
1647 $ilDB->setLimit($limit, $offset);
1648 $set =
$ilDB->query($query);
1649 while ($rec =
$ilDB->fetchAssoc($set)) {
1654 return array(
"cnt" => $cnt,
"set" => $result);
1668 int $a_parent_ref_id,
1670 ?
string $a_user_filter =
null,
1671 ?array $a_additional_fields =
null,
1672 ?array $a_privacy_fields =
null,
1673 ?
int $a_check_agreement =
null
1678 $result = array(
"cnt" => 0,
"set" =>
null);
1679 if (
sizeof($a_obj_ids)) {
1681 $where[] =
"usr_data.usr_id <> " .
$ilDB->quote(
1685 if ($a_user_filter) {
1686 $where[] =
$ilDB->like(
1689 "%" . $a_user_filter .
"%"
1695 $a_users = self::getParticipantsForObject($a_parent_ref_id);
1696 if (is_array($a_users)) {
1698 $where[] =
$ilDB->in(
1707 self::refreshObjectsStatus($a_obj_ids, $a_users);
1709 $fields = array(
"usr_data.usr_id",
"login",
"active");
1710 $udf = self::buildColumns($fields, $a_additional_fields);
1713 $fields[] =
"percentage";
1716 foreach ($a_obj_ids as $obj_id) {
1718 $query =
" FROM usr_data " . $left .
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
1719 " AND read_event.obj_id = " .
$ilDB->quote(
1723 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
1724 " AND ut_lp_marks.obj_id = " .
$ilDB->quote(
1728 " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " .
$ilDB->quote(
1732 self::buildFilters($where);
1734 $raw = self::executeQueries(
1735 array(array(
"fields" => $fields,
"query" => $query)),
1740 foreach ($raw[
"set"] as $row) {
1741 $result[
"set"][(
int) $row[
"usr_id"]][
"login"] = ($row[
"login"] ??
'');
1742 $result[
"set"][(
int) $row[
"usr_id"]][
"usr_id"] = (
int) ($row[
"usr_id"] ?? 0);
1745 $result[
"set"][(
int) $row[
"usr_id"]][
"obj_" . $obj_id] = (
int) ($row[
"status"] ?? 0);
1746 $result[
"set"][(
int) $row[
"usr_id"]][
"obj_" . $obj_id .
"_perc"] = (
int) ($row[
"percentage"] ?? 0);
1747 if ($obj_id == $parent_obj_id) {
1748 $result[
"set"][(
int) $row[
"usr_id"]][
"status_changed"] = (
int) ($row[
"status_changed"] ?? 0);
1749 $result[
"set"][(
int) $row[
"usr_id"]][
"last_access"] = (
int) ($row[
"last_access"] ?? 0);
1750 $result[
"set"][(
int) $row[
"usr_id"]][
"spent_seconds"] = (
int) ($row[
"spent_seconds"] ?? 0);
1751 $result[
"set"][(
int) $row[
"usr_id"]][
"read_count"] = (
int) ($row[
"read_count"] ?? 0);
1755 foreach ($fields as $field) {
1757 if (stristr($field,
"language")) {
1758 $field =
"language";
1761 if (isset($row[$field])) {
1763 if ($obj_id == $parent_obj_id ||
1766 array(
"mark",
"u_comment")
1768 $result[
"set"][(
int) $row[
"usr_id"]][$field] = $row[$field];
1777 if (is_array($result[
"set"])) {
1778 $result[
"cnt"] = count($result[
"set"]);
1780 $result[
"users"] = $a_users;
1782 self::getUDFAndHandlePrivacy(
1787 $a_additional_fields
1794 int $a_parent_obj_id,
1801 if ($a_parent_obj_id && $a_users) {
1811 $initial_qualifying = $lo_set->isInitialTestQualifying();
1814 foreach ($objective_ids as $objective_id) {
1820 $query =
"SELECT * FROM loc_user_results" .
1821 " WHERE " .
$ilDB->in(
1827 " AND " .
$ilDB->in(
"user_id", $a_users,
false,
"integer");
1828 if (!$initial_qualifying) {
1829 $query .=
" AND type = " .
$ilDB->quote(
1834 $query .=
" ORDER BY type";
1835 $set =
$ilDB->query($query);
1836 while ($row =
$ilDB->fetchAssoc($set)) {
1837 $objective_id = (
int) $row[
"objective_id"];
1860 ?
string $a_month =
null
1866 $obj_ids = array_keys($a_ref_ids);
1875 $sql =
"SELECT obj_id," . $column .
",SUM(read_count) read_count,SUM(childs_read_count) childs_read_count," .
1876 "SUM(spent_seconds) spent_seconds,SUM(childs_spent_seconds) childs_spent_seconds" .
1878 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
"",
"integer") .
1879 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
1881 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
1883 $sql .=
" GROUP BY obj_id," . $column;
1884 $set =
$ilDB->query($sql);
1885 while ($row =
$ilDB->fetchAssoc($set)) {
1886 $row[
"read_count"] += (
int) $row[
"childs_read_count"];
1887 $row[
"spent_seconds"] += (
int) $row[
"childs_spent_seconds"];
1888 $res[$row[
"obj_id"]][$row[$column]][
"read_count"] =
1889 (
$res[$row[
"obj_id"]][$row[$column]][
"read_count"] ?? 0) + $row[
"read_count"];
1890 $res[$row[
"obj_id"]][$row[$column]][
"spent_seconds"] =
1891 (
$res[$row[
"obj_id"]][$row[$column]][
"spent_seconds"] ?? 0) + $row[
"spent_seconds"];
1896 $sql =
"SELECT obj_id," . $column .
",SUM(counter) counter" .
1897 " FROM obj_user_stat" .
1898 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
"",
"integer") .
1899 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
1901 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
1903 $sql .=
" GROUP BY obj_id," . $column;
1904 $set =
$ilDB->query($sql);
1905 while ($row =
$ilDB->fetchAssoc($set)) {
1906 if (!isset(
$res[(
int) $row[
"obj_id"]][$row[$column]][
"users"])) {
1907 $res[(
int) $row[
"obj_id"]][$row[$column]][
"users"] = 0;
1909 $res[(
int) $row[
"obj_id"]][$row[$column]][
"users"] += (
int) $row[
"counter"];
1920 $objDefinition =
$DIC[
'objDefinition'];
1923 $types = array_keys(
1924 $objDefinition->getCreatableSubObjects(
1932 $sql =
"SELECT " . $tree->getObjectDataTable(
1933 ) .
".obj_id," . $tree->getObjectDataTable() .
".type," .
1934 $tree->getTreeTable() .
"." . $tree->getTreePk(
1935 ) .
"," . $tree->getTableReference() .
".ref_id" .
1936 " FROM " . $tree->getTreeTable() .
1937 " " . $tree->buildJoin() .
1938 " WHERE " .
$ilDB->in(
1939 $tree->getObjectDataTable() .
".type",
1944 $set =
$ilDB->query($sql);
1946 while ($row =
$ilDB->fetchAssoc($set)) {
1947 $res[$row[
"type"]][
"type"] = (string) $row[
"type"];
1948 $res[$row[
"type"]][
"references"] = (
$res[$row[
"type"]][
"references"] ?? 0) + 1;
1949 $res[$row[
"type"]][
"objects"][] = (
int) $row[
"obj_id"];
1950 if ($row[$tree->getTreePk()] < 0) {
1951 $res[$row[
"type"]][
"deleted"] = (
$res[$row[
"type"]][
"deleted"] ?? 0) + 1;
1953 $res[$row[
"type"]][
"deleted"] = (
$res[$row[
"type"]][
"deleted"] ?? 0);
1957 foreach (
$res as $type => $values) {
1958 $res[$type][
"objects"] = count((array_unique($values[
"objects"] ?? [])));
1962 foreach (self::getPortfolios() as $obj_id) {
1963 $res[
"prtf"][
"type"] =
"prtf";
1964 $res[
"prtf"][
"references"] = (
$res[
"prtf"][
"references"] ?? 0) + 1;
1965 $res[
"prtf"][
"objects"] = (
$res[
"prtf"][
"objects"] ?? 0) + 1;
1968 foreach (self::getWorkspaceBlogs() as $obj_id) {
1969 $res[
"blog"][
"type"] =
"blog";
1970 $res[
"blog"][
"references"] = (
$res[
"blog"][
"references"] ?? 0) + 1;
1971 $res[
"blog"][
"objects"] = (
$res[
"blog"][
"objects"] ?? 0) + 1;
1985 $sql =
"SELECT od.obj_id,oref.wsp_id,od.type" .
1986 " FROM tree_workspace wst" .
1987 " JOIN object_reference_ws oref ON (oref.wsp_id = wst.child)" .
1988 " JOIN object_data od ON (oref.obj_id = od.obj_id)" .
1989 " WHERE od.type = " .
$ilDB->quote(
"blog",
"text");
1992 $sql .=
" AND " .
$ilDB->like(
1995 "%" . $a_title .
"%"
1999 $set =
$ilDB->query($sql);
2000 while ($row =
$ilDB->fetchAssoc($set)) {
2001 $res[] = (
int) $row[
"obj_id"];
2014 $sql =
"SELECT od.obj_id" .
2015 " FROM usr_portfolio prtf" .
2016 " JOIN object_data od ON (od.obj_id = prtf.id)";
2019 $sql .=
" WHERE " .
$ilDB->like(
2022 "%" . $a_title .
"%"
2026 $set =
$ilDB->query($sql);
2027 while ($row =
$ilDB->fetchAssoc($set)) {
2028 $res[] = (
int) $row[
"obj_id"];
2037 ?
string $a_month =
null
2042 $obj_ids = array_keys($a_ref_ids);
2045 $sql =
"SELECT obj_id,hh,SUM(read_count) read_count,SUM(childs_read_count) childs_read_count," .
2046 "SUM(spent_seconds) spent_seconds,SUM(childs_spent_seconds) childs_spent_seconds" .
2048 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
false,
"integer") .
2049 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
2051 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
2053 $sql .=
" GROUP BY obj_id,hh";
2054 $set =
$ilDB->query($sql);
2055 while ($row =
$ilDB->fetchAssoc($set)) {
2056 $row[
"read_count"] += (
int) $row[
"childs_read_count"];
2057 $row[
"spent_seconds"] += (
int) $row[
"childs_spent_seconds"];
2058 $res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"read_count"] =
2059 (
$res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"read_count"] ?? 0) + $row[
"read_count"];
2060 $res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"spent_seconds"] =
2061 (
$res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"spent_seconds"] ?? 0) + $row[
"spent_seconds"];
2072 $set =
$ilDB->query(
2073 "SELECT COUNT(*) AS COUNTER,yyyy,mm" .
2075 " GROUP BY yyyy, mm" .
2076 " ORDER BY yyyy DESC, mm DESC"
2079 while ($row =
$ilDB->fetchAssoc($set)) {
2080 $res[] = array(
"month" => $row[
"yyyy"] .
"-" . $row[
"mm"],
2081 "count" => (
int) ($row[
"COUNTER"] ?? 0)
2094 $date_compare =
$ilDB->in(
2096 array(array(
"yyyy",
""),
2097 array(
$ilDB->quote(
"-",
"text"),
""),
2105 $sql =
"DELETE FROM obj_stat" .
2106 " WHERE " . $date_compare;
2107 $ilDB->manipulate($sql);
2110 $tables = array(
"obj_lp_stat",
"obj_type_stat",
"obj_user_stat");
2111 foreach ($a_months as $month) {
2112 $year = substr($month, 0, 4);
2113 $month = substr($month, 5);
2114 $from = $year . str_pad($month, 2,
"0", STR_PAD_LEFT) .
"01";
2115 $to = $year . str_pad($month, 2,
"0", STR_PAD_LEFT) .
"31";
2117 foreach ($tables as $table) {
2118 $sql =
"DELETE FROM " . $table .
2119 " WHERE fulldate >= " .
$ilDB->quote($from,
"integer") .
2120 " AND fulldate <= " .
$ilDB->quote($to,
"integer");
2121 $ilDB->manipulate($sql);
2128 ?
string $a_title =
null,
2129 ?
int $a_root =
null,
2130 ?array $a_hidden =
null,
2131 ?array $a_preset_obj_ids =
null
2136 $tree =
$DIC->repositoryTree();
2138 if ($a_type ==
"lres") {
2139 $a_type = array(
'lm',
'sahs',
'htlm');
2142 $sql =
"SELECT r.ref_id,r.obj_id" .
2143 " FROM object_data o" .
2144 " JOIN object_reference r ON (o.obj_id = r.obj_id)" .
2145 " JOIN tree t ON (t.child = r.ref_id)" .
2146 " WHERE t.tree = " .
$ilDB->quote(1,
"integer");
2148 if (!is_array($a_type)) {
2149 $sql .=
" AND o.type = " .
$ilDB->quote($a_type,
"text");
2151 $sql .=
" AND " .
$ilDB->in(
"o.type", $a_type,
false,
"text");
2155 $sql .=
" AND (" .
$ilDB->like(
2158 "%" . $a_title .
"%"
2160 " OR " .
$ilDB->like(
2163 "%" . $a_title .
"%"
2167 if (is_array($a_hidden)) {
2168 $sql .=
" AND " .
$ilDB->in(
"o.obj_id", $a_hidden,
true,
"integer");
2171 if (is_array($a_preset_obj_ids)) {
2172 $sql .=
" AND " .
$ilDB->in(
2180 $set =
$ilDB->query($sql);
2182 while ($row =
$ilDB->fetchAssoc($set)) {
2187 if ($tree->isGrandChild($a_root,
$ref_id)) {
2188 $res[$row[
"obj_id"]][] = (
int) $row[
"ref_id"];
2192 $res[$row[
"obj_id"]][] = (
int) $row[
"ref_id"];
2203 ?array $a_users =
null
2205 foreach ($a_obj_ids as $obj_id) {
2218 $set =
$ilDB->query(
2219 "SELECT COUNT(*) counter, MIN(tstamp) tstamp" .
2220 " FROM obj_stat_log"
2222 return $ilDB->fetchAssoc($set);
2228 ?
int $a_month =
null,
2229 bool $a_group_by_day =
false
2234 if ($a_group_by_day) {
2237 $column =
"mm,yyyy";
2241 $sql =
"SELECT obj_id," . $column .
"," .
2242 "MIN(mem_cnt) mem_cnt_min,AVG(mem_cnt) mem_cnt_avg, MAX(mem_cnt) mem_cnt_max," .
2243 "MIN(in_progress) in_progress_min,AVG(in_progress) in_progress_avg,MAX(in_progress) in_progress_max," .
2244 "MIN(completed) completed_min,AVG(completed) completed_avg,MAX(completed) completed_max," .
2245 "MIN(failed) failed_min,AVG(failed) failed_avg,MAX(failed) failed_max," .
2246 "MIN(not_attempted) not_attempted_min,AVG(not_attempted) not_attempted_avg,MAX(not_attempted) not_attempted_max" .
2247 " FROM obj_lp_stat" .
2248 " WHERE " .
$ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer") .
2249 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
2251 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
2253 $sql .=
" GROUP BY obj_id," . $column;
2254 $set =
$ilDB->query($sql);
2255 while ($row =
$ilDB->fetchAssoc($set)) {
2256 $row[
'obj_id'] = (
int) $row[
'obj_id'];
2264 string $a_aggregation,
2265 ?
string $a_year =
null
2272 $a_year = date(
"Y");
2275 $agg = strtoupper($a_aggregation);
2278 $sql =
"SELECT type,yyyy,mm," . $agg .
"(cnt_objects) cnt_objects," . $agg .
"(cnt_references) cnt_references," .
2279 "" . $agg .
"(cnt_deleted) cnt_deleted FROM obj_type_stat" .
2280 " WHERE yyyy = " .
$ilDB->quote($a_year,
"integer") .
2281 " GROUP BY type,yyyy,mm";
2282 $set =
$ilDB->query($sql);
2283 while ($row =
$ilDB->fetchAssoc($set)) {
2284 $row[
"mm"] = str_pad($row[
"mm"], 2,
"0", STR_PAD_LEFT);
2285 $res[$row[
"type"]][$row[
"yyyy"] .
"-" . $row[
"mm"]] = array(
2286 "objects" => (
int) $row[
"cnt_objects"],
2287 "references" => (
int) $row[
"cnt_references"],
2288 "deleted" => (
int) $row[
"cnt_deleted"]
2299 $db =
$DIC->database();
2300 $query =
'select min(yyyy) min from obj_type_stat';
2301 $res = $db->query($query);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
static _lookupTargetTitle(int $a_obj_id)
const IL_CRS_VIEW_OBJECTIVE
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
static getInstanceByObjId(int $a_obj_id)
static getObjectiveStatusForLP(int $a_user_id, int $a_obj_id, array $a_objective_ids)
const LP_MODE_COLLECTION_TLT
const LP_MODE_SURVEY_FINISHED
const LP_MODE_TEST_FINISHED
const LP_MODE_COLLECTION_MANUAL
const LP_MODE_COLLECTION_MOBS
static _getInstance(int $a_obj_id, ?int $a_mode=null)
static _getClassById(int $a_obj_id, ?int $a_mode=null)
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
static checkStatusForObject(int $a_obj_id, ?array $a_users=null)
This function checks whether the status for a given number of users is dirty and must be recalculated...
const LP_STATUS_FAILED_NUM
static lookupAcceptedAgreements(int $a_obj_id)
Lookup users who have accepted the agreement.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
static _getTrackedUsers(int $a_obj_id)
Get all tracked users.
static userExists(array $a_usr_ids=[])
static getInstance(int $obj_id)
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static getInstance(int $a_ref_id)
static getObjectLPStatistics(array $a_obj_ids, int $a_year, ?int $a_month=null, bool $a_group_by_day=false)
static filterOutUsersWithoutData(array $user_ids)
static getUserDataForObject(int $a_ref_id, string $a_order_field="", string $a_order_dir="", int $a_offset=0, int $a_limit=9999, ?array $a_filters=null, ?array $a_additional_fields=null, ?int $check_agreement=null, ?array $privacy_fields=null)
static getSCOsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_sco_ids)
static getParticipantsForObject(int $a_ref_id)
Get participant ids for given object.
static getUserObjectiveMatrix(int $a_parent_obj_id, array $a_users)
static getObjectAccessStatistics(array $a_ref_ids, string $a_year, ?string $a_month=null)
static getSessionData(int $a_user_id, array $obj_ids)
Get session data for given objects and user.
static getObjectsSummaryForObject(int $a_parent_obj_id, int $a_parent_ref_id, string $a_order_field="", string $a_order_dir="", int $a_offset=0, int $a_limit=9999, ?array $a_filters=null, ?array $a_additional_fields=null, ?array $a_preselected_obj_ids=null)
Get all aggregated tracking data for parent object :TODO: sorting, offset, limit, objectives,...
static buildColumns(array &$a_fields, ?array $a_additional_fields=null, bool $a_aggregate=false)
static getSummaryDataForObject(int $a_ref_id, array $fields, ?array $a_filters=null)
static getObjectTypeStatistics()
static getObjectTypeStatisticsPerMonth(string $a_aggregation, ?string $a_year=null)
static getObjectStatisticsMonthlySummary()
static getUDFAndHandlePrivacy(array &$a_result, ?array $a_udf=null, ?int $a_check_agreement=null, ?array $a_privacy_fields=null, ?array $a_filters=null)
Handle privacy and add udf data to (user) result data.
static buildFilters(array $where, ?array $a_filters=null, bool $a_aggregate=false)
static getObjectTypeStatisticsMinYear()
static getWorkspaceBlogs(?string $a_title=null)
static getObjectivesStatusForUser(int $a_user_id, int $a_obj_id, array $a_objective_ids)
static getPortfolios(?string $a_title=null)
static searchObjects(string $a_type, ?string $a_title=null, ?int $a_root=null, ?array $a_hidden=null, ?array $a_preset_obj_ids=null)
static getObjectsDataForUser(int $a_user_id, int $a_parent_obj_id, int $a_parent_ref_id, string $a_order_field="", string $a_order_dir="", int $a_offset=0, int $a_limit=9999, ?array $a_filters=null, ?array $a_additional_fields=null, bool $use_collection=true)
Get all object-based tracking data for user and parent object.
static getSubTree(int $a_parent_ref_id, array &$a_object_ids, array &$a_ref_ids)
Get complete branch of tree (recursively)
static getObjectIds(int $a_parent_obj_id, int $a_parent_ref_id, bool $use_collection=true, bool $a_refresh_status=true, ?array $a_user_ids=null)
Get (sub)objects for given object, also handles learning objectives (course only)
static getObjectStatisticsLogInfo()
Get last update info for object statistics.
static getSummaryPercentages(string $field, string $base_query, ?string $alias=null)
Get aggregated data for field.
static refreshObjectsStatus(array $a_obj_ids, ?array $a_users=null)
check whether status (for all relevant users) exists
static getSubItemsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_item_ids)
Get subitems status.
static executeQueries(array $queries, string $a_order_field="", string $a_order_dir="", int $a_offset=0, int $a_limit=9999)
Execute given queries, including count query.
static getUserObjectMatrix(int $a_parent_ref_id, array $a_obj_ids, ?string $a_user_filter=null, ?array $a_additional_fields=null, ?array $a_privacy_fields=null, ?int $a_check_agreement=null)
Get status matrix for users on objects.
static getSubItemType(int $a_parent_obj_id)
Get sub-item object type for parent.
static getObjectDailyStatistics(array $a_ref_ids, string $a_year, ?string $a_month=null)
static getObjectsStatusForUser(int $a_user_id, array $obj_refs)
static deleteObjectStatistics(array $a_months)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
if(!file_exists('../ilias.ini.php'))