19 declare(strict_types=1);
70 private readonly \
ilCtrl $ctrl,
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(),
93 $this->
refinery->kindlyTo()->string(),
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
143 return count($this->translations->getLanguages());
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()
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();
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(
248 $this->object_properties->storePropertyTranslations(
255 if ($this->
http->wrapper()->query()->retrieve(
256 $this->token_action_affected_items->getName(),
258 $this->
refinery->kindlyTo()->string(),
259 $this->
refinery->kindlyTo()->listOf(
260 $this->
refinery->kindlyTo()->string()
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}")),
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(),
346 $this->
refinery->container()->mapValues(
347 $this->
refinery->kindlyTo()->string()
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();
Interface InterruptiveItem.
const QUERY_PARAMETER_NAME_SPACE
const TOKEN_STRING_ROW_ID
withoutLanguage(string $lang)
retrieveAffectedItemsFromQuery()
const ACTION_MAKE_DEFAULT
Class handles translation mode for an object.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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)
retrieveAffectedItemsFromQueryForDeletion()
sendAsync(UIComponent $response)
Both the subject and the direction need to be specified when expressing an order. ...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
buildConfirmationModal(array $languages_to_delete)
URLBuilderToken $token_row_id
RoundtripModal $modal_with_error
URLBuilderToken $token_action_affected_items
URLBuilderToken $token_action
static ofString(string $string)
Creates a new stream with an initial value.
const TOKEN_STRING_ACTON_AFFECTED_ITEMS
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...
const TOKEN_STRING_ACTION
A simple class to express a naive range of whole positive numbers.
buildEditLanguageModal(string $language_code)