19declare(strict_types=0);
54 ?
object $a_parent_obj,
60 $this->tree =
$DIC->repositoryTree();
61 $this->rbacsystem =
$DIC->rbac()->system();
62 $this->ilObjDataCache =
$DIC[
'ilObjDataCache'];
64 $this->
setId(
"trsmtx_" . $ref_id);
69 $this->in_group_ref_id = $this->tree->checkForParentType($this->ref_id,
"grp");
70 if ($this->in_group_ref_id) {
73 $this->in_course_ref_id = $this->tree->checkForParentType(
77 if ($this->in_course_ref_id) {
82 $this->
lng = $DIC->language();
83 $this->
http = $DIC->http();
88 $this->
parseTitle($this->obj_id,
"trac_matrix");
91 $this->
ctrl->getFormActionByClass(get_class($this))
94 "tpl.user_object_matrix_row.html",
103 if ($this->rbacsystem->checkAccess(
105 $mail->getMailObjectReferenceId()
109 $this->
lng->txt(
"send_mail")
113 $this->
lng->loadLanguageModule(
'user');
116 $this->
lng->txt(
'clipboard_add_btn')
119 $this->has_multi =
true;
125 foreach ($selected as
$c) {
128 if (isset($labels[
$c][
"no_permission"]) && $labels[
$c][
"no_permission"]) {
129 $title .=
" (" . $this->
lng->txt(
"status_no_permission") .
")";
133 if (isset($labels[
$c][
"icon"])) {
134 $alt = $this->
lng->txt($labels[
$c][
"type"] ??
"");
135 $icon =
'<img class="ilListItemIcon" src="' . $labels[
$c][
"icon"] .
'" alt="' . $alt .
'" />';
136 if (
sizeof($selected) > 5) {
142 if ($labels[
$c][
"path"] ??
false) {
143 $tooltip[] = $labels[
$c][
"path"];
147 if (isset($labels[
$c][
"id"])) {
148 $sort_id = $labels[
$c][
"id"];
151 $sort_id = (substr(
$c, 0, 4) ==
"udf_") ?
"" :
$c;
160 implode(
" - ", $tooltip)
172 $this->
lng->txt(
'login')
174 $this->
filter[
"name"] = $item->getValue();
177 if ($this->
http->wrapper()->query()->has($this->prefix .
'_tpl')) {
178 $this->
filter[
"name"] =
null;
185 if ($a_field ===
'read_count' || $a_field ===
'spent_seconds') {
194 $this->in_course_ref_id,
195 $this->in_group_ref_id
198 if ($this->obj_ids ===
null) {
202 array_keys($user_cols[0]),
207 if (isset($this->obj_ids)) {
209 foreach ($this->obj_ids as
$obj_id) {
210 if (
$obj_id == $this->obj_id) {
211 $parent = array(
"txt" => $this->
lng->txt(
"status"),
220 'read_learning_progress',
224 $this->privacy_cols[] =
$obj_id;
228 $type = $this->ilObjDataCache->lookupType((
int)
$obj_id);
230 if (
$type ==
"sess") {
232 $title = $sess->getPresentationTitle();
248 $relpath = $this->
lng->txt(
'path') .
': ' .
$path;
256 "no_permission" => $no_perm,
261 if (
sizeof($this->objective_ids)) {
263 $tmp_cols[strtolower(
270 if (
sizeof($this->sco_ids)) {
273 $tmp_cols[strtolower(
281 if (
sizeof($this->subitem_ids)) {
290 $tmp_cols[strtolower(
300 if (!
sizeof($this->sco_ids) && !
sizeof($this->subitem_ids)) {
303 foreach ($tmp_cols as
$id => $def) {
304 $id = explode(
'#~#',
$id);
305 $columns[
$id[1]] = $def;
314 unset($user_cols[0][
"status"]);
315 unset($user_cols[0][
"login"]);
316 foreach ($user_cols[0] as $col_id => $col_def) {
317 if (!isset($columns[$col_id])) {
319 $col_def[
"default"] =
false;
320 $columns[$col_id] = $col_def;
328 array $a_user_fields,
329 array $a_privary_fields =
null
333 if ($this->restore_filter) {
334 $name = $this->restore_filter_values[
"name"];
344 if ($collection[
"object_ids"]) {
346 $this->ref_ids = $collection[
"ref_ids"];
349 $check_agreement =
false;
350 if ($this->in_course) {
353 if ($privacy->courseConfirmationRequired()) {
356 } elseif ($this->in_group) {
359 if ($privacy->groupConfirmationRequired()) {
365 $collection[
"object_ids"],
366 $this->
filter[
"name"] ??
'',
371 if ($collection[
"objectives_parent_id"] &&
$data[
"users"]) {
374 $collection[
"objectives_parent_id"],
378 $this->objective_ids = array();
380 foreach (
$objectives as $user_id => $inner_objectives) {
381 if (isset(
$data[
"set"][$user_id])) {
382 foreach ($inner_objectives as $objective_id => $status) {
383 $obj_id =
"objtv_" . $objective_id;
386 if (!in_array(
$obj_id, $this->objective_ids)) {
397 if ($collection[
"scorm"] &&
$data[
"set"]) {
398 $this->sco_ids = array();
399 foreach (array_keys(
$data[
"set"]) as $user_id) {
400 foreach ($collection[
"scorm"][
"scos"] as $sco) {
401 if (!in_array($sco, $this->sco_ids)) {
402 $this->sco_ids[$sco] = $collection[
"scorm"][
"scos_title"][$sco];
412 $collection[
"scorm"][
"failed"][$sco]
417 $collection[
"scorm"][
"completed"][$sco]
422 $collection[
"scorm"][
"in_progress"][$sco]
434 if ($collection[
"subitems"] &&
$data[
"set"]) {
435 foreach (array_keys(
$data[
"set"]) as $user_id) {
436 foreach ($collection[
"subitems"][
"items"] as $item_id) {
437 $this->subitem_ids[$item_id] = $collection[
"subitems"][
"item_titles"][$item_id];
441 $collection[
"subitems"][
"completed"]
444 $collection[
"subitems"][
"completed"][$item_id]
448 $collection[
"subitems"][
"in_progress"]
452 $collection[
"subitems"][
"in_progress"][$item_id]
457 $obj_id =
"objsub_" . $item_id;
465 $this->perc_map = array();
466 foreach (
$data[
"set"] as $row_idx => $row) {
467 foreach ($row as
$column => $value) {
468 if (substr(
$column, -5) ==
"_perc") {
477 $this->perc_map[
$obj_id] =
true;
488 if (in_array(
'org_units', $a_user_fields)) {
489 foreach ((
$data[
'set'] ?? []) as
$key => $usr_data) {
490 if (!isset($usr_data[
'usr_id'])) {
493 $usr_id = (
int) $usr_data[
'usr_id'];
494 $org_units = ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($usr_id);
495 $data[
"set"][
$key][
'org_units'] = $org_units;
501 return $collection[
"object_ids"] ?? [];
506 protected function fillRow(array $a_set): void
508 if ($this->has_multi) {
509 $this->tpl->setVariable(
"USER_ID", $a_set[
"usr_id"]);
512 foreach ($this->getSelectedColumns() as
$c) {
514 case (substr(
$c, 0, 4) ==
"obj_"):
515 $obj_id = substr(
$c, 4);
518 if (in_array($obj_id, $this->privacy_cols) ||
519 ($a_set[
"privacy_conflict"] ??
false)) {
520 $this->tpl->setCurrentBlock(
"objects");
521 $this->tpl->setVariable(
"VAL_STATUS",
" ");
522 $this->tpl->parseCurrentBlock();
526 $status = isset($a_set[
$c])
529 $percentage = isset($a_set[
$c .
"_perc"])
530 ? (
int) $a_set[
$c .
"_perc"]
534 $timing = $this->showTimingsWarning(
535 $this->ref_ids[$obj_id],
539 if ($timing !==
true) {
546 $this->tpl->setCurrentBlock(
'warning_img');
547 $this->tpl->setVariable(
553 $this->tpl->setVariable(
559 $this->tpl->parseCurrentBlock();
563 $this->tpl->setCurrentBlock(
"objects");
564 $this->tpl->setVariable(
572 $this->tpl->setVariable(
576 (
string) $percentage,
580 $this->tpl->parseCurrentBlock();
583 case (substr(
$c, 0, 6) ==
"objtv_"):
584 case (substr(
$c, 0, 7) ==
"objsco_"):
585 case (substr(
$c, 0, 7) ==
"objsub_"):
586 $status = isset($a_set[
$c])
590 $this->tpl->setCurrentBlock(
"objects");
591 if (!($a_set[
"privacy_conflict"] ??
false)) {
592 $this->tpl->setVariable(
601 $this->tpl->setVariable(
"VAL_STATUS",
" ");
603 $this->tpl->parseCurrentBlock();
607 $this->tpl->setCurrentBlock(
"user_field");
608 if (!($a_set[
"privacy_conflict"] ??
false)) {
609 $this->tpl->setVariable(
618 $this->tpl->setVariable(
"VAL_UF",
" ");
620 $this->tpl->parseCurrentBlock();
626 if (!$a_set[
"active"] || ($a_set[
"privacy_conflict"] ??
false)) {
628 if ($a_set[
"privacy_conflict"] ??
false) {
629 $mess[] = $this->
lng->txt(
"status_no_permission");
630 } elseif (!$a_set[
"active"]) {
631 $mess[] = $this->
lng->txt(
"inactive");
633 $this->tpl->setCurrentBlock(
'inactive_bl');
634 $this->tpl->setVariable(
'TXT_INACTIVE', implode(
", ", $mess));
635 $this->tpl->parseCurrentBlock();
638 $login = !($a_set[
"privacy_conflict"] ??
false)
641 $this->tpl->setVariable(
"VAL_LOGIN", $login);
648 $ilObjDataCache =
$DIC[
'ilObjDataCache'];
650 $a_excel->
setCell($a_row, 0, $this->
lng->txt(
"login"));
652 $labels = $this->getSelectableColumns();
654 foreach ($this->getSelectedColumns() as
$c) {
655 if (substr(
$c, 0, 4) ==
"obj_") {
656 $obj_id = substr(
$c, 4);
658 $type = $this->ilObjDataCache->lookupType((
int) $obj_id);
659 if (
$DIC[
'objDefinition']->isPlugin(
$type)) {
665 $type_text = $this->
lng->txt($type);
671 "(" . $type_text .
") " . $labels[
$c][
"txt"]
674 if (isset($this->perc_map) && ($this->perc_map[$obj_id] ??
false)) {
685 $a_excel->
setCell($a_row, $cnt, $labels[
$c][
"txt"]);
700 $a_excel->setCell($a_row, 0, $a_set[
"login"]);
703 foreach ($this->getSelectedColumns() as
$c) {
705 case (substr(
$c, 0, 4) ==
"obj_"):
706 $obj_id = substr(
$c, 4);
710 $a_excel->
setCell($a_row, $cnt, $val);
712 if (isset($this->perc_map) && ($this->perc_map[$obj_id] ??
false)) {
714 $perc = (
int) ($a_set[
$c .
"_perc"] ?? 0);
718 $a_excel->
setCell($a_row, $cnt, $perc);
722 case (substr(
$c, 0, 6) ==
"objtv_"):
723 case (substr(
$c, 0, 7) ==
"objsco_"):
724 case (substr(
$c, 0, 7) ==
"objsub_"):
728 $a_excel->
setCell($a_row, $cnt, $val);
737 $val = $this->parseValue(
$c, $a_set[
$c] ??
'',
"user");
738 $a_excel->
setCell($a_row, $cnt, $val);
750 $ilObjDataCache =
$DIC[
'ilObjDataCache'];
754 $labels = $this->getSelectableColumns();
755 foreach ($this->getSelectedColumns() as
$c) {
756 if (substr(
$c, 0, 4) ==
"obj_") {
757 $obj_id = substr(
$c, 4);
759 $type = $this->ilObjDataCache->lookupType((
int) $obj_id);
760 if (
$DIC[
'objDefinition']->isPlugin(
$type)) {
766 $type_text = $this->
lng->txt($type);
769 $a_csv->
addColumn(
"(" . $type_text .
") " . $labels[
$c][
"txt"]);
771 if (isset($this->perc_map) && ($this->perc_map[$obj_id] ??
false)) {
773 $this->
lng->txt(
"trac_percentage") .
" (%)"
788 foreach ($this->getSelectedColumns() as
$c) {
790 case (substr(
$c, 0, 4) ==
"obj_"):
791 $obj_id = substr(
$c, 4);
797 if (isset($this->perc_map) && ($this->perc_map[$obj_id] ??
false)) {
798 $perc = (
int) $a_set[
$c .
"_perc"];
806 case (substr(
$c, 0, 6) ==
"objtv_"):
807 case (substr(
$c, 0, 7) ==
"objsco_"):
808 case (substr(
$c, 0, 7) ==
"objsub_"):
821 $val = $this->parseValue(
$c, $a_set[
$c] ??
'',
"user");
static _lookupTargetTitle(int $a_obj_id)
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
setBold(string $a_coords)
Set cell(s) to bold.
getColumnCoord(int $a_col)
Get column "name" from number.
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
TableGUI class for learning progress.
isPercentageAvailable(int $a_obj_id)
parseTitle(int $a_obj_id, string $action, int $a_user_id=0)
getSelectableUserColumns(int $a_in_course=0, int $a_in_group=0)
static checkPermission(string $a_permission, int $a_ref_id, ?int $a_user_id=null)
wrapper for rbac access checks
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTxtById(string $plugin_id, string $lang_var)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
Creates a path for a start and endnode.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
setExportFormats(array $formats)
Set available export formats.
addMultiCommand(string $a_cmd, string $a_text)
setShowTemplates(bool $a_value)
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setFilterValue(ilTableFilterItem $a_item, $a_value)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
fillRow(array $a_set)
Standard Version of Fill Row.
fillHeaderCSV(ilCSVWriter $a_csv)
CSV Version of Fill Header.
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
Excel Version of Fill Row.
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
Excel Version of Fill Header.
__construct(?object $a_parent_obj, string $a_parent_cmd, int $ref_id)
Constructor.
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
CSV Version of Fill Row.
ilObjectDataCache $ilObjDataCache
getItems(array $a_user_fields, array $a_privary_fields=null)
numericOrdering($a_field)
getSelectableColumns()
Get selectable columns.
static getUserObjectiveMatrix(int $a_parent_obj_id, array $a_users)
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 getSubItemType(int $a_parent_obj_id)
Get sub-item object type for parent.
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc