ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilFooterGroupsGUI Class Reference
+ Collaboration diagram for ilFooterGroupsGUI:

Public Member Functions

 __construct (private Container $dic, private Translator $translator, private ilObjFooterUIHandling $ui_handling)
 
 create ()
 
 update ()
 
 executeCommand ()
 

Data Fields

const CMD_DEFAULT = 'index'
 
const CMD_ADD = 'add'
 
const CMD_CREATE = 'create'
 
const CMD_EDIT = 'edit'
 
const CMD_UPDATE = 'update'
 
const CMD_RESET = 'reset'
 
const CMD_SAVE_ORDER = 'saveOrder'
 
const GSFO_ID = 'gsfo_group_id'
 

Protected Member Functions

 addButtons ()
 
 confirmReset ()
 
 index ()
 
 confirmDelete ()
 
 add ()
 
 edit ()
 
 toggleActivation ()
 
 reset ()
 
 editEntries ()
 

Private Member Functions

 delete ()
 
 saveOrder ()
 

Private Attributes

const CMD_CONFIRM_RESET = 'confirmReset'
 
GroupsRepository $repository
 
Factory $ui_factory
 
ilCtrlInterface $ctrl
 
ServerRequestInterface $request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFooterGroupsGUI::__construct ( private Container  $dic,
private Translator  $translator,
private ilObjFooterUIHandling  $ui_handling 
)

Definition at line 59 of file class.ilFooterGroupsGUI.php.

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

63  {
64  $this->ui_factory = $this->dic->ui()->factory();
65  $this->ctrl = $this->dic->ctrl();
66  $this->request = $this->dic->http()->request();
67  $this->repository = new GroupsRepositoryDB(
68  $this->dic->database(),
70  );
71  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$dic
Definition: ltiresult.php:33
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilFooterGroupsGUI::add ( )
protected

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

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

229  : void
230  {
231  $form = new GroupForm(
232  $this->repository,
233  $this->translator
234  );
235 
236  $action = $this->ctrl->getFormAction($this, self::CMD_CREATE);
237 
238  $this->ui_handling->outAsyncAsModal(
239  $this->translator->translate('group_add'),
240  $action,
241  $form->get($action)
242  );
243  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ addButtons()

ilFooterGroupsGUI::addButtons ( )
protected

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

References ILIAS\Repository\button(), ILIAS\Repository\ctrl(), ILIAS\UI\examples\MainControls\Slate\Notification\standard(), and ILIAS\UI\Implementation\Component\withHelpTopics().

Referenced by index().

73  : array
74  {
75  $modal = $this->ui_factory->modal()->roundtrip(
76  $this->translator->translate('group_add'),
77  null
78  )->withAsyncRenderUrl(
79  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
80  );
81 
82  $confirm_reset = $this->ui_factory->prompt()->standard(
83  $this->ui_handling->getHereAsURI(self::CMD_CONFIRM_RESET),
84  );
85 
86  $this->dic->toolbar()->addComponent(
87  $this->ui_factory
88  ->button()
89  ->primary(
90  $this->translator->translate('group_add'),
91  '#' //$this->ctrl->getLinkTarget($this, self::CMD_ADD)
92  )
93  ->withOnClick($modal->getShowSignal())
94  ->withHelpTopics(...$this->ui_factory->helpTopics('gsfo_button_add'))
95  );
96  $this->dic->toolbar()->addComponent(
97  $this->ui_factory
98  ->button()
99  ->standard(
100  $this->translator->translate('reset_footer'),
101  '#' //'$this->ctrl->getLinkTarget($this, self::CMD_RESET)
102  )
103  ->withOnClick($confirm_reset->getShowSignal())
104  ->withHelpTopics(...$this->ui_factory->helpTopics('gsfo_button_reset'))
105  );
106 
107  return [$modal, $confirm_reset];
108  }
button(string $caption, string $cmd)
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
Definition: standard.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilFooterGroupsGUI::confirmDelete ( )
protected

Definition at line 162 of file class.ilFooterGroupsGUI.php.

References $id, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

162  : void
163  {
164  $items = [];
165 
166  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
167  $group = $this->repository->get($id);
168  if ($group === null) {
169  continue;
170  }
171  if ($group->isCore()) {
172  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
173  $id,
174  $group->getTitle(),
175  $this->translator->translate('info_not_deletable_core') .
176  $this->ui_handling->render($this->nok($this->ui_factory))
177  );
178  continue;
179  }
180  if ($group->getItems() > 0) {
181  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
182  $id,
183  $group->getTitle(),
184  $this->translator->translate('info_not_deletable_not_empty') .
185  $this->ui_handling->render($this->nok($this->ui_factory))
186  );
187  continue;
188  }
189  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
190  $id,
191  $group->getTitle(),
192  $this->ui_handling->render($this->ok($this->ui_factory))
193  );
194  }
195 
196  $this->ui_handling->outAsyncAsModal(
197  $this->translator->translate('group_delete'),
198  $this->ctrl->getFormAction($this, 'delete'),
199  ...$items
200  );
201  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ confirmReset()

ilFooterGroupsGUI::confirmReset ( )
protected

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

References ILIAS\Repository\ctrl().

110  : void
111  {
112  $this->ui_handling->outAsync(
113  $this->ui_factory->prompt()->state()->show(
114  $this->ui_factory->messageBox()->confirmation(
115  $this->translator->translate('confirm_reset')
116  )->withButtons(
117  [
118  $this->ui_factory->button()->standard(
119  $this->translator->translate('reset'),
120  $this->ctrl->getLinkTarget($this, self::CMD_RESET)
121  )
122  ]
123  )
124  )
125  );
126  }
+ Here is the call graph for this function:

◆ create()

ilFooterGroupsGUI::create ( )

Definition at line 245 of file class.ilFooterGroupsGUI.php.

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

245  : void
246  {
247  $form = new GroupForm(
248  $this->repository,
249  $this->translator
250  );
251  if ($form->store(
252  $this->request,
253  $this->ctrl->getFormAction($this, self::CMD_CREATE)
254  )) {
255  $this->ctrl->redirect($this, self::CMD_DEFAULT);
256  }
257  $this->ui_handling->out(
258  $form->get(
259  $this->ctrl->getFormAction($this, self::CMD_CREATE)
260  )
261  );
262  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ delete()

ilFooterGroupsGUI::delete ( )
private

Definition at line 203 of file class.ilFooterGroupsGUI.php.

References $id, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

203  : void
204  {
205  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
206  $group = $this->repository->get($id);
207  $this->repository->delete($group);
208  }
209 
210  $this->ui_handling->sendMessageAndRedirect(
211  'success',
212  $this->translator->translate('group_deleted'),
213  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
214  );
215  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ edit()

ilFooterGroupsGUI::edit ( )
protected

Definition at line 264 of file class.ilFooterGroupsGUI.php.

References $id, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

264  : void
265  {
266  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
267  $this->ui_handling->saveIdentificationsToRequest(
268  $this,
269  self::GSFO_ID,
270  $id
271  );
272  $group = $this->repository->get($id);
273 
274  $form = new GroupForm(
275  $this->repository,
276  $this->translator,
277  $group
278  );
279 
280  $target = $this->ctrl->getFormAction($this, self::CMD_UPDATE);
281  $this->ui_handling->outAsyncAsModal(
282  $this->translator->translate('group_edit'),
283  $target,
284  $form->get($target)
285  );
286  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ editEntries()

ilFooterGroupsGUI::editEntries ( )
protected

Definition at line 343 of file class.ilFooterGroupsGUI.php.

References $id, and ILIAS\Repository\ctrl().

Referenced by executeCommand().

343  : void
344  {
345  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
346  $this->ui_handling->saveIdentificationsToRequest(
347  ilFooterEntriesGUI::class,
348  self::GSFO_ID,
349  $id
350  );
351  $this->ctrl->redirectByClass(ilFooterEntriesGUI::class);
352  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilFooterGroupsGUI::executeCommand ( )

Definition at line 357 of file class.ilFooterGroupsGUI.php.

References $id, ILIAS\Repository\ctrl(), editEntries(), index(), and ILIAS\UI\examples\Deck\repository().

357  : void
358  {
359  $this->ui_handling->requireReadable();
360 
361  $next_class = $this->ctrl->getNextClass($this) ?? '';
362  $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
363 
364  switch (strtolower($next_class)) {
365  case strtolower(ilFooterTranslationGUI::class):
366  $item = $this->repository->get(
367  $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0]
368  );
369  $back_target = null;
370  if ($this->request->getQueryParams()['async'] ?? false) {
371  $back_target = $this->ui_handling->buildURI($this->ctrl->getLinkTarget($this, self::CMD_DEFAULT));
372  }
373  $translation = new ilFooterTranslationGUI(
374  $this->dic,
375  $this->translator,
376  $this->ui_handling,
377  $item,
378  $back_target
379  );
380 
381  $this->ctrl->forwardCommand($translation);
382 
383  return;
384  case strtolower(ilFooterEntriesGUI::class):
385  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
386  $this->ui_handling->saveIdentificationsToRequest(
387  ilFooterEntriesGUI::class,
388  self::GSFO_ID,
389  $id
390  );
391  $group = $this->repository->get($id);
392 
393  $this->ctrl->forwardCommand(
394  new ilFooterEntriesGUI(
395  $this->dic,
396  $this->translator,
397  $this->ui_handling,
398  $group,
399  $this->repository
400  )
401  );
402  return;
403  default:
404  switch ($cmd) {
405  case self::CMD_DEFAULT:
406  $this->ui_handling->requireReadable();
407  $this->index();
408  break;
409  case 'editEntries':
410  $this->ui_handling->requireReadable();
411  $this->editEntries();
412  break;
413  case self::CMD_ADD:
414  case self::CMD_CREATE:
415  case self::CMD_EDIT:
416  case self::CMD_UPDATE:
417  default:
418  $this->ui_handling->backToMainTab();
419  $this->ui_handling->requireWritable();
420  $this->$cmd();
421  break;
422  }
423  }
424  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
get(string $class_name)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ index()

ilFooterGroupsGUI::index ( )
protected

Definition at line 128 of file class.ilFooterGroupsGUI.php.

References $components, addButtons(), ilFooterTranslationGUI\CMD_DEFAULT, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

Referenced by executeCommand().

128  : void
129  {
130  // Add new
131  $components = [];
132  if ($this->ui_handling->hasPermission('write')) {
133  $components = $this->addButtons();
134  }
135  // Sync
136  $this->repository->syncWithGlobalScreen(
137  $this->dic->globalScreen()->collector()->footer()
138  );
139 
140  // Table
141  $table = new GroupsTable(
142  $this->repository,
143  new TranslationsRepositoryDB($this->dic->database()),
144  $this->translator,
145  $this->ui_handling->hasPermission('write')
146  );
147 
148  $this->ui_handling->out(
149  $table->get(
150  $this->ui_handling->getHereAsURI(self::CMD_SAVE_ORDER),
151  $this->ui_handling->buildURI(
152  $this->ctrl->getLinkTargetByClass(
153  ilFooterTranslationGUI::class,
155  )
156  )
157  ),
158  ...$components
159  );
160  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$components
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilFooterGroupsGUI::reset ( )
protected

Definition at line 325 of file class.ilFooterGroupsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\UI\examples\Deck\repository(), ILIAS\GlobalScreen\UI\Footer\Translation\TranslationsRepositoryDB\reset(), and ILIAS\GlobalScreen\UI\Footer\Entries\EntriesRepositoryDB\reset().

325  : void
326  {
327  $this->repository->reset(
328  $this->dic->globalScreen()->collector()->footer()
329  );
330  $entries_repo = new EntriesRepositoryDB($this->dic->database(), new ilFooterCustomGroupsProvider($this->dic));
331  $entries_repo->reset($this->dic->globalScreen()->collector()->footer());
332 
333  $translations = new TranslationsRepositoryDB($this->dic->database());
334  $translations->reset();
335 
336  $this->ui_handling->sendMessageAndRedirect(
337  'success',
338  $this->translator->translate('reset_success'),
339  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
340  );
341  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ saveOrder()

ilFooterGroupsGUI::saveOrder ( )
private

Definition at line 217 of file class.ilFooterGroupsGUI.php.

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

217  : void
218  {
219  foreach ($this->request->getParsedBody() as $hashed_id => $position) {
220  $this->repository->updatePositionById($this->unhash($hashed_id), (int) $position);
221  }
222  $this->ui_handling->sendMessageAndRedirect(
223  'success',
224  $this->translator->translate('order_saved'),
225  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
226  );
227  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ toggleActivation()

ilFooterGroupsGUI::toggleActivation ( )
protected

Definition at line 311 of file class.ilFooterGroupsGUI.php.

References $id, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

311  : void
312  {
313  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
314  $group = $this->repository->get($id);
315  $this->repository->store($group->withActive(!$group->isActive()));
316  }
317 
318  $this->ui_handling->sendMessageAndRedirect(
319  'success',
320  $this->translator->translate('group_activation_toggled'),
321  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
322  );
323  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ update()

ilFooterGroupsGUI::update ( )

Definition at line 288 of file class.ilFooterGroupsGUI.php.

References $id, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

288  : void
289  {
290  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
291  $group = $this->repository->get($id);
292 
293  $form = new GroupForm(
294  $this->repository,
295  $this->translator,
296  $group
297  );
298  if ($form->store(
299  $this->request,
300  $this->ctrl->getFormAction($this, self::CMD_CREATE)
301  )) {
302  $this->ctrl->redirect($this, self::CMD_DEFAULT);
303  }
304  $this->ui_handling->out(
305  $form->get(
306  $this->ctrl->getFormAction($this, self::CMD_CREATE)
307  )
308  );
309  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilFooterGroupsGUI::$ctrl
private

Definition at line 56 of file class.ilFooterGroupsGUI.php.

◆ $repository

GroupsRepository ilFooterGroupsGUI::$repository
private

Definition at line 54 of file class.ilFooterGroupsGUI.php.

◆ $request

ServerRequestInterface ilFooterGroupsGUI::$request
private

Definition at line 57 of file class.ilFooterGroupsGUI.php.

◆ $ui_factory

Factory ilFooterGroupsGUI::$ui_factory
private

Definition at line 55 of file class.ilFooterGroupsGUI.php.

◆ CMD_ADD

const ilFooterGroupsGUI::CMD_ADD = 'add'

Definition at line 46 of file class.ilFooterGroupsGUI.php.

◆ CMD_CONFIRM_RESET

const ilFooterGroupsGUI::CMD_CONFIRM_RESET = 'confirmReset'
private

Definition at line 53 of file class.ilFooterGroupsGUI.php.

◆ CMD_CREATE

const ilFooterGroupsGUI::CMD_CREATE = 'create'

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

◆ CMD_DEFAULT

const ilFooterGroupsGUI::CMD_DEFAULT = 'index'

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

◆ CMD_EDIT

const ilFooterGroupsGUI::CMD_EDIT = 'edit'

Definition at line 48 of file class.ilFooterGroupsGUI.php.

◆ CMD_RESET

const ilFooterGroupsGUI::CMD_RESET = 'reset'

Definition at line 50 of file class.ilFooterGroupsGUI.php.

◆ CMD_SAVE_ORDER

const ilFooterGroupsGUI::CMD_SAVE_ORDER = 'saveOrder'

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

◆ CMD_UPDATE

const ilFooterGroupsGUI::CMD_UPDATE = 'update'

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

◆ GSFO_ID

const ilFooterGroupsGUI::GSFO_ID = 'gsfo_group_id'

Definition at line 52 of file class.ilFooterGroupsGUI.php.


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