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,
131 mixed $additional_viewcontrol_data,
133 mixed $additional_parameters
135 foreach ($this->translations->
getLanguages() as $langauge) {
136 yield $langauge->toRow($row_builder, $this->
lng);
141 mixed $additional_viewcontrol_data,
143 mixed $additional_parameters
151 $cf = $this->ui_factory->table()->column();
153 'language' => $cf->text($this->
lng->txt(
'language')),
155 if ($this->translations->getContentTranslationActivated()) {
156 $columns[
'base'] = $cf->boolean(
157 $this->
lng->txt(
'obj_base_lang'),
158 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_checked.svg',
'',
'small'),
159 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_unchecked.svg',
'',
'small')
164 'default' => $cf->boolean(
165 $this->
lng->txt(
'default'),
166 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_checked.svg',
'',
'small'),
167 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_unchecked.svg',
'',
'small')
169 'title' => $cf->text($this->
lng->txt(
'title')),
170 'description' => $cf->text($this->
lng->txt(
'description')),
177 if ($this->translations->migrationMissing()) {
181 self::ACTION_EDIT => $this->ui_factory->table()->action()->single(
182 $this->
lng->txt(
'edit'),
183 $this->url_builder->withParameter(
189 self::ACTION_MAKE_DEFAULT => $this->ui_factory->table()->action()->single(
190 $this->
lng->txt(
'make_default_language'),
191 $this->url_builder->withParameter(
193 self::ACTION_MAKE_DEFAULT
197 self::ACTION_DELETE => $this->ui_factory->table()->action()->standard(
198 $this->
lng->txt(
'delete'),
199 $this->url_builder->withParameter(
210 if ($this->
http->wrapper()->query()->retrieve(
211 $this->token_action_affected_items->getName(),
212 $this->refinery->kindlyTo()->string()
215 $this->buildEditLanguageModal(
216 $this->retrieveAffectedItemsFromQuery()[0]
221 $modal = $this->buildEditLanguageModal(
222 $this->
http->wrapper()->query()->retrieve(
223 $this->token_action_affected_items->getName(),
224 $this->refinery->kindlyTo()->string()
226 )->withRequest($this->
http->request());
227 $data = $modal->getData();
228 if (
$data ===
null) {
229 $this->modal_with_error = $modal->withOnLoad($modal->getShowSignal());
233 $this->translations = $this->translations->withLanguage(
$data[0]);
234 $this->object_properties->storePropertyTranslations(
238 $this->object_properties->storePropertyTranslations(
239 $this->translations->withLanguage(
$data[0])
241 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
242 $this->
ctrl->redirectByClass($this->
ctrl->getCurrentClassPath());
247 $this->translations = $this->translations->withDefaultLanguage(
248 $this->retrieveAffectedItemsFromQuery()[0]
250 $this->object_properties->storePropertyTranslations(
257 if ($this->
http->wrapper()->query()->retrieve(
258 $this->token_action_affected_items->getName(),
259 $this->refinery->byTrying([
260 $this->refinery->kindlyTo()->string(),
261 $this->refinery->kindlyTo()->listOf(
262 $this->refinery->kindlyTo()->string()
267 $this->buildConfirmationModal(
268 $this->retrieveAffectedItemsFromQueryForDeletion()
273 $this->object_properties->storePropertyTranslations(
275 $this->
http->wrapper()->post()->retrieve(
276 'interruptive_items',
277 $this->refinery->kindlyTo()->listOf(
278 $this->refinery->kindlyTo()->string()
285 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
286 $this->
ctrl->redirectByClass($this->
ctrl->getCurrentClassPath());
291 return $this->ui_factory->modal()->roundtrip(
292 $this->
lng->txt(
'edit_language'),
294 $this->translations->getLaguageForCode(
298 $this->ui_factory->input()->field(),
302 ->withParameter($this->token_action, self::ACTION_EDIT)
303 ->withParameter($this->token_action_affected_items, $language_code)
304 ->buildURI()->__toString()
310 return $this->ui_factory->modal()->interruptive(
311 $this->
lng->txt(
'confirm'),
312 $this->lng->txt(
'obj_conf_delete_lang'),
314 ->withParameter($this->token_action, self::ACTION_DELETE)
315 ->withParameter($this->token_action_affected_items, $languages_to_delete)
316 ->buildURI()->__toString()
317 )->withAffectedItems(
320 ->interruptiveItem()->standard($v, $this->lng->txt(
"meta_l_{$v}")),
328 $affected_items = $this->retrieveAffectedItemsFromQuery();
329 if (in_array($this->translations->getDefaultLanguage(), $affected_items)
330 || in_array($this->translations->getBaseLanguage(), $affected_items)) {
332 $this->ui_factory->messageBox()->failure(
333 $this->lng->txt(
'default_base_lang_not_deletable')
337 return $affected_items;
342 $affected_items = [];
343 if ($this->
http->wrapper()->query()->has($this->token_row_id->getName())) {
344 $affected_items = $this->
http->wrapper()->query()->retrieve(
345 $this->token_row_id->getName(),
346 $this->refinery->byTrying(
348 $this->refinery->container()->mapValues(
349 $this->refinery->kindlyTo()->string()
351 $this->refinery->always([])
356 if ($affected_items === []) {
358 $this->ui_factory->messageBox()->failure(
359 $this->lng->txt(
'no_checkbox')
364 return $affected_items;
369 $this->
http->saveResponse(
370 $this->
http->response()->withBody(
372 $this->ui_renderer->renderAsync(
$response)
376 $this->
http->sendResponse();
377 $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.
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)
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...
const ACTION_MAKE_DEFAULT
RoundtripModal $modal_with_error
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e....
retrieveAffectedItemsFromQueryForDeletion()
URLBuilderToken $token_action_affected_items
retrieveAffectedItemsFromQuery()
const TOKEN_STRING_ACTON_AFFECTED_ITEMS
buildConfirmationModal(array $languages_to_delete)
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.