ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilDidacticTemplateSettingsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use ILIAS\Data\URI;
25 use ILIAS\DATA\Factory as DataFactory;
30 
37 {
39  protected UIRenderer $renderer;
42  protected ilLanguage $lng;
43  protected ilCtrl $ctrl;
44  protected HTTPServices $http;
47  protected int $ref_id;
48 
49  public function __construct(
50  ilDidacticTemplateSettingsGUI $didactic_template_settings_gui,
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 }
Description of ilDidacticTemplateSettingsTableGUI.
renderer()
static http()
Fetches the global http state from ILIAS.
__construct(ilDidacticTemplateSettingsGUI $didactic_template_settings_gui, int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:22
getHTML(ilDidacticTemplateSettingsTableDataRetrieval $data_retrieval)
Settings for a single didactic template.
URLBuilder.
Definition: URLBuilder.php:40