ILIAS  release_8 Revision v8.23
ilMMSubItemGUI Class Reference

Class ilMMTopItemGUI ilMMSubItemGUI: ilObjMainMenuGUI 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.

References $DIC, Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, and ILIAS\UI\examples\Deck\repository().

Referenced by dispatchCommand().

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  }
global $DIC
Definition: feed.php:28
Class ilMMSubitemFormGUI.
ilMMItemRepository $repository
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilter()

ilMMSubItemGUI::applyFilter ( )
private

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

References ILIAS\Repository\access(), cancel(), and ILIAS\UI\examples\Deck\repository().

Referenced by dispatchCommand().

211  : void
212  {
213  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
214  $table->writeFilterToSession();
215 
216  $this->cancel();
217  }
Class ilMMSubItemTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMMSubItemGUI::cancel ( )
protected

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

References ILIAS\Repository\ctrl().

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

268  : void
269  {
270  $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS);
271  }
+ 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.

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

Referenced by dispatchCommand().

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  }
$c
Definition: cli.php:38
$i
Definition: metadata.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

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

Referenced by dispatchCommand().

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  }
$c
Definition: cli.php:38
$i
Definition: metadata.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

References $DIC, Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, cancel(), and ILIAS\UI\examples\Deck\repository().

Referenced by dispatchCommand().

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  }
global $DIC
Definition: feed.php:28
Class ilMMSubitemFormGUI.
ilMMItemRepository $repository
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMSubItemGUI::dispatchCommand ( string  $cmd)
private

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

References $DIC, ILIAS\Repository\access(), add(), applyFilter(), cancel(), CMD_VIEW_SUB_ITEMS, confirmDelete(), confirmMove(), create(), edit(), ilMMAbstractItemGUI\flush(), index(), move(), resetFilter(), saveTable(), ilObjMainMenuGUI\TAB_MAIN, and update().

Referenced by executeCommand().

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);
58  case self::CMD_CREATE:
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);
68  case self::CMD_UPDATE:
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);
73  case self::CMD_APPLY_FILTER:
74  $this->access->checkAccessAndThrowException('visible,read');
75  $this->applyFilter();
76  break;
77  case self::CMD_RESET_FILTER:
78  $this->access->checkAccessAndThrowException('visible,read');
79  $this->resetFilter();
80  break;
81  case self::CMD_VIEW_SUB_ITEMS:
82  $this->access->checkAccessAndThrowException('visible,read');
83  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
84 
85  return $this->index();
86  case self::CMD_SAVE_TABLE:
87  $this->access->checkAccessAndThrowException('write');
88  $this->saveTable();
89  break;
90  case self::CMD_CONFIRM_DELETE:
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();
95  case self::CMD_CONFIRM_MOVE:
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  }
global $DIC
Definition: feed.php:28
+ 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.

References $DIC, Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, and ilMMAbstractItemGUI\getMMItemFromRequest().

Referenced by dispatchCommand().

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  }
global $DIC
Definition: feed.php:28
Class ilMMSubitemFormGUI.
ilMMItemRepository $repository
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMSubItemGUI::executeCommand ( )

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

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

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  }
Class ilObjMainMenuGUI ilObjMainMenuGUI: ilAdministrationGUI ilObjMainMenuGUI: ilPermissionGUI.
Class ilMMItemTranslationGUI.
dispatchCommand(string $cmd)
determineCommand(string $standard, string $delete)
+ Here is the call graph for this function:

◆ index()

ilMMSubItemGUI::index ( )
private
Returns
string

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

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

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  }
Class ilMMSubItemTableGUI.
+ 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.

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

Referenced by dispatchCommand().

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  }
+ 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.

References ILIAS\Repository\access(), cancel(), and ILIAS\UI\examples\Deck\repository().

Referenced by dispatchCommand().

219  : void
220  {
221  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
222  $table->resetFilter();
223  $table->resetOffset();
224 
225  $this->cancel();
226  }
Class ilMMSubItemTableGUI.
+ 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.

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

Referenced by dispatchCommand().

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  }
global $DIC
Definition: feed.php:28
+ 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.

References $DIC, Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, cancel(), and ilMMAbstractItemGUI\getMMItemFromRequest().

Referenced by dispatchCommand().

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  }
global $DIC
Definition: feed.php:28
Class ilMMSubitemFormGUI.
ilMMItemRepository $repository
+ 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 index(), and ilMMSubitemFormGUI\initForm().

◆ CMD_APPLY_FILTER

const ilMMSubItemGUI::CMD_APPLY_FILTER = 'applyFilter'

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

◆ CMD_CANCEL

const ilMMSubItemGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_CONFIRM_DELETE

const ilMMSubItemGUI::CMD_CONFIRM_DELETE = 'subitem_confirm_delete'

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

Referenced by ilMMSubItemTableGUI\initColumns().

◆ CMD_CONFIRM_MOVE

const ilMMSubItemGUI::CMD_CONFIRM_MOVE = 'confirm_move'

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

Referenced by ilMMSubItemTableGUI\initColumns().

◆ CMD_CREATE

const ilMMSubItemGUI::CMD_CREATE = 'subitem_create'

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

Referenced by ilMMSubitemFormGUI\initForm().

◆ CMD_DELETE

const ilMMSubItemGUI::CMD_DELETE = 'delete'

◆ CMD_EDIT

const ilMMSubItemGUI::CMD_EDIT = 'subitem_edit'

◆ CMD_MOVE

const ilMMSubItemGUI::CMD_MOVE = 'move'

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

Referenced by ilMMSubItemTableGUI\initColumns().

◆ 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.

◆ CMD_SAVE_TABLE

const ilMMSubItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMSubItemTableGUI\__construct().

◆ 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 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: