ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 86 of file class.ilFooterGroupsGUI.php.

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

90  {
91  $this->ui_factory = $this->dic->ui()->factory();
92  $this->ctrl = $this->dic->ctrl();
93  $this->request = $this->dic->http()->request();
94  $this->repository = new GroupsRepositoryDB(
95  $this->dic->database(),
97  );
98  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$dic
Definition: result.php:31
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilFooterGroupsGUI::add ( )
protected

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

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

255  : void
256  {
257  $form = new GroupForm(
258  $this->repository,
259  $this->translator
260  );
261 
262  $action = $this->ctrl->getFormAction($this, self::CMD_CREATE);
263 
264  $this->ui_handling->outAsyncAsModal(
265  $this->translator->translate('group_add'),
266  $action,
267  $form->get($action)
268  );
269  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ addButtons()

ilFooterGroupsGUI::addButtons ( )
protected

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

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

Referenced by index().

100  : array
101  {
102  $modal = $this->ui_factory->modal()->roundtrip(
103  $this->translator->translate('group_add'),
104  null
105  )->withAsyncRenderUrl(
106  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
107  );
108 
109  $confirm_reset = $this->ui_factory->prompt()->standard(
110  $this->ui_handling->getHereAsURI(self::CMD_CONFIRM_RESET),
111  );
112 
113  $this->dic->toolbar()->addComponent(
114  $this->ui_factory
115  ->button()
116  ->primary(
117  $this->translator->translate('group_add'),
118  '#' //$this->ctrl->getLinkTarget($this, self::CMD_ADD)
119  )
120  ->withOnClick($modal->getShowSignal())
121  // ->withHelpTopics(...$this->ui_factory->helpTopics('gsfo_button_add')) // TODO reenable after ilHelp is working again
122  );
123  $this->dic->toolbar()->addComponent(
124  $this->ui_factory
125  ->button()
126  ->standard(
127  $this->translator->translate('reset_footer'),
128  '#' //'$this->ctrl->getLinkTarget($this, self::CMD_RESET)
129  )
130  ->withOnClick($confirm_reset->getShowSignal())
131  // ->withHelpTopics(...$this->ui_factory->helpTopics('gsfo_button_reset')) // TODO reenable after ilHelp is working again
132  );
133 
134  return [$modal, $confirm_reset];
135  }
button(string $caption, string $cmd)
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
Definition: standard.php:38
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilFooterGroupsGUI::confirmDelete ( )
protected

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

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

188  : void
189  {
190  $items = [];
191 
192  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
193  $group = $this->repository->get($id);
194  if ($group === null) {
195  continue;
196  }
197  if ($group->isCore()) {
198  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
199  $id,
200  $group->getTitle(),
201  $this->translator->translate('info_not_deletable_core') .
202  $this->ui_handling->render($this->nok($this->ui_factory))
203  );
204  continue;
205  }
206  if ($group->getItems() > 0) {
207  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
208  $id,
209  $group->getTitle(),
210  $this->translator->translate('info_not_deletable_not_empty') .
211  $this->ui_handling->render($this->nok($this->ui_factory))
212  );
213  continue;
214  }
215  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
216  $id,
217  $group->getTitle(),
218  $this->ui_handling->render($this->ok($this->ui_factory))
219  );
220  }
221 
222  $this->ui_handling->outAsyncAsModal(
223  $this->translator->translate('group_delete'),
224  $this->ctrl->getFormAction($this, 'delete'),
225  ...$items
226  );
227  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ confirmReset()

ilFooterGroupsGUI::confirmReset ( )
protected

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

References ILIAS\Repository\ctrl().

137  : void
138  {
139  $this->ui_handling->outAsync(
140  $this->ui_factory->prompt()->state()->show(
141  $this->ui_factory->messageBox()->confirmation(
142  $this->translator->translate('confirm_reset')
143  )->withButtons(
144  [
145  $this->ui_factory->button()->standard(
146  $this->translator->translate('reset'),
147  $this->ctrl->getLinkTarget($this, self::CMD_RESET)
148  )
149  ]
150  )
151  )
152  );
153  }
+ Here is the call graph for this function:

◆ create()

ilFooterGroupsGUI::create ( )

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

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

271  : void
272  {
273  $form = new GroupForm(
274  $this->repository,
275  $this->translator
276  );
277  if ($form->store(
278  $this->request,
279  $this->ctrl->getFormAction($this, self::CMD_CREATE)
280  )) {
281  $this->ctrl->redirect($this, self::CMD_DEFAULT);
282  }
283  $this->ui_handling->out(
284  $form->get(
285  $this->ctrl->getFormAction($this, self::CMD_CREATE)
286  )
287  );
288  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ delete()

ilFooterGroupsGUI::delete ( )
private

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

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

229  : void
230  {
231  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
232  $group = $this->repository->get($id);
233  $this->repository->delete($group);
234  }
235 
236  $this->ui_handling->sendMessageAndRedirect(
237  'success',
238  $this->translator->translate('group_deleted'),
239  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
240  );
241  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ edit()

ilFooterGroupsGUI::edit ( )
protected

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

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

290  : void
291  {
292  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
293  $this->ui_handling->saveIdentificationsToRequest(
294  $this,
295  self::GSFO_ID,
296  $id
297  );
298  $group = $this->repository->get($id);
299 
300  $form = new GroupForm(
301  $this->repository,
302  $this->translator,
303  $group
304  );
305 
306  $target = $this->ctrl->getFormAction($this, self::CMD_UPDATE);
307  $this->ui_handling->outAsyncAsModal(
308  $this->translator->translate('group_edit'),
309  $target,
310  $form->get($target)
311  );
312  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ editEntries()

ilFooterGroupsGUI::editEntries ( )
protected

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

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

369  : void
370  {
371  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
372  $this->ui_handling->saveIdentificationsToRequest(
373  ilFooterEntriesGUI::class,
374  self::GSFO_ID,
375  $id
376  );
377  $this->ctrl->redirectByClass(ilFooterEntriesGUI::class);
378  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ executeCommand()

ilFooterGroupsGUI::executeCommand ( )

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

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

383  : void
384  {
385  $this->ui_handling->requireReadable();
386 
387  $next_class = $this->ctrl->getNextClass($this) ?? '';
388  $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
389 
390  switch (strtolower($next_class)) {
391  case strtolower(ilFooterTranslationGUI::class):
392  $item = $this->repository->get(
393  $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0]
394  );
395  $back_target = null;
396  if ($this->request->getQueryParams()['async'] ?? false) {
397  $back_target = $this->ui_handling->buildURI($this->ctrl->getLinkTarget($this, self::CMD_DEFAULT));
398  }
399  $translation = new ilFooterTranslationGUI(
400  $this->dic,
401  $this->translator,
402  $this->ui_handling,
403  $item,
404  $back_target
405  );
406 
407  $this->ctrl->forwardCommand($translation);
408 
409  return;
410  case strtolower(ilFooterEntriesGUI::class):
411  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
412  $this->ui_handling->saveIdentificationsToRequest(
413  ilFooterEntriesGUI::class,
414  self::GSFO_ID,
415  $id
416  );
417  $group = $this->repository->get($id);
418 
419  $this->ctrl->forwardCommand(
420  new ilFooterEntriesGUI(
421  $this->dic,
422  $this->translator,
423  $this->ui_handling,
424  $group,
425  $this->repository
426  )
427  );
428  return;
429  default:
430  switch ($cmd) {
431  case self::CMD_DEFAULT:
432  $this->ui_handling->requireWritable();
433  $this->index();
434  break;
435  case self::CMD_ADD:
436  case self::CMD_CREATE:
437  case self::CMD_EDIT:
438  case self::CMD_UPDATE:
439  default:
440  $this->ui_handling->backToMainTab();
441  $this->ui_handling->requireWritable();
442  $this->$cmd();
443  break;
444  }
445  }
446  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
get(string $class_name)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ index()

ilFooterGroupsGUI::index ( )
protected

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

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

Referenced by executeCommand().

155  : void
156  {
157  // Add new
158  $components = [];
159  if ($this->ui_handling->hasPermission('write')) {
160  $components = $this->addButtons();
161  }
162  // Sync
163  $this->repository->syncWithGlobalScreen(
164  $this->dic->globalScreen()->collector()->footer()
165  );
166 
167  // Table
168  $table = new GroupsTable(
169  $this->repository,
170  new TranslationsRepositoryDB($this->dic->database()),
171  $this->translator
172  );
173 
174  $this->ui_handling->out(
175  $table->get(
176  $this->ui_handling->getHereAsURI(self::CMD_SAVE_ORDER),
177  $this->ui_handling->buildURI(
178  $this->ctrl->getLinkTargetByClass(
179  ilFooterTranslationGUI::class,
181  )
182  )
183  ),
184  ...$components
185  );
186  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$components
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilFooterGroupsGUI::reset ( )
protected

Definition at line 351 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().

351  : void
352  {
353  $this->repository->reset(
354  $this->dic->globalScreen()->collector()->footer()
355  );
356  $entries_repo = new EntriesRepositoryDB($this->dic->database(), new ilFooterCustomGroupsProvider($this->dic));
357  $entries_repo->reset($this->dic->globalScreen()->collector()->footer());
358 
359  $translations = new TranslationsRepositoryDB($this->dic->database());
360  $translations->reset();
361 
362  $this->ui_handling->sendMessageAndRedirect(
363  'success',
364  $this->translator->translate('reset_success'),
365  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
366  );
367  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ saveOrder()

ilFooterGroupsGUI::saveOrder ( )
private

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

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

243  : void
244  {
245  foreach ($this->request->getParsedBody() as $hashed_id => $position) {
246  $this->repository->updatePositionById($this->unhash($hashed_id), (int) $position);
247  }
248  $this->ui_handling->sendMessageAndRedirect(
249  'success',
250  $this->translator->translate('order_saved'),
251  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
252  );
253  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ toggleActivation()

ilFooterGroupsGUI::toggleActivation ( )
protected

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

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

337  : void
338  {
339  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
340  $group = $this->repository->get($id);
341  $this->repository->store($group->withActive(!$group->isActive()));
342  }
343 
344  $this->ui_handling->sendMessageAndRedirect(
345  'success',
346  $this->translator->translate('group_activation_toggled'),
347  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
348  );
349  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ update()

ilFooterGroupsGUI::update ( )

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

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

314  : void
315  {
316  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
317  $group = $this->repository->get($id);
318 
319  $form = new GroupForm(
320  $this->repository,
321  $this->translator,
322  $group
323  );
324  if ($form->store(
325  $this->request,
326  $this->ctrl->getFormAction($this, self::CMD_CREATE)
327  )) {
328  $this->ctrl->redirect($this, self::CMD_DEFAULT);
329  }
330  $this->ui_handling->out(
331  $form->get(
332  $this->ctrl->getFormAction($this, self::CMD_CREATE)
333  )
334  );
335  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilFooterGroupsGUI::$ctrl
private

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

◆ $repository

GroupsRepository ilFooterGroupsGUI::$repository
private

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

◆ $request

ServerRequestInterface ilFooterGroupsGUI::$request
private

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

◆ $ui_factory

Factory ilFooterGroupsGUI::$ui_factory
private

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

◆ CMD_ADD

const ilFooterGroupsGUI::CMD_ADD = 'add'

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

◆ CMD_CONFIRM_RESET

const ilFooterGroupsGUI::CMD_CONFIRM_RESET = 'confirmReset'
private

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

◆ CMD_CREATE

const ilFooterGroupsGUI::CMD_CREATE = 'create'

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

◆ CMD_DEFAULT

const ilFooterGroupsGUI::CMD_DEFAULT = 'index'

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

◆ CMD_EDIT

const ilFooterGroupsGUI::CMD_EDIT = 'edit'

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

◆ CMD_RESET

const ilFooterGroupsGUI::CMD_RESET = 'reset'

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

◆ CMD_SAVE_ORDER

const ilFooterGroupsGUI::CMD_SAVE_ORDER = 'saveOrder'

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

◆ CMD_UPDATE

const ilFooterGroupsGUI::CMD_UPDATE = 'update'

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

◆ GSFO_ID

const ilFooterGroupsGUI::GSFO_ID = 'gsfo_group_id'

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


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