ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjectTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
30 protected array $objects = [];
31 protected bool $show_path = false;
32 protected bool $row_selection_input = false;
33 protected UIServices $ui;
34
35 public function __construct(?object $parent_obj, string $parent_cmd, string $id)
36 {
37 global $DIC;
38 $this->ui = $DIC->ui();
39 $this->setId('obj_table_' . $id);
41 }
42
43 public function enableObjectPath(bool $status): void
44 {
45 $this->show_path = $status;
46 }
47
48 public function enabledObjectPath(): bool
49 {
50 return $this->show_path;
51 }
52
54 {
55 return $path;
56 }
57
58 public function enableRowSelectionInput(bool $stat): void
59 {
60 $this->row_selection_input = $stat;
61 }
62
63 public function enabledRowSelectionInput(): bool
64 {
66 }
67
68 public function fillRowSelectionInput(array $set): void
69 {
70 $this->tpl->setCurrentBlock('row_selection_input');
71 $this->tpl->setVariable('OBJ_INPUT_TYPE', 'checkbox');
72 $this->tpl->setVariable('OBJ_INPUT_NAME', 'id[]');
73 $this->tpl->setVariable('OBJ_INPUT_VALUE', $set['ref_id']);
74 }
75
79 public function setObjects(array $ref_ids): void
80 {
81 $this->objects = $ref_ids;
82 }
83
87 public function getObjects(): array
88 {
89 return $this->objects;
90 }
91
92 public function init(): void
93 {
94 if ($this->enabledRowSelectionInput()) {
95 $this->addColumn('', 'id', '5px');
96 }
97
98 $this->addColumn($this->lng->txt('type'), 'type', '30px');
99 $this->addColumn($this->lng->txt('title'), 'title');
100
101 $this->setOrderColumn('title');
102 $this->setRowTemplate('tpl.object_table_row.html', 'components/ILIAS/ILIASObject');
103 }
104
105 protected function fillRow(array $set): void
106 {
107 if ($this->enabledRowSelectionInput()) {
108 $this->fillRowSelectionInput($set);
109 }
110
111 $type_icon = $this->ui->factory()->symbol()->icon()->custom(
112 ilObject::_getIcon($set['obj_id'], 'big', $set['type']),
113 $this->lng->txt('obj_' . $set['type'])
114 );
115
116 $this->tpl->setVariable('OBJ_LINK', ilLink::_getLink($set['ref_id'], $set['type']));
117 $this->tpl->setVariable('OBJ_LINKED_TITLE', $set['title']);
118 $this->tpl->setVariable('TYPE_IMG', $this->ui->renderer()->render($type_icon));
119
120 if ($this->enabledObjectPath()) {
121 $path_gui = new ilPathGUI();
122 $path_gui = $this->customizePath($path_gui);
123
124 $this->tpl->setCurrentBlock('path');
125 $this->tpl->setVariable('OBJ_PATH', $path_gui->getPath(ROOT_FOLDER_ID, (int) $set['ref_id']));
126 $this->tpl->parseCurrentBlock();
127 }
128 }
129
130 public function parse(): void
131 {
132 $counter = 0;
133 $set = [];
134 foreach ($this->getObjects() as $ref_id) {
136 if ($type == 'rolf') {
137 continue;
138 }
139
140 $set[$counter]['ref_id'] = $ref_id;
141 $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id);
144 $counter++;
145 }
146 $this->setData($set);
147 }
148}
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
Settings for LO courses.
customizePath(ilPathGUI $path)
__construct(?object $parent_obj, string $parent_cmd, string $id)
fillRowSelectionInput(array $set)
getObjects()
get object ref_ids
fillRow(array $set)
Standard Version of Fill Row.
enableRowSelectionInput(bool $stat)
enableObjectPath(bool $status)
setObjects(array $ref_ids)
set table content objects
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)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
setOrderColumn(string $a_order_column="", string $a_default_column="")
const ROOT_FOLDER_ID
Definition: constants.php:32
$ref_id
Definition: ltiauth.php:66
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$counter