ILIAS  release_8 Revision v8.24
class.ilMMAbstractItemGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
24
29abstract class ilMMAbstractItemGUI
30{
31 use Hasher;
32 public const IDENTIFIER = 'identifier';
33 public const CMD_FLUSH = 'flush';
34
35 protected UIServices $ui;
36
37 protected Services $http;
38
40
42
44
45 protected ilTabsGUI $tabs;
46
48
49 protected ilCtrl $ctrl;
50
52
53 public ilTree $tree;
54
56
63 {
64 global $DIC;
65
66 $this->repository = new ilMMItemRepository();
67 $this->tab_handling = $tab_handling;
68 $this->tabs = $DIC['ilTabs'];
69 $this->lng = $DIC->language();
70 $this->ctrl = $DIC['ilCtrl'];
71 $this->tpl = $DIC['tpl'];
72 $this->tree = $DIC['tree'];
73 $this->toolbar = $DIC['ilToolbar'];
74 $this->http = $DIC->http();
75 $this->ui = $DIC->ui();
76 $this->access = new ilObjMainMenuAccess();
77
78 $this->lng->loadLanguageModule('form');
79 }
80
87 protected function determineCommand(string $standard, string $delete): string
88 {
89 $this->access->checkAccessAndThrowException('visible,read');
90 $cmd = $this->ctrl->getCmd();
91 if ($cmd !== '') {
92 return $cmd;
93 }
94
95 $r = $this->http->request();
96 $post = $r->getParsedBody();
97
98 if ($cmd == "" && isset($post['interruptive_items'])) {
99 $cmd = $delete;
100 } else {
101 $cmd = $standard;
102 }
103
104 return $cmd;
105 }
106
112 {
113 $r = $this->http->request();
114 $get = $r->getQueryParams();
115 $post = $r->getParsedBody();
116
117 if (isset($post['interruptive_items'])) {
118 $string = $post['interruptive_items'][0];
119 $identification = $this->unhash($string);
120 } else {
121 $identification = $this->unhash($get[self::IDENTIFIER]);
122 }
123
124 return $this->repository->getItemFacadeForIdentificationString($identification);
125 }
126
127 protected function flush(): void
128 {
129 $this->repository->flushLostItems();
130 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_subitem_flushed"), true);
131 $this->cancel();
132 }
133
134 abstract protected function cancel(): void;
135}
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
Class Services.
Definition: Services.php:38
Class ilCtrl provides processing control methods.
language handling
Class ilMMAbstractItemGUI.
ilGlobalTemplateInterface $tpl
__construct(ilMMTabHandling $tab_handling)
ilMMAbstractItemGUI constructor.
determineCommand(string $standard, string $delete)
ilMMItemRepository $repository
Class ilMMItemRepository.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjMainMenuAccess.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilMMItemFacadeInterface.
$post
Definition: ltitoken.php:49
static http()
Fetches the global http state from ILIAS.