ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilRecommendedContentRoleTableGUI.php
Go to the documentation of this file.
1<?php
2
26{
28 protected ilTree $tree;
29 protected int $role_id;
31
32 public function __construct(
34 string $a_parent_cmd,
35 int $role_id,
37 ) {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->main_tpl = $DIC->ui()->mainTemplate();
42 $this->tree = $DIC->repositoryTree();
43
44 $this->role_id = $role_id;
45
46 $this->setId('objrolepd');
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49
50 $this->setTitle($this->lng->txt('rep_recommended_content') .
51 ', ' . $this->lng->txt("obj_role") . ': ' . ilObjRole::_getTranslation(ilObject::_lookupTitle($this->role_id)));
52
53 $this->addColumn('', '', '1');
54 $this->addColumn($this->lng->txt('title'), 'title');
55 $this->addColumn($this->lng->txt('path'));
56
57 $this->setRowTemplate(
58 "tpl.rec_content_list_role.html",
59 "components/ILIAS/Repository/RecommendedContent"
60 );
61 $this->setDefaultOrderField('title');
62
63 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
64 $this->addMultiCommand('confirmRemoveItems', $this->lng->txt('remove'));
65 $this->setSelectAllCheckbox('item_ref_ids');
66
67 $this->manager = $manager;
68
69 $this->getItems();
70 }
71
72 protected function getItems(): void
73 {
75
76 $data = array_map(function ($ref_id) use ($tree) {
77 return [
78 "ref_id" => $ref_id,
80 "path" => $this->formatPath($tree->getPathFull($ref_id))
81 ];
82 }, $this->manager->getRecommendationsOfRole($this->role_id));
83
84 $this->setData($data);
85 }
86
87 protected function formatPath(array $a_path_arr): string
88 {
89 return implode(" &raquo; ", array_column($a_path_arr, "title"));
90 }
91
92 protected function fillRow(array $a_set): void
93 {
94 $this->tpl->setVariable("VAL_ID", $a_set["ref_id"]);
95 $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
96 $this->tpl->setVariable("VAL_PATH", $a_set["path"]);
97 }
98}
static _getTranslation(string $a_role_title)
static _lookupObjectId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilRecommendedContentRoleConfigGUI $a_parent_obj, string $a_parent_cmd, int $role_id, ilRecommendedContentManager $manager)
fillRow(array $a_set)
Standard Version of Fill Row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
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)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26