19declare(strict_types=1);
44 $this->top_token = $this->pons->in()->buildToken(
'top',
'id');
50 if ($this->pons->handle(
'top_items')) {
54 $command = $this->flow->getCommand(self::CMD_DEFAULT);
57 self::CMD_MOVE => $this->
move(),
58 self::CMD_RESTORE => $this->
restore(),
59 default => parent::executeCommand()
66 $ids = $this->pons->in()->getAllFromRequest($this->top_token->token());
67 if (($ids[0] ??
null) === Input::ALL_OBJECTS) {
70 $this->repository->getTopItems()
73 return $this->
repository->getItemFacadesForIdentificationStrings($ids);
78 return $this->
repository->getItemFacadeForIdentificationString(
79 $this->pons->in()->getFirstFromRequest($this->top_token->token())
86 $this->top_token->token(),
92 $item = $this->
repository->getItemFacadeForIdentificationString(
93 $this->pons->in()->getFirstFromRequest($this->top_token->token())
98 $this->ui->renderer(),
100 $this->pons->in()->request(),
107 protected function form(
bool $save =
false): void
110 $this->pons->in()->keep($this->top_token->token());
115 if ($save && $form->save()) {
116 $this->pons->out()->success($this->
lng->t(
'item_updated'),
true);
117 $this->pons->flow()->redirect(self::CMD_DEFAULT);
120 $this->pons->out()->outAsyncAsModal(
121 $this->pons->i18n()->txt(
'edit'),
122 $this->flow->getLinkTarget($this, self::CMD_UPDATE),
130 $write_access = $this->
access->hasUserPermissionTo(
'write');
134 $add_modal = $this->
ui->factory()->modal()->roundtrip(
135 $this->
lng->t(
'topitem_add'),
137 $form->get()->getInputs(),
138 $this->flow->getLinkTarget($this, self::CMD_CREATE)
141 $btn_add = $this->
ui->factory()->button()->primary(
142 $this->
lng->t(
'topitem_add'),
143 $add_modal->getShowSignal()
145 $this->
toolbar->addComponent($add_modal);
146 $this->
toolbar->addComponent($btn_add);
149 $restoration_modal = $this->
ui->factory()->modal()->interruptive(
150 $this->
lng->t(self::CMD_RESTORE),
151 $this->lng->t(
'msg_restore_confirm'),
152 $this->flow->getLinkTarget($this, self::CMD_RESTORE)
153 )->withActionButtonLabel($this->
lng->t(
'restore'));
154 $btn_restore = $this->
ui->factory()->button()->standard(
155 $this->
lng->t(self::CMD_RESTORE),
158 $restoration_modal->getShowSignal()
160 $this->
toolbar->addComponent($btn_restore);
161 $this->
toolbar->addComponent($restoration_modal);
165 $btn_flush = $this->
ui->factory()->button()->standard(
166 $this->
lng->txt(self::CMD_FLUSH),
167 $this->flow->getLinkTarget($this, self::CMD_FLUSH)
169 $this->
toolbar->addComponent($btn_flush);
180 $this->pons->out()->out(...$table->get());
188 $this->pons->out()->outAsyncAsModal(
189 $this->
lng->txt(
'select_parent'),
190 $this->flow->getLinkTarget($this, self::CMD_MOVE),
201 ->withRequest($this->pons->in()->request())
204 if (isset(
$data[0]) && $item->isInterchangeable()) {
206 $item->setParent(
$data[0]);
208 $this->pons->out()->success($this->
lng->txt(
'msg_moved'),
true);
210 $this->pons->out()->error($this->
lng->txt(
'msg_not_moved'),
true);
213 $this->pons->flow()->redirect(self::CMD_DEFAULT);
218 $f = $this->
ui->factory();
219 $parent =
$f->input()
222 $this->
lng->txt(
'select_parent'),
223 $this->repository->getPossibleParentsForFormAndTable()
225 ->withRequired(
true);
231 $this->flow->getLinkTarget($this, self::CMD_MOVE),
244 $this->pons->out()->success($this->
lng->txt(
'msg_restored'),
true);
245 $this->flow->redirect(self::CMD_DEFAULT);
static flushDB()
@depracated never use in ILIAS Core, Plugins only
@ilCtrl_IsCalledBy ilMMTopItemGUI: ilObjMainMenuGUI @ilCtrl_Calls ilMMTopItemGUI: ILIAS\GlobalScreen\...
TokenContainer $top_token
Interface ilMMItemFacadeInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc