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;
335 array_merge([
"login",
"active",
"usr_pref.value"], $a_additional_fields)
337 $a_order_field =
"login";
340 $result = self::executeQueries(
348 self::getUDFAndHandlePrivacy(
374 ?array $a_udf =
null,
375 ?
int $a_check_agreement =
null,
376 ?array $a_privacy_fields =
null,
377 ?array $a_filters =
null
383 if (!$a_result[
"cnt"]) {
387 if (is_array($a_udf) && count($a_udf) > 0) {
388 $query =
"SELECT usr_id, field_id, value FROM udf_text WHERE " .
$ilDB->in(
394 $set =
$ilDB->query($query);
396 while ($row =
$ilDB->fetchAssoc($set)) {
397 $udf[(
int) $row[
"usr_id"]][
"udf_" . $row[
"field_id"]] = $row[
"value"];
402 if ($a_check_agreement) {
409 $query =
"SELECT usr_id FROM usr_pref WHERE keyword = " .
$ilDB->quote(
413 " AND value = " .
$ilDB->quote(
416 ) .
" OR value = " .
$ilDB->quote(
"g",
"text");
417 $set =
$ilDB->query($query);
418 $all_public = array();
419 while ($row =
$ilDB->fetchAssoc($set)) {
420 $all_public[] = $row[
"usr_id"];
422 $query =
"SELECT usr_id,keyword FROM usr_pref WHERE " .
$ilDB->like(
428 " AND value = " .
$ilDB->quote(
431 ) .
" AND " .
$ilDB->in(
437 $set =
$ilDB->query($query);
439 while ($row =
$ilDB->fetchAssoc($set)) {
440 $public[$row[
"usr_id"]][] = substr($row[
"keyword"], 7);
445 foreach ($a_result[
"set"] as $idx => $row) {
447 if (isset($udf[$row[
"usr_id"]])) {
448 $a_result[
"set"][$idx] = $row = array_merge(
455 if (
sizeof($a_privacy_fields) && $a_check_agreement && !in_array(
459 foreach ($a_privacy_fields as $field) {
461 if (isset($row[$field]) && (!isset($public[$row[
"usr_id"]]) ||
462 !in_array($field, $public[$row[
"usr_id"]]))) {
464 if (isset($a_filters[$field])) {
466 foreach (array_keys($row) as $col_id) {
467 $a_result[
"set"][$idx][$col_id] =
null;
469 $a_result[
"set"][$idx][
"privacy_conflict"] =
true;
474 $a_result[
"set"][$idx][$field] =
false;
488 int $a_parent_obj_id,
489 int $a_parent_ref_id,
490 string $a_order_field =
"",
491 string $a_order_dir =
"",
494 ?array $a_filters =
null,
495 ?array $a_additional_fields =
null,
496 bool $use_collection =
true
502 $fields = array(
"object_data.obj_id",
"title",
"type");
503 self::buildColumns($fields, $a_additional_fields);
505 $objects = self::getObjectIds(
513 $query =
" FROM object_data LEFT JOIN read_event ON (object_data.obj_id = read_event.obj_id AND" .
514 " read_event.usr_id = " .
$ilDB->quote(
518 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = " .
$ilDB->quote(
522 " ut_lp_marks.obj_id = object_data.obj_id)" .
523 " WHERE " .
$ilDB->in(
524 "object_data.obj_id",
525 $objects[
"object_ids"],
529 self::buildFilters(array(), $a_filters);
532 $queries[] = array(
"fields" => $fields,
"query" => $query);
534 if (!in_array($a_order_field, $fields)) {
535 $a_order_field =
"title";
538 $result = self::executeQueries(
545 if ($result[
"cnt"]) {
547 $sessions = self::getSessionData(
549 $objects[
"object_ids"]
552 foreach ($result[
"set"] as $idx => $item) {
553 if ($item[
"type"] ==
"sess") {
554 $session = $sessions[(
int) $item[
"obj_id"]];
555 $result[
"set"][$idx][
"title"] = $session[
"title"];
556 $result[
"set"][$idx][
"sort_title"] = $session[
"e_start"];
560 $result[
"set"][$idx][
"ref_id"] = $objects[
"ref_ids"][(
int) $item[
"obj_id"]];
564 $item[
'title'] ==
'' &&
565 ($item[
'type'] ==
'catr' ||
566 $item[
'type'] ==
'crsr' ||
567 $item[
'type'] ==
'grpr')
569 $result[
'set'][$idx][
'title'] =
571 (
int) $item[
"obj_id"]
577 if ($objects[
"scorm"]) {
581 if ($subtype ==
"scorm2004") {
586 $scos_tracking = $sobj->getTrackingDataAgg(
595 $scos_tracking = array();
596 foreach ($sobj->getTrackingDataAgg($a_user_id) as $item) {
599 $time = explode(
":", $item[
"time"]);
600 $item[
"time"] = $time[0] * 60 * 60 + $time[1] * 60 + $time[2];
602 $scos_tracking[(
int) $item[
"sco_id"]] = array(
"session_time" => $item[
"time"]);
606 foreach ($objects[
"scorm"][
"scos"] as $sco) {
607 $row = array(
"title" => $objects[
"scorm"][
"scos_title"][$sco],
614 $objects[
"scorm"][
"completed"][$sco]
619 $objects[
"scorm"][
"failed"][$sco]
624 $objects[
"scorm"][
"in_progress"][$sco]
628 $row[
"status"] = $status;
631 if (isset($scos_tracking[$sco])) {
632 if (isset($scos_tracking[$sco][
"last_access"])) {
634 $scos_tracking[$sco][
"last_access"],
639 $row[
"spent_seconds"] = $scos_tracking[$sco][
"session_time"];
642 $result[
"set"][] = $row;
643 $result[
"cnt"] = ($result[
"cnt"] ?? 0) + 1;
648 if ($objects[
"objectives_parent_id"]) {
650 $objects[
"objectives_parent_id"],
653 foreach (self::getObjectivesStatusForUser(
655 $objects[
"objectives_parent_id"],
658 $result[
"set"][] = $item;
659 $result[
"cnt"] = ($result[
"cnt"] ?? 0) + 1;
664 if ($objects[
"subitems"]) {
665 $sub_type = self::getSubItemType($a_parent_obj_id);
666 foreach ($objects[
"subitems"][
"items"] as $item_id) {
667 $row = array(
"title" => $objects[
"subitems"][
"item_titles"][$item_id],
674 $objects[
"subitems"][
"completed"][(
int) $item_id]
678 $row[
"status"] = $status;
680 $result[
"set"][] = $row;
681 $result[
"cnt"] = ($result[
"cnt"] ?? 0) + 1;
713 $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," .
716 " JOIN event_appointment ON (event.obj_id = event_appointment.event_id)" .
717 " LEFT JOIN event_participants ON (event_participants.event_id = event.obj_id AND usr_id = " .
$ilDB->quote(
721 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
false,
"integer");
722 $set =
$ilDB->query($query);
724 while ($rec =
$ilDB->fetchAssoc($set)) {
725 $rec[
"comment"] = $rec[
"e_comment"];
726 unset($rec[
"e_comment"]);
738 $rec[
"title"] = $date .
': ' . $rec[
"title"];
740 $rec[
"title"] = $date;
742 $sessions[(
int) $rec[
"obj_id"]] = $rec;
752 int $a_parent_obj_id,
753 int $a_parent_ref_id,
754 string $a_order_field =
"",
755 string $a_order_dir =
"",
758 ?array $a_filters =
null,
759 ?array $a_additional_fields =
null,
760 ?array $a_preselected_obj_ids =
null
767 self::buildColumns($fields, $a_additional_fields,
true);
770 if ($a_preselected_obj_ids ===
null) {
771 $objects = self::getObjectIds(
778 foreach ($a_preselected_obj_ids as $obj_id => $ref_ids) {
779 $objects[
"object_ids"][] = $obj_id;
780 $objects[
"ref_ids"][$obj_id] = array_pop($ref_ids);
789 "SELECT obj_id,title,type FROM object_data" .
790 " WHERE " .
$ilDB->in(
792 $objects[
"object_ids"],
797 while ($rec =
$ilDB->fetchAssoc($set)) {
798 $object_data[(
int) $rec[
"obj_id"]] = $rec;
799 if ($a_preselected_obj_ids) {
800 $object_data[(
int) $rec[
"obj_id"]][
"ref_ids"] = $a_preselected_obj_ids[(
int) $rec[
"obj_id"]];
802 $object_data[(
int) $rec[
"obj_id"]][
"ref_ids"] = array($objects[
"ref_ids"][(
int) $rec[
"obj_id"]]);
806 foreach ($objects[
"ref_ids"] as $object_id =>
$ref_id) {
807 $object_result = self::getSummaryDataForObject(
812 if (
sizeof($object_result)) {
813 if ($object_data[$object_id]) {
814 $result[] = array_merge(
815 $object_data[$object_id],
824 return array(
"cnt" =>
sizeof($result),
"set" => $result);
830 ?array $a_filters =
null
837 $where[] =
"usr_data.usr_id <> " .
$ilDB->quote(
843 $a_users = self::getParticipantsForObject($a_ref_id);
846 if (is_array($a_users)) {
848 $where[] =
$ilDB->in(
"usr_data.usr_id", $a_users,
false,
"integer");
852 self::refreshObjectsStatus(array($obj_id), $a_users);
854 $query =
" FROM usr_data " . $left .
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
855 " AND obj_id = " .
$ilDB->quote($obj_id,
"integer") .
")" .
856 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
857 " AND ut_lp_marks.obj_id = " .
$ilDB->quote(
861 " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " .
$ilDB->quote(
865 self::buildFilters($where, $a_filters,
true);
867 $fields[] =
'COUNT(usr_data.usr_id) AS user_count';
870 $queries[] = array(
"fields" => $fields,
875 $result = self::executeQueries($queries);
876 $result = (array) ($result[
'set'][0] ?? []);
877 $users_no = $result[
"user_count"] ?? 0;
882 } elseif (isset($a_filters[
"user_total"])) {
883 if ($a_filters[
"user_total"][
"from"] && $users_no < $a_filters[
"user_total"][
"from"]) {
885 } elseif ($a_filters[
"user_total"][
"to"] && $users_no > $a_filters[
"user_total"][
"to"]) {
891 $result[
"country"] = self::getSummaryPercentages(
895 $result[
"city"] = self::getSummaryPercentages(
"city", $query);
896 $result[
"gender"] = self::getSummaryPercentages(
"gender", $query);
897 $result[
"language"] = self::getSummaryPercentages(
902 $result[
"status"] = self::getSummaryPercentages(
"status", $query);
903 $result[
"mark"] = self::getSummaryPercentages(
"mark", $query);
909 $result[
"user_total"] = $users_no;
921 ?
string $alias =
null
928 $field_alias = $field;
930 $field_alias = $alias;
931 $alias =
" AS " . $alias;
937 "/" . preg_quote(
" [[--HAVING") .
"(.+)" . preg_quote(
943 $having =
" HAVING " . $hits[1];
944 $base_query = str_replace($hits[0],
"", $base_query);
947 $query =
"SELECT COUNT(*) AS counter, " . $field . $alias .
" " . $base_query .
" GROUP BY " . $field . $having .
" ORDER BY counter DESC";
948 $set =
$ilDB->query($query);
950 while ($rec =
$ilDB->fetchAssoc($set)) {
951 $result[$rec[$field_alias]] = (
int) $rec[
"counter"];
965 $tree =
$DIC[
'tree'];
973 $members_read =
false;
976 $members_read =
true;
978 $members = $olp->getMembers();
983 $members_read =
true;
985 $members = $member_obj->getMembers();
992 $members_read =
true;
994 $members = $iass->loadMembers()->membersIds();
999 $path = $tree->getPathId($a_ref_id);
1001 foreach (array_reverse(
$path) as $path_ref_id) {
1003 if ($type ==
"crs" || $type ==
"grp") {
1004 $members_read =
true;
1005 $members = self::getParticipantsForObject($path_ref_id);
1012 if ($members_read) {
1014 $members = self::filterOutUsersWithoutData($members);
1017 )->filterUserIdsByRbacOrPositionOfCurrentUser(
1018 'read_learning_progress',
1019 'read_learning_progress',
1028 switch ($obj_type) {
1031 if ($subtype ==
"scorm2004") {
1034 $all = $mod->getTrackedUsers(
"");
1037 foreach ($all as $item) {
1038 $a_users[] = $item[
"user_id"];
1049 $a_users = $members->getMembers();
1057 $a_users = $class::getParticipants($obj_id);
1065 $a_users = $class::getParticipants($obj_id);
1070 $a_users = $prg->getIdsOfUsersWithRelevantProgress();
1077 if (is_null($a_users)) {
1082 $a_users = self::filterOutUsersWithoutData($a_users);
1086 )->filterUserIdsByRbacOrPositionOfCurrentUser(
1087 'read_learning_progress',
1088 'read_learning_progress',
1111 $DIC->logger()->trac()->info(
1112 'Excluded user with id ' .
$user_id .
1113 ' from participants, because they do not have an entry in usr_data.'
1121 ?array $a_filters =
null,
1122 bool $a_aggregate =
false
1130 if (is_array($a_filters) &&
sizeof($a_filters) > 0) {
1131 foreach ($a_filters as
$id => $value) {
1140 case "matriculation":
1143 $where[] =
$ilDB->like(
1153 $where[] =
"usr_data." .
$id .
" = " .
$ilDB->quote(
1160 $where[] =
$ilDB->like(
1161 "ut_lp_marks." .
$id,
1170 $where[] =
"(ut_lp_marks.status = " .
$ilDB->quote(
1174 " OR ut_lp_marks.status IS NULL)";
1181 $where[] =
"ut_lp_marks." .
$id .
" = " .
$ilDB->quote(
1188 if (!$a_aggregate) {
1189 if (isset($value[
"from"])) {
1190 $where[] =
"ut_lp_marks." .
$id .
" >= " .
$ilDB->quote(
1195 if (isset($value[
"to"])) {
1196 $where[] =
"(ut_lp_marks." .
$id .
" <= " .
$ilDB->quote(
1200 " OR ut_lp_marks." .
$id .
" IS NULL)";
1203 if (isset($value[
"from"])) {
1204 $having[] =
"ROUND(AVG(ut_lp_marks." .
$id .
")) >= " .
$ilDB->quote(
1209 if (isset($value[
"to"])) {
1210 $having[] =
"ROUND(AVG(ut_lp_marks." .
$id .
")) <= " .
$ilDB->quote(
1219 $where[] =
"usr_pref.value = " .
$ilDB->quote(
1227 if (isset($value[
"from"])) {
1228 $value[
"from"] = substr(
1237 $value[
"from"] = $value[
"from"]->get(
IL_CAL_UNIX);
1239 if (isset($value[
"to"])) {
1240 if (strlen($value[
"to"]) == 19) {
1241 $value[
"to"] = substr(
1256 case 'status_changed':
1259 case "registration":
1260 if (
$id ==
"registration") {
1261 $id =
"create_date";
1267 case "first_access":
1269 if (isset($value[
"from"])) {
1270 $where[] =
$id .
" >= " .
$ilDB->quote(
1275 if (isset($value[
"to"])) {
1276 if (strlen($value[
"to"]) == 19) {
1277 $value[
"to"] = substr(
1283 $where[] =
$id .
" <= " .
$ilDB->quote(
1291 if (!$a_aggregate) {
1292 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1293 $where[] =
"(read_event." .
$id .
"+read_event.childs_" .
$id .
") >= " .
$ilDB->quote(
1298 if (isset($value[
"to"])) {
1299 $where[] =
"((read_event." .
$id .
"+read_event.childs_" .
$id .
") <= " .
$ilDB->quote(
1303 " OR (read_event." .
$id .
"+read_event.childs_" .
$id .
") IS NULL)";
1306 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1307 $having[] =
"IFNULL(SUM(read_event." .
$id .
"+read_event.childs_" .
$id .
"),0) >= " .
$ilDB->quote(
1312 if (isset($value[
"to"])) {
1313 $having[] =
"IFNULL(SUM(read_event." .
$id .
"+read_event.childs_" .
$id .
"),0) <= " .
$ilDB->quote(
1321 case "spent_seconds":
1322 if (!$a_aggregate) {
1323 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1324 $where[] =
"(read_event." .
$id .
"+read_event.childs_" .
$id .
") >= " .
$ilDB->quote(
1329 if (isset($value[
"to"]) && $value[
"to"] > 0) {
1330 $where[] =
"((read_event." .
$id .
"+read_event.childs_" .
$id .
") <= " .
$ilDB->quote(
1334 " OR (read_event." .
$id .
"+read_event.childs_" .
$id .
") IS NULL)";
1337 if (isset($value[
"from"]) && $value[
"from"] > 0) {
1338 $having[] =
"ROUND(AVG(read_event." .
$id .
"+read_event.childs_" .
$id .
")) >= " .
$ilDB->quote(
1343 if (isset($value[
"to"]) && $value[
"to"] > 0) {
1344 $having[] =
"ROUND(AVG(read_event." .
$id .
"+read_event.childs_" .
$id .
")) <= " .
$ilDB->quote(
1360 if (
sizeof($where)) {
1361 $sql .=
" WHERE " . implode(
" AND ", $where);
1363 if (
sizeof($having)) {
1365 $sql .=
" [[--HAVING " . implode(
" AND ", $having) .
" HAVING--]]";
1373 ?array $a_additional_fields =
null,
1374 bool $a_aggregate =
false
1376 if ($a_additional_fields === null || !count($a_additional_fields)) {
1380 foreach ($a_additional_fields as $field) {
1381 if (substr($field, 0, 4) !=
"udf_") {
1384 $pos = strrpos($field,
"_");
1385 if ($pos ===
false) {
1388 $function = strtoupper(substr($field, $pos + 1));
1389 $field = substr($field, 0, $pos);
1392 array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")
1404 $a_fields[] = $function .
"(value) " . $field .
"_" . strtolower(
1408 $a_fields[] =
"value as " . $field;
1413 case "spent_seconds":
1415 $a_fields[] =
"(" . $field .
"+childs_" . $field .
") " . $field;
1417 if ($function ==
"AVG") {
1418 $a_fields[] =
"ROUND(AVG(" . $field .
"+childs_" . $field .
"), 2) " . $field .
"_" . strtolower(
1422 $a_fields[] = $function .
"(COALESCE(" . $field .
", 0) + COALESCE(childs_" . $field .
", 0)) " . $field .
"_" . strtolower(
1429 case "read_count_spent_seconds":
1430 if ($function ==
"AVG") {
1431 $a_fields[] =
"ROUND(AVG((spent_seconds+childs_spent_seconds)/(read_count+childs_read_count)), 2) " . $field .
"_" . strtolower(
1439 if ($function ==
"AVG") {
1440 $a_fields[] =
"ROUND(AVG(" . $field .
"), 2) " . $field .
"_" . strtolower(
1444 $a_fields[] = $function .
"(" . $field .
") " . $field .
"_" . strtolower(
1449 $a_fields[] = $field;
1454 $udf[] = substr($field, 4);
1459 $a_fields = array_unique($a_fields);
1461 $udf = array_unique($udf);
1476 int $a_parent_obj_id,
1477 int $a_parent_ref_id,
1478 bool $use_collection =
true,
1479 bool $a_refresh_status =
true,
1480 ?array $a_user_ids =
null
1482 $object_ids = array($a_parent_obj_id);
1483 $ref_ids = array($a_parent_obj_id => $a_parent_ref_id);
1484 $objectives_parent_id = $scorm = $subitems =
false;
1487 $mode = $olp->getCurrentMode();
1491 $status_scorm = get_class(
1497 $scorm = $status_scorm::_getStatusInfo($a_parent_obj_id);
1502 $objectives_parent_id = $a_parent_obj_id;
1509 $status_coll_tlt = get_class(
1512 $subitems = $status_coll_tlt::_getStatusInfo($a_parent_obj_id);
1517 if ($use_collection) {
1518 $collection = $olp->getCollectionInstance();
1520 foreach ($collection->getItems() as $child_ref_id) {
1522 $object_ids[] = $child_id;
1523 $ref_ids[$child_id] = $child_ref_id;
1528 self::getSubTree($a_parent_ref_id, $object_ids, $ref_ids);
1529 $object_ids = array_unique($object_ids);
1532 foreach ($object_ids as $idx => $object_id) {
1534 unset($object_ids[$idx]);
1540 if ($a_refresh_status) {
1541 self::refreshObjectsStatus($object_ids, $a_user_ids);
1544 return array(
"object_ids" => $object_ids,
1545 "ref_ids" => $ref_ids,
1546 "objectives_parent_id" => $objectives_parent_id,
1548 "subitems" => $subitems
1556 int $a_parent_ref_id,
1557 array &$a_object_ids,
1562 $tree =
$DIC[
'tree'];
1564 $children = $tree->getChilds($a_parent_ref_id);
1566 foreach ($children as $child) {
1567 if ($child[
"type"] ==
"adm" || $child[
"type"] ==
"rolf") {
1575 $cmode = $olp->getCurrentMode();
1578 $a_object_ids[] = $child[
"obj_id"];
1579 $a_ref_ids[$child[
"obj_id"]] = $child[
"ref_id"];
1582 self::getSubTree($child[
"ref_id"], $a_object_ids, $a_ref_ids);
1598 string $a_order_field =
"",
1599 string $a_order_dir =
"",
1607 $subqueries = array();
1608 foreach ($queries as $item) {
1610 $item[
'query'] = str_replace(
"[[--HAVING",
"HAVING", $item[
'query']);
1611 $item[
'query'] = str_replace(
"HAVING--]]",
"", $item[
'query']);
1613 if (!isset($item[
"count"])) {
1614 $count_field = $item[
"fields"];
1615 $count_field = array_shift($count_field);
1617 $count_field = $item[
"count"];
1619 $count_query =
"SELECT COUNT(" . $count_field .
") AS cnt" . $item[
"query"];
1620 $set =
$ilDB->query($count_query);
1621 if ($rec =
$ilDB->fetchAssoc($set)) {
1622 $cnt += $rec[
"cnt"];
1625 $subqueries[] =
"SELECT " . implode(
1634 if (
sizeof($subqueries) > 1) {
1635 $base = array_shift($subqueries);
1636 $query = $base .
" UNION (" . implode(
1641 $query = $subqueries[0];
1644 if ($a_order_dir !=
"asc" && $a_order_dir !=
"desc") {
1645 $a_order_dir =
"asc";
1647 if ($a_order_field) {
1648 $query .=
" ORDER BY " . $a_order_field .
" " . strtoupper(
1653 $offset = $a_offset;
1655 $ilDB->setLimit($limit, $offset);
1656 $set =
$ilDB->query($query);
1657 while ($rec =
$ilDB->fetchAssoc($set)) {
1662 return array(
"cnt" => $cnt,
"set" => $result);
1676 int $a_parent_ref_id,
1678 ?
string $a_user_filter =
null,
1679 ?array $a_additional_fields =
null,
1680 ?array $a_privacy_fields =
null,
1681 ?
int $a_check_agreement =
null
1686 $result = array(
"cnt" => 0,
"set" =>
null);
1687 if (
sizeof($a_obj_ids)) {
1689 $where[] =
"usr_data.usr_id <> " .
$ilDB->quote(
1693 if ($a_user_filter) {
1694 $where[] =
$ilDB->like(
1697 "%" . $a_user_filter .
"%"
1703 $a_users = self::getParticipantsForObject($a_parent_ref_id);
1704 if (is_array($a_users)) {
1706 $where[] =
$ilDB->in(
1715 self::refreshObjectsStatus($a_obj_ids, $a_users);
1717 $fields = array(
"usr_data.usr_id",
"login",
"active");
1718 $udf = self::buildColumns($fields, $a_additional_fields);
1721 $fields[] =
"percentage";
1724 foreach ($a_obj_ids as $obj_id) {
1726 $query =
" FROM usr_data " . $left .
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
1727 " AND read_event.obj_id = " .
$ilDB->quote(
1731 " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
1732 " AND ut_lp_marks.obj_id = " .
$ilDB->quote(
1736 " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " .
$ilDB->quote(
1740 self::buildFilters($where);
1742 $raw = self::executeQueries(
1743 array(array(
"fields" => $fields,
"query" => $query)),
1748 foreach ($raw[
"set"] as $row) {
1749 $result[
"set"][(
int) $row[
"usr_id"]][
"login"] = ($row[
"login"] ??
'');
1750 $result[
"set"][(
int) $row[
"usr_id"]][
"usr_id"] = (
int) ($row[
"usr_id"] ?? 0);
1753 $result[
"set"][(
int) $row[
"usr_id"]][
"obj_" . $obj_id] = (
int) ($row[
"status"] ?? 0);
1754 $result[
"set"][(
int) $row[
"usr_id"]][
"obj_" . $obj_id .
"_perc"] = (
int) ($row[
"percentage"] ?? 0);
1755 if ($obj_id == $parent_obj_id) {
1756 $result[
"set"][(
int) $row[
"usr_id"]][
"status_changed"] = (
int) ($row[
"status_changed"] ?? 0);
1757 $result[
"set"][(
int) $row[
"usr_id"]][
"last_access"] = (
int) ($row[
"last_access"] ?? 0);
1758 $result[
"set"][(
int) $row[
"usr_id"]][
"spent_seconds"] = (
int) ($row[
"spent_seconds"] ?? 0);
1759 $result[
"set"][(
int) $row[
"usr_id"]][
"read_count"] = (
int) ($row[
"read_count"] ?? 0);
1763 foreach ($fields as $field) {
1765 if (stristr($field,
"language")) {
1766 $field =
"language";
1769 if (isset($row[$field])) {
1771 if ($obj_id == $parent_obj_id ||
1774 array(
"mark",
"u_comment")
1776 $result[
"set"][(
int) $row[
"usr_id"]][$field] = $row[$field];
1785 if (is_array($result[
"set"])) {
1786 $result[
"cnt"] = count($result[
"set"]);
1788 $result[
"users"] = $a_users;
1790 self::getUDFAndHandlePrivacy(
1795 $a_additional_fields
1802 int $a_parent_obj_id,
1809 if ($a_parent_obj_id && $a_users) {
1819 $initial_qualifying = $lo_set->isInitialTestQualifying();
1822 foreach ($objective_ids as $objective_id) {
1828 $query =
"SELECT * FROM loc_user_results" .
1829 " WHERE " .
$ilDB->in(
1835 " AND " .
$ilDB->in(
"user_id", $a_users,
false,
"integer");
1836 if (!$initial_qualifying) {
1837 $query .=
" AND type = " .
$ilDB->quote(
1842 $query .=
" ORDER BY type";
1843 $set =
$ilDB->query($query);
1844 while ($row =
$ilDB->fetchAssoc($set)) {
1845 $objective_id = (
int) $row[
"objective_id"];
1868 ?
string $a_month =
null
1874 $obj_ids = array_keys($a_ref_ids);
1883 $sql =
"SELECT obj_id," . $column .
",SUM(read_count) read_count,SUM(childs_read_count) childs_read_count," .
1884 "SUM(spent_seconds) spent_seconds,SUM(childs_spent_seconds) childs_spent_seconds" .
1886 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
"",
"integer") .
1887 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
1889 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
1891 $sql .=
" GROUP BY obj_id," . $column;
1892 $set =
$ilDB->query($sql);
1893 while ($row =
$ilDB->fetchAssoc($set)) {
1894 $row[
"read_count"] += (
int) $row[
"childs_read_count"];
1895 $row[
"spent_seconds"] += (
int) $row[
"childs_spent_seconds"];
1896 $res[$row[
"obj_id"]][$row[$column]][
"read_count"] =
1897 (
$res[$row[
"obj_id"]][$row[$column]][
"read_count"] ?? 0) + $row[
"read_count"];
1898 $res[$row[
"obj_id"]][$row[$column]][
"spent_seconds"] =
1899 (
$res[$row[
"obj_id"]][$row[$column]][
"spent_seconds"] ?? 0) + $row[
"spent_seconds"];
1904 $sql =
"SELECT obj_id," . $column .
",SUM(counter) counter" .
1905 " FROM obj_user_stat" .
1906 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
"",
"integer") .
1907 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
1909 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
1911 $sql .=
" GROUP BY obj_id," . $column;
1912 $set =
$ilDB->query($sql);
1913 while ($row =
$ilDB->fetchAssoc($set)) {
1914 if (!isset(
$res[(
int) $row[
"obj_id"]][$row[$column]][
"users"])) {
1915 $res[(
int) $row[
"obj_id"]][$row[$column]][
"users"] = 0;
1917 $res[(
int) $row[
"obj_id"]][$row[$column]][
"users"] += (
int) $row[
"counter"];
1928 $objDefinition =
$DIC[
'objDefinition'];
1931 $types = array_keys(
1932 $objDefinition->getCreatableSubObjects(
1940 $sql =
"SELECT " . $tree->getObjectDataTable(
1941 ) .
".obj_id," . $tree->getObjectDataTable() .
".type," .
1942 $tree->getTreeTable() .
"." . $tree->getTreePk(
1943 ) .
"," . $tree->getTableReference() .
".ref_id" .
1944 " FROM " . $tree->getTreeTable() .
1945 " " . $tree->buildJoin() .
1946 " WHERE " .
$ilDB->in(
1947 $tree->getObjectDataTable() .
".type",
1952 $set =
$ilDB->query($sql);
1954 while ($row =
$ilDB->fetchAssoc($set)) {
1955 $res[$row[
"type"]][
"type"] = (string) $row[
"type"];
1956 $res[$row[
"type"]][
"references"] = (
$res[$row[
"type"]][
"references"] ?? 0) + 1;
1957 $res[$row[
"type"]][
"objects"][] = (
int) $row[
"obj_id"];
1958 if ($row[$tree->getTreePk()] < 0) {
1959 $res[$row[
"type"]][
"deleted"] = (
$res[$row[
"type"]][
"deleted"] ?? 0) + 1;
1961 $res[$row[
"type"]][
"deleted"] = (
$res[$row[
"type"]][
"deleted"] ?? 0);
1965 foreach (
$res as $type => $values) {
1966 $res[$type][
"objects"] = count((array_unique($values[
"objects"] ?? [])));
1970 foreach (self::getPortfolios() as $obj_id) {
1971 $res[
"prtf"][
"type"] =
"prtf";
1972 $res[
"prtf"][
"references"] = (
$res[
"prtf"][
"references"] ?? 0) + 1;
1973 $res[
"prtf"][
"objects"] = (
$res[
"prtf"][
"objects"] ?? 0) + 1;
1976 foreach (self::getWorkspaceBlogs() as $obj_id) {
1977 $res[
"blog"][
"type"] =
"blog";
1978 $res[
"blog"][
"references"] = (
$res[
"blog"][
"references"] ?? 0) + 1;
1979 $res[
"blog"][
"objects"] = (
$res[
"blog"][
"objects"] ?? 0) + 1;
1993 $sql =
"SELECT od.obj_id,oref.wsp_id,od.type" .
1994 " FROM tree_workspace wst" .
1995 " JOIN object_reference_ws oref ON (oref.wsp_id = wst.child)" .
1996 " JOIN object_data od ON (oref.obj_id = od.obj_id)" .
1997 " WHERE od.type = " .
$ilDB->quote(
"blog",
"text");
2000 $sql .=
" AND " .
$ilDB->like(
2003 "%" . $a_title .
"%"
2007 $set =
$ilDB->query($sql);
2008 while ($row =
$ilDB->fetchAssoc($set)) {
2009 $res[] = (
int) $row[
"obj_id"];
2022 $sql =
"SELECT od.obj_id" .
2023 " FROM usr_portfolio prtf" .
2024 " JOIN object_data od ON (od.obj_id = prtf.id)";
2027 $sql .=
" WHERE " .
$ilDB->like(
2030 "%" . $a_title .
"%"
2034 $set =
$ilDB->query($sql);
2035 while ($row =
$ilDB->fetchAssoc($set)) {
2036 $res[] = (
int) $row[
"obj_id"];
2045 ?
string $a_month =
null
2050 $obj_ids = array_keys($a_ref_ids);
2053 $sql =
"SELECT obj_id,hh,SUM(read_count) read_count,SUM(childs_read_count) childs_read_count," .
2054 "SUM(spent_seconds) spent_seconds,SUM(childs_spent_seconds) childs_spent_seconds" .
2056 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
false,
"integer") .
2057 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
2059 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
2061 $sql .=
" GROUP BY obj_id,hh";
2062 $set =
$ilDB->query($sql);
2063 while ($row =
$ilDB->fetchAssoc($set)) {
2064 $row[
"read_count"] += (
int) $row[
"childs_read_count"];
2065 $row[
"spent_seconds"] += (
int) $row[
"childs_spent_seconds"];
2066 $res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"read_count"] =
2067 (
$res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"read_count"] ?? 0) + $row[
"read_count"];
2068 $res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"spent_seconds"] =
2069 (
$res[$row[
"obj_id"]][(
int) $row[
"hh"]][
"spent_seconds"] ?? 0) + $row[
"spent_seconds"];
2080 $set =
$ilDB->query(
2081 "SELECT COUNT(*) AS COUNTER,yyyy,mm" .
2083 " GROUP BY yyyy, mm" .
2084 " ORDER BY yyyy DESC, mm DESC"
2087 while ($row =
$ilDB->fetchAssoc($set)) {
2088 $res[] = array(
"month" => $row[
"yyyy"] .
"-" . $row[
"mm"],
2089 "count" => (
int) ($row[
"COUNTER"] ?? 0)
2102 $date_compare =
$ilDB->in(
2104 array(array(
"yyyy",
""),
2105 array(
$ilDB->quote(
"-",
"text"),
""),
2113 $sql =
"DELETE FROM obj_stat" .
2114 " WHERE " . $date_compare;
2115 $ilDB->manipulate($sql);
2118 $tables = array(
"obj_lp_stat",
"obj_type_stat",
"obj_user_stat");
2119 foreach ($a_months as $month) {
2120 $year = substr($month, 0, 4);
2121 $month = substr($month, 5);
2122 $from = $year . str_pad($month, 2,
"0", STR_PAD_LEFT) .
"01";
2123 $to = $year . str_pad($month, 2,
"0", STR_PAD_LEFT) .
"31";
2125 foreach ($tables as $table) {
2126 $sql =
"DELETE FROM " . $table .
2127 " WHERE fulldate >= " .
$ilDB->quote($from,
"integer") .
2128 " AND fulldate <= " .
$ilDB->quote($to,
"integer");
2129 $ilDB->manipulate($sql);
2136 ?
string $a_title =
null,
2137 ?
int $a_root =
null,
2138 ?array $a_hidden =
null,
2139 ?array $a_preset_obj_ids =
null
2144 $tree =
$DIC->repositoryTree();
2146 if ($a_type ==
"lres") {
2147 $a_type = array(
'lm',
'sahs',
'htlm');
2150 $sql =
"SELECT r.ref_id,r.obj_id" .
2151 " FROM object_data o" .
2152 " JOIN object_reference r ON (o.obj_id = r.obj_id)" .
2153 " JOIN tree t ON (t.child = r.ref_id)" .
2154 " WHERE t.tree = " .
$ilDB->quote(1,
"integer");
2156 if (!is_array($a_type)) {
2157 $sql .=
" AND o.type = " .
$ilDB->quote($a_type,
"text");
2159 $sql .=
" AND " .
$ilDB->in(
"o.type", $a_type,
false,
"text");
2163 $sql .=
" AND (" .
$ilDB->like(
2166 "%" . $a_title .
"%"
2168 " OR " .
$ilDB->like(
2171 "%" . $a_title .
"%"
2175 if (is_array($a_hidden)) {
2176 $sql .=
" AND " .
$ilDB->in(
"o.obj_id", $a_hidden,
true,
"integer");
2179 if (is_array($a_preset_obj_ids)) {
2180 $sql .=
" AND " .
$ilDB->in(
2188 $set =
$ilDB->query($sql);
2190 while ($row =
$ilDB->fetchAssoc($set)) {
2195 if ($tree->isGrandChild($a_root,
$ref_id)) {
2196 $res[$row[
"obj_id"]][] = (
int) $row[
"ref_id"];
2200 $res[$row[
"obj_id"]][] = (
int) $row[
"ref_id"];
2211 ?array $a_users =
null
2213 foreach ($a_obj_ids as $obj_id) {
2226 $set =
$ilDB->query(
2227 "SELECT COUNT(*) counter, MIN(tstamp) tstamp" .
2228 " FROM obj_stat_log"
2230 return $ilDB->fetchAssoc($set);
2236 ?
int $a_month =
null,
2237 bool $a_group_by_day =
false
2242 if ($a_group_by_day) {
2245 $column =
"mm,yyyy";
2249 $sql =
"SELECT obj_id," . $column .
"," .
2250 "MIN(mem_cnt) mem_cnt_min,AVG(mem_cnt) mem_cnt_avg, MAX(mem_cnt) mem_cnt_max," .
2251 "MIN(in_progress) in_progress_min,AVG(in_progress) in_progress_avg,MAX(in_progress) in_progress_max," .
2252 "MIN(completed) completed_min,AVG(completed) completed_avg,MAX(completed) completed_max," .
2253 "MIN(failed) failed_min,AVG(failed) failed_avg,MAX(failed) failed_max," .
2254 "MIN(not_attempted) not_attempted_min,AVG(not_attempted) not_attempted_avg,MAX(not_attempted) not_attempted_max" .
2255 " FROM obj_lp_stat" .
2256 " WHERE " .
$ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer") .
2257 " AND yyyy = " .
$ilDB->quote($a_year,
"integer");
2259 $sql .=
" AND mm = " .
$ilDB->quote($a_month,
"integer");
2261 $sql .=
" GROUP BY obj_id," . $column;
2262 $set =
$ilDB->query($sql);
2263 while ($row =
$ilDB->fetchAssoc($set)) {
2264 $row[
'obj_id'] = (
int) $row[
'obj_id'];
2272 string $a_aggregation,
2273 ?
string $a_year =
null
2280 $a_year = date(
"Y");
2283 $agg = strtoupper($a_aggregation);
2286 $sql =
"SELECT type,yyyy,mm," . $agg .
"(cnt_objects) cnt_objects," . $agg .
"(cnt_references) cnt_references," .
2287 "" . $agg .
"(cnt_deleted) cnt_deleted FROM obj_type_stat" .
2288 " WHERE yyyy = " .
$ilDB->quote($a_year,
"integer") .
2289 " GROUP BY type,yyyy,mm";
2290 $set =
$ilDB->query($sql);
2291 while ($row =
$ilDB->fetchAssoc($set)) {
2292 $row[
"mm"] = str_pad($row[
"mm"], 2,
"0", STR_PAD_LEFT);
2293 $res[$row[
"type"]][$row[
"yyyy"] .
"-" . $row[
"mm"]] = array(
2294 "objects" => (
int) $row[
"cnt_objects"],
2295 "references" => (
int) $row[
"cnt_references"],
2296 "deleted" => (
int) $row[
"cnt_deleted"]
2307 $db =
$DIC->database();
2308 $query =
'select min(yyyy) min from obj_type_stat';
2309 $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'))