19declare(strict_types=1);
26use Psr\Http\Message\ServerRequestInterface;
37 public const string EDIT =
'edit';
54 private readonly
bool $has_write_access
56 $this->request =
$http->request();
57 $this->data_factory =
new Data\Factory();
65 return $this->ui_factory
67 ->data($this, $this->
lng->txt($this->context->pageLanguageIdentifier(
true)), $columns)
68 ->withId(str_replace(
'\\',
'', self::class) .
'_' . $this->context->value)
70 ->withRange(
new Range(0, 100))
71 ->withActions($actions)
72 ->withRequest($this->request);
81 'language' => $this->ui_factory
84 ->text($this->
lng->txt($this->context->pageLanguageIdentifier()))
85 ->withIsSortable(
true),
86 'status_icon' => $this->ui_factory
89 ->statusIcon($this->
lng->txt(
'active'))
90 ->withIsSortable(
true)
99 $query_params_namespace = [
'authpage',
'languages'];
101 $overview_uri = $this->data_factory->uri(
102 ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTargetByClass(
103 \ilAuthPageEditorGUI::class,
108 $overview_url_builder =
new UI\URLBuilder($overview_uri);
110 $overview_url_builder,
111 $overview_action_parameter,
113 ] = $overview_url_builder->acquireParameters(
114 $query_params_namespace,
120 $actions[
self::EDIT] = $this->ui_factory->table()->action()->single(
121 $this->
lng->txt($this->has_write_access ?
'edit' :
'preview'),
122 $overview_url_builder->withParameter($overview_action_parameter, $this->has_write_access ? self::EDIT : self::PREVIEW),
126 if ($this->has_write_access) {
127 $actions[
self::ACTIVATE] = $this->ui_factory->table()->action()->standard(
128 $this->
lng->txt(
'page_design_activate'),
129 $overview_url_builder->withParameter($overview_action_parameter, self::ACTIVATE),
133 $actions[
self::DEACTIVATE] = $this->ui_factory->table()->action()->standard(
134 $this->
lng->txt(
'page_design_deactivate'),
135 $overview_url_builder->withParameter($overview_action_parameter, self::DEACTIVATE),
145 if ($this->records ===
null) {
148 $entries = $this->
lng->getInstalledLanguages();
149 foreach ($entries as $langkey) {
150 $this->records[$i][
'key'] = $langkey;
156 $this->records[$i][
'status'] = $status;
157 $this->records[$i][
'status_icon'] = $this->
getStatusIcon($status);
158 $this->records[$i][
'language'] = $this->
lng->txt(
'meta_l_' . $langkey);
168 return $this->ui_factory->symbol()->icon()->custom(
170 $this->
lng->txt(
'active')
174 return $this->ui_factory->symbol()->icon()->custom(
176 $this->
lng->txt(
'inactive')
182 array $visible_column_ids,
185 mixed $additional_viewcontrol_data,
187 mixed $additional_parameters
192 $row_id = (string) $record[
'key'];
193 $deactivate_action = (bool) $record[
'status'] ===
true ? self::ACTIVATE : self::DEACTIVATE;
194 yield $row_builder->buildDataRow($row_id, $record)->withDisabledAction($deactivate_action);
199 mixed $additional_viewcontrol_data,
201 mixed $additional_parameters
203 $this->initRecords();
205 return \count($this->records);
213 $records = $this->records;
214 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
216 if ($order_field ===
'status_icon') {
217 $order_field =
'status';
228 $this->initRecords();
230 $records = $this->sortedRecords($order);
232 return $this->limitRecords($records,
$range);
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
sortedRecords(Data\Order $order)
getStatusIcon(bool $status)
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
__construct(private readonly ilCtrlInterface $ctrl, private readonly ilLanguage $lng, \ILIAS\HTTP\Services $http, private readonly \ILIAS\UI\Factory $ui_factory, private readonly \ILIAS\UI\Renderer $ui_renderer, private readonly AuthPageEditorContext $context, private readonly bool $has_write_access)
getRows(UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Data\Range $range, Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
limitRecords(array $records, Data\Range $range)
Data Factory $data_factory
getRecords(Data\Range $range, Data\Order $order)
ServerRequestInterface $request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
@ilCtrl_isCalledBy ilAuthPageEditorGUI: ilObjAuthSettingsGUI @ilCtrl_Calls ilAuthPageEditorGUI: ilLog...
final const string LANGUAGE_TABLE_ACTIONS_COMMAND
static getInstance(AuthPageEditorContext $context)
static lookupId(string $a_lang_key)
Lookup obj_id of language.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
An entity that renders components to a string output.
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...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.