ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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'
 
 $lng
 
 $tpl
 
 $tree
 

Private Member Functions

 dispatchCommand ($cmd)
 
 saveTable ()
 
 add ($DIC)
 
 create ($DIC)
 
 edit ($DIC)
 
 update ($DIC)
 
 applyFilter ()
 
 resetFilter ()
 
 index ()
 
 delete ()
 
 cancel ()
 
 confirmDelete ()
 
 confirmMove ()
 
 move ()
 

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
 

Detailed Description

Member Function Documentation

◆ add()

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

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

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

Referenced by dispatchCommand().

140  : string
141  {
142  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->repository->getItemFacade(), $this->repository);
143 
144  return $f->getHTML();
145  }
repository()
Definition: repository.php:5
global $DIC
Definition: goto.php:24
Class ilMMSubitemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilter()

ilMMSubItemGUI::applyFilter ( )
private

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

References cancel(), and repository().

Referenced by dispatchCommand().

189  : void
190  {
191  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
192  $table->writeFilterToSession();
193 
194  $this->cancel();
195  }
Class ilMMSubItemTableGUI.
repository()
Definition: repository.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMMSubItemGUI::cancel ( )
private

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

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

238  : void
239  {
240  $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS);
241  }
+ Here is the caller graph for this function:

◆ confirmDelete()

ilMMSubItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

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

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

Referenced by dispatchCommand().

247  : string
248  {
249  $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
250  $i = $this->getMMItemFromRequest();
251  $c = new ilConfirmationGUI();
252  $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
253  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
254  $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
255  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
256  $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
257 
258  return $c->getHTML();
259  }
$c
Definition: cli.php:37
$i
Definition: metadata.php:24
Confirmation screen class.
+ 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 265 of file class.ilMMSubItemGUI.php.

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

Referenced by dispatchCommand().

265  : string
266  {
267  $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
268  $i = $this->getMMItemFromRequest();
269  $c = new ilConfirmationGUI();
270  $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
271  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
272  $c->setConfirm($this->lng->txt(self::CMD_MOVE), self::CMD_MOVE);
273  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
274  $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_MOVE));
275 
276  return $c->getHTML();
277  }
$c
Definition: cli.php:37
$i
Definition: metadata.php:24
Confirmation screen class.
+ 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 152 of file class.ilMMSubItemGUI.php.

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

Referenced by dispatchCommand().

152  : string
153  {
154  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->repository->getItemFacade(), $this->repository);
155  if ($f->save()) {
156  $this->cancel();
157  }
158 
159  return $f->getHTML();
160  }
repository()
Definition: repository.php:5
global $DIC
Definition: goto.php:24
Class ilMMSubitemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMMSubItemGUI::delete ( )
private

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

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

227  : void
228  {
229  $item = $this->getMMItemFromRequest();
230  if ($item->isCustom()) {
231  $this->repository->deleteItem($item);
232  }
233 
234  ilUtil::sendSuccess($this->lng->txt("msg_subitem_deleted"), true);
235  $this->cancel();
236  }
repository()
Definition: repository.php:5
+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMSubItemGUI::dispatchCommand (   $cmd)
private

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

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

Referenced by executeCommand().

32  {
33  global $DIC;
34  switch ($cmd) {
35  case self::CMD_ADD:
36  $this->access->checkAccessAndThrowException('write');
37  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
38 
39  return $this->add($DIC);
40  case self::CMD_CREATE:
41  $this->access->checkAccessAndThrowException('write');
42  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
43 
44  return $this->create($DIC);
45  case self::CMD_EDIT:
46  $this->access->checkAccessAndThrowException('write');
47  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
48 
49  return $this->edit($DIC);
50  case self::CMD_UPDATE:
51  $this->access->checkAccessAndThrowException('write');
52  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
53 
54  return $this->update($DIC);
55  case self::CMD_APPLY_FILTER:
56  $this->access->checkAccessAndThrowException('visible,read');
57  $this->applyFilter();
58  break;
59  case self::CMD_RESET_FILTER:
60  $this->access->checkAccessAndThrowException('visible,read');
61  $this->resetFilter();
62  break;
63  case self::CMD_VIEW_SUB_ITEMS:
64  $this->access->checkAccessAndThrowException('visible,read');
65  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
66 
67  return $this->index();
68  case self::CMD_SAVE_TABLE:
69  $this->access->checkAccessAndThrowException('write');
70  $this->saveTable();
71  break;
72  case self::CMD_CONFIRM_DELETE:
73  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
74  $this->access->checkAccessAndThrowException('write');
75 
76  return $this->confirmDelete();
77  case self::CMD_CONFIRM_MOVE:
78  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS, true, self::class);
79  $this->access->checkAccessAndThrowException('write');
80 
81  return $this->confirmMove();
82  case self::CMD_MOVE:
83  $this->access->checkAccessAndThrowException('write');
84  $this->move();
85  break;
86  case self::CMD_DELETE:
87  $this->access->checkAccessAndThrowException('write');
88  $this->delete();
89  break;
90  case self::CMD_CANCEL:
91  $this->cancel();
92  break;
93  }
94 
95  return "";
96  }
global $DIC
Definition: goto.php:24
+ 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 167 of file class.ilMMSubItemGUI.php.

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

Referenced by dispatchCommand().

167  : string
168  {
169  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->getMMItemFromRequest(), $this->repository);
170 
171  return $f->getHTML();
172  }
global $DIC
Definition: goto.php:24
Class ilMMSubitemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMSubItemGUI::executeCommand ( )

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

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

113  : void
114  {
115  $next_class = $this->ctrl->getNextClass();
116 
117  if ('' === $next_class) {
118  $cmd = $this->determineCommand(self::CMD_VIEW_SUB_ITEMS, self::CMD_DELETE);
119  $this->tpl->setContent($this->dispatchCommand($cmd));
120 
121  return;
122  }
123 
124  switch ($next_class) {
125  case strtolower(ilMMItemTranslationGUI::class):
126  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_SUB_ITEMS, true, $this->ctrl->getCallHistory()[2]['class'] ? $this->ctrl->getCallHistory()[2]['class'] : "");
127  $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
128  $this->ctrl->forwardCommand($g);
129  break;
130  default:
131  break;
132  }
133  }
Class ilObjMainMenuGUI.
repository()
Definition: repository.php:5
Class ilMMItemTranslationGUI.
determineCommand(string $standard, string $delete)
+ Here is the call graph for this function:

◆ index()

ilMMSubItemGUI::index ( )
private
Returns
string

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

References Vendor\Package\$b, CMD_ADD, ilLinkButton\getInstance(), and repository().

Referenced by dispatchCommand().

209  : string
210  {
211  // ADD NEW
212  if ($this->access->hasUserPermissionTo('write')) {
214  $b->setUrl($this->ctrl->getLinkTarget($this, ilMMSubItemGUI::CMD_ADD));
215  $b->setCaption($this->lng->txt(ilMMSubItemGUI::CMD_ADD), false);
216 
217  $this->toolbar->addButtonInstance($b);
218  }
219 
220  // TABLE
221  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
222  $table->setShowRowsSelector(false);
223 
224  return $table->getHTML();
225  }
Class ilMMSubItemTableGUI.
repository()
Definition: repository.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move()

ilMMSubItemGUI::move ( )
private

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

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

Referenced by dispatchCommand().

279  : void
280  {
281  $item = $this->getMMItemFromRequest();
282  if ($item->isInterchangeable()) {
283  $item->setParent('');
284  $this->repository->updateItem($item);
285  }
286 
287  ilUtil::sendSuccess($this->lng->txt("msg_moved"), true);
288  $this->cancel();
289  }
repository()
Definition: repository.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilMMSubItemGUI::resetFilter ( )
private

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

References cancel(), and repository().

Referenced by dispatchCommand().

197  : void
198  {
199  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
200  $table->resetFilter();
201  $table->resetOffset();
202 
203  $this->cancel();
204  }
Class ilMMSubItemTableGUI.
repository()
Definition: repository.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTable()

ilMMSubItemGUI::saveTable ( )
private

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

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

Referenced by dispatchCommand().

98  : void
99  {
100  global $DIC;
101  $r = $DIC->http()->request()->getParsedBody();
102  foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
103  $item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
104  $position = (int) $data['position'];
105  $item->setPosition($position);
106  $item->setActiveStatus(isset($data['active']) && (bool) $data['active']);
107  $item->setParent($this->unhash((string) $data['parent']));
108  $this->repository->updateItem($item);
109  }
110  $this->cancel();
111  }
$data
Definition: storeScorm.php:23
repository()
Definition: repository.php:5
global $DIC
Definition: goto.php:24
+ 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 179 of file class.ilMMSubItemGUI.php.

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

Referenced by dispatchCommand().

179  : string
180  {
181  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->getMMItemFromRequest(), $this->repository);
182  if ($f->save()) {
183  $this->cancel();
184  }
185 
186  return $f->getHTML();
187  }
global $DIC
Definition: goto.php:24
Class ilMMSubitemFormGUI.
+ 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 16 of file class.ilMMSubItemGUI.php.

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

◆ CMD_APPLY_FILTER

const ilMMSubItemGUI::CMD_APPLY_FILTER = 'applyFilter'

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

◆ CMD_CANCEL

const ilMMSubItemGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_CONFIRM_DELETE

const ilMMSubItemGUI::CMD_CONFIRM_DELETE = 'subitem_confirm_delete'

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

Referenced by ilMMSubItemTableGUI\initColumns().

◆ CMD_CONFIRM_MOVE

const ilMMSubItemGUI::CMD_CONFIRM_MOVE = 'confirm_move'

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

Referenced by ilMMSubItemTableGUI\initColumns().

◆ CMD_CREATE

const ilMMSubItemGUI::CMD_CREATE = 'subitem_create'

Definition at line 17 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 19 of file class.ilMMSubItemGUI.php.

Referenced by ilMMSubItemTableGUI\initColumns().

◆ CMD_RENDER_INTERRUPTIVE

const ilMMSubItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

◆ CMD_RESET_FILTER

const ilMMSubItemGUI::CMD_RESET_FILTER = 'resetFilter'

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

◆ CMD_SAVE_TABLE

const ilMMSubItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMSubItemTableGUI\__construct().

◆ CMD_TRANSLATE

const ilMMSubItemGUI::CMD_TRANSLATE = 'subitem_translate'

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

◆ CMD_UPDATE

const ilMMSubItemGUI::CMD_UPDATE = 'subitem_update'

Definition at line 24 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: