ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMMAbstractItemGUI.php
Go to the documentation of this file.
1<?php
2
3use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
4
11{
12 const IDENTIFIER = 'identifier';
13 use Hasher;
17 protected $ui;
21 protected $http;
25 protected $repository;
29 protected $toolbar;
33 protected $tab_handling;
37 protected $tabs;
41 public $lng;
45 protected $ctrl;
49 public $tpl;
53 public $tree;
57 protected $access;
61 protected $gs;
62
71 {
72 global $DIC;
73
74 $this->repository = new ilMMItemRepository();
75 $this->tab_handling = $tab_handling;
76 $this->tabs = $DIC['ilTabs'];
77 $this->lng = $DIC->language();
78 $this->ctrl = $DIC['ilCtrl'];
79 $this->tpl = $DIC['tpl'];
80 $this->tree = $DIC['tree'];
81 $this->toolbar = $DIC['ilToolbar'];
82 $this->http = $DIC->http();
83 $this->ui = $DIC->ui();
84 $this->access = new ilObjMainMenuAccess();
85 $this->gs = $DIC->globalScreen();
86 }
87
88
96 protected function determineCommand(string $standard, string $delete) : string
97 {
98 $this->access->checkAccessAndThrowException('visible,read');
99 $cmd = $this->ctrl->getCmd();
100 if ($cmd !== '') {
101 return $cmd;
102 }
103
104 $r = $this->http->request();
105 $post = $r->getParsedBody();
106
107 if ($cmd == "" && isset($post['interruptive_items'])) {
108 $cmd = $delete;
109 } else {
110 $cmd = $standard;
111 }
112
113 return $cmd;
114 }
115
116
122 {
123 $r = $this->http->request();
124 $get = $r->getQueryParams();
125 $post = $r->getParsedBody();
126
127 if (!isset($post['cmd']) && isset($post['interruptive_items'])) {
128 $string = $post['interruptive_items'][0];
129 $identification = $this->unhash($string);
130 } else {
131 $identification = $this->unhash($get[self::IDENTIFIER]);
132 }
133
134 return $this->repository->getItemFacadeForIdentificationString($identification);
135 }
136
137
138 public function renderInterruptiveModal()
139 {
140 $f = $this->ui->factory();
141 $r = $this->ui->renderer();
142
143 $form_action = $this->ctrl->getFormActionByClass(self::class, self::CMD_DELETE);
144 $delete_modal = $f->modal()->interruptive(
145 $this->lng->txt("delete"),
146 $this->lng->txt(self::CMD_CONFIRM_DELETE),
147 $form_action
148 );
149
150 echo $r->render([$delete_modal]);
151 exit;
152 }
153}
exit
Definition: backend.php:16
An exception for terminatinating execution or to throw for unit testing.
Class ilMMAbstractItemGUI.
__construct(ilMMTabHandling $tab_handling)
ilMMAbstractItemGUI constructor.
determineCommand(string $standard, string $delete)
Class ilMMItemRepository.
Class ilMMTabHandling.
Class ilObjMainMenuAccess.
$r
Definition: example_031.php:79
Interface ilMMItemFacadeInterface.
static http()
Fetches the global http state from ILIAS.
$post
Definition: post.php:34
repository()
Definition: repository.php:5
global $DIC
Definition: saml.php:7