ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Table.php
Go to the documentation of this file.
1<?php
2
20
30
35class Table
36{
39 private \ilCtrlInterface $ctrl;
40 private \ilLanguage $lng;
44
45 protected array $components = [];
46
50 public function __construct(
51 private \ilBiblAdminFieldGUI $calling_gui,
53 ) {
54 global $DIC;
55 $this->ui_factory = $DIC['ui.factory'];
56 $this->ui_renderer = $DIC['ui.renderer'];
57 $this->ctrl = $DIC['ilCtrl'];
58 $this->lng = $DIC['lng'];
59
60 $this->url_builder = $this->initURIBuilder();
61 $columns = $this->initColumns();
62 $actions = $this->initActions();
63 $data_retrieval = new DataRetrieval(
64 $facade,
65 $calling_gui->checkPermissionBoolAndReturn('write')
66 );
67
68 $this->components[] = $this->table = $this->ui_factory->table()->ordering(
69 $data_retrieval,
70 $this->lng->txt('filter'),
71 $columns,
72 new URI(
73 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget($this->calling_gui, \ilBiblAdminFieldGUI::CMD_SAVE_ORDERING)
74 )
75 )->withActions($actions)->withRequest(
76 $DIC->http()->request()
77 );
78 }
79
80 private function initURIBuilder(): URLBuilder
81 {
84 );
85
86 // these are the query parameters this instance is controlling
87 $query_params_namespace = ['bibl'];
89 $query_params_namespace,
91 );
92 return $url_builder;
93 }
94
95 protected function initColumns(): array
96 {
97 return [
98 'identifier' => $this->ui_factory->table()->column()->text($this->lng->txt('identifier')),
99 'data_type' => $this->ui_factory->table()->column()->text($this->lng->txt('translation')),
100 'is_standard_field' => $this->ui_factory->table()->column()->text($this->lng->txt('standard'))
101 ];
102 }
103
104 protected function initActions(): array
105 {
106 return [
107 'translate' => $this->ui_factory->table()->action()->single(
108 $this->lng->txt("translate"),
109 $this->url_builder->withURI($this->getURIWithTargetClass(\ilBiblTranslationGUI::class, \ilBiblTranslationGUI::CMD_DEFAULT)),
110 $this->id_token
111 )
112 ];
113 }
114
119 protected function getURI(string $command): URI
120 {
121 return new URI(
122 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget(
123 $this->calling_gui,
124 $command
125 )
126 );
127 }
128
129 protected function getURIWithTargetClass(string $target_gui, string $command): URI
130 {
131 return new URI(
132 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
133 $target_gui,
134 $command
135 )
136 );
137 }
138
139 public function getHTML(): string
140 {
141 return $this->ui_renderer->render($this->components);
142 }
143
144 public function getOrdering(): array
145 {
146 return $this->table->getData();
147 }
148
149 public function getUrlBuilder(): URLBuilder
150 {
151 return $this->url_builder;
152 }
153
154 public function getIdToken(): URLBuilderToken
155 {
156 return $this->id_token;
157 }
158}
__construct(private \ilBiblAdminFieldGUI $calling_gui, \ilBiblAdminFactoryFacadeInterface $facade)
ilTable constructor.
Definition: Table.php:50
getURIWithTargetClass(string $target_gui, string $command)
Definition: Table.php:129
ilCtrlInterface $ctrl
Definition: Table.php:39
getURI(string $command)
@description Unfortunately, I have not yet found an easier way to generate this URI.
Definition: Table.php:119
URLBuilderToken $id_token
Definition: Table.php:42
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
acquireParameters(array $namespace, string ... $names)
Definition: URLBuilder.php:138
Class ilBiblAdminFieldGUI.
checkPermissionBoolAndReturn(string $permission)
Class ilBiblTranslationGUI.
This describes a Table to specify the order of its data (rows).
Definition: Ordering.php:29
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
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...
Class ilChatroomConfigFileHandler \ILIAS\Chatroom\classes.
global $DIC
Definition: shib_login.php:26