19declare(strict_types=1);
64 private readonly UIFactory $ui_factory,
65 private readonly UIRenderer $ui_renderer,
66 private readonly SystemLanguage
$lng,
69 private readonly HTTPService
$http,
70 private readonly \
ilCtrl $ctrl,
72 private readonly ObjectProperties $object_properties,
80 ] = (
new URLBuilder($here_uri))->acquireParameters(
81 self::QUERY_PARAMETER_NAME_SPACE,
82 self::TOKEN_STRING_ACTION,
83 self::TOKEN_STRING_ROW_ID,
84 self::TOKEN_STRING_ACTON_AFFECTED_ITEMS
90 $action = $this->
http->wrapper()->query()->retrieve(
91 $this->token_action->getName(),
92 $this->refinery->byTrying([
93 $this->refinery->kindlyTo()->string(),
94 $this->refinery->always(
'')
112 if ($this->modal_with_error !==
null) {
116 $content[] = $this->ui_factory->table()->data(
118 $this->
lng->txt(
'available_languages'),
121 ->withRequest($this->
http->request());
128 array $visible_column_ids,
132 ?array $additional_parameters
134 foreach ($this->translations->
getLanguages() as $langauge) {
135 yield $langauge->toRow($row_builder, $this->
lng);
141 ?array $additional_parameters
149 $cf = $this->ui_factory->table()->column();
151 'language' => $cf->text($this->
lng->txt(
'language')),
153 if ($this->translations->getContentTranslationActivated()) {
154 $columns[
'base'] = $cf->boolean(
155 $this->
lng->txt(
'obj_base_lang'),
156 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_checked.svg',
'',
'small'),
157 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_unchecked.svg',
'',
'small')
162 'default' => $cf->boolean(
163 $this->
lng->txt(
'default'),
164 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_checked.svg',
'',
'small'),
165 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_unchecked.svg',
'',
'small')
167 'title' => $cf->text($this->
lng->txt(
'title')),
168 'description' => $cf->text($this->
lng->txt(
'description')),
175 if ($this->translations->migrationMissing()) {
179 self::ACTION_EDIT => $this->ui_factory->table()->action()->single(
180 $this->
lng->txt(
'edit'),
181 $this->url_builder->withParameter(
187 self::ACTION_MAKE_DEFAULT => $this->ui_factory->table()->action()->single(
188 $this->
lng->txt(
'make_default_language'),
189 $this->url_builder->withParameter(
191 self::ACTION_MAKE_DEFAULT
195 self::ACTION_DELETE => $this->ui_factory->table()->action()->standard(
196 $this->
lng->txt(
'delete'),
197 $this->url_builder->withParameter(
208 if ($this->
http->wrapper()->query()->retrieve(
209 $this->token_action_affected_items->getName(),
210 $this->refinery->kindlyTo()->string()
213 $this->buildEditLanguageModal(
214 $this->retrieveAffectedItemsFromQuery()[0]
219 $modal = $this->buildEditLanguageModal(
220 $this->
http->wrapper()->query()->retrieve(
221 $this->token_action_affected_items->getName(),
222 $this->refinery->kindlyTo()->string()
224 )->withRequest($this->
http->request());
225 $data = $modal->getData();
226 if (
$data ===
null) {
227 $this->modal_with_error = $modal->withOnLoad($modal->getShowSignal());
231 $this->translations = $this->translations->withLanguage(
$data[0]);
232 $this->object_properties->storePropertyTranslations(
236 $this->object_properties->storePropertyTranslations(
237 $this->translations->withLanguage(
$data[0])
239 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
240 $this->
ctrl->redirectByClass($this->
ctrl->getCurrentClassPath());
245 $this->translations = $this->translations->withDefaultLanguage(
246 $this->retrieveAffectedItemsFromQuery()[0]
248 $this->object_properties->storePropertyTranslations(
255 if ($this->
http->wrapper()->query()->retrieve(
256 $this->token_action_affected_items->getName(),
257 $this->refinery->byTrying([
258 $this->refinery->kindlyTo()->string(),
259 $this->refinery->kindlyTo()->listOf(
260 $this->refinery->kindlyTo()->string()
265 $this->buildConfirmationModal(
266 $this->retrieveAffectedItemsFromQueryForDeletion()
271 $this->object_properties->storePropertyTranslations(
273 $this->
http->wrapper()->post()->retrieve(
274 'interruptive_items',
275 $this->refinery->kindlyTo()->listOf(
276 $this->refinery->kindlyTo()->string()
283 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
284 $this->
ctrl->redirectByClass($this->
ctrl->getCurrentClassPath());
289 return $this->ui_factory->modal()->roundtrip(
290 $this->
lng->txt(
'edit_language'),
292 $this->translations->getLaguageForCode(
296 $this->ui_factory->input()->field(),
300 ->withParameter($this->token_action, self::ACTION_EDIT)
301 ->withParameter($this->token_action_affected_items, $language_code)
302 ->buildURI()->__toString()
308 return $this->ui_factory->modal()->interruptive(
309 $this->
lng->txt(
'confirm'),
310 $this->lng->txt(
'obj_conf_delete_lang'),
312 ->withParameter($this->token_action, self::ACTION_DELETE)
313 ->withParameter($this->token_action_affected_items, $languages_to_delete)
314 ->buildURI()->__toString()
315 )->withAffectedItems(
318 ->interruptiveItem()->standard($v, $this->lng->txt(
"meta_l_{$v}")),
326 $affected_items = $this->retrieveAffectedItemsFromQuery();
327 if (in_array($this->translations->getDefaultLanguage(), $affected_items)
328 || in_array($this->translations->getBaseLanguage(), $affected_items)) {
330 $this->ui_factory->messageBox()->failure(
331 $this->lng->txt(
'default_base_lang_not_deletable')
335 return $affected_items;
340 $affected_items = [];
341 if ($this->
http->wrapper()->query()->has($this->token_row_id->getName())) {
342 $affected_items = $this->
http->wrapper()->query()->retrieve(
343 $this->token_row_id->getName(),
344 $this->refinery->byTrying(
346 $this->refinery->container()->mapValues(
347 $this->refinery->kindlyTo()->string()
349 $this->refinery->always([])
354 if ($affected_items === []) {
356 $this->ui_factory->messageBox()->failure(
357 $this->lng->txt(
'no_checkbox')
362 return $affected_items;
367 $this->
http->saveResponse(
368 $this->
http->response()->withBody(
370 $this->ui_renderer->renderAsync(
$response)
374 $this->
http->sendResponse();
375 $this->
http->close();
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.
The scope of this class is split ilias-conform URI's into components.
Stream factory which enables the user to create streams without the knowledge of the concrete class.
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
sendAsync(UIComponent $response)
const TOKEN_STRING_ACTION
buildEditLanguageModal(string $language_code)
const TOKEN_STRING_ROW_ID
const QUERY_PARAMETER_NAME_SPACE
URLBuilderToken $token_row_id
__construct(private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly SystemLanguage $lng, private readonly Refinery $refinery, private readonly \ilGlobalTemplateInterface $tpl, private readonly HTTPService $http, private readonly \ilCtrl $ctrl, private Translations $translations, private readonly ObjectProperties $object_properties, URI $here_uri)
const ACTION_MAKE_DEFAULT
RoundtripModal $modal_with_error
retrieveAffectedItemsFromQueryForDeletion()
URLBuilderToken $token_action_affected_items
retrieveAffectedItemsFromQuery()
const TOKEN_STRING_ACTON_AFFECTED_ITEMS
buildConfirmationModal(array $languages_to_delete)
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e....
URLBuilderToken $token_action
Class handles translation mode for an object.
Class ilCtrl provides processing control methods.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A component is the most general form of an entity in the UI.
Interface InterruptiveItem.
An entity that renders components to a string output.
static http()
Fetches the global http state from ILIAS.