ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMMSubItemGUI Class Reference

@ilCtrl_IsCalledBy ilMMSubItemGUI: ilMMTopItemGUI @ilCtrl_Calls ilMMSubItemGUI: ILIAS\GlobalScreen\GUI\I18n\MultiLanguageGUI More...

+ Inheritance diagram for ilMMSubItemGUI:
+ Collaboration diagram for ilMMSubItemGUI:

Public Member Functions

 __construct (Pons $pons)
 
 executeCommand ()
 
 getCurrentItem ()
 
 getMutlipleItems ()
 
 getTokensToKeep ()
 
- Public Member Functions inherited from ilMMBaseGUI
 __construct (protected Pons $pons)
 
 getCurrentItem ()
 
 getMutlipleItems ()
 
 getTokensToKeep ()
 
 executeCommand ()
 
 getCurrentItem ()
 
 __construct (Pons $pons)
 
 executeCommand ()
 
 getTokensToKeep ()
 

Data Fields

const CMD_CONFIRM_MOVE = 'confirmMove'
 
const CMD_MOVE = 'MOVE'
 
- Data Fields inherited from ilMMBaseGUI
const CMD_DEFAULT = 'index'
 
const CMD_ADD = 'add'
 
const CMD_CREATE = 'create'
 
const CMD_EDIT = 'edit'
 
const CMD_DELETE = 'delete'
 
const CMD_CONFIRM_DELETE = 'confirmDelete'
 
const CMD_UPDATE = 'update'
 
const CMD_ACTIVATE = 'activate'
 
const CMD_DEACTIVATE = 'deactivate'
 
const CMD_SAVE_ORDER = 'saveOrder'
 
- Data Fields inherited from ILIAS\GlobalScreen\GUI\PonsGUI
const CMD_DEFAULT = 'index'
 

Protected Member Functions

 buildForm ()
 
 form (bool $save=false)
 
 index ()
 
- Protected Member Functions inherited from ilMMBaseGUI
 keepTokens ()
 
 delete ()
 
 confirmDelete ()
 
 activate ()
 
 deactivate ()
 
 toggle (bool $activation)
 
 saveOrder ()
 

Private Member Functions

 confirmMove ()
 
 move ()
 

Private Attributes

TokenContainer $sub_token
 
TokenContainer $top_token
 
ilMMItemFacadeInterface $parent_item
 

Additional Inherited Members

- Protected Attributes inherited from ilMMBaseGUI
ilMMItemRepository $repository
 
UIServices $ui
 
Translator $lng
 
Access $access
 
Flow $flow
 
ilToolbarGUI $toolbar
 

Detailed Description

@ilCtrl_IsCalledBy ilMMSubItemGUI: ilMMTopItemGUI @ilCtrl_Calls ilMMSubItemGUI: ILIAS\GlobalScreen\GUI\I18n\MultiLanguageGUI

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

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

Constructor & Destructor Documentation

◆ __construct()

ilMMSubItemGUI::__construct ( Pons  $pons)

Implements ILIAS\GlobalScreen\GUI\PonsGUI.

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

41 {
43 $this->sub_token = $this->pons->in()->buildToken('sub', 'id');
44 $this->top_token = $this->pons->in()->buildToken('top', 'id');
45 $this->parent_item = $this->repository->getItemFacadeForIdentificationString(
46 $this->pons->in()->getFirstFromRequest($this->top_token->token())
47 );
48 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\UI\examples\Deck\repository().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

ilMMSubItemGUI::buildForm ( )
protected

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

96 {
97 $item = $this->repository->getItemFacadeForIdentificationString(
98 $this->pons->in()->getFirstFromRequest($this->sub_token->token())
99 );
100 return new ilMMSubitemFormGUI(
101 $this->flow->ctrl(),
102 $this->ui->factory(),
103 $this->ui->renderer(),
104 $this->lng,
105 $this->pons->in()->request(),
106 $item,
107 $this->repository,
108 $this->parent_item
109 );
110 }
Class ilMMSubitemFormGUI.

References ILIAS\UI\examples\Deck\repository().

Referenced by form(), and index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmMove()

ilMMSubItemGUI::confirmMove ( )
private

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

164 : void
165 {
166 $this->keepTokens();
167
168 $items = [];
169 foreach ($this->getMutlipleItems() as $item) {
170 $items[] = $this->ui->factory()->modal()->interruptiveItem()->standard(
171 $this->hash($item->getId()),
172 $item->getDefaultTitle(),
173 );
174 }
175
176 $this->pons->out()->outAsyncAsConfirmation(
177 $this->lng->t('move'),
178 $this->lng->t('confirm_move'),
179 $this->lng->t('move'),
180 $this->flow->getLinkTarget($this, self::CMD_MOVE),
181 ...$items
182 );
183 }

References getMutlipleItems(), ilMMBaseGUI\keepTokens(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMMSubItemGUI::executeCommand ( )
Returns
bool true if you handled this command aka you were the CtrlClass, otherwise false

Reimplemented from ilMMBaseGUI.

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

51 : bool
52 {
53 $this->pons->in()->keep($this->top_token->token());
54 if ($this->pons->handle('sub_items')) {
55 return true;
56 }
57
58 match ($this->pons->flow()->getCommand(self::CMD_DEFAULT)) {
59 self::CMD_CONFIRM_MOVE => $this->confirmMove(),
60 self::CMD_MOVE => $this->move(),
61 default => parent::executeCommand()
62 };
63 return true;
64 }

References confirmMove(), and move().

+ Here is the call graph for this function:

◆ form()

ilMMSubItemGUI::form ( bool  $save = false)
protected

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

112 : void
113 {
114 if (!$save) {
115 $this->pons->in()->keep($this->sub_token->token());
116 }
117
118 $form = $this->buildForm();
119
120 if ($save && $form->save()) {
121 $this->pons->out()->success($this->lng->t('item_updated'), true);
122 $this->pons->flow()->redirect(self::CMD_DEFAULT);
123 }
124
125 $this->pons->out()->outAsyncAsModal(
126 $this->lng->txt('subitem'),
127 $this->flow->getLinkTarget($this, self::CMD_UPDATE),
128 $form->get()
129 );
130 }

References buildForm(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getCurrentItem()

ilMMSubItemGUI::getCurrentItem ( )

Reimplemented from ilMMBaseGUI.

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

67 {
68 return $this->repository->getItemFacadeForIdentificationString(
69 $this->pons->in()->getFirstFromRequest($this->sub_token->token())
70 );
71 }
Interface ilMMItemFacadeInterface.

References ILIAS\UI\examples\Deck\repository().

+ Here is the call graph for this function:

◆ getMutlipleItems()

ilMMSubItemGUI::getMutlipleItems ( )
Returns
ilMMItemFacadeInterface[]

Reimplemented from ilMMBaseGUI.

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

73 : array
74 {
75 $ids = $this->pons->in()->getAllFromRequest($this->sub_token->token());
76 if (($ids[0] ?? null) === Input::ALL_OBJECTS) {
77 return array_map(
78 fn(array $data): \ilMMItemFacadeInterface => $this->repository->getItemFacadeForIdentificationString(
79 $data['identification']
80 ),
81 $this->repository->getSubItemsForTable($this->parent_item)
82 );
83 }
84 return $this->repository->getItemFacadesForIdentificationStrings($ids);
85 }

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

Referenced by confirmMove(), and move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTokensToKeep()

ilMMSubItemGUI::getTokensToKeep ( )

Reimplemented from ilMMBaseGUI.

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

87 : array
88 {
89 return [
90 $this->top_token->token(),
91 $this->sub_token->token(),
92 ];
93 }

◆ index()

ilMMSubItemGUI::index ( )
protected

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

132 : void
133 {
134 $write_access = $this->access->hasUserPermissionTo('write');
135 if ($write_access) {
136 // ADD NEW
137 $form = $this->buildForm();
138 $add_modal = $this->ui->factory()->modal()->roundtrip(
139 $this->lng->t('subitem_add'),
140 null,
141 $form->get()->getInputs(),
142 $this->flow->getLinkTarget($this, self::CMD_CREATE)
143 );
144
145 $btn_add = $this->ui->factory()->button()->primary(
146 $this->lng->t('subitem_add'),
147 $add_modal->getShowSignal()
148 );
149 $this->toolbar->addComponent($add_modal);
150 $this->toolbar->addComponent($btn_add);
151 }
152
153 $table = new ilMMSubItemTableComponent(
154 $this->pons,
155 $this->sub_token,
156 $this->repository,
157 $this->parent_item,
158 $write_access
159 );
160
161 $this->pons->out()->out(...$table->get());
162 }

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

+ Here is the call graph for this function:

◆ move()

ilMMSubItemGUI::move ( )
private

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

185 : void
186 {
187 $mutliple_items = $this->getMutlipleItems();
188 if (empty($mutliple_items)) {
189 $this->pons->out()->error($this->lng->t('msg_not_moved'), true);
190 $this->pons->flow()->redirect(self::CMD_DEFAULT);
191 return;
192 }
193 foreach ($mutliple_items as $item) {
194 $item->setParent('');
195 $this->repository->updateItem($item);
196 }
197
198 $this->pons->out()->success($this->lng->t('msg_moved'), true);
199 $this->pons->flow()->redirect(self::CMD_DEFAULT);
200 }

References getMutlipleItems(), ILIAS\Repository\lng(), and ILIAS\UI\examples\Deck\repository().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $parent_item

ilMMItemFacadeInterface ilMMSubItemGUI::$parent_item
private

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

◆ $sub_token

TokenContainer ilMMSubItemGUI::$sub_token
private

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

◆ $top_token

TokenContainer ilMMSubItemGUI::$top_token
private

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

◆ CMD_CONFIRM_MOVE

const ilMMSubItemGUI::CMD_CONFIRM_MOVE = 'confirmMove'

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

Referenced by ilMMSubItemTableComponent\get().

◆ CMD_MOVE

const ilMMSubItemGUI::CMD_MOVE = 'MOVE'

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


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