19 declare(strict_types=0);
43 ?
object $a_parent_obj,
46 bool $a_print_mode =
false 49 $this->objDefinition = $DIC[
'objDefinition'];
50 $this->rbacsystem = $DIC->rbac()->system();
51 $this->
access = $DIC->access();
52 $this->ref_id = $a_ref_id;
56 $this->
setId(
"trsmy");
58 if (!$this->is_root) {
62 if (!$this->objDefinition->isContainer($type)) {
70 $DIC->repositoryTree()->checkForParentType($this->ref_id,
'grp')
72 $this->is_in_group =
true;
75 $DIC->repositoryTree()->checkForParentType($this->ref_id,
'crs')
77 $this->is_in_course =
true;
86 $this->
parseTitle($this->obj_id,
"trac_summary");
96 if (in_array($c, [
"status",
"mark",
"language",
"country",
"gender",
"city",
"sel_country"])) {
103 if ($this->is_root) {
111 $this->
ctrl->getFormActionByClass(get_class($this))
113 $this->
setRowTemplate(
"tpl.trac_summary_row.html",
"components/ILIAS/Tracking");
116 $this->
getItems($a_parent_obj->getObjId(), $a_ref_id);
121 $lng_map = array(
"user_total" =>
"users",
122 "first_access_min" =>
"trac_first_access",
123 "last_access_max" =>
"trac_last_access",
124 "mark" =>
"trac_mark",
125 "status" =>
"trac_status",
126 'status_changed_max' =>
'trac_status_changed',
127 "spent_seconds_avg" =>
"trac_spent_seconds",
128 "percentage_avg" =>
"trac_percentage",
129 "read_count_sum" =>
"trac_read_count",
130 "read_count_avg" =>
"trac_read_count",
131 "read_count_spent_seconds_avg" =>
"trac_read_count_spent_seconds" 134 $all = array(
"user_total");
139 if ($tracking->hasExtendedData(
142 $all[] =
"read_count_sum";
143 $all[] =
"read_count_avg";
144 $default[] =
"read_count_sum";
146 if ($tracking->hasExtendedData(
152 $all[] =
"spent_seconds_avg";
153 $default[] =
"spent_seconds_avg";
156 if ($tracking->hasExtendedData(
159 $tracking->hasExtendedData(
165 $all[] =
"read_count_spent_seconds_avg";
173 $all[] =
"percentage_avg";
176 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
178 $all[] =
'status_changed_max';
187 $privacy = array(
"gender",
"city",
"country",
"sel_country");
188 foreach ($privacy as $field) {
190 ($this->is_in_course && $this->setting->get(
"usr_settings_course_export_" . $field)) ||
191 ($this->is_in_group && $this->setting->get(
"usr_settings_group_export_" . $field))
199 $default[] =
"percentage_avg";
200 $default[] =
"status";
203 if ($tracking->hasExtendedData(
206 $all[] =
"first_access_min";
207 $all[] =
"last_access_max";
210 $all[] =
"create_date_min";
211 $all[] =
"create_date_max";
218 if (substr($l, -3) ==
"avg") {
220 } elseif (substr($l, -3) ==
"sum" || $l ==
"user_total") {
224 if (isset($lng_map[$l])) {
232 array(
"read_count_avg",
237 $txt .=
" / " . $this->
lng->txt(
"user");
242 "default" => (in_array($column, $default) ?
true :
false)
250 if ($this->is_root) {
251 parent::initBaseFilter(
true,
false);
262 "∑ " . $this->
lng->txt(
"users")
264 $this->
filter[
"user_total"] = $item->getValue();
266 if ($tracking->hasExtendedData(
273 "∑ " . $this->
lng->txt(
"trac_read_count")
275 $this->filter[
"read_count"] = $item->getValue();
278 if ($tracking->hasExtendedData(
288 "Ø " . $this->
lng->txt(
290 ) .
" / " . $this->
lng->txt(
"user")
292 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
294 )->getValueInSeconds();
295 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
297 )->getValueInSeconds();
308 "Ø " . $this->
lng->txt(
310 ) .
" / " . $this->
lng->txt(
"user")
312 $this->filter[
"percentage"] = $item->getValue();
315 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
322 array(
"" => $this->
lng->txt(
"trac_all"),
337 $this->filter[
"status"] = $item->getValue();
338 if ($this->filter[
"status"]) {
339 $this->filter[
"status"]--;
343 "status_changed_max",
346 $this->
lng->txt(
"trac_status_changed")
348 $this->filter[
"status_changed"] = $item->getDate();
358 $this->
lng->txt(
"trac_mark")
360 $this->filter[
"mark"] = $item->getValue();
363 if ($this->setting->get(
"usr_settings_course_export_gender")) {
371 "" => $this->
lng->txt(
"trac_all"),
372 "n" => $this->
lng->txt(
"gender_n"),
373 "m" => $this->
lng->txt(
"gender_m"),
374 "f" => $this->
lng->txt(
"gender_f"),
377 $this->filter[
"gender"] = $item->getValue();
380 if ($this->setting->get(
"usr_settings_course_export_city")) {
386 $this->filter[
"city"] = $item->getValue();
389 if ($this->setting->get(
"usr_settings_course_export_country")) {
395 $this->filter[
"country"] = $item->getValue();
398 if ($this->setting->get(
"usr_settings_course_export_sel_country")) {
405 array(
"" => $this->
lng->txt(
410 $this->filter[
"sel_country"] = $item->getValue();
418 $this->filter[
"language"] = $item->getValue();
420 if ($tracking->hasExtendedData(
427 $this->
lng->txt(
"trac_first_access")
429 $this->filter[
"first_access"] = $item->getDate();
435 $this->
lng->txt(
"trac_last_access")
437 $this->filter[
"last_access"] = $item->getDate();
441 "registration_filter",
445 $this->filter[
"registration"] = $item->getDate();
452 $options[
$c] = $this->
lng->txt(
"meta_c_" . $c);
461 public function getItems(
int $a_object_id,
int $a_ref_id): void
474 $preselected_obj_ids[$a_object_id][] = $a_ref_id;
475 foreach ($collection->getItems() as $item => $item_info) {
479 if ($tmp_lp->isActive()) {
486 } elseif ($this->is_root) {
491 "read_learning_progress" 516 $status_map = array();
518 foreach ($valid_status as $status) {
519 $status_map[$status] = $status_icons->renderIconForStatus($status);
523 $this->
lng->loadLanguageModule(
"meta");
524 $languages = array();
525 foreach ($this->
lng->getInstalledLanguages() as $lang_key) {
526 $languages[$lang_key] = $this->
lng->txt(
"meta_l_" . $lang_key);
530 foreach (
$data[
"set"] as $idx => $result) {
532 if ($result[
"title"] ==
"" && $result[
"type"] ==
"sess") {
534 $data[
"set"][$idx][
"title"] = $sess->getFirstAppointment(
535 )->appointmentToString();
544 if ($result[
"ref_ids"]) {
546 foreach ($result[
"ref_ids"] as $check_ref_id) {
548 'read_learning_progress',
556 foreach (array_keys(
$data[
"set"][$idx]) as $col_id) {
569 $data[
"set"][$idx][
"privacy_conflict"] =
true;
575 $users_no = $result[
"user_total"];
584 "n" => $this->
lng->txt(
"gender_n"),
585 "m" => $this->
lng->txt(
"gender_m"),
586 "f" => $this->
lng->txt(
"gender_f"),
594 $result[
"sel_country"],
609 foreach ($result[
"status"] as $status_code => $status_counter) {
611 if ($status_code ===
"" || !in_array(
617 unset($result[
"status"][$status_code]);
627 $data[
"set"][$idx][
"percentage_avg"] =
null;
641 ?array $value_map =
null,
657 $counter = $others_counter = 0;
658 $others_sum = $overall;
666 if ($value_map && isset($value_map[
$id])) {
667 $caption = $value_map[
$id];
669 if ($caption ==
"") {
670 $caption = $this->
lng->txt(
"none");
679 $perc = round($count / $overall * 100);
681 "caption" => $caption,
682 "absolute" => $count,
684 "percentage" => $perc
686 $others_sum -= $count;
692 if ($others_counter) {
693 $perc = round($others_sum / $overall * 100);
695 "caption" => $others_counter .
" " . $this->
lng->txt(
698 "absolute" => $others_sum,
700 "percentage" => $perc
714 ?array $value_map =
null 717 foreach ($value_map as
$id => $caption) {
722 $perc = round($count / $overall * 100);
725 "caption" => $caption,
726 "absolute" => $count,
727 "percentage" => $perc
740 $pos = strrpos($id,
"_");
741 if ($pos !==
false) {
742 $function = strtoupper(substr($id, $pos + 1));
745 array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")
747 $id = substr($id, 0, $pos);
751 if (trim((
string) $value) ==
"") {
752 if ($id ==
"title") {
753 return "--" . $this->
lng->txt(
"none") .
"--";
758 case 'status_changed':
772 case "spent_seconds":
773 case "read_count_spent_seconds":
788 $value = $value .
"%";
805 protected function fillRow(array $a_set): void
807 $this->tpl->setVariable(
810 (
int) $a_set[
"obj_id"],
815 $this->tpl->setVariable(
"ICON_ALT", $this->
lng->txt($a_set[
"type"]));
816 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
818 if ($a_set[
"offline"] || ($a_set[
"privacy_conflict"] ??
null)) {
820 if ($a_set[
"offline"]) {
821 $mess[] = $this->
lng->txt(
"offline");
823 if ($a_set[
"privacy_conflict"] ?? null) {
824 $mess[] = $this->
lng->txt(
"status_no_permission");
826 $this->tpl->setCurrentBlock(
"status_bl");
827 $this->tpl->setVariable(
"TEXT_STATUS", implode(
", ", $mess));
828 $this->tpl->parseCurrentBlock();
843 case "percentage_avg":
847 $this->tpl->setVariable(strtoupper($c),
"");
853 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
854 $this->tpl->setVariable(strtoupper($c), $value);
859 if ($this->is_root) {
862 $this->tpl->setCurrentBlock(
"item_path");
863 foreach (
$path as $ref_id => $path_item) {
864 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
866 if (!$this->anonymized) {
867 $this->
ctrl->setParameterByClass(
868 $this->
ctrl->getCmdClass(),
872 $this->tpl->setVariable(
874 $this->
ctrl->getLinkTargetByClass(
875 $this->ctrl->getCmdClass(),
879 $this->
ctrl->setParameterByClass(
880 $this->
ctrl->getCmdClass(),
884 $this->tpl->setVariable(
891 $this->tpl->setVariable(
898 $this->tpl->setVariable(
900 $this->
lng->txt(
'view')
904 $this->tpl->parseCurrentBlock();
908 $this->tpl->setCurrentBlock(
"item_command");
909 $this->
ctrl->setParameterByClass(
914 $this->tpl->setVariable(
916 $this->
ctrl->getLinkTargetByClass(
921 $this->tpl->setVariable(
923 $this->
lng->txt(
'trac_hide')
925 $this->tpl->parseCurrentBlock();
927 $this->tpl->touchBlock(
"path_action");
928 } elseif ($a_set[
"ref_ids"]) {
933 (
int) array_pop($a_set[
"ref_ids"])
936 $this->tpl->setVariable(
938 $this->
lng->txt(
'path') .
': ' .
$path 947 foreach ($data as $item) {
948 $this->tpl->setCurrentBlock($id .
"_row");
949 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
950 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
951 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
952 $this->tpl->parseCurrentBlock();
955 $this->tpl->touchBlock($id);
979 $pos = strrpos($a_field,
"_");
980 if ($pos !==
false) {
981 $function = strtoupper(substr($a_field, $pos + 1));
984 array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")
999 $a_excel->
setCell($a_row, 0, $this->
lng->txt(
"title"));
1004 $label = $labels[
$c][
"txt"];
1005 $label = str_replace(
1007 $this->
lng->txt(
"trac_average"),
1010 $label = str_replace(
1012 $this->
lng->txt(
"trac_sum"),
1017 $a_excel->
setCell($a_row, $cnt, $label);
1020 if ($c !=
"status") {
1021 $a_excel->
setCell($a_row, $cnt, $label .
" #1");
1022 $a_excel->
setCell($a_row, ++$cnt, $label .
" #1");
1023 $a_excel->
setCell($a_row, ++$cnt, $label .
" #1 %");
1024 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2");
1025 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2");
1026 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2 %");
1027 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3");
1028 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3");
1029 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3 %");
1033 $label .
" " . $this->
lng->txt(
1040 $label .
" " . $this->
lng->txt(
1047 $label .
" " . $this->
lng->txt(
1059 foreach ($valid_status as $status) {
1063 $a_excel->
setCell($a_row, ++$cnt, $text);
1064 $a_excel->
setCell($a_row, ++$cnt, $text .
" %");
1081 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
1086 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
1087 $a_excel->
setCell($a_row, $cnt, $val);
1090 foreach ((array) $a_set[$c] as $idx => $value) {
1091 if ($c ==
"status") {
1095 (
int) $value[
"absolute"]
1100 $value[
"percentage"] .
"%" 1103 $a_excel->
setCell($a_row, $cnt, $value[
"caption"]);
1107 (
int) $value[
"absolute"]
1112 $value[
"percentage"] .
"%" 1117 if (
sizeof($a_set[$c]) < 4 && $c !=
"status") {
1118 for ($loop = 4; $loop >
sizeof($a_set[
$c]); $loop--) {
1119 $a_excel->
setCell($a_row, $cnt,
"");
1120 $a_excel->
setCell($a_row, ++$cnt,
"");
1121 $a_excel->
setCell($a_row, ++$cnt,
"");
1135 $label = $labels[
$c][
"txt"];
1136 $label = str_replace(
1138 $this->
lng->txt(
"trac_average"),
1141 $label = str_replace(
1143 $this->
lng->txt(
"trac_sum"),
1150 if ($c !=
"status") {
1161 $label .
" " . $this->
lng->txt(
"trac_others")
1164 $label .
" " . $this->
lng->txt(
"trac_others")
1167 $label .
" " . $this->
lng->txt(
"trac_others") .
" %" 1176 foreach ($valid_status as $status) {
1196 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
1199 foreach ((array) $a_set[$c] as $idx => $value) {
1200 if ($c !=
"status") {
1203 $a_csv->
addColumn((
string) $value[
"absolute"]);
1204 $a_csv->
addColumn($value[
"percentage"]);
1206 if (
sizeof($a_set[$c]) < 4 && $c !=
"status") {
1207 for ($loop = 4; $loop >
sizeof($a_set[
$c]); $loop--) {
const LP_STATUS_COMPLETED_NUM
__construct(?object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, bool $a_print_mode=false)
Constructor.
parseValue(string $id, ?string $value, string $type)
const EXTENDED_DATA_LAST_ACCESS
fillRow(array $a_set)
Fill table row.
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
getCurrentFilter(bool $as_query=false)
setExportFormats(array $formats)
Set available export formats.
getItemsPercentages( $data=null, int $overall=0, ?array $value_map=null, $limit=3)
Render data as needed for summary list (based on grouped values)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const LP_MODE_MANUAL_BY_TUTOR
setFormAction(string $a_form_action, bool $a_multipart=false)
numericOrdering(string $a_field)
fillHeaderCSV(ilCSVWriter $a_csv)
buildPath(array $ref_ids)
const LP_STATUS_NOT_ATTEMPTED
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
getItems(int $a_object_id, int $a_ref_id)
Build summary item rows for given object and filter(s.
searchObjects(array $filter, string $permission, ?array $preset_obj_ids=null, bool $a_check_lp_activation=true)
Search objects that match current filters.
getColumnCoord(int $a_col)
Get column "name" from number.
const LP_STATUS_IN_PROGRESS_NUM
const LP_MODE_COLLECTION_MANUAL
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
setPrintMode(bool $a_value=false)
const EXTENDED_DATA_READ_COUNT
isArrayColumn(string $a_name)
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
const FILTER_NUMBER_RANGE
const LP_STATUS_IN_PROGRESS
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setBold(string $a_coords)
Set cell(s) to bold.
const FILTER_DATETIME_RANGE
TableGUI class for learning progress.
setDefaultOrderField(string $a_defaultorderfield)
isPercentageAvailable(int $a_obj_id)
const FILTER_DURATION_RANGE
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
renderPercentages(string $id, array $data)
const EXTENDED_DATA_SPENT_SECONDS
const LP_STATUS_NOT_ATTEMPTED_NUM
static supportsSpentSeconds(string $obj_type)
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
__construct(Container $dic, ilPlugin $plugin)
getItemsPercentagesStatus( $data=null, int $overall=0, ?array $value_map=null)
Render status data as needed for summary list (based on grouped values)
setLimit(int $a_limit=0, int $a_default_limit=0)
static checkPermission(string $a_permission, int $a_ref_id, ?int $a_user_id=null)
wrapper for rbac access checks
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
static getCountryCodes()
Get country codes (DIN EN 3166-1)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static supportsMark(string $obj_type)
static _lookupType(int $id, bool $reference=false)
parseTitle(int $a_obj_id, string $action, int $a_user_id=0)
static isObjectOffline(int $a_obj_id, string $a_type='')
const LP_STATUS_COMPLETED
static getInstance(int $obj_id)
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.
const LP_STATUS_FAILED_NUM