ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (protected 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_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 ()
 
 restore ()
 
 selectParent ()
 
 move ()
 
 getMoveForm ()
 

Additional Inherited Members

- Protected Attributes inherited from ilMMAbstractItemGUI
UIServices $ui
 
Services $http
 
ilMMItemRepository $repository
 
ilToolbarGUI $toolbar
 
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 212 of file class.ilMMTopItemGUI.php.

References Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, ILIAS\DI\Container\ctrl(), ILIAS\DI\Container\http(), ILIAS\UI\examples\Deck\repository(), and ILIAS\DI\Container\ui().

Referenced by dispatchCommand().

212  : string
213  {
214  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
215 
216  return $f->getHTML();
217  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
ilMMItemRepository $repository
Class ilMMTopItemFormGUI.
ctrl()
Get the interface to the control structure.
Definition: Container.php:63
ui()
Get the interface to get services from UI framework.
Definition: Container.php:127
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMMTopItemGUI::cancel ( )
protected

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

References ILIAS\Repository\ctrl().

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

197  : void
198  {
199  $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_TOP_ITEMS);
200  }
+ 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 224 of file class.ilMMTopItemGUI.php.

References Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, cancel(), ILIAS\DI\Container\ctrl(), ILIAS\DI\Container\http(), ILIAS\UI\examples\Deck\repository(), and ILIAS\DI\Container\ui().

Referenced by dispatchCommand().

224  : string
225  {
226  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
227  if ($f->save()) {
228  $this->cancel();
229  }
230 
231  return $f->getHTML();
232  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
ilMMItemRepository $repository
Class ilMMTopItemFormGUI.
ctrl()
Get the interface to the control structure.
Definition: Container.php:63
ui()
Get the interface to get services from UI framework.
Definition: Container.php:127
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMMTopItemGUI::delete ( )
private

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

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

266  : void
267  {
268  $item = $this->getMMItemFromRequest();
269  if ($item->isDeletable()) {
270  $this->repository->deleteItem($item);
271  }
272  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_topitem_deleted"), true);
273  $this->cancel();
274  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMTopItemGUI::dispatchCommand ( string  $cmd)
private

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

References $DIC, ILIAS\Repository\access(), add(), cancel(), create(), edit(), ilMMAbstractItemGUI\flush(), index(), move(), restore(), saveTable(), selectParent(), ilObjMainMenuGUI\TAB_MAIN, and update().

Referenced by executeCommand().

51  : string
52  {
53  global $DIC;
54  switch ($cmd) {
55  case self::CMD_VIEW_TOP_ITEMS:
56  $this->access->checkAccessAndThrowException("visible,read");
57  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
58 
59  return $this->index();
60  case self::CMD_ADD:
61  $this->access->checkAccessAndThrowException('write');
62  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
63 
64  return $this->add($DIC);
65  case self::CMD_CREATE:
66  $this->access->checkAccessAndThrowException('write');
67  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
68 
69  return $this->create($DIC);
70  case self::CMD_EDIT:
71  $this->access->checkAccessAndThrowException('write');
72  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
73 
74  return $this->edit($DIC);
75  case self::CMD_UPDATE:
76  $this->access->checkAccessAndThrowException('write');
77  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
78 
79  return $this->update($DIC);
80  case self::CMD_SAVE_TABLE:
81  $this->access->checkAccessAndThrowException('write');
82  $this->saveTable();
83 
84  break;
85  case self::CMD_DELETE:
86  $this->access->checkAccessAndThrowException('write');
87  $this->delete();
88  break;
89  case self::CMD_CANCEL:
90  $this->cancel();
91  break;
92  case self::CMD_RESTORE:
93  $this->access->checkAccessAndThrowException('write');
94 
95  $this->restore();
96  break;
97  case self::CMD_SELECT_PARENT:
98  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true, self::class);
99  $this->access->checkAccessAndThrowException('write');
100  return $this->selectParent();
101  case self::CMD_FLUSH:
102  $this->access->checkAccessAndThrowException('write');
103  $this->flush();
104  break;
105  case self::CMD_UPLOAD:
106  $this->access->checkAccessAndThrowException('write');
107  return $this->selectParent();
108  case self::CMD_MOVE:
109  $this->access->checkAccessAndThrowException('write');
110  $this->move();
111  break;
112  }
113 
114  return "";
115  }
edit(Container $DIC)
create(Container $DIC)
global $DIC
Definition: shib_login.php:22
add(Container $DIC)
update(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 202 of file class.ilMMTopItemGUI.php.

References ILIAS\Repository\ctrl().

202  : void
203  {
204  $this->ctrl->redirectByClass(self::class, self::CMD_CANCEL);
205  }
+ Here is the call graph for this function:

◆ edit()

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

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

References Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, ILIAS\DI\Container\ctrl(), ilMMAbstractItemGUI\getMMItemFromRequest(), ILIAS\DI\Container\http(), and ILIAS\DI\Container\ui().

Referenced by dispatchCommand().

239  : string
240  {
241  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->getMMItemFromRequest(), $this->repository);
242 
243  return $f->getHTML();
244  }
ilMMItemRepository $repository
Class ilMMTopItemFormGUI.
ctrl()
Get the interface to the control structure.
Definition: Container.php:63
ui()
Get the interface to get services from UI framework.
Definition: Container.php:127
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMTopItemGUI::executeCommand ( )

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

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

130  : void
131  {
132  $next_class = $this->ctrl->getNextClass();
133 
134  if ($next_class === '') {
135  $cmd = $this->determineCommand(self::CMD_VIEW_TOP_ITEMS, self::CMD_DELETE);
136  $this->tpl->setContent($this->dispatchCommand($cmd));
137 
138  return;
139  }
140 
141  switch ($next_class) {
142  case strtolower(ilMMItemTranslationGUI::class):
143  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true);
144  $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
145  $this->ctrl->forwardCommand($g);
146  break;
147  default:
148  break;
149  }
150  }
Class ilObjMainMenuGUI ilObjMainMenuGUI: ilAdministrationGUI ilObjMainMenuGUI: ilPermissionGUI.
dispatchCommand(string $cmd)
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
Class ilMMItemTranslationGUI.
determineCommand(string $standard, string $delete)
+ Here is the call graph for this function:

◆ getMoveForm()

ilMMTopItemGUI::getMoveForm ( )
private
Returns
Standard

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

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

Referenced by move(), and selectParent().

319  : Standard
320  {
321  $this->ctrl->saveParameter($this, self::IDENTIFIER);
322  $f = $this->ui->factory();
323 
324  $parent = $f->input()->field()->select($this->lng->txt('select_parent'), $this->repository->getPossibleParentsForFormAndTable())->withRequired(true);
325 
326  return $f->input()->container()->form()->standard($this->ctrl->getFormAction($this, self::CMD_MOVE), [$parent]);
327  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
This describes a standard form.
Definition: Standard.php:28
+ 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 155 of file class.ilMMTopItemGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\UI\examples\Deck\repository(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

Referenced by dispatchCommand().

155  : string
156  {
157  if ($this->access->hasUserPermissionTo('write')) {
158  // ADD NEW
159  $btn_add = $this->ui->factory()->button()->standard(
160  $this->lng->txt(self::CMD_ADD),
161  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
162  );
163  $this->toolbar->addComponent($btn_add);
164 
165  // RESTORE
166  $restoration_modal = $this->ui->factory()->modal()->interruptive(
167  $this->lng->txt(self::CMD_RESTORE),
168  $this->lng->txt('msg_restore_confirm'),
169  $this->ctrl->getLinkTarget($this, self::CMD_RESTORE)
170  )->withActionButtonLabel($this->lng->txt('restore'));
171  $btn_restore = $this->ui->factory()->button()->standard(
172  $this->lng->txt(self::CMD_RESTORE),
173  ''
174  )->withOnClick(
175  $restoration_modal->getShowSignal()
176  );
177  $this->toolbar->addComponent($btn_restore);
178  $this->toolbar->addComponent($restoration_modal);
179 
180  // REMOVE LOST ITEMS
181  if ($this->repository->hasLostItems()) {
182  $btn_flush = $this->ui->factory()->button()->standard(
183  $this->lng->txt(self::CMD_FLUSH),
184  $this->ctrl->getLinkTarget($this, self::CMD_FLUSH)
185  );
186  $this->toolbar->addComponent($btn_flush);
187  }
188  }
189 
190  // TABLE
191  $table = new ilMMTopItemTableGUI($this, new ilMMItemRepository(), $this->access);
192  $table->setShowRowsSelector(false);
193 
194  return $table->getHTML();
195  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
Class ilMMItemRepository.
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 296 of file class.ilMMTopItemGUI.php.

References $data, Vendor\Package\$f, cancel(), ilMMAbstractItemGUI\getMMItemFromRequest(), getMoveForm(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\UI\examples\Deck\repository().

Referenced by dispatchCommand().

296  : void
297  {
298  $form = $this->getMoveForm();
299  $form = $form->withRequest($this->http->request());
300 
301  $item = $this->getMMItemFromRequest();
302 
303  $data = $form->getData();
304  if ($item->isInterchangeable() && isset($data[0])) {
305  $f = $this->repository->getItemFacadeForIdentificationString($data[0]);
306  $item->setParent($data[0]);
307  $this->repository->updateItem($item);
308  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_moved'), true);
309  } else {
310  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_not_moved'), true);
311  }
312 
313  $this->cancel();
314  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restore()

ilMMTopItemGUI::restore ( )
private

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

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

Referenced by dispatchCommand().

277  : void
278  {
283 
284  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_restored'), true);
285 
286  $this->cancel();
287  }
static flushDB()
never use in ILIAS Core, Plugins only
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTable()

ilMMTopItemGUI::saveTable ( )
private

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

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

Referenced by dispatchCommand().

117  : void
118  {
119  global $DIC;
120  $r = $DIC->http()->request()->getParsedBody();
121  foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
122  $item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
123  $item->setPosition((int) ($data['position'] ?? 999));
124  $item->setActiveStatus((bool) ($data['active'] ?? false));
125  $this->repository->updateItem($item);
126  }
127  $this->cancel();
128  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
global $DIC
Definition: shib_login.php:22
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectParent()

ilMMTopItemGUI::selectParent ( )
private

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

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

Referenced by dispatchCommand().

289  : string
290  {
291  $form = $this->getMoveForm();
292 
293  return $this->ui->renderer()->render($form);
294  }
+ 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 251 of file class.ilMMTopItemGUI.php.

References Vendor\Package\$f, ilMMAbstractItemGUI\$lng, ilMMAbstractItemGUI\$repository, cancel(), ILIAS\DI\Container\ctrl(), ilMMAbstractItemGUI\getMMItemFromRequest(), ILIAS\DI\Container\http(), and ILIAS\DI\Container\ui().

Referenced by dispatchCommand().

251  : string
252  {
253  $item = $this->getMMItemFromRequest();
254  if ($item->isEditable()) {
255  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $item, $this->repository);
256  if ($f->save()) {
257  $this->cancel();
258  }
259 
260  return $f->getHTML();
261  }
262 
263  return "";
264  }
ilMMItemRepository $repository
Class ilMMTopItemFormGUI.
ctrl()
Get the interface to the control structure.
Definition: Container.php:63
ui()
Get the interface to get services from UI framework.
Definition: Container.php:127
+ 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 ilMMTopItemFormGUI\initForm().

◆ CMD_CANCEL

const ilMMTopItemGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_CONFIRM_DELETE

const ilMMTopItemGUI::CMD_CONFIRM_DELETE = 'topitem_confirm_delete'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_CREATE

const ilMMTopItemGUI::CMD_CREATE = 'topitem_create'

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

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_DELETE

const ilMMTopItemGUI::CMD_DELETE = 'delete'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_EDIT

const ilMMTopItemGUI::CMD_EDIT = 'topitem_edit'

◆ CMD_MOVE

const ilMMTopItemGUI::CMD_MOVE = 'move'

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

Referenced by 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.

◆ CMD_SAVE_TABLE

const ilMMTopItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMTopItemTableGUI\__construct().

◆ CMD_SELECT_PARENT

const ilMMTopItemGUI::CMD_SELECT_PARENT = 'selectParent'

Definition at line 48 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 43 of file class.ilMMTopItemGUI.php.

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_UPLOAD

const ilMMTopItemGUI::CMD_UPLOAD = 'upload'

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

◆ CMD_VIEW_TOP_ITEMS

const ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS = 'subtab_topitems'

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

Referenced by ilMMTabHandling\initTabs().


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