ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMMTopItemGUI Class Reference

Class ilMMTopItemGUI ilMMTopItemGUI: ilObjMainMenuGUI 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'
 
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 ()
 
 selectParent ()
 
 move ()
 
 getMoveForm ()
 

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

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

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

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

Referenced by dispatchCommand().

193  : string
194  {
195  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
196 
197  return $f->getHTML();
198  }
repository()
Definition: repository.php:5
$DIC
Definition: xapitoken.php:46
Class ilMMTopItemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMMTopItemGUI::cancel ( )
private

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

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

179  {
180  $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_TOP_ITEMS);
181  }
+ Here is the caller graph for this function:

◆ confirmDelete()

ilMMTopItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

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

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

Referenced by dispatchCommand().

261  : string
262  {
263  $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
264  $i = $this->getMMItemFromRequest();
265  $c = new ilConfirmationGUI();
266  $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
267  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
268  $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
269  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
270  $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
271 
272  return $c->getHTML();
273  }
$i
Definition: metadata.php:24
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmRestore()

ilMMTopItemGUI::confirmRestore ( )
private

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

References Vendor\Package\$c.

Referenced by dispatchCommand().

275  : string
276  {
277  $c = new ilConfirmationGUI();
278  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
279  $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_RESTORE);
280  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
281  $c->setHeaderText($this->lng->txt('msg_restore_confirm'));
282 
283  return $c->getHTML();
284  }
Confirmation screen class.
+ 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 205 of file class.ilMMTopItemGUI.php.

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

Referenced by dispatchCommand().

205  : string
206  {
207  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
208  if ($f->save()) {
209  $this->cancel();
210  }
211 
212  return $f->getHTML();
213  }
repository()
Definition: repository.php:5
$DIC
Definition: xapitoken.php:46
Class ilMMTopItemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMMTopItemGUI::delete ( )
private

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

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

247  : void
248  {
249  $item = $this->getMMItemFromRequest();
250  if ($item->isDeletable()) {
251  $this->repository->deleteItem($item);
252  }
253  ilUtil::sendSuccess($this->lng->txt("msg_topitem_deleted"), true);
254  $this->cancel();
255  }
repository()
Definition: repository.php:5
+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMTopItemGUI::dispatchCommand (   $cmd)
private

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

References $DIC, add(), cancel(), confirmDelete(), confirmRestore(), create(), edit(), flush(), index(), move(), restore(), saveTable(), selectParent(), ilObjMainMenuGUI\TAB_MAIN, and update().

Referenced by executeCommand().

34  {
35  global $DIC;
36  switch ($cmd) {
37  case self::CMD_VIEW_TOP_ITEMS:
38  $this->access->checkAccessAndThrowException("visible,read");
39  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
40 
41  return $this->index($DIC);
42  case self::CMD_ADD:
43  $this->access->checkAccessAndThrowException('write');
44  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
45 
46  return $this->add($DIC);
47  case self::CMD_CREATE:
48  $this->access->checkAccessAndThrowException('write');
49  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
50 
51  return $this->create($DIC);
52  case self::CMD_EDIT:
53  $this->access->checkAccessAndThrowException('write');
54  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
55 
56  return $this->edit($DIC);
57  case self::CMD_UPDATE:
58  $this->access->checkAccessAndThrowException('write');
59  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
60 
61  return $this->update($DIC);
62  case self::CMD_SAVE_TABLE:
63  $this->access->checkAccessAndThrowException('write');
64  $this->saveTable();
65 
66  break;
67  case self::CMD_CONFIRM_DELETE:
68  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
69  $this->access->checkAccessAndThrowException('write');
70 
71  return $this->confirmDelete();
72  case self::CMD_DELETE:
73  $this->access->checkAccessAndThrowException('write');
74  $this->delete();
75  break;
76  case self::CMD_CANCEL:
77  $this->cancel();
78  break;
79  case self::CMD_CONFIRM_RESTORE:
80  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
81  $this->access->checkAccessAndThrowException('write');
82  return $this->confirmRestore();
83  case self::CMD_RESTORE:
84  $this->access->checkAccessAndThrowException('write');
85 
86  $this->restore();
87  break;
88  case self::CMD_SELECT_PARENT:
89  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
90  $this->access->checkAccessAndThrowException('write');
91  return $this->selectParent();
92  case self::CMD_FLUSH:
93  $this->access->checkAccessAndThrowException('write');
94  $this->flush();
95  break;
96  case self::CMD_UPLOAD:
97  $this->access->checkAccessAndThrowException('write');
98  return $this->selectParent();
99  case self::CMD_MOVE:
100  $this->access->checkAccessAndThrowException('write');
101  $this->move();
102  break;
103  }
104 
105  return "";
106  }
update(\ILIAS\DI\Container $DIC)
add(\ILIAS\DI\Container $DIC)
edit(\ILIAS\DI\Container $DIC)
$DIC
Definition: xapitoken.php:46
create(\ILIAS\DI\Container $DIC)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doubleCancel()

ilMMTopItemGUI::doubleCancel ( )
private

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

184  {
185  $this->ctrl->redirectByClass(self::class, self::CMD_CANCEL);
186  }

◆ edit()

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

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

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

Referenced by dispatchCommand().

220  : string
221  {
222  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->getMMItemFromRequest(), $this->repository);
223 
224  return $f->getHTML();
225  }
$DIC
Definition: xapitoken.php:46
Class ilMMTopItemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMTopItemGUI::executeCommand ( )

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

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

121  : void
122  {
123  $next_class = $this->ctrl->getNextClass();
124 
125  if ($next_class === '') {
126  $cmd = $this->determineCommand(self::CMD_VIEW_TOP_ITEMS, self::CMD_DELETE);
127  $this->tpl->setContent($this->dispatchCommand($cmd));
128 
129  return;
130  }
131 
132  switch ($next_class) {
133  case strtolower(ilMMItemTranslationGUI::class):
134  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true);
135  $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
136  $this->ctrl->forwardCommand($g);
137  break;
138  default:
139  break;
140  }
141  }
Class ilObjMainMenuGUI.
repository()
Definition: repository.php:5
Class ilMMItemTranslationGUI.
determineCommand(string $standard, string $delete)
+ Here is the call graph for this function:

◆ flush()

ilMMTopItemGUI::flush ( )
private

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

References cancel(), and repository().

Referenced by dispatchCommand().

286  : void
287  {
288  $this->repository->flushLostItems();
289  ilUtil::sendSuccess($this->lng->txt("msg_subitem_flushed"), true);
290  $this->cancel();
291  }
repository()
Definition: repository.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMoveForm()

ilMMTopItemGUI::getMoveForm ( )
private
Returns

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

References Vendor\Package\$f, repository(), and ui().

Referenced by move(), and selectParent().

336  {
337  $this->ctrl->saveParameter($this, self::IDENTIFIER);
338  $f = $this->ui->factory();
339 
340  $parent = $f->input()->field()->select($this->lng->txt('select_parent'), $this->repository->getPossibleParentsForFormAndTable())->withRequired(true);
341 
342  return $f->input()->container()->form()->standard($this->ctrl->getFormAction($this, self::CMD_MOVE), [$parent]);
343  }
repository()
Definition: repository.php:5
ui()
Definition: ui.php:5
This describes a standard form.
Definition: Standard.php:10
+ 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 146 of file class.ilMMTopItemGUI.php.

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

Referenced by dispatchCommand().

146  : string
147  {
148 
149  if ($this->access->hasUserPermissionTo('write')) {
150  // ADD NEW
152  $b->setCaption($this->lng->txt(self::CMD_ADD), false);
153  $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD));
154  $this->toolbar->addButtonInstance($b);
155 
156  // RESTORE
158  $b->setCaption($this->lng->txt(self::CMD_RESTORE), false);
159  $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_CONFIRM_RESTORE));
160  $this->toolbar->addButtonInstance($b);
161 
162  // REMOVE LOST ITEMS
163  if ($this->repository->hasLostItems()) {
165  $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_FLUSH));
166  $b->setCaption($this->lng->txt(self::CMD_FLUSH), false);
167  $this->toolbar->addButtonInstance($b);
168  }
169  }
170 
171  // TABLE
172  $table = new ilMMTopItemTableGUI($this, new ilMMItemRepository(), $this->access);
173  $table->setShowRowsSelector(false);
174 
175  return $table->getHTML();
176  }
Class ilMMItemRepository.
repository()
Definition: repository.php:5
Class ilMMTopItemTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move()

ilMMTopItemGUI::move ( )
private

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

References $data, Vendor\Package\$f, cancel(), ilMMAbstractItemGUI\getMMItemFromRequest(), getMoveForm(), ILIAS\FileDelivery\http(), repository(), and ilUtil\sendFailure().

Referenced by dispatchCommand().

312  : void
313  {
314  $form = $this->getMoveForm();
315  $form = $form->withRequest($this->http->request());
316 
317  $item = $this->getMMItemFromRequest();
318 
319  $data = $form->getData();
320  if ($item->isInterchangeable() && isset($data[0])) {
321  $f = $this->repository->getItemFacadeForIdentificationString($data[0]);
322  $item->setParent($data[0]);
323  $this->repository->updateItem($item);
324  ilUtil::sendSuccess($this->lng->txt('msg_moved'), true);
325  } else {
326  ilUtil::sendFailure($this->lng->txt('msg_not_moved'), true);
327  }
328 
329  $this->cancel();
330  }
$data
Definition: storeScorm.php:23
static http()
Fetches the global http state from ILIAS.
repository()
Definition: repository.php:5
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restore()

ilMMTopItemGUI::restore ( )
private

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

References cancel(), and ActiveRecord\flushDB().

Referenced by dispatchCommand().

293  : void
294  {
299 
300  ilUtil::sendSuccess($this->lng->txt('msg_restored'), true);
301 
302  $this->cancel();
303  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTable()

ilMMTopItemGUI::saveTable ( )
private

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

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

Referenced by dispatchCommand().

108  : void
109  {
110  global $DIC;
111  $r = $DIC->http()->request()->getParsedBody();
112  foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
113  $item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
114  $item->setPosition((int) $data['position']);
115  $item->setActiveStatus((bool) $data['active']);
116  $this->repository->updateItem($item);
117  }
118  $this->cancel();
119  }
$data
Definition: storeScorm.php:23
repository()
Definition: repository.php:5
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectParent()

ilMMTopItemGUI::selectParent ( )
private

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

References getMoveForm(), and ui().

Referenced by dispatchCommand().

305  : string
306  {
307  $form = $this->getMoveForm();
308 
309  return $this->ui->renderer()->render($form);
310  }
ui()
Definition: ui.php:5
+ 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 232 of file class.ilMMTopItemGUI.php.

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

Referenced by dispatchCommand().

232  : string
233  {
234  $item = $this->getMMItemFromRequest();
235  if ($item->isEditable()) {
236  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $item, $this->repository);
237  if ($f->save()) {
238  $this->cancel();
239  }
240 
241  return $f->getHTML();
242  }
243 
244  return "";
245  }
$DIC
Definition: xapitoken.php:46
Class ilMMTopItemFormGUI.
+ 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 16 of file class.ilMMTopItemGUI.php.

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_CANCEL

const ilMMTopItemGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_CONFIRM_DELETE

const ilMMTopItemGUI::CMD_CONFIRM_DELETE = 'topitem_confirm_delete'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_CONFIRM_RESTORE

const ilMMTopItemGUI::CMD_CONFIRM_RESTORE = 'confirmRestore'

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

◆ CMD_CREATE

const ilMMTopItemGUI::CMD_CREATE = 'topitem_create'

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

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_DELETE

const ilMMTopItemGUI::CMD_DELETE = 'delete'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_EDIT

const ilMMTopItemGUI::CMD_EDIT = 'topitem_edit'

◆ CMD_FLUSH

const ilMMTopItemGUI::CMD_FLUSH = 'flush'

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

◆ CMD_MOVE

const ilMMTopItemGUI::CMD_MOVE = 'move'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_RENDER_INTERRUPTIVE

const ilMMTopItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

◆ CMD_RESTORE

const ilMMTopItemGUI::CMD_RESTORE = 'restore'

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

◆ CMD_SAVE_TABLE

const ilMMTopItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMTopItemTableGUI\__construct().

◆ CMD_SELECT_PARENT

const ilMMTopItemGUI::CMD_SELECT_PARENT = 'selectParent'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_TRANSLATE

const ilMMTopItemGUI::CMD_TRANSLATE = 'topitem_translate'

◆ CMD_UPDATE

const ilMMTopItemGUI::CMD_UPDATE = 'topitem_update'

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

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_UPLOAD

const ilMMTopItemGUI::CMD_UPLOAD = 'upload'

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

◆ CMD_VIEW_TOP_ITEMS

const ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS = 'subtab_topitems'

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

Referenced by ilMMTabHandling\initTabs().


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