ILIAS  release_8 Revision v8.24
ilMMSubItemGUI Class Reference

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

+ Inheritance diagram for ilMMSubItemGUI:
+ Collaboration diagram for ilMMSubItemGUI:

Public Member Functions

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

Data Fields

const CMD_VIEW_SUB_ITEMS = 'subtab_subitems'
 
const CMD_ADD = 'subitem_add'
 
const CMD_CREATE = 'subitem_create'
 
const CMD_CONFIRM_MOVE = 'confirm_move'
 
const CMD_MOVE = 'move'
 
const CMD_DELETE = 'delete'
 
const CMD_CONFIRM_DELETE = 'subitem_confirm_delete'
 
const CMD_EDIT = 'subitem_edit'
 
const CMD_TRANSLATE = 'subitem_translate'
 
const CMD_UPDATE = 'subitem_update'
 
const CMD_SAVE_TABLE = 'save_table'
 
const CMD_APPLY_FILTER = 'applyFilter'
 
const CMD_RESET_FILTER = 'resetFilter'
 
const CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'
 
const CMD_CANCEL = 'cancel'
 
- 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 ()
 
 add ($DIC)
 
 create ($DIC)
 
 edit ($DIC)
 
 update ($DIC)
 
 applyFilter ()
 
 resetFilter ()
 
 index ()
 
 delete ()
 
 confirmDelete ()
 
 confirmMove ()
 
 move ()
 

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()

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

Definition at line 162 of file class.ilMMSubItemGUI.php.

162 : string
163 {
164 $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->repository->getItemFacade(), $this->repository);
165
166 return $f->getHTML();
167 }
Class ilMMSubitemFormGUI.
global $DIC
Definition: feed.php:28

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

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ applyFilter()

ilMMSubItemGUI::applyFilter ( )
private

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

211 : void
212 {
213 $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
214 $table->writeFilterToSession();
215
216 $this->cancel();
217 }
Class ilMMSubItemTableGUI.

References ILIAS\Repository\access(), 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:

◆ cancel()

ilMMSubItemGUI::cancel ( )
protected

Reimplemented from ilMMAbstractItemGUI.

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

268 : void
269 {
270 $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS);
271 }

References ILIAS\Repository\ctrl().

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

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

◆ confirmDelete()

ilMMSubItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

Definition at line 277 of file class.ilMMSubItemGUI.php.

277 : string
278 {
279 $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
280 $i = $this->getMMItemFromRequest();
281 $c = new ilConfirmationGUI();
282 $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
283 $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
284 $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
285 $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
286 $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
287
288 return $c->getHTML();
289 }
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:

◆ confirmMove()

ilMMSubItemGUI::confirmMove ( )
private
Returns
string
Exceptions
Throwable

Definition at line 295 of file class.ilMMSubItemGUI.php.

295 : string
296 {
297 $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
298 $i = $this->getMMItemFromRequest();
299 $c = new ilConfirmationGUI();
300 $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
301 $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
302 $c->setConfirm($this->lng->txt(self::CMD_MOVE), self::CMD_MOVE);
303 $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
304 $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_MOVE));
305
306 return $c->getHTML();
307 }

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:

◆ create()

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

Definition at line 174 of file class.ilMMSubItemGUI.php.

174 : string
175 {
176 $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->repository->getItemFacade(), $this->repository);
177 if ($f->save()) {
178 $this->cancel();
179 }
180
181 return $f->getHTML();
182 }

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()

ilMMSubItemGUI::delete ( )
private

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

257 : void
258 {
259 $item = $this->getMMItemFromRequest();
260 if ($item->isDeletable()) {
261 $this->repository->deleteItem($item);
262 }
263
264 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_subitem_deleted"), true);
265 $this->cancel();
266 }

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

+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMSubItemGUI::dispatchCommand ( string  $cmd)
private

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

49 : string
50 {
51 global $DIC;
52 switch ($cmd) {
53 case self::CMD_ADD:
54 $this->access->checkAccessAndThrowException('write');
55 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
56
57 return $this->add($DIC);
59 $this->access->checkAccessAndThrowException('write');
60 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
61
62 return $this->create($DIC);
63 case self::CMD_EDIT:
64 $this->access->checkAccessAndThrowException('write');
65 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
66
67 return $this->edit($DIC);
69 $this->access->checkAccessAndThrowException('write');
70 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
71
72 return $this->update($DIC);
74 $this->access->checkAccessAndThrowException('visible,read');
75 $this->applyFilter();
76 break;
78 $this->access->checkAccessAndThrowException('visible,read');
79 $this->resetFilter();
80 break;
82 $this->access->checkAccessAndThrowException('visible,read');
83 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
84
85 return $this->index();
87 $this->access->checkAccessAndThrowException('write');
88 $this->saveTable();
89 break;
91 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
92 $this->access->checkAccessAndThrowException('write');
93
94 return $this->confirmDelete();
96 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
97 $this->access->checkAccessAndThrowException('write');
98
99 return $this->confirmMove();
100 case self::CMD_MOVE:
101 $this->access->checkAccessAndThrowException('write');
102 $this->move();
103 break;
104 case self::CMD_DELETE:
105 $this->access->checkAccessAndThrowException('write');
106 $this->delete();
107 break;
108 case self::CMD_CANCEL:
109 $this->cancel();
110 break;
111 case self::CMD_FLUSH:
112 $this->access->checkAccessAndThrowException('write');
113 $this->flush();
114 break;
115 }
116
117 return "";
118 }

References $DIC, ILIAS\Repository\access(), add(), applyFilter(), cancel(), CMD_ADD, CMD_APPLY_FILTER, CMD_CANCEL, CMD_CONFIRM_DELETE, CMD_CONFIRM_MOVE, CMD_CREATE, CMD_DELETE, CMD_EDIT, ilMMAbstractItemGUI\CMD_FLUSH, CMD_MOVE, CMD_RESET_FILTER, CMD_SAVE_TABLE, CMD_UPDATE, CMD_VIEW_SUB_ITEMS, confirmDelete(), confirmMove(), create(), edit(), ilMMAbstractItemGUI\flush(), index(), move(), resetFilter(), 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:

◆ edit()

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

Definition at line 189 of file class.ilMMSubItemGUI.php.

189 : string
190 {
191 $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->getMMItemFromRequest(), $this->repository);
192
193 return $f->getHTML();
194 }

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

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilMMSubItemGUI::executeCommand ( )

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

135 : void
136 {
137 $next_class = $this->ctrl->getNextClass();
138
139 if ('' === $next_class) {
140 $cmd = $this->determineCommand(self::CMD_VIEW_SUB_ITEMS, self::CMD_DELETE);
141 $this->tpl->setContent($this->dispatchCommand($cmd));
142
143 return;
144 }
145
146 switch ($next_class) {
147 case strtolower(ilMMItemTranslationGUI::class):
148 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_SUB_ITEMS, true, $this->ctrl->getCallHistory()[2][ilCtrlInterface::PARAM_CMD_CLASS] ?? '');
149 $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
150 $this->ctrl->forwardCommand($g);
151 break;
152 default:
153 break;
154 }
155 }
return true
determineCommand(string $standard, string $delete)
Class ilMMItemTranslationGUI.
dispatchCommand(string $cmd)
Class ilObjMainMenuGUI @ilCtrl_IsCalledBy ilObjMainMenuGUI: ilAdministrationGUI @ilCtrl_Calls ilObjMa...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ index()

ilMMSubItemGUI::index ( )
private
Returns
string

Definition at line 231 of file class.ilMMSubItemGUI.php.

231 : string
232 {
233 // ADD NEW
234 if ($this->access->hasUserPermissionTo('write')) {
236 $b->setUrl($this->ctrl->getLinkTarget($this, ilMMSubItemGUI::CMD_ADD));
237 $b->setCaption($this->lng->txt(ilMMSubItemGUI::CMD_ADD), false);
238
239 $this->toolbar->addButtonInstance($b);
240
241 // REMOVE LOST ITEMS
242 if ($this->repository->hasLostItems()) {
244 $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_FLUSH));
245 $b->setCaption($this->lng->txt(self::CMD_FLUSH), false);
246 $this->toolbar->addButtonInstance($b);
247 }
248 }
249
250 // TABLE
251 $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
252 $table->setShowRowsSelector(false);
253
254 return $table->getHTML();
255 }

References Vendor\Package\$b, ILIAS\Repository\access(), CMD_ADD, 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()

ilMMSubItemGUI::move ( )
private

Definition at line 309 of file class.ilMMSubItemGUI.php.

309 : void
310 {
311 $item = $this->getMMItemFromRequest();
312 if ($item->isInterchangeable()) {
313 $item->setParent('');
314 $this->repository->updateItem($item);
315 }
316
317 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_moved"), true);
318 $this->cancel();
319 }

References cancel(), ilMMAbstractItemGUI\getMMItemFromRequest(), 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:

◆ resetFilter()

ilMMSubItemGUI::resetFilter ( )
private

Definition at line 219 of file class.ilMMSubItemGUI.php.

219 : void
220 {
221 $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
222 $table->resetFilter();
223 $table->resetOffset();
224
225 $this->cancel();
226 }

References ILIAS\Repository\access(), 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:

◆ saveTable()

ilMMSubItemGUI::saveTable ( )
private

Definition at line 120 of file class.ilMMSubItemGUI.php.

120 : void
121 {
122 global $DIC;
123 $r = $DIC->http()->request()->getParsedBody();
124 foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
125 $item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
126 $position = (int) $data['position'];
127 $item->setPosition($position);
128 $item->setActiveStatus(isset($data['active']) && $data['active']);
129 $item->setParent($this->unhash((string) $data['parent']));
130 $this->repository->updateItem($item);
131 }
132 $this->cancel();
133 }

References $data, $DIC, cancel(), ILIAS\Repository\int(), 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:

◆ update()

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

Definition at line 201 of file class.ilMMSubItemGUI.php.

201 : string
202 {
203 $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->getMMItemFromRequest(), $this->repository);
204 if ($f->save()) {
205 $this->cancel();
206 }
207
208 return $f->getHTML();
209 }

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:

Field Documentation

◆ CMD_ADD

const ilMMSubItemGUI::CMD_ADD = 'subitem_add'

Definition at line 34 of file class.ilMMSubItemGUI.php.

Referenced by dispatchCommand(), index(), and ilMMSubitemFormGUI\initForm().

◆ CMD_APPLY_FILTER

const ilMMSubItemGUI::CMD_APPLY_FILTER = 'applyFilter'

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

Referenced by dispatchCommand().

◆ CMD_CANCEL

const ilMMSubItemGUI::CMD_CANCEL = 'cancel'

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

Referenced by dispatchCommand().

◆ CMD_CONFIRM_DELETE

const ilMMSubItemGUI::CMD_CONFIRM_DELETE = 'subitem_confirm_delete'

Definition at line 39 of file class.ilMMSubItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_CONFIRM_MOVE

const ilMMSubItemGUI::CMD_CONFIRM_MOVE = 'confirm_move'

Definition at line 36 of file class.ilMMSubItemGUI.php.

Referenced by dispatchCommand().

◆ CMD_CREATE

const ilMMSubItemGUI::CMD_CREATE = 'subitem_create'

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

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

◆ CMD_DELETE

const ilMMSubItemGUI::CMD_DELETE = 'delete'

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

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

◆ CMD_EDIT

const ilMMSubItemGUI::CMD_EDIT = 'subitem_edit'

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

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

◆ CMD_MOVE

const ilMMSubItemGUI::CMD_MOVE = 'move'

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

Referenced by dispatchCommand().

◆ CMD_RENDER_INTERRUPTIVE

const ilMMSubItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

◆ CMD_RESET_FILTER

const ilMMSubItemGUI::CMD_RESET_FILTER = 'resetFilter'

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

Referenced by dispatchCommand().

◆ CMD_SAVE_TABLE

const ilMMSubItemGUI::CMD_SAVE_TABLE = 'save_table'

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

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

◆ CMD_TRANSLATE

const ilMMSubItemGUI::CMD_TRANSLATE = 'subitem_translate'

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

◆ CMD_UPDATE

const ilMMSubItemGUI::CMD_UPDATE = 'subitem_update'

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

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

◆ CMD_VIEW_SUB_ITEMS

const ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS = 'subtab_subitems'

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