ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 renderInterruptiveModal ()
 

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 = 'topitem_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_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 ()
 

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
 
 $gs
 

Detailed Description

Member Function Documentation

◆ add()

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

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

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

Referenced by dispatchCommand().

175  : string
176  {
177  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
178 
179  return $f->getHTML();
180  }
global $DIC
Definition: saml.php:7
repository()
Definition: repository.php:5
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 160 of file class.ilMMTopItemGUI.php.

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

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

◆ confirmDelete()

ilMMTopItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

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

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

Referenced by dispatchCommand().

243  : string
244  {
245  $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
246  $i = $this->getMMItemFromRequest();
247  $c = new ilConfirmationGUI();
248  $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
249  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
250  $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
251  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
252  $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
253 
254  return $c->getHTML();
255  }
$i
Definition: disco.tpl.php:19
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406
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 257 of file class.ilMMTopItemGUI.php.

References $c.

Referenced by dispatchCommand().

257  : string
258  {
259  $c = new ilConfirmationGUI();
260  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
261  $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_RESTORE);
262  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
263  $c->setHeaderText($this->lng->txt('msg_restore_confirm'));
264 
265  return $c->getHTML();
266  }
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 187 of file class.ilMMTopItemGUI.php.

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

Referenced by dispatchCommand().

188  {
189  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->repository->getItemFacade(), $this->repository);
190  if ($f->save()) {
191  $this->cancel();
192  }
193 
194  return $f->getHTML();
195  }
global $DIC
Definition: saml.php:7
repository()
Definition: repository.php:5
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 229 of file class.ilMMTopItemGUI.php.

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

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

◆ dispatchCommand()

ilMMTopItemGUI::dispatchCommand (   $cmd)
private

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

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

Referenced by executeCommand().

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

166  {
167  $this->ctrl->redirectByClass(self::class, self::CMD_CANCEL);
168  }

◆ edit()

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

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

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

Referenced by dispatchCommand().

202  : string
203  {
204  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $this->getMMItemFromRequest(), $this->repository);
205 
206  return $f->getHTML();
207  }
global $DIC
Definition: saml.php:7
Class ilMMTopItemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMTopItemGUI::executeCommand ( )

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

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

111  {
112  $next_class = $this->ctrl->getNextClass();
113 
114  if ($next_class == '') {
115  $cmd = $this->determineCommand(self::CMD_VIEW_TOP_ITEMS, self::CMD_DELETE);
116  $this->tpl->setContent($this->dispatchCommand($cmd));
117 
118  return;
119  }
120 
121  switch ($next_class) {
122  case strtolower(ilMMItemTranslationGUI::class):
123  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_TOP_ITEMS, true);
124  $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
125  $this->ctrl->forwardCommand($g);
126  break;
127  default:
128  break;
129  }
130  }
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 268 of file class.ilMMTopItemGUI.php.

References cancel(), and repository().

Referenced by dispatchCommand().

269  {
270  $this->repository->flushLostItems();
271  ilUtil::sendSuccess($this->lng->txt("msg_subitem_flushed"), true);
272  $this->cancel();
273  }
repository()
Definition: repository.php:5
+ 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 135 of file class.ilMMTopItemGUI.php.

References $table, ilLinkButton\getInstance(), and repository().

Referenced by dispatchCommand().

135  : string
136  {
137  if ($this->access->hasUserPermissionTo('write')) {
138  // ADD NEW
140  $b->setCaption($this->lng->txt(self::CMD_ADD), false);
141  $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD));
142  $this->toolbar->addButtonInstance($b);
143 
144  // REMOVE LOST ITEMS
145  if ($this->repository->hasLostItems()) {
147  $b->setUrl($this->ctrl->getLinkTarget($this, self::CMD_FLUSH));
148  $b->setCaption($this->lng->txt(self::CMD_FLUSH), false);
149  $this->toolbar->addButtonInstance($b);
150  }
151  }
152 
153  // TABLE
154  $table = new ilMMTopItemTableGUI($this, new ilMMItemRepository(), $this->access);
155  $table->setShowRowsSelector(false);
156 
157  return $table->getHTML();
158  }
Class ilMMItemRepository.
repository()
Definition: repository.php:5
if(empty($password)) $table
Definition: pwgen.php:24
Class ilMMTopItemTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restore()

ilMMTopItemGUI::restore ( )
private

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

References $attributes, $filename, $path, PHPMailer\PHPMailer\$provider, $r, $xml, cancel(), ActiveRecord\flushDB(), and ilGSProviderStorage\registerIdentifications().

Referenced by dispatchCommand().

276  {
283 
284  $r = function ($path, $xml_name) {
285  foreach (new DirectoryIterator($path) as $fileInfo) {
286  $filename = $fileInfo->getPathname() . $xml_name;
287  if ($fileInfo->isDir() && !$fileInfo->isDot() && file_exists($filename)) {
288  $xml = simplexml_load_file($filename);
289  if (isset($xml->gsproviders)) {
290  foreach ($xml->gsproviders as $item) {
291  if (isset($item->gsprovider)) {
292  foreach ($item->gsprovider as $provider) {
293  $attributes = $provider->attributes();
294  if ($attributes->purpose == StaticMainMenuProvider::PURPOSE_MAINBAR) {
295  $classname = $attributes->class_name[0];
296  ilGSProviderStorage::registerIdentifications($classname, StaticMainMenuProvider::PURPOSE_MAINBAR);
297  }
298  }
299  }
300  }
301  }
302  }
303  }
304  };
305  $r("./Services", "/service.xml");
306  $r("./Modules", "/module.xml");
307 
308  ilGlobalCache::flushAll();
309 
310  ilUtil::sendSuccess($this->lng->txt('msg_restored'), true);
311 
312  $this->cancel();
313  }
$path
Definition: aliased.php:25
static registerIdentifications(string $class_name, string $purpose)
$r
Definition: example_031.php:79
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTable()

ilMMTopItemGUI::saveTable ( )
private

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

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

Referenced by dispatchCommand().

98  {
99  global $DIC;
100  $r = $DIC->http()->request()->getParsedBody();
101  foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
102  $item = $this->repository->getItemFacadeForIdentificationString($identification_string);
103  $item->setPosition((int) $data['position']);
104  $item->setActiveStatus((bool) $data['active']);
105  $this->repository->updateItem($item);
106  }
107  $this->cancel();
108  }
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
repository()
Definition: repository.php:5
$data
Definition: bench.php:6
+ 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 214 of file class.ilMMTopItemGUI.php.

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

Referenced by dispatchCommand().

215  {
216  $item = $this->getMMItemFromRequest();
217  if ($item->isEditable()) {
218  $f = new ilMMTopItemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $DIC->http(), $item, $this->repository);
219  if ($f->save()) {
220  $this->cancel();
221  }
222 
223  return $f->getHTML();
224  }
225 
226  return "";
227  }
global $DIC
Definition: saml.php:7
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 17 of file class.ilMMTopItemGUI.php.

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_CANCEL

const ilMMTopItemGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_CONFIRM_DELETE

const ilMMTopItemGUI::CMD_CONFIRM_DELETE = 'topitem_confirm_delete'

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

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_CONFIRM_RESTORE

const ilMMTopItemGUI::CMD_CONFIRM_RESTORE = 'confirmRestore'

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

◆ CMD_CREATE

const ilMMTopItemGUI::CMD_CREATE = 'topitem_create'

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

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_DELETE

const ilMMTopItemGUI::CMD_DELETE = 'topitem_delete'

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

◆ CMD_RENDER_INTERRUPTIVE

const ilMMTopItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

◆ CMD_RESTORE

const ilMMTopItemGUI::CMD_RESTORE = 'restore'

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

◆ CMD_SAVE_TABLE

const ilMMTopItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMTopItemTableGUI\__construct().

◆ CMD_TRANSLATE

const ilMMTopItemGUI::CMD_TRANSLATE = 'topitem_translate'

◆ CMD_UPDATE

const ilMMTopItemGUI::CMD_UPDATE = 'topitem_update'

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

Referenced by ilMMTopItemFormGUI\initForm().

◆ CMD_VIEW_TOP_ITEMS

const ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS = 'subtab_topitems'

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

Referenced by ilMMTabHandling\initTabs().


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