19 declare(strict_types=1);
55 case self::CMD_VIEW_TOP_ITEMS:
56 $this->
access->checkAccessAndThrowException(
"visible,read");
59 return $this->
index();
61 $this->
access->checkAccessAndThrowException(
'write');
64 return $this->
add($DIC);
65 case self::CMD_CREATE:
66 $this->
access->checkAccessAndThrowException(
'write');
69 return $this->
create($DIC);
71 $this->
access->checkAccessAndThrowException(
'write');
74 return $this->
edit($DIC);
75 case self::CMD_UPDATE:
76 $this->
access->checkAccessAndThrowException(
'write');
79 return $this->
update($DIC);
80 case self::CMD_SAVE_TABLE:
81 $this->
access->checkAccessAndThrowException(
'write');
85 case self::CMD_DELETE:
86 $this->
access->checkAccessAndThrowException(
'write');
89 case self::CMD_CANCEL:
92 case self::CMD_RESTORE:
93 $this->
access->checkAccessAndThrowException(
'write');
97 case self::CMD_SELECT_PARENT:
99 $this->
access->checkAccessAndThrowException(
'write');
101 case self::CMD_FLUSH:
102 $this->
access->checkAccessAndThrowException(
'write');
105 case self::CMD_UPLOAD:
106 $this->
access->checkAccessAndThrowException(
'write');
109 $this->
access->checkAccessAndThrowException(
'write');
120 $r = $DIC->http()->request()->getParsedBody();
121 foreach (
$r[self::IDENTIFIER] as $identification_string =>
$data) {
122 $item = $this->
repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
123 $item->setPosition((
int) (
$data[
'position'] ?? 999));
124 $item->setActiveStatus((
bool) (
$data[
'active'] ??
false));
132 $next_class = $this->
ctrl->getNextClass();
134 if ($next_class ===
'') {
141 switch ($next_class) {
142 case strtolower(ilMMItemTranslationGUI::class):
145 $this->
ctrl->forwardCommand($g);
157 if ($this->
access->hasUserPermissionTo(
'write')) {
159 $btn_add = $this->
ui->factory()->button()->standard(
160 $this->
lng->txt(self::CMD_ADD),
161 $this->
ctrl->getLinkTarget($this, self::CMD_ADD)
163 $this->
toolbar->addComponent($btn_add);
166 $restoration_modal = $this->
ui->factory()->modal()->interruptive(
167 $this->
lng->txt(self::CMD_RESTORE),
168 $this->
lng->txt(
'msg_restore_confirm'),
169 $this->
ctrl->getLinkTarget($this, self::CMD_RESTORE)
170 )->withActionButtonLabel($this->
lng->txt(
'restore'));
171 $btn_restore = $this->
ui->factory()->button()->standard(
172 $this->
lng->txt(self::CMD_RESTORE),
175 $restoration_modal->getShowSignal()
177 $this->
toolbar->addComponent($btn_restore);
178 $this->
toolbar->addComponent($restoration_modal);
182 $btn_flush = $this->
ui->factory()->button()->standard(
183 $this->
lng->txt(self::CMD_FLUSH),
184 $this->
ctrl->getLinkTarget($this, self::CMD_FLUSH)
186 $this->
toolbar->addComponent($btn_flush);
192 $table->setShowRowsSelector(
false);
194 return $table->getHTML();
199 $this->
ctrl->redirectByClass(self::class, self::CMD_VIEW_TOP_ITEMS);
204 $this->
ctrl->redirectByClass(self::class, self::CMD_CANCEL);
216 return $f->getHTML();
231 return $f->getHTML();
243 return $f->getHTML();
254 if ($item->isEditable()) {
260 return $f->getHTML();
266 private function delete():
void 269 if ($item->isDeletable()) {
272 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_topitem_deleted"),
true);
284 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_restored'),
true);
293 return $this->
ui->renderer()->render($form);
299 $form = $form->withRequest($this->
http->request());
303 $data = $form->getData();
304 if ($item->isInterchangeable() && isset(
$data[0])) {
306 $item->setParent(
$data[0]);
308 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_moved'),
true);
310 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_not_moved'),
true);
321 $this->
ctrl->saveParameter($this, self::IDENTIFIER);
322 $f = $this->
ui->factory();
324 $parent =
$f->input()->field()->select($this->
lng->txt(
'select_parent'), $this->
repository->getPossibleParentsForFormAndTable())->withRequired(
true);
326 return $f->input()->container()->form()->standard($this->
ctrl->getFormAction($this, self::CMD_MOVE), [$parent]);
Class ilMMAbstractItemGUI.
const CMD_RENDER_INTERRUPTIVE
dispatchCommand(string $cmd)
repository()
description: > Example for rendering a repository card
Class ilMMItemRepository.
Customizing of pimple-DIC for ILIAS.
static http()
Fetches the global http state from ILIAS.
Class ilMMTopItemGUI ilMMTopItemGUI: ilObjMainMenuGUI ilMMTopItemGUI: ilMMItemTranslationGUI.
Class ilMMItemTranslationGUI.
ilMMItemRepository $repository
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static flushDB()
never use in ILIAS Core, Plugins only
ctrl()
Get the interface to the control structure.
ui()
Get the interface to get services from UI framework.
Class ilMMTopItemTableGUI.
determineCommand(string $standard, string $delete)