19 declare(strict_types=1);
66 $this->ui_factory = $this->dic->ui()->factory();
67 $this->
ctrl = $this->dic->ctrl();
68 $this->request = $this->dic->http()->request();
70 $this->dic->database(),
75 protected function index(): void
79 if ($this->ui_handling->hasPermission(
'write')) {
84 $this->dic->globalScreen()->collector()->footer()
92 $this->ui_handling->hasPermission(
'write')
95 $this->ui_handling->out(
97 $this->ui_handling->getHereAsURI(self::CMD_SAVE_ORDER),
98 $this->ui_handling->buildURI(
99 $this->
ctrl->getLinkTargetByClass(
100 ilFooterTranslationGUI::class,
111 foreach ($this->request->getParsedBody() as $hashed_id => $position) {
112 $this->
repository->updatePositionById($this->unhash($hashed_id), (
int) $position);
114 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
117 protected function add(): void
125 $target = $this->
ctrl->getFormAction($this, self::CMD_CREATE);
126 $this->ui_handling->outAsyncAsModal(
127 $this->translator->translate(
'add',
'entries'),
135 $modal = $this->ui_factory->modal()->roundtrip(
136 $this->translator->translate(
'add',
'entries'),
138 )->withAsyncRenderUrl(
139 $this->
ctrl->getLinkTarget($this, self::CMD_ADD)
142 $this->dic->toolbar()->addComponent(
146 $this->translator->translate(
'add',
'entries'),
149 ->withOnClick($modal->getShowSignal())
157 $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
158 $this->ui_handling->saveIdentificationsToRequest(
175 $this->ctrl->getFormAction($this, self::CMD_CREATE)
177 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
179 $this->ui_handling->out(
181 $this->ctrl->getFormAction($this, self::CMD_CREATE)
186 protected function edit(): void
198 $target = $this->
ctrl->getFormAction($this, self::CMD_UPDATE);
199 $this->ui_handling->outAsyncAsModal(
200 $this->translator->translate(
'edit',
'entries'),
208 $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
217 $target = $this->
ctrl->getFormAction($this, self::CMD_CREATE);
222 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
224 $this->ui_handling->out(
231 foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as
$id) {
233 $this->
repository->store($entry->withActive(!$entry->isActive()));
236 $this->ui_handling->sendMessageAndRedirect(
238 $this->translator->translate(
'group_activation_toggled'),
239 $this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT)
246 $this->dic->globalScreen()->collector()->footer()
248 $this->ui_handling->sendMessageAndRedirect(
250 $this->translator->translate(
'reset_success'),
251 $this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT)
259 foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as
$id) {
261 if ($entry === null) {
264 if ($entry->isCore()) {
265 $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
268 $this->translator->translate(
'info_not_deletable_core') .
269 $this->ui_handling->render($this->nok($this->ui_factory))
273 $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
276 $this->ui_handling->render($this->ok($this->ui_factory))
280 $this->ui_handling->outAsyncAsModal(
281 $this->translator->translate(
'entry_delete'),
282 $this->
ctrl->getFormAction($this,
'delete'),
287 private function delete():
void 289 foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as
$id) {
294 $this->ui_handling->sendMessageAndRedirect(
296 $this->translator->translate(
'entry_deleted'),
297 $this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT)
306 $this->ui_handling->outAsyncAsModal(
307 $this->translator->translate(
'select_parent',
'entries'),
308 $this->
ctrl->getFormAction($this,
'move'),
317 foreach ($this->groups_repository->all() as $group) {
318 $parents[$group->getId()] = $group->getTitle();
321 $factory = $this->ui_factory->input();
326 $this->
ctrl->getFormAction($this,
'move'),
331 $this->translator->translate(
'parent',
'entries'),
335 ->withValue($this->group->getId())
340 protected function move(): void
342 $new_parent = $this->
getMoveForm()->withRequest($this->request)->getData()[
'parent'] ?? null;
343 $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
345 $entry = $entry->withParent($new_parent);
347 $this->ui_handling->sendMessageAndRedirect(
349 $this->translator->translate(
'entry_moved'),
350 $this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT)
358 $this->ui_handling->requireReadable();
360 $next_class = $this->
ctrl->getNextClass($this) ??
'';
361 $cmd = $this->
ctrl->getCmd(self::CMD_DEFAULT);
363 switch (strtolower($next_class)) {
364 case strtolower(ilFooterTranslationGUI::class):
366 $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0]
369 if ($this->request->getQueryParams()[
'async'] ??
false) {
370 $back_target = $this->ui_handling->buildURI($this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT));
380 $this->
ctrl->forwardCommand($translation);
385 case self::CMD_DEFAULT:
386 $this->ui_handling->requireReadable();
390 case self::CMD_CREATE:
392 case self::CMD_UPDATE:
394 $this->ui_handling->backToMainTab();
395 $this->ui_handling->requireWritable();
button(string $caption, string $cmd)
repository()
description: > Example for rendering a repository card
Customizing of pimple-DIC for ILIAS.
This is how the factory for UI elements looks.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins