ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 83 of file class.ilFooterEntriesGUI.php.

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

89  {
90  $this->ui_factory = $this->dic->ui()->factory();
91  $this->ctrl = $this->dic->ctrl();
92  $this->request = $this->dic->http()->request();
93  $this->repository = new EntriesRepositoryDB(
94  $this->dic->database(),
96  );
97  }
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()

ilFooterEntriesGUI::add ( )
protected

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

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

140  : void
141  {
142  $form = new EntryForm(
143  $this->repository,
144  $this->translator,
145  $this->group
146  );
147 
148  $target = $this->ctrl->getFormAction($this, self::CMD_CREATE);
149  $this->ui_handling->outAsyncAsModal(
150  $this->translator->translate('add', 'entries'),
151  $target,
152  $form->get($target)
153  );
154  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ addButtons()

ilFooterEntriesGUI::addButtons ( )
protected

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

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

Referenced by index().

156  : array
157  {
158  $modal = $this->ui_factory->modal()->roundtrip(
159  $this->translator->translate('add', 'entries'),
160  null
161  )->withAsyncRenderUrl(
162  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
163  );
164 
165  $this->dic->toolbar()->addComponent(
166  $this->ui_factory
167  ->button()
168  ->primary(
169  $this->translator->translate('add', 'entries'),
170  '#'
171  )
172  ->withOnClick($modal->getShowSignal())
173  );
174 
175  return [$modal];
176  }
button(string $caption, string $cmd)
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()

ilFooterEntriesGUI::confirmDelete ( )
protected

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

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

278  : void
279  {
280  $items = [];
281 
282  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
283  $entry = $this->repository->get($id);
284  if ($entry === null) {
285  continue;
286  }
287  if ($entry->isCore()) {
288  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
289  $id,
290  $entry->getTitle(),
291  $this->translator->translate('info_not_deletable_core') .
292  $this->ui_handling->render($this->nok($this->ui_factory))
293  );
294  continue;
295  }
296  $items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
297  $id,
298  $entry->getTitle(),
299  $this->ui_handling->render($this->ok($this->ui_factory))
300  );
301  }
302 
303  $this->ui_handling->outAsyncAsModal(
304  $this->translator->translate('entry_delete'),
305  $this->ctrl->getFormAction($this, 'delete'),
306  ...$items
307  );
308  }
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:

◆ create()

ilFooterEntriesGUI::create ( )

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

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

189  : void
190  {
191  $form = new EntryForm(
192  $this->repository,
193  $this->translator,
194  $this->group
195  );
196  if ($form->store(
197  $this->request,
198  $this->ctrl->getFormAction($this, self::CMD_CREATE)
199  )) {
200  $this->ctrl->redirect($this, self::CMD_DEFAULT);
201  }
202  $this->ui_handling->out(
203  $form->get(
204  $this->ctrl->getFormAction($this, self::CMD_CREATE)
205  )
206  );
207  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ delete()

ilFooterEntriesGUI::delete ( )
private

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

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

310  : void
311  {
312  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
313  $item = $this->repository->get($id);
314  $this->repository->delete($item);
315  }
316 
317  $this->ui_handling->sendMessageAndRedirect(
318  'success',
319  $this->translator->translate('entry_deleted'),
320  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
321  );
322  }
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()

ilFooterEntriesGUI::edit ( )
protected

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

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

209  : void
210  {
211  $id = $this->saveCurrentEntry();
212  $entry = $this->repository->get($id);
213 
214  $form = new EntryForm(
215  $this->repository,
216  $this->translator,
217  $this->group,
218  $entry
219  );
220 
221  $target = $this->ctrl->getFormAction($this, self::CMD_UPDATE);
222  $this->ui_handling->outAsyncAsModal(
223  $this->translator->translate('edit', 'entries'),
224  $target,
225  $form->get($target)
226  );
227  }
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:

◆ executeCommand()

ilFooterEntriesGUI::executeCommand ( )

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

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

379  : void
380  {
381  $this->ui_handling->requireReadable();
382 
383  $next_class = $this->ctrl->getNextClass($this) ?? '';
384  $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
385 
386  switch (strtolower($next_class)) {
387  case strtolower(ilFooterTranslationGUI::class):
388  $item = $this->repository->get(
389  $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0]
390  );
391  $back_target = null;
392  if ($this->request->getQueryParams()['async'] ?? false) {
393  $back_target = $this->ui_handling->buildURI($this->ctrl->getLinkTarget($this, self::CMD_DEFAULT));
394  }
395  $translation = new ilFooterTranslationGUI(
396  $this->dic,
397  $this->translator,
398  $this->ui_handling,
399  $item,
400  $back_target
401  );
402 
403  $this->ctrl->forwardCommand($translation);
404 
405  return;
406  default:
407  switch ($cmd) {
408  case self::CMD_ADD:
409  case self::CMD_CREATE:
410  case self::CMD_EDIT:
411  case self::CMD_UPDATE:
412  default:
413  $this->ui_handling->backToMainTab();
414  $this->ui_handling->requireWritable();
415  $this->$cmd();
416  }
417  }
418  }
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)
+ Here is the call graph for this function:

◆ getMoveForm()

ilFooterEntriesGUI::getMoveForm ( )
protected

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

References ILIAS\Repository\ctrl().

Referenced by move(), and selectMove().

336  : Standard
337  {
338  $parents = [];
339 
340  foreach ($this->groups_repository->all() as $group) {
341  $parents[$group->getId()] = $group->getTitle();
342  }
343 
344  $factory = $this->ui_factory->input();
345  return $factory
346  ->container()
347  ->form()
348  ->standard(
349  $this->ctrl->getFormAction($this, 'move'),
350  [
351  'parent' => $factory
352  ->field()
353  ->select(
354  $this->translator->translate('parent', 'entries'),
355  $parents
356  )
357  ->withRequired(true)
358  ->withValue($this->group->getId())
359  ]
360  );
361  }
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 99 of file class.ilFooterEntriesGUI.php.

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

99  : void
100  {
101  // Add new
102  $components = [];
103  if ($this->ui_handling->hasPermission('write')) {
104  $components = $this->addButtons();
105  }
106  // Sync
107  $this->repository->syncWithGlobalScreen(
108  $this->dic->globalScreen()->collector()->footer()
109  );
110  // Table
111  $table = new EntriesTable(
112  $this->group,
113  $this->repository,
114  new TranslationsRepositoryDB($this->dic->database()),
115  $this->translator
116  );
117 
118  $this->ui_handling->out(
119  $table->get(
120  $this->ui_handling->getHereAsURI(self::CMD_SAVE_ORDER),
121  $this->ui_handling->buildURI(
122  $this->ctrl->getLinkTargetByClass(
123  ilFooterTranslationGUI::class,
125  )
126  )
127  ),
128  ...$components
129  );
130  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$components
+ Here is the call graph for this function:

◆ move()

ilFooterEntriesGUI::move ( )
protected

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

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

363  : void
364  {
365  $new_parent = $this->getMoveForm()->withRequest($this->request)->getData()['parent'] ?? null;
366  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
367  $entry = $this->repository->get($id);
368  $entry = $entry->withParent($new_parent);
369  $this->repository->store($entry);
370  $this->ui_handling->sendMessageAndRedirect(
371  'success',
372  $this->translator->translate('entry_moved'),
373  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
374  );
375  }
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:

◆ reset()

ilFooterEntriesGUI::reset ( )
protected

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

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

266  : void
267  {
268  $this->repository->reset(
269  $this->dic->globalScreen()->collector()->footer()
270  );
271  $this->ui_handling->sendMessageAndRedirect(
272  'success',
273  $this->translator->translate('reset_success'),
274  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
275  );
276  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ saveCurrentEntry()

ilFooterEntriesGUI::saveCurrentEntry ( )
protected

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

References $id.

Referenced by edit(), and selectMove().

178  : mixed
179  {
180  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
181  $this->ui_handling->saveIdentificationsToRequest(
182  $this,
183  self::GSFO_ID,
184  $id
185  );
186  return $id;
187  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ saveOrder()

ilFooterEntriesGUI::saveOrder ( )
private

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

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

132  : void
133  {
134  foreach ($this->request->getParsedBody() as $hashed_id => $position) {
135  $this->repository->updatePositionById($this->unhash($hashed_id), (int) $position);
136  }
137  $this->ctrl->redirect($this, self::CMD_DEFAULT);
138  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ selectMove()

ilFooterEntriesGUI::selectMove ( )
protected

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

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

324  : void
325  {
326  $id = $this->saveCurrentEntry();
327  $form = $this->getMoveForm();
328 
329  $this->ui_handling->outAsyncAsModal(
330  $this->translator->translate('select_parent', 'entries'),
331  $this->ctrl->getFormAction($this, 'move'),
332  $form
333  );
334  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ toggleActivation()

ilFooterEntriesGUI::toggleActivation ( )
protected

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

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

252  : void
253  {
254  foreach ($this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID) as $id) {
255  $entry = $this->repository->get($id);
256  $this->repository->store($entry->withActive(!$entry->isActive()));
257  }
258 
259  $this->ui_handling->sendMessageAndRedirect(
260  'success',
261  $this->translator->translate('group_activation_toggled'),
262  $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
263  );
264  }
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()

ilFooterEntriesGUI::update ( )

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

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

229  : void
230  {
231  $id = $this->ui_handling->getIdentificationsFromRequest(self::GSFO_ID)[0];
232  $entry = $this->repository->get($id);
233 
234  $form = new EntryForm(
235  $this->repository,
236  $this->translator,
237  $this->group,
238  $entry
239  );
240  $target = $this->ctrl->getFormAction($this, self::CMD_CREATE);
241  if ($form->store(
242  $this->request,
243  $target
244  )) {
245  $this->ctrl->redirect($this, self::CMD_DEFAULT);
246  }
247  $this->ui_handling->out(
248  $form->get($target)
249  );
250  }
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 ilFooterEntriesGUI::$ctrl
private

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

◆ $repository

EntriesRepository ilFooterEntriesGUI::$repository
private

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

◆ $request

ServerRequestInterface ilFooterEntriesGUI::$request
private

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

◆ $ui_factory

Factory ilFooterEntriesGUI::$ui_factory
private

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

◆ CMD_ADD

const ilFooterEntriesGUI::CMD_ADD = 'add'

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

◆ CMD_CREATE

const ilFooterEntriesGUI::CMD_CREATE = 'create'

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

◆ CMD_DEFAULT

const ilFooterEntriesGUI::CMD_DEFAULT = 'index'

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

Referenced by ilObjFooterUIHandling\backToMainTab().

◆ CMD_EDIT

const ilFooterEntriesGUI::CMD_EDIT = 'edit'

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

◆ CMD_RESET

const ilFooterEntriesGUI::CMD_RESET = 'reset'

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

◆ CMD_SAVE_ORDER

const ilFooterEntriesGUI::CMD_SAVE_ORDER = 'saveOrder'

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

◆ CMD_UPDATE

const ilFooterEntriesGUI::CMD_UPDATE = 'update'

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

◆ GSFO_ID

const ilFooterEntriesGUI::GSFO_ID = 'gsfo_entry_id'

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


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