ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMMSubItemGUI Class Reference

Class ilMMTopItemGUI @ilCtrl_IsCalledBy ilMMSubItemGUI: ilObjMainMenuGUI @ilCtrl_Calls 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.

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 }
Class ilMMSubitemFormGUI.
global $DIC
Definition: saml.php:7

References $DIC, and $f.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ applyFilter()

ilMMSubItemGUI::applyFilter ( )
private

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

182 {
183 $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
184 $table->writeFilterToSession();
185
186 $this->cancel();
187 }
Class ilMMSubItemTableGUI.
if(empty($password)) $table
Definition: pwgen.php:24
repository()
Definition: repository.php:5

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

Referenced by dispatchCommand().

+ 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.

230 {
231 $this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS);
232 }

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

+ 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.

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 }
Confirmation screen class.
$i
Definition: disco.tpl.php:19
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406

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

Referenced by dispatchCommand().

+ 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.

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 }

References $DIC, $f, and cancel().

Referenced by dispatchCommand().

+ 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.

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 }

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

+ Here is the call graph for this function:

◆ dispatchCommand()

ilMMSubItemGUI::dispatchCommand (   $cmd)
private

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

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);
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);
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);
54 $this->access->checkAccessAndThrowException('visible,read');
55 $this->applyFilter();
56 break;
58 $this->access->checkAccessAndThrowException('visible,read');
59 $this->resetFilter();
60 break;
62 $this->access->checkAccessAndThrowException('visible,read');
63 $this->tab_handling->initTabs(ilObjMainMenuGUI::TAB_MAIN, $cmd);
64
65 return $this->index();
67 $this->access->checkAccessAndThrowException('write');
68 $this->saveTable();
69 break;
71 $this->access->checkAccessAndThrowException('write');
72
73 return $this->confirmDelete();
75 $this->access->checkAccessAndThrowException('write');
76 $this->delete();
77 break;
79 $this->cancel();
80 break;
82 $this->access->checkAccessAndThrowException('write');
84 break;
85 }
86
87 return "";
88 }

References $DIC, add(), applyFilter(), cancel(), CMD_ADD, CMD_APPLY_FILTER, CMD_CANCEL, CMD_CONFIRM_DELETE, CMD_CREATE, CMD_DELETE, CMD_EDIT, CMD_RENDER_INTERRUPTIVE, CMD_RESET_FILTER, CMD_SAVE_TABLE, CMD_UPDATE, CMD_VIEW_SUB_ITEMS, confirmDelete(), create(), edit(), index(), ilMMAbstractItemGUI\renderInterruptiveModal(), resetFilter(), saveTable(), ilObjMainMenuGUI\TAB_MAIN, and update().

Referenced by executeCommand().

+ 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.

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 }

References $DIC, and $f.

Referenced by dispatchCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilMMSubItemGUI::executeCommand ( )

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

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 }
determineCommand(string $standard, string $delete)
Class ilMMItemTranslationGUI.
Class ilObjMainMenuGUI.

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

+ Here is the call graph for this function:

◆ index()

ilMMSubItemGUI::index ( )
private
Returns
string

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

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 }
static getInstance()
Factory.

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

Referenced by dispatchCommand().

+ 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.

190 {
191 $table = new ilMMSubItemTableGUI($this, $this->repository, $this->access);
192 $table->resetFilter();
193 $table->resetOffset();
194
195 $this->cancel();
196 }

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

Referenced by dispatchCommand().

+ 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.

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 }
$r
Definition: example_031.php:79
$data
Definition: bench.php:6

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

Referenced by dispatchCommand().

+ 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.

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 }

References $DIC, $f, and cancel().

Referenced by dispatchCommand().

+ 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 dispatchCommand(), index(), and ilMMSubitemFormGUI\initForm().

◆ CMD_APPLY_FILTER

const ilMMSubItemGUI::CMD_APPLY_FILTER = 'applyFilter'

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

Referenced by dispatchCommand().

◆ CMD_CANCEL

const ilMMSubItemGUI::CMD_CANCEL = 'cancel'

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

Referenced by dispatchCommand().

◆ CMD_CONFIRM_DELETE

const ilMMSubItemGUI::CMD_CONFIRM_DELETE = 'subitem_confirm_delete'

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

Referenced by dispatchCommand().

◆ CMD_CREATE

const ilMMSubItemGUI::CMD_CREATE = 'subitem_create'

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

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

◆ CMD_DELETE

const ilMMSubItemGUI::CMD_DELETE = 'subitem_delete'

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

Referenced by dispatchCommand(), and ilMMTopItemTableGUI\fillRow().

◆ CMD_EDIT

const ilMMSubItemGUI::CMD_EDIT = 'subitem_edit'

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

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

◆ CMD_RENDER_INTERRUPTIVE

const ilMMSubItemGUI::CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal'

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

Referenced by dispatchCommand().

◆ CMD_RESET_FILTER

const ilMMSubItemGUI::CMD_RESET_FILTER = 'resetFilter'

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

Referenced by dispatchCommand().

◆ CMD_SAVE_TABLE

const ilMMSubItemGUI::CMD_SAVE_TABLE = 'save_table'

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

Referenced by ilMMSubItemTableGUI\__construct(), and dispatchCommand().

◆ 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 dispatchCommand(), and 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: