ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMMTopItemGUI Class Reference

Class ilMMTopItemGUI @ilCtrl_IsCalledBy ilMMTopItemGUI: ilObjMainMenuGUI @ilCtrl_Calls ilMMTopItemGUI: ilMMItemTranslationGUI. More...

+ Inheritance diagram for ilMMTopItemGUI:
+ Collaboration diagram for ilMMTopItemGUI:

Public Member Functions

 executeCommand ()
 
- Public Member Functions inherited from ilMMAbstractItemGUI
 __construct (ilMMTabHandling $tab_handling)
 ilMMAbstractItemGUI constructor. More...
 
 renderInterruptiveModal ()
 

Data Fields

const CMD_VIEW_TOP_ITEMS = 'subtab_topitems'
 
const CMD_ADD = 'topitem_add'
 
const CMD_RESTORE = 'restore'
 
const CMD_CREATE = 'topitem_create'
 
const CMD_EDIT = 'topitem_edit'
 
const CMD_DELETE = 'topitem_delete'
 
const CMD_CONFIRM_DELETE = 'topitem_confirm_delete'
 
const CMD_TRANSLATE = 'topitem_translate'
 
const CMD_UPDATE = 'topitem_update'
 
const CMD_SAVE_TABLE = 'save_table'
 
const CMD_CANCEL = 'cancel'
 
const CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'
 
const CMD_CONFIRM_RESTORE = 'confirmRestore'
 
const CMD_FLUSH = 'flush'
 
- Data Fields inherited from ilMMAbstractItemGUI
const IDENTIFIER = 'identifier'
 
 $lng
 
 $tpl
 
 $tree
 

Private Member Functions

 dispatchCommand ($cmd)
 
 saveTable ()
 
 index ()
 
 cancel ()
 
 doubleCancel ()
 
 add (\ILIAS\DI\Container $DIC)
 
 create (\ILIAS\DI\Container $DIC)
 
 edit (\ILIAS\DI\Container $DIC)
 
 update (\ILIAS\DI\Container $DIC)
 
 delete ()
 
 confirmDelete ()
 
 confirmRestore ()
 
 flush ()
 
 restore ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilMMAbstractItemGUI
 determineCommand (string $standard, string $delete)
 
 getMMItemFromRequest ()
 
- Protected Attributes inherited from ilMMAbstractItemGUI
 $ui
 
 $http
 
 $repository
 
 $toolbar
 
 $tab_handling
 
 $tabs
 
 $ctrl
 
 $access
 
 $gs
 

Detailed Description

Member Function Documentation

◆ add()

ilMMTopItemGUI::add ( \ILIAS\DI\Container  $DIC)
private
Parameters
$DIC
Returns
string
Exceptions
Throwable

Definition at line 175 of file class.ilMMTopItemGUI.php.

175 : string
176 {
177 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
178
179 return $f->getHTML();
180 }
Class ilMMTopItemFormGUI.
global $DIC
Definition: saml.php:7

References $DIC, and $f.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ cancel()

ilMMTopItemGUI::cancel ( )
private

Definition at line 160 of file class.ilMMTopItemGUI.php.

161 {
162 $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_TOP_ITEMS);
163 }

Referenced by create(), delete(), dispatchCommand(), flush(), restore(), saveTable(), and update().

+ Here is the caller graph for this function:

◆ confirmDelete()

ilMMTopItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

Definition at line 243 of file class.ilMMTopItemGUI.php.

243 : string
244 {
245 $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
246 $i = $this->getMMItemFromRequest();
247 $c = new ilConfirmationGUI();
248 $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
249 $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
250 $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
251 $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
252 $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
253
254 return $c->getHTML();
255 }
Confirmation screen class.
$i
Definition: disco.tpl.php:19
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406

References $c, $i, ilMMAbstractItemGUI\getMMItemFromRequest(), and GuzzleHttp\Psr7\hash().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmRestore()

ilMMTopItemGUI::confirmRestore ( )
private

Definition at line 257 of file class.ilMMTopItemGUI.php.

257 : string
258 {
259 $c = new ilConfirmationGUI();
260 $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
261 $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_RESTORE);
262 $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
263 $c->setHeaderText($this->lng->txt('msg_restore_confirm'));
264
265 return $c->getHTML();
266 }

References $c.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ create()

ilMMTopItemGUI::create ( \ILIAS\DI\Container  $DIC)
private
Parameters
\ILIAS\DI\Container$DIC
Returns
string
Exceptions
Throwable

Definition at line 187 of file class.ilMMTopItemGUI.php.

188 {
189 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
190 if ($f->save()) {
191 $this->cancel();
192 }
193
194 return $f->getHTML();
195 }

References $DIC, $f, and cancel().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMMTopItemGUI::delete ( )
private

Definition at line 229 of file class.ilMMTopItemGUI.php.

230 {
231 $item = $this->getMMItemFromRequest();
232 if ($item->isDeletable()) {
233 $this->repository->deleteItem($item);
234 }
235 ilUtil::sendSuccess($this->lng->txt("msg_topitem_deleted"), true);
236 $this->cancel();
237 }
repository()
Definition: repository.php:5

References cancel(), ilMMAbstractItemGUI\getMMItemFromRequest(), and repository().

+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMTopItemGUI::dispatchCommand (   $cmd)
private

Definition at line 31 of file class.ilMMTopItemGUI.php.

32 {
33 global $DIC;
34 switch ($cmd) {
36 $this->access->checkAccessAndThrowException("visible,read");
37 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
38
39 return $this->index($DIC);
40 case self::CMD_ADD:
41 $this->access->checkAccessAndThrowException("write");
42 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
43
44 return $this->add($DIC);
46 $this->access->checkAccessAndThrowException("write");
47 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
48
49 return $this->create($DIC);
50 case self::CMD_EDIT:
51 $this->access->checkAccessAndThrowException("write");
52 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
53
54 return $this->edit($DIC);
56 $this->access->checkAccessAndThrowException("write");
57 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
58
59 return $this->update($DIC);
61 $this->access->checkAccessAndThrowException("write");
62 $this->saveTable();
63
64 break;
66 $this->access->checkAccessAndThrowException("write");
67
68 return $this->confirmDelete();
70 $this->access->checkAccessAndThrowException("write");
71 $this->delete();
72 break;
74 $this->cancel();
75 break;
77 return $this->confirmRestore();
78 break;
79 case self::CMD_FLUSH:
80 $this->access->checkAccessAndThrowException('write');
81 $this->flush();
82 break;
84 $this->access->checkAccessAndThrowException("write");
85
86 $this->restore();
87 break;
89 $this->access->checkAccessAndThrowException("write");
91 break;
92 }
93
94 return "";
95 }
update(\ILIAS\DI\Container $DIC)
create(\ILIAS\DI\Container $DIC)
add(\ILIAS\DI\Container $DIC)
edit(\ILIAS\DI\Container $DIC)

References $DIC, add(), cancel(), CMD_ADD, CMD_CANCEL, CMD_CONFIRM_DELETE, CMD_CONFIRM_RESTORE, CMD_CREATE, CMD_DELETE, CMD_EDIT, CMD_FLUSH, CMD_RENDER_INTERRUPTIVE, CMD_RESTORE, CMD_SAVE_TABLE, CMD_UPDATE, CMD_VIEW_TOP_ITEMS, confirmDelete(), confirmRestore(), create(), edit(), flush(), index(), ilMMAbstractItemGUI\renderInterruptiveModal(), restore(), saveTable(), ilObjMainMenuGUI\TAB_MAIN, and update().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doubleCancel()

ilMMTopItemGUI::doubleCancel ( )
private

Definition at line 165 of file class.ilMMTopItemGUI.php.

166 {
167 $this->ctrl->redirectByClass(self::class, self::CMD_CANCEL);
168 }

◆ edit()

ilMMTopItemGUI::edit ( \ILIAS\DI\Container  $DIC)
private
Parameters
$DIC
Returns
string
Exceptions
Throwable

Definition at line 202 of file class.ilMMTopItemGUI.php.

202 : string
203 {
204 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->getMMItemFromRequest(), $this->repository);
205
206 return $f->getHTML();
207 }

References $DIC, and $f.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilMMTopItemGUI::executeCommand ( )

Definition at line 110 of file class.ilMMTopItemGUI.php.

111 {
112 $next_class = $this->ctrl->getNextClass();
113
114 if ($next_class == '') {
115 $cmd = $this->determineCommand(self::CMD_VIEW_TOP_ITEMS, self::CMD_DELETE);
116 $this->tpl->setContent($this->dispatchCommand($cmd));
117
118 return;
119 }
120
121 switch ($next_class) {
122 case strtolower(ilMMItemTranslationGUI::class):
123 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true);
124 $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
125 $this->ctrl->forwardCommand($g);
126 break;
127 default:
128 break;
129 }
130 }
determineCommand(string $standard, string $delete)
Class ilMMItemTranslationGUI.
Class ilObjMainMenuGUI.

References ilMMAbstractItemGUI\determineCommand(), dispatchCommand(), ilMMAbstractItemGUI\getMMItemFromRequest(), repository(), and ilObjMainMenuGUI\TAB_MAIN.

+ Here is the call graph for this function:

◆ flush()

ilMMTopItemGUI::flush ( )
private

Definition at line 268 of file class.ilMMTopItemGUI.php.

269 {
270 $this->repository->flushLostItems();
271 ilUtil::sendSuccess($this->lng->txt("msg_subitem_flushed"), true);
272 $this->cancel();
273 }

References cancel(), and repository().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilMMTopItemGUI::index ( )
private
Returns
string

Definition at line 135 of file class.ilMMTopItemGUI.php.

135 : string
136 {
137 if ($this->access->hasUserPermissionTo('write')) {
138 // ADD NEW
140 $b->setCaption($this->lng->txt(self::CMD_ADD), false);
141 $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD));
142 $this->toolbar->addButtonInstance($b);
143
144 // REMOVE LOST ITEMS
145 if ($this->repository->hasLostItems()) {
147 $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_FLUSH));
148 $b->setCaption($this->lng->txt(self::CMD_FLUSH), false);
149 $this->toolbar->addButtonInstance($b);
150 }
151 }
152
153 // TABLE
154 $table = new ilMMTopItemTableGUI($this, new ilMMItemRepository(), $this->access);
155 $table->setShowRowsSelector(false);
156
157 return $table->getHTML();
158 }
static getInstance()
Factory.
Class ilMMItemRepository.
Class ilMMTopItemTableGUI.
if(empty($password)) $table
Definition: pwgen.php:24

References $table, ilLinkButton\getInstance(), and repository().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restore()

ilMMTopItemGUI::restore ( )
private

Definition at line 275 of file class.ilMMTopItemGUI.php.

276 {
283
284 $r = function ($path, $xml_name) {
285 foreach (new DirectoryIterator($path) as $fileInfo) {
286 $filename = $fileInfo->getPathname() . $xml_name;
287 if ($fileInfo->isDir() && !$fileInfo->isDot() && file_exists($filename)) {
288 $xml = simplexml_load_file($filename);
289 if (isset($xml->gsproviders)) {
290 foreach ($xml->gsproviders as $item) {
291 if (isset($item->gsprovider)) {
292 foreach ($item->gsprovider as $provider) {
293 $attributes = $provider->attributes();
294 if ($attributes->purpose == StaticMainMenuProvider::PURPOSE_MAINBAR) {
295 $classname = $attributes->class_name[0];
296 ilGSProviderStorage::registerIdentifications($classname, StaticMainMenuProvider::PURPOSE_MAINBAR);
297 }
298 }
299 }
300 }
301 }
302 }
303 }
304 };
305 $r("./Services", "/service.xml");
306 $r("./Modules", "/module.xml");
307
308 ilGlobalCache::flushAll();
309
310 ilUtil::sendSuccess($this->lng->txt('msg_restored'), true);
311
312 $this->cancel();
313 }
$path
Definition: aliased.php:25
$filename
Definition: buildRTE.php:89
static registerIdentifications(string $class_name, string $purpose)
$r
Definition: example_031.php:79
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85

References $attributes, $filename, $path, PHPMailer\PHPMailer\$provider, $r, $xml, cancel(), ActiveRecord\flushDB(), and ilGSProviderStorage\registerIdentifications().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTable()

ilMMTopItemGUI::saveTable ( )
private

Definition at line 97 of file class.ilMMTopItemGUI.php.

98 {
99 global $DIC;
100 $r = $DIC->http()->request()->getParsedBody();
101 foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
102 $item = $this->repository->getItemFacadeForIdentificationString($identification_string);
103 $item->setPosition((int) $data['position']);
104 $item->setActiveStatus((bool) $data['active']);
105 $this->repository->updateItem($item);
106 }
107 $this->cancel();
108 }
$data
Definition: bench.php:6

References $data, $DIC, $r, cancel(), and repository().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilMMTopItemGUI::update ( \ILIAS\DI\Container  $DIC)
private
Parameters
\ILIAS\DI\Container$DIC
Returns
string
Exceptions
Throwable

Definition at line 214 of file class.ilMMTopItemGUI.php.

215 {
216 $item = $this->getMMItemFromRequest();
217 if ($item->isEditable()) {
218 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $item, $this->repository);
219 if ($f->save()) {
220 $this->cancel();
221 }
222
223 return $f->getHTML();
224 }
225
226 return "";
227 }

References $DIC, $f, cancel(), and ilMMAbstractItemGUI\getMMItemFromRequest().

Referenced by dispatchCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ CMD_ADD

const ilMMTopItemGUI::CMD_ADD = 'topitem_add'

Definition at line 17 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand(), and ilMMTopItemFormGUI\initForm().

◆ CMD_CANCEL

const ilMMTopItemGUI::CMD_CANCEL = 'cancel'

Definition at line 26 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_CONFIRM_DELETE

const ilMMTopItemGUI::CMD_CONFIRM_DELETE = 'topitem_confirm_delete'

Definition at line 22 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand(), and ilMMTopItemTableGUI\fillRow().

◆ CMD_CONFIRM_RESTORE

const ilMMTopItemGUI::CMD_CONFIRM_RESTORE = 'confirmRestore'

Definition at line 28 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_CREATE

const ilMMTopItemGUI::CMD_CREATE = 'topitem_create'

Definition at line 19 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand(), and ilMMTopItemFormGUI\initForm().

◆ CMD_DELETE

const ilMMTopItemGUI::CMD_DELETE = 'topitem_delete'

Definition at line 21 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand(), and ilMMTopItemTableGUI\fillRow().

◆ CMD_EDIT

const ilMMTopItemGUI::CMD_EDIT = 'topitem_edit'

◆ CMD_FLUSH

const ilMMTopItemGUI::CMD_FLUSH = 'flush'

Definition at line 29 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_RENDER_INTERRUPTIVE

const ilMMTopItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

Definition at line 27 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_RESTORE

const ilMMTopItemGUI::CMD_RESTORE = 'restore'

Definition at line 18 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_SAVE_TABLE

const ilMMTopItemGUI::CMD_SAVE_TABLE = 'save_table'

Definition at line 25 of file class.ilMMTopItemGUI.php.

Referenced by ilMMTopItemTableGUI\__construct(), and dispatchCommand().

◆ CMD_TRANSLATE

const ilMMTopItemGUI::CMD_TRANSLATE = 'topitem_translate'

Definition at line 23 of file class.ilMMTopItemGUI.php.

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_UPDATE

const ilMMTopItemGUI::CMD_UPDATE = 'topitem_update'

Definition at line 24 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand(), and ilMMTopItemFormGUI\initForm().

◆ CMD_VIEW_TOP_ITEMS

const ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS = 'subtab_topitems'

Definition at line 16 of file class.ilMMTopItemGUI.php.

Referenced by dispatchCommand(), and ilMMTabHandling\initTabs().


The documentation for this class was generated from the following file: