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

Public Member Functions

 __construct (private Container $dic, private Translator $translator, private ilObjFooterUIHandling $ui_handling, private Group $group, private GroupsRepository $groups_repository)
 
 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_entry_id'
 

Protected Member Functions

 index ()
 
 add ()
 
 addButtons ()
 
 saveCurrentEntry ()
 
 edit ()
 
 toggleActivation ()
 
 reset ()
 
 confirmDelete ()
 
 selectMove ()
 
 getMoveForm ()
 
 move ()
 

Private Member Functions

 saveOrder ()
 
 delete ()
 

Private Attributes

EntriesRepository $repository
 
Factory $ui_factory
 
ilCtrlInterface $ctrl
 
ServerRequestInterface $request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFooterEntriesGUI::__construct ( private Container  $dic,
private Translator  $translator,
private ilObjFooterUIHandling  $ui_handling,
private Group  $group,
private GroupsRepository  $groups_repository 
)

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

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

65  {
66  $this->ui_factory = $this->dic->ui()->factory();
67  $this->ctrl = $this->dic->ctrl();
68  $this->request = $this->dic->http()->request();
69  $this->repository = new EntriesRepositoryDB(
70  $this->dic->database(),
72  );
73  }
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()

ilFooterEntriesGUI::add ( )
protected

Definition at line 117 of file class.ilFooterEntriesGUI.php.

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

117  : void
118  {
119  $form = new EntryForm(
120  $this->repository,
121  $this->translator,
122  $this->group
123  );
124 
125  $target = $this->ctrl->getFormAction($this, self::CMD_CREATE);
126  $this->ui_handling->outAsyncAsModal(
127  $this->translator->translate('add', 'entries'),
128  $target,
129  $form->get($target)
130  );
131  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ addButtons()

ilFooterEntriesGUI::addButtons ( )
protected

Definition at line 133 of file class.ilFooterEntriesGUI.php.

References ILIAS\Repository\button(), and ILIAS\Repository\ctrl().

Referenced by index().

133  : array
134  {
135  $modal = $this->ui_factory->modal()->roundtrip(
136  $this->translator->translate('add', 'entries'),
137  null
138  )->withAsyncRenderUrl(
139  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
140  );
141 
142  $this->dic->toolbar()->addComponent(
143  $this->ui_factory
144  ->button()
145  ->primary(
146  $this->translator->translate('add', 'entries'),
147  '#'
148  )
149  ->withOnClick($modal->getShowSignal())
150  );
151 
152  return [$modal];
153  }
button(string $caption, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilFooterEntriesGUI::confirmDelete ( )
protected

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

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

255  : void
256  {
257  $items = [];
258 
259  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
260  $entry = $this->repository->get($id);
261  if ($entry === null) {
262  continue;
263  }
264  if ($entry->isCore()) {
265  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
266  $id,
267  $entry->getTitle(),
268  $this->translator->translate('info_not_deletable_core') .
269  $this->ui_handling->render($this->nok($this->ui_factory))
270  );
271  continue;
272  }
273  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
274  $id,
275  $entry->getTitle(),
276  $this->ui_handling->render($this->ok($this->ui_factory))
277  );
278  }
279 
280  $this->ui_handling->outAsyncAsModal(
281  $this->translator->translate('entry_delete'),
282  $this->ctrl->getFormAction($this, 'delete'),
283  ...$items
284  );
285  }
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:

◆ create()

ilFooterEntriesGUI::create ( )

Definition at line 166 of file class.ilFooterEntriesGUI.php.

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

166  : void
167  {
168  $form = new EntryForm(
169  $this->repository,
170  $this->translator,
171  $this->group
172  );
173  if ($form->store(
174  $this->request,
175  $this->ctrl->getFormAction($this, self::CMD_CREATE)
176  )) {
177  $this->ctrl->redirect($this, self::CMD_DEFAULT);
178  }
179  $this->ui_handling->out(
180  $form->get(
181  $this->ctrl->getFormAction($this, self::CMD_CREATE)
182  )
183  );
184  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ delete()

ilFooterEntriesGUI::delete ( )
private

Definition at line 287 of file class.ilFooterEntriesGUI.php.

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

287  : void
288  {
289  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
290  $item = $this->repository->get($id);
291  $this->repository->delete($item);
292  }
293 
294  $this->ui_handling->sendMessageAndRedirect(
295  'success',
296  $this->translator->translate('entry_deleted'),
297  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
298  );
299  }
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()

ilFooterEntriesGUI::edit ( )
protected

Definition at line 186 of file class.ilFooterEntriesGUI.php.

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

186  : void
187  {
188  $id = $this->saveCurrentEntry();
189  $entry = $this->repository->get($id);
190 
191  $form = new EntryForm(
192  $this->repository,
193  $this->translator,
194  $this->group,
195  $entry
196  );
197 
198  $target = $this->ctrl->getFormAction($this, self::CMD_UPDATE);
199  $this->ui_handling->outAsyncAsModal(
200  $this->translator->translate('edit', 'entries'),
201  $target,
202  $form->get($target)
203  );
204  }
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:

◆ executeCommand()

ilFooterEntriesGUI::executeCommand ( )

Definition at line 356 of file class.ilFooterEntriesGUI.php.

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

356  : void
357  {
358  $this->ui_handling->requireReadable();
359 
360  $next_class = $this->ctrl->getNextClass($this) ?? '';
361  $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
362 
363  switch (strtolower($next_class)) {
364  case strtolower(ilFooterTranslationGUI::class):
365  $item = $this->repository->get(
366  $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0]
367  );
368  $back_target = null;
369  if ($this->request->getQueryParams()['async'] ?? false) {
370  $back_target = $this->ui_handling->buildURI($this->ctrl->getLinkTarget($this, self::CMD_DEFAULT));
371  }
372  $translation = new ilFooterTranslationGUI(
373  $this->dic,
374  $this->translator,
375  $this->ui_handling,
376  $item,
377  $back_target
378  );
379 
380  $this->ctrl->forwardCommand($translation);
381 
382  return;
383  default:
384  switch ($cmd) {
385  case self::CMD_DEFAULT:
386  $this->ui_handling->requireReadable();
387  $this->index();
388  break;
389  case self::CMD_ADD:
390  case self::CMD_CREATE:
391  case self::CMD_EDIT:
392  case self::CMD_UPDATE:
393  default:
394  $this->ui_handling->backToMainTab();
395  $this->ui_handling->requireWritable();
396  $this->$cmd();
397  }
398  }
399  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
get(string $class_name)
+ Here is the call graph for this function:

◆ getMoveForm()

ilFooterEntriesGUI::getMoveForm ( )
protected

Definition at line 313 of file class.ilFooterEntriesGUI.php.

References ILIAS\Repository\ctrl().

Referenced by move(), and selectMove().

313  : Standard
314  {
315  $parents = [];
316 
317  foreach ($this->groups_repository->all() as $group) {
318  $parents[$group->getId()] = $group->getTitle();
319  }
320 
321  $factory = $this->ui_factory->input();
322  return $factory
323  ->container()
324  ->form()
325  ->standard(
326  $this->ctrl->getFormAction($this, 'move'),
327  [
328  'parent' => $factory
329  ->field()
330  ->select(
331  $this->translator->translate('parent', 'entries'),
332  $parents
333  )
334  ->withRequired(true)
335  ->withValue($this->group->getId())
336  ]
337  );
338  }
This describes a standard form.
Definition: Standard.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilFooterEntriesGUI::index ( )
protected

Definition at line 75 of file class.ilFooterEntriesGUI.php.

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

Referenced by executeCommand().

75  : void
76  {
77  // Add new
78  $components = [];
79  if ($this->ui_handling->hasPermission('write')) {
80  $components = $this->addButtons();
81  }
82  // Sync
83  $this->repository->syncWithGlobalScreen(
84  $this->dic->globalScreen()->collector()->footer()
85  );
86  // Table
87  $table = new EntriesTable(
88  $this->group,
89  $this->repository,
90  new TranslationsRepositoryDB($this->dic->database()),
91  $this->translator,
92  $this->ui_handling->hasPermission('write')
93  );
94 
95  $this->ui_handling->out(
96  $table->get(
97  $this->ui_handling->getHereAsURI(self::CMD_SAVE_ORDER),
98  $this->ui_handling->buildURI(
99  $this->ctrl->getLinkTargetByClass(
100  ilFooterTranslationGUI::class,
102  )
103  )
104  ),
105  ...$components
106  );
107  }
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:

◆ move()

ilFooterEntriesGUI::move ( )
protected

Definition at line 340 of file class.ilFooterEntriesGUI.php.

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

340  : void
341  {
342  $new_parent = $this->getMoveForm()->withRequest($this->request)->getData()['parent'] ?? null;
343  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
344  $entry = $this->repository->get($id);
345  $entry = $entry->withParent($new_parent);
346  $this->repository->store($entry);
347  $this->ui_handling->sendMessageAndRedirect(
348  'success',
349  $this->translator->translate('entry_moved'),
350  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
351  );
352  }
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:

◆ reset()

ilFooterEntriesGUI::reset ( )
protected

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

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

243  : void
244  {
245  $this->repository->reset(
246  $this->dic->globalScreen()->collector()->footer()
247  );
248  $this->ui_handling->sendMessageAndRedirect(
249  'success',
250  $this->translator->translate('reset_success'),
251  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
252  );
253  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ saveCurrentEntry()

ilFooterEntriesGUI::saveCurrentEntry ( )
protected

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

References $id.

Referenced by edit(), and selectMove().

155  : mixed
156  {
157  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
158  $this->ui_handling->saveIdentificationsToRequest(
159  $this,
160  self::GSFO_ID,
161  $id
162  );
163  return $id;
164  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the caller graph for this function:

◆ saveOrder()

ilFooterEntriesGUI::saveOrder ( )
private

Definition at line 109 of file class.ilFooterEntriesGUI.php.

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

109  : void
110  {
111  foreach ($this->request->getParsedBody() as $hashed_id => $position) {
112  $this->repository->updatePositionById($this->unhash($hashed_id), (int) $position);
113  }
114  $this->ctrl->redirect($this, self::CMD_DEFAULT);
115  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:17
+ Here is the call graph for this function:

◆ selectMove()

ilFooterEntriesGUI::selectMove ( )
protected

Definition at line 301 of file class.ilFooterEntriesGUI.php.

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

301  : void
302  {
303  $id = $this->saveCurrentEntry();
304  $form = $this->getMoveForm();
305 
306  $this->ui_handling->outAsyncAsModal(
307  $this->translator->translate('select_parent', 'entries'),
308  $this->ctrl->getFormAction($this, 'move'),
309  $form
310  );
311  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ toggleActivation()

ilFooterEntriesGUI::toggleActivation ( )
protected

Definition at line 229 of file class.ilFooterEntriesGUI.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  $entry = $this->repository->get($id);
233  $this->repository->store($entry->withActive(!$entry->isActive()));
234  }
235 
236  $this->ui_handling->sendMessageAndRedirect(
237  'success',
238  $this->translator->translate('group_activation_toggled'),
239  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
240  );
241  }
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()

ilFooterEntriesGUI::update ( )

Definition at line 206 of file class.ilFooterEntriesGUI.php.

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

206  : void
207  {
208  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
209  $entry = $this->repository->get($id);
210 
211  $form = new EntryForm(
212  $this->repository,
213  $this->translator,
214  $this->group,
215  $entry
216  );
217  $target = $this->ctrl->getFormAction($this, self::CMD_CREATE);
218  if ($form->store(
219  $this->request,
220  $target
221  )) {
222  $this->ctrl->redirect($this, self::CMD_DEFAULT);
223  }
224  $this->ui_handling->out(
225  $form->get($target)
226  );
227  }
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 ilFooterEntriesGUI::$ctrl
private

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

◆ $repository

EntriesRepository ilFooterEntriesGUI::$repository
private

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

◆ $request

ServerRequestInterface ilFooterEntriesGUI::$request
private

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

◆ $ui_factory

Factory ilFooterEntriesGUI::$ui_factory
private

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

◆ CMD_ADD

const ilFooterEntriesGUI::CMD_ADD = 'add'

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

◆ CMD_CREATE

const ilFooterEntriesGUI::CMD_CREATE = 'create'

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

◆ CMD_DEFAULT

const ilFooterEntriesGUI::CMD_DEFAULT = 'index'

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

Referenced by ilObjFooterUIHandling\backToMainTab().

◆ CMD_EDIT

const ilFooterEntriesGUI::CMD_EDIT = 'edit'

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

◆ CMD_RESET

const ilFooterEntriesGUI::CMD_RESET = 'reset'

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

◆ CMD_SAVE_ORDER

const ilFooterEntriesGUI::CMD_SAVE_ORDER = 'saveOrder'

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

◆ CMD_UPDATE

const ilFooterEntriesGUI::CMD_UPDATE = 'update'

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

◆ GSFO_ID

const ilFooterEntriesGUI::GSFO_ID = 'gsfo_entry_id'

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


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