ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDidacticTemplateSettingsTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\UI\Factory as UIFactory;
24use ILIAS\UI\Renderer as UIRenderer;
25use ILIAS\DATA\Factory as DataFactory;
27use ILIAS\HTTP\Services as HTTPServices;
28use ILIAS\Refinery\Factory as RefineryFactory;
30
37{
39 protected UIRenderer $renderer;
40 protected UIFactory $ui_factory;
41 protected DataFactory $data_factory;
42 protected ilLanguage $lng;
43 protected ilCtrl $ctrl;
44 protected HTTPServices $http;
46 protected RefineryFactory $refinery;
47 protected int $ref_id;
48
49 public function __construct(
51 int $ref_id
52 ) {
53 global $DIC;
54 $this->ref_id = $ref_id;
55 $this->renderer = $DIC->ui()->renderer();
56 $this->ui_factory = $DIC->ui()->factory();
57 $this->didactic_template_settings_gui = $didactic_template_settings_gui;
58 $this->lng = $DIC->language();
59 $this->access = $DIC->access();
60 $this->ctrl = $DIC->ctrl();
61 $this->http = $DIC->http();
62 $this->refinery = $DIC->refinery();
63 $this->data_factory = new DataFactory();
64 }
65
66 protected function createTable(
68 ): Data {
69 $this->lng->loadLanguageModule('search');
70 $this->lng->loadLanguageModule('meta');
71
72 $columns = [
73 'icon' => $this->ui_factory->table()->column()->statusIcon(($this->lng->txt('icon')))
74 ->withIsSortable(false)
75 ->withIsOptional(true),
76 'title' => $this->ui_factory->table()->column()->text($this->lng->txt('search_title_description')),
77 'applicable' => $this->ui_factory->table()->column()->text($this->lng->txt('didactic_applicable_for')),
78 'scope' => $this->ui_factory->table()->column()->text($this->lng->txt('didactic_scope')),
79 'enabled' => $this->ui_factory->table()->column()->statusIcon($this->lng->txt('active'))
80 ];
81
87 $query_params_namespace = ['didactic_template'];
88 $url_builder = new URLBuilder(
89 new URI(
90 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
91 ilDidacticTemplateSettingsGUI::class,
92 'handleTableActions'
93 )
94 )
95 );
96 list($url_builder, $action_parameter_token, $row_id_token) = $url_builder->acquireParameters(
97 $query_params_namespace,
98 'table_action',
99 'template_ids'
100 );
101
102 $actions = [];
103 if ($this->access->checkAccess('write', '', $this->ref_id)) {
104 $actions = [
105 'settings' => $this->ui_factory->table()->action()->single(
106 $this->lng->txt('settings'),
107 $url_builder->withParameter($action_parameter_token, 'editTemplate'),
108 $row_id_token
109 ),
110 'copy' => $this->ui_factory->table()->action()->single(
111 $this->lng->txt('copy'),
112 $url_builder->withParameter($action_parameter_token, 'copyTemplate'),
113 $row_id_token
114 ),
115 'didactic_do_export' => $this->ui_factory->table()->action()->single(
116 $this->lng->txt('didactic_do_export'),
117 $url_builder->withParameter($action_parameter_token, 'exportTemplate'),
118 $row_id_token
119 ),
120 'confirmDelete' => $this->ui_factory->table()->action()->multi(
121 $this->lng->txt('delete'),
122 $url_builder->withParameter($action_parameter_token, 'confirmDelete'),
123 $row_id_token
124 )
125 ->withAsync(),
126 'activateTemplates' => $this->ui_factory->table()->action()->multi(
127 $this->lng->txt('activate'),
128 $url_builder->withParameter($action_parameter_token, 'activateTemplates'),
129 $row_id_token
130 ),
131 'deactivateTemplates' => $this->ui_factory->table()->action()->multi(
132 $this->lng->txt('deactivate'),
133 $url_builder->withParameter($action_parameter_token, 'deactivateTemplates'),
134 $row_id_token
135 )
136 ];
137 }
138
139 return $this->ui_factory->table()->data(
140 $data_retrieval,
141 $this->lng->txt('didactic_available_templates'),
142 $columns,
143 )
144 ->withActions($actions)
145 ->withRequest($this->http->request());
146 }
147
148 public function getHTML(
150 ): string {
151 return $this->renderer->render(
152 $this->createTable($data_retrieval)
153 );
154 }
155}
renderer()
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
Class Services.
Definition: Services.php:38
Class ilCtrl provides processing control methods.
Settings for a single didactic template.
Description of ilDidacticTemplateSettingsTableGUI.
getHTML(ilDidacticTemplateSettingsTableDataRetrieval $data_retrieval)
__construct(ilDidacticTemplateSettingsGUI $didactic_template_settings_gui, int $ref_id)
language handling
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes a Data Table.
Definition: Data.php:31
An entity that renders components to a string output.
Definition: Renderer.php:31
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26