19declare(strict_types=1);
45 $this->top_token = $this->pons->in()->buildToken(
'top',
'id');
51 if ($this->pons->handle(
'top_items')) {
55 $command = $this->flow->getCommand(self::CMD_DEFAULT);
58 self::CMD_MOVE => $this->
move(),
59 self::CMD_RESTORE => $this->
restore(),
60 default => parent::executeCommand()
67 $ids = $this->pons->in()->getAllFromRequest($this->top_token->token());
68 if (($ids[0] ??
null) === Input::ALL_OBJECTS) {
71 $this->repository->getTopItems()
74 return $this->
repository->getItemFacadesForIdentificationStrings($ids);
79 return $this->
repository->getItemFacadeForIdentificationString(
80 $this->pons->in()->getFirstFromRequest($this->top_token->token())
87 $this->top_token->token(),
93 $item = $this->
repository->getItemFacadeForIdentificationString(
94 $this->pons->in()->getFirstFromRequest($this->top_token->token())
99 $this->ui->renderer(),
101 $this->pons->in()->request(),
108 protected function form(
bool $save =
false): void
111 $this->pons->in()->keep($this->top_token->token());
118 $this->pons->out()->success($this->
lng->t(
'item_updated'),
true);
119 $this->pons->flow()->redirect(self::CMD_DEFAULT);
121 $this->pons->in()->keep($this->top_token->token());
122 $this->pons->out()->out($form->get());
127 $this->pons->out()->outAsyncAsModal(
128 $this->pons->i18n()->txt(
'edit'),
129 $this->flow->getLinkTarget($this, self::CMD_UPDATE),
137 $write_access = $this->
access->hasUserPermissionTo(
'write');
141 $add_modal = $this->
ui->factory()->modal()->roundtrip(
142 $this->
lng->t(
'topitem_add'),
144 $form->get()->getInputs(),
145 $this->flow->getLinkTarget($this, self::CMD_CREATE)
148 $btn_add = $this->
ui->factory()->button()->primary(
149 $this->
lng->t(
'topitem_add'),
150 $add_modal->getShowSignal()
152 $this->
toolbar->addComponent($add_modal);
153 $this->
toolbar->addComponent($btn_add);
156 $restoration_modal = $this->
ui->factory()->modal()->interruptive(
157 $this->
lng->t(self::CMD_RESTORE),
158 $this->lng->t(
'msg_restore_confirm'),
159 $this->flow->getLinkTarget($this, self::CMD_RESTORE)
160 )->withActionButtonLabel($this->
lng->t(
'restore'));
161 $btn_restore = $this->
ui->factory()->button()->standard(
162 $this->
lng->t(self::CMD_RESTORE),
165 $restoration_modal->getShowSignal()
167 $this->
toolbar->addComponent($btn_restore);
168 $this->
toolbar->addComponent($restoration_modal);
171 if ($this->
repository->hasLostItems() && method_exists($this, self::CMD_FLUSH)) {
172 $btn_flush = $this->
ui->factory()->button()->standard(
173 $this->
lng->txt(self::CMD_FLUSH),
174 $this->flow->getLinkTarget($this, self::CMD_FLUSH)
176 $this->
toolbar->addComponent($btn_flush);
187 $this->pons->out()->out(...$table->get());
195 $this->pons->out()->outAsyncAsModal(
196 $this->
lng->txt(
'select_parent'),
197 $this->flow->getLinkTarget($this, self::CMD_MOVE),
206 ->withRequest($this->pons->in()->request())
210 if (isset(
$data[0]) && $item->isInterchangeable()) {
212 $item->setParent(
$data[0]);
214 $this->pons->out()->success($this->
lng->txt(
'msg_moved'),
true);
216 $this->pons->out()->error($this->
lng->txt(
'msg_not_moved'),
true);
219 $this->pons->flow()->redirect(self::CMD_DEFAULT);
225 $f = $this->
ui->factory();
226 $parent =
$f->input()
229 $this->
lng->txt(
'select_parent'),
230 $this->repository->getPossibleParentsForFormAndTable()
232 ->withRequired(
true);
238 $this->flow->getLinkTarget($this, self::CMD_MOVE),
251 $this->pons->out()->success($this->
lng->txt(
'msg_restored'),
true);
252 $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