ILIAS  release_8 Revision v8.24
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...
 

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 = '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_UPLOAD = 'upload'
 
const CMD_SELECT_PARENT = 'selectParent'
 
const CMD_MOVE = 'move'
 
- Data Fields inherited from ilMMAbstractItemGUI
const IDENTIFIER = 'identifier'
 
const CMD_FLUSH = 'flush'
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 

Protected Member Functions

 cancel ()
 
- Protected Member Functions inherited from ilMMAbstractItemGUI
 determineCommand (string $standard, string $delete)
 
 getMMItemFromRequest ()
 
 flush ()
 
 cancel ()
 

Private Member Functions

 dispatchCommand (string $cmd)
 
 saveTable ()
 
 index ()
 
 doubleCancel ()
 
 add (Container $DIC)
 
 create (Container $DIC)
 
 edit (Container $DIC)
 
 update (Container $DIC)
 
 delete ()
 
 confirmDelete ()
 
 confirmRestore ()
 
 restore ()
 
 selectParent ()
 
 move ()
 
 getMoveForm ()
 

Additional Inherited Members

- Protected Attributes inherited from ilMMAbstractItemGUI
UIServices $ui
 
Services $http
 
ilMMItemRepository $repository
 
ilToolbarGUI $toolbar
 
ilMMTabHandling $tab_handling
 
ilTabsGUI $tabs
 
ilCtrl $ctrl
 
ilObjMainMenuAccess $access
 

Detailed Description

Member Function Documentation

◆ add()

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

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

211 : string
212 {
213 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
214
215 return $f->getHTML();
216 }
Class ilMMTopItemFormGUI.
global $DIC
Definition: feed.php:28

References $DIC, and Vendor\Package\$f.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ cancel()

ilMMTopItemGUI::cancel ( )
protected

Reimplemented from ilMMAbstractItemGUI.

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

196 : void
197 {
198 $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_TOP_ITEMS);
199 }

References ILIAS\Repository\ctrl().

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

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

◆ confirmDelete()

ilMMTopItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

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

279 : string
280 {
281 $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
282 $i = $this->getMMItemFromRequest();
283 $c = new ilConfirmationGUI();
284 $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
285 $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
286 $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
287 $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
288 $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
289
290 return $c->getHTML();
291 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: cli.php:38
$i
Definition: metadata.php:41

References $c, $i, ILIAS\Repository\ctrl(), ilMMAbstractItemGUI\getMMItemFromRequest(), and ILIAS\Repository\lng().

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 293 of file class.ilMMTopItemGUI.php.

293 : string
294 {
295 $c = new ilConfirmationGUI();
296 $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
297 $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_RESTORE);
298 $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
299 $c->setHeaderText($this->lng->txt('msg_restore_confirm'));
300
301 return $c->getHTML();
302 }

References $c, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by dispatchCommand().

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

◆ create()

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

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

223 : string
224 {
225 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
226 if ($f->save()) {
227 $this->cancel();
228 }
229
230 return $f->getHTML();
231 }

References $DIC, Vendor\Package\$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 265 of file class.ilMMTopItemGUI.php.

265 : void
266 {
267 $item = $this->getMMItemFromRequest();
268 if ($item->isDeletable()) {
269 $this->repository->deleteItem($item);
270 }
271 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_topitem_deleted"), true);
272 $this->cancel();
273 }

References cancel(), ilMMAbstractItemGUI\getMMItemFromRequest(), ILIAS\Repository\lng(), and ILIAS\UI\examples\Deck\repository().

+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMTopItemGUI::dispatchCommand ( string  $cmd)
private

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

52 : string
53 {
54 global $DIC;
55 switch ($cmd) {
57 $this->access->checkAccessAndThrowException("visible,read");
58 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
59
60 return $this->index();
61 case self::CMD_ADD:
62 $this->access->checkAccessAndThrowException('write');
63 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
64
65 return $this->add($DIC);
67 $this->access->checkAccessAndThrowException('write');
68 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
69
70 return $this->create($DIC);
71 case self::CMD_EDIT:
72 $this->access->checkAccessAndThrowException('write');
73 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
74
75 return $this->edit($DIC);
77 $this->access->checkAccessAndThrowException('write');
78 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
79
80 return $this->update($DIC);
82 $this->access->checkAccessAndThrowException('write');
83 $this->saveTable();
84
85 break;
87 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
88 $this->access->checkAccessAndThrowException('write');
89
90 return $this->confirmDelete();
92 $this->access->checkAccessAndThrowException('write');
93 $this->delete();
94 break;
96 $this->cancel();
97 break;
99 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
100 $this->access->checkAccessAndThrowException('write');
101 return $this->confirmRestore();
103 $this->access->checkAccessAndThrowException('write');
104
105 $this->restore();
106 break;
108 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
109 $this->access->checkAccessAndThrowException('write');
110 return $this->selectParent();
111 case self::CMD_FLUSH:
112 $this->access->checkAccessAndThrowException('write');
113 $this->flush();
114 break;
115 case self::CMD_UPLOAD:
116 $this->access->checkAccessAndThrowException('write');
117 return $this->selectParent();
118 case self::CMD_MOVE:
119 $this->access->checkAccessAndThrowException('write');
120 $this->move();
121 break;
122 }
123
124 return "";
125 }
update(Container $DIC)
create(Container $DIC)
edit(Container $DIC)
add(Container $DIC)

References $DIC, ILIAS\Repository\access(), add(), cancel(), CMD_ADD, CMD_CANCEL, CMD_CONFIRM_DELETE, CMD_CONFIRM_RESTORE, CMD_CREATE, CMD_DELETE, CMD_EDIT, ilMMAbstractItemGUI\CMD_FLUSH, CMD_MOVE, CMD_RESTORE, CMD_SAVE_TABLE, CMD_SELECT_PARENT, CMD_UPDATE, CMD_UPLOAD, CMD_VIEW_TOP_ITEMS, confirmDelete(), confirmRestore(), create(), edit(), ilMMAbstractItemGUI\flush(), index(), move(), restore(), saveTable(), selectParent(), 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 201 of file class.ilMMTopItemGUI.php.

201 : void
202 {
203 $this->ctrl->redirectByClass(self::class, self::CMD_CANCEL);
204 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ edit()

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

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

238 : string
239 {
240 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->getMMItemFromRequest(), $this->repository);
241
242 return $f->getHTML();
243 }

References $DIC, and Vendor\Package\$f.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilMMTopItemGUI::executeCommand ( )

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

140 : void
141 {
142 $next_class = $this->ctrl->getNextClass();
143
144 if ($next_class === '') {
145 $cmd = $this->determineCommand(self::CMD_VIEW_TOP_ITEMS, self::CMD_DELETE);
146 $this->tpl->setContent($this->dispatchCommand($cmd));
147
148 return;
149 }
150
151 switch ($next_class) {
152 case strtolower(ilMMItemTranslationGUI::class):
153 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true);
154 $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
155 $this->ctrl->forwardCommand($g);
156 break;
157 default:
158 break;
159 }
160 }
return true
determineCommand(string $standard, string $delete)
Class ilMMItemTranslationGUI.
dispatchCommand(string $cmd)
Class ilObjMainMenuGUI @ilCtrl_IsCalledBy ilObjMainMenuGUI: ilAdministrationGUI @ilCtrl_Calls ilObjMa...

References ILIAS\Repository\ctrl(), ilMMAbstractItemGUI\determineCommand(), dispatchCommand(), ilMMAbstractItemGUI\getMMItemFromRequest(), ILIAS\UI\examples\Deck\repository(), and ilObjMainMenuGUI\TAB_MAIN.

+ Here is the call graph for this function:

◆ getMoveForm()

ilMMTopItemGUI::getMoveForm ( )
private
Returns
Standard

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

347 : Standard
348 {
349 $this->ctrl->saveParameter($this, self::IDENTIFIER);
350 $f = $this->ui->factory();
351
352 $parent = $f->input()->field()->select($this->lng->txt('select_parent'), $this->repository->getPossibleParentsForFormAndTable())->withRequired(true);
353
354 return $f->input()->container()->form()->standard($this->ctrl->getFormAction($this, self::CMD_MOVE), [$parent]);
355 }
This describes a standard form.
Definition: Standard.php:27

References Vendor\Package\$f, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by move(), and selectParent().

+ 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 165 of file class.ilMMTopItemGUI.php.

165 : string
166 {
167 if ($this->access->hasUserPermissionTo('write')) {
168 // ADD NEW
170 $b->setCaption($this->lng->txt(self::CMD_ADD), false);
171 $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD));
172 $this->toolbar->addButtonInstance($b);
173
174 // RESTORE
176 $b->setCaption($this->lng->txt(self::CMD_RESTORE), false);
177 $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_CONFIRM_RESTORE));
178 $this->toolbar->addButtonInstance($b);
179
180 // REMOVE LOST ITEMS
181 if ($this->repository->hasLostItems()) {
183 $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_FLUSH));
184 $b->setCaption($this->lng->txt(self::CMD_FLUSH), false);
185 $this->toolbar->addButtonInstance($b);
186 }
187 }
188
189 // TABLE
190 $table = new ilMMTopItemTableGUI($this, new ilMMItemRepository(), $this->access);
191 $table->setShowRowsSelector(false);
192
193 return $table->getHTML();
194 }
Class ilMMItemRepository.
Class ilMMTopItemTableGUI.

References Vendor\Package\$b, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), ILIAS\Repository\lng(), ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\toolbar().

Referenced by dispatchCommand().

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

◆ move()

ilMMTopItemGUI::move ( )
private

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

324 : void
325 {
326 $form = $this->getMoveForm();
327 $form = $form->withRequest($this->http->request());
328
329 $item = $this->getMMItemFromRequest();
330
331 $data = $form->getData();
332 if ($item->isInterchangeable() && isset($data[0])) {
333 $f = $this->repository->getItemFacadeForIdentificationString($data[0]);
334 $item->setParent($data[0]);
335 $this->repository->updateItem($item);
336 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_moved'), true);
337 } else {
338 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_not_moved'), true);
339 }
340
341 $this->cancel();
342 }
static http()
Fetches the global http state from ILIAS.

References $data, Vendor\Package\$f, cancel(), ilMMAbstractItemGUI\getMMItemFromRequest(), getMoveForm(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\UI\examples\Deck\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 305 of file class.ilMMTopItemGUI.php.

305 : void
306 {
311
312 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_restored'), true);
313
314 $this->cancel();
315 }
static flushDB()
@depracated never use in ILIAS Core, Plugins only

References cancel(), ActiveRecord\flushDB(), and ILIAS\Repository\lng().

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 127 of file class.ilMMTopItemGUI.php.

127 : void
128 {
129 global $DIC;
130 $r = $DIC->http()->request()->getParsedBody();
131 foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
132 $item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
133 $item->setPosition((int) ($data['position'] ?? 999));
134 $item->setActiveStatus((bool) ($data['active'] ?? false));
135 $this->repository->updateItem($item);
136 }
137 $this->cancel();
138 }

References $data, $DIC, cancel(), and ILIAS\UI\examples\Deck\repository().

Referenced by dispatchCommand().

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

◆ selectParent()

ilMMTopItemGUI::selectParent ( )
private

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

317 : string
318 {
319 $form = $this->getMoveForm();
320
321 return $this->ui->renderer()->render($form);
322 }

References getMoveForm(), and ILIAS\Repository\ui().

Referenced by dispatchCommand().

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

◆ update()

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

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

250 : string
251 {
252 $item = $this->getMMItemFromRequest();
253 if ($item->isEditable()) {
254 $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $item, $this->repository);
255 if ($f->save()) {
256 $this->cancel();
257 }
258
259 return $f->getHTML();
260 }
261
262 return "";
263 }

References $DIC, Vendor\Package\$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 36 of file class.ilMMTopItemGUI.php.

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

◆ CMD_CANCEL

const ilMMTopItemGUI::CMD_CANCEL = 'cancel'

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

Referenced by dispatchCommand().

◆ CMD_CONFIRM_DELETE

const ilMMTopItemGUI::CMD_CONFIRM_DELETE = 'topitem_confirm_delete'

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

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

◆ CMD_CONFIRM_RESTORE

const ilMMTopItemGUI::CMD_CONFIRM_RESTORE = 'confirmRestore'

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

Referenced by dispatchCommand().

◆ CMD_CREATE

const ilMMTopItemGUI::CMD_CREATE = 'topitem_create'

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

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

◆ CMD_DELETE

const ilMMTopItemGUI::CMD_DELETE = 'delete'

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

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

◆ CMD_EDIT

const ilMMTopItemGUI::CMD_EDIT = 'topitem_edit'

◆ CMD_MOVE

const ilMMTopItemGUI::CMD_MOVE = 'move'

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

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

◆ CMD_RENDER_INTERRUPTIVE

const ilMMTopItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

◆ CMD_RESTORE

const ilMMTopItemGUI::CMD_RESTORE = 'restore'

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

Referenced by dispatchCommand().

◆ CMD_SAVE_TABLE

const ilMMTopItemGUI::CMD_SAVE_TABLE = 'save_table'

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

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

◆ CMD_SELECT_PARENT

const ilMMTopItemGUI::CMD_SELECT_PARENT = 'selectParent'

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

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

◆ CMD_TRANSLATE

const ilMMTopItemGUI::CMD_TRANSLATE = 'topitem_translate'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_UPDATE

const ilMMTopItemGUI::CMD_UPDATE = 'topitem_update'

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

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

◆ CMD_UPLOAD

const ilMMTopItemGUI::CMD_UPLOAD = 'upload'

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

Referenced by dispatchCommand().

◆ CMD_VIEW_TOP_ITEMS

const ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS = 'subtab_topitems'

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

Referenced by dispatchCommand().


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