19declare(strict_types=1);
22use ILIAS\GlobalScreen\GUI\I18n\Translator;
26use ILIAS\GlobalScreen\GUI\Hasher;
84 $this->
ui = $this->pons->out()->ui();
85 $this->
lng = $this->pons->i18n();
87 $this->
access = $this->pons->access();
88 $this->flow = $this->pons->flow();
89 $this->
toolbar = $this->pons->out()->toolbar();
94 $this->pons->in()->keepTokens($this);
108 match ($cmd = $this->pons->flow()->getCommand(self::CMD_DEFAULT)) {
109 self::CMD_DEFAULT => $this->index(),
110 self::CMD_ADD => $this->
add(),
111 self::CMD_EDIT => $this->
edit(),
112 self::CMD_CREATE => $this->
create(),
113 self::CMD_UPDATE => $this->
update(),
114 self::CMD_ACTIVATE => $this->
activate(),
117 self::CMD_DELETE => $this->
delete(),
118 self::CMD_SAVE_ORDER => $this->
saveOrder(),
119 default => $this->pons->out()->outString(
'Command not found:' . $cmd)
125 private function add(): void
149 protected function delete():
void
152 if ($item->isDeletable()) {
156 $this->pons->out()->success($this->
lng->txt(
"msg_topitem_deleted"),
true);
157 $this->pons->flow()->redirect(self::CMD_DEFAULT);
166 $items[] = $this->
ui->factory()->modal()->interruptiveItem()->standard(
167 $this->hash($item->identification()->serialize()),
168 $item->getDefaultTitle()
172 $this->pons->out()->outAsyncAsConfirmation(
173 $this->
lng->txt(
'delete'),
174 $this->lng->txt(
'confirm_delete'),
175 $this->lng->txt(
'delete'),
176 $this->flow->getHereAsURI(self::CMD_DELETE),
194 protected function toggle(
bool $activation): void
200 if (!$item->canBeDeactivated()) {
201 $not_changed[] = $item->getDefaultTitle();
204 $item->setActiveStatus($activation);
206 $changed[] = $item->getDefaultTitle();
208 if ($changed !== []) {
209 $this->pons->out()->success(
210 $this->
lng->t(
'msg_success'),
215 if ($not_changed !== []) {
216 $this->pons->out()->error(
217 $this->
lng->t(
'msg_not_changed',
null, [implode(
', ', $not_changed)]),
221 $this->flow->redirect(self::CMD_DEFAULT);
227 foreach ($this->pons->in()->request()->getParsedBody() as $hashed_id => $position) {
228 $item = $this->
repository->getItemFacadeForIdentificationString($this->unhash($hashed_id));
229 $item->setPosition((
int) $position);
232 $this->pons->out()->success($this->pons->i18n()->translate(
'order_saved'));
233 $this->pons->flow()->redirect(self::CMD_DEFAULT);
Provides fluid interface to RBAC services.
ilMMItemRepository $repository
__construct(protected Pons $pons)
Interface ilMMItemFacadeInterface.
form( $class_path, string $cmd, string $submit_caption="")