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

Data Fields

const CMD_VIEW_SUB_ITEMS = 'subtab_subitems'
 
const CMD_ADD = 'subitem_add'
 
const CMD_CREATE = 'subitem_create'
 
const CMD_DELETE = 'subitem_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 ()
 

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

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

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

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

Referenced by dispatchCommand().

132  : string
133  {
134  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->repository->getItemFacade(), $this->repository);
135 
136  return $f->getHTML();
137  }
global $DIC
Definition: saml.php:7
repository()
Definition: repository.php:5
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 181 of file class.ilMMSubItemGUI.php.

References $table, cancel(), and repository().

Referenced by dispatchCommand().

182  {
183  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
184  $table->writeFilterToSession();
185 
186  $this->cancel();
187  }
Class ilMMSubItemTableGUI.
repository()
Definition: repository.php:5
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMMSubItemGUI::cancel ( )
private

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

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

230  {
231  $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS);
232  }
+ Here is the caller graph for this function:

◆ confirmDelete()

ilMMSubItemGUI::confirmDelete ( )
private
Returns
string
Exceptions
Throwable

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

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

Referenced by dispatchCommand().

238  : string
239  {
240  $this->ctrl->saveParameterByClass(self::class, self::IDENTIFIER);
241  $i = $this->getMMItemFromRequest();
242  $c = new ilConfirmationGUI();
243  $c->addItem(self::IDENTIFIER, $this->hash($i->getId()), $i->getDefaultTitle());
244  $c->setFormAction($this->ctrl->getFormActionByClass(self::class));
245  $c->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
246  $c->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
247  $c->setHeaderText($this->lng->txt(self::CMD_CONFIRM_DELETE));
248 
249  return $c->getHTML();
250  }
$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:

◆ create()

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

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

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

Referenced by dispatchCommand().

145  {
146  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->repository->getItemFacade(), $this->repository);
147  if ($f->save()) {
148  $this->cancel();
149  }
150 
151  return $f->getHTML();
152  }
global $DIC
Definition: saml.php:7
repository()
Definition: repository.php:5
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 218 of file class.ilMMSubItemGUI.php.

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

219  {
220  $item = $this->getMMItemFromRequest();
221  if ($item->isDeletable()) {
222  $this->repository->deleteItem($item);
223  }
224 
225  ilUtil::sendSuccess($this->lng->txt("msg_subitem_deleted"), true);
226  $this->cancel();
227  }
repository()
Definition: repository.php:5
+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMSubItemGUI::dispatchCommand (   $cmd)
private

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

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

Referenced by executeCommand().

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

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

Referenced by dispatchCommand().

159  : string
160  {
161  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->getMMItemFromRequest(), $this->repository);
162 
163  return $f->getHTML();
164  }
global $DIC
Definition: saml.php:7
Class ilMMSubitemFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMSubItemGUI::executeCommand ( )

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

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

106  {
107  $next_class = $this->ctrl->getNextClass();
108 
109  if ($next_class == '') {
110  $cmd = $this->determineCommand(self::CMD_VIEW_SUB_ITEMS, self::CMD_DELETE);
111  $this->tpl->setContent($this->dispatchCommand($cmd));
112 
113  return;
114  }
115 
116  switch ($next_class) {
117  case strtolower(ilMMItemTranslationGUI::class):
118  $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, self::CMD_VIEW_SUB_ITEMS, true, $this->ctrl->getCallHistory()[2]['class'] ? $this->ctrl->getCallHistory()[2]['class'] : "");
119  $g = new ilMMItemTranslationGUI($this->getMMItemFromRequest(), $this->repository);
120  $this->ctrl->forwardCommand($g);
121  break;
122  default:
123  break;
124  }
125  }
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 201 of file class.ilMMSubItemGUI.php.

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

Referenced by dispatchCommand().

201  : string
202  {
203  if ($this->access->hasUserPermissionTo('write')) {
204  // ADD NEW
206  $b->setUrl($this->ctrl->getLinkTarget($this, ilMMSubItemGUI::CMD_ADD));
207  $b->setCaption($this->lng->txt(ilMMSubItemGUI::CMD_ADD), false);
208  $this->toolbar->addButtonInstance($b);
209  }
210 
211  // TABLE
212  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
213  $table->setShowRowsSelector(false);
214 
215  return $table->getHTML();
216  }
Class ilMMSubItemTableGUI.
repository()
Definition: repository.php:5
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilMMSubItemGUI::resetFilter ( )
private

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

References $table, cancel(), and repository().

Referenced by dispatchCommand().

190  {
191  $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
192  $table->resetFilter();
193  $table->resetOffset();
194 
195  $this->cancel();
196  }
Class ilMMSubItemTableGUI.
repository()
Definition: repository.php:5
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTable()

ilMMSubItemGUI::saveTable ( )
private

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

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

Referenced by dispatchCommand().

91  {
92  global $DIC;
93  $r = $DIC->http()->request()->getParsedBody();
94  foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
95  $item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
96  $position = (int) $data['position'];
97  $item->setPosition($position);
98  $item->setActiveStatus((bool) $data['active']);
99  $item->setParent($this->unhash((string) $data['parent']));
100  $this->repository->updateItem($item);
101  }
102  $this->cancel();
103  }
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()

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

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

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

Referenced by dispatchCommand().

172  {
173  $f = new ilMMSubitemFormGUI($DIC->ctrl(), $DIC->ui()->factory(), $DIC->ui()->renderer(), $this->lng, $this->getMMItemFromRequest(), $this->repository);
174  if ($f->save()) {
175  $this->cancel();
176  }
177 
178  return $f->getHTML();
179  }
global $DIC
Definition: saml.php:7
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 24 of file class.ilMMSubItemGUI.php.

◆ CMD_CANCEL

const ilMMSubItemGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_CONFIRM_DELETE

const ilMMSubItemGUI::CMD_CONFIRM_DELETE = 'subitem_confirm_delete'

Definition at line 19 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 = 'subitem_delete'

◆ CMD_EDIT

const ilMMSubItemGUI::CMD_EDIT = 'subitem_edit'

◆ CMD_RENDER_INTERRUPTIVE

const ilMMSubItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

◆ CMD_RESET_FILTER

const ilMMSubItemGUI::CMD_RESET_FILTER = 'resetFilter'

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

◆ CMD_SAVE_TABLE

const ilMMSubItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMSubItemTableGUI\__construct().

◆ CMD_TRANSLATE

const ilMMSubItemGUI::CMD_TRANSLATE = 'subitem_translate'

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

◆ CMD_UPDATE

const ilMMSubItemGUI::CMD_UPDATE = 'subitem_update'

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

Referenced by ilMMSubitemFormGUI\initForm().

◆ CMD_VIEW_SUB_ITEMS

const ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS = 'subtab_subitems'

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

Referenced by dispatchCommand(), and ilMMTabHandling\initTabs().


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