ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilFavouritesListGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24  protected ilCtrl $ctrl;
25  protected ilLanguage $lng;
27 
28  public function __construct(?ilObjUser $user = null)
29  {
30  global $DIC;
31 
32  if (is_null($user)) {
33  $user = $DIC->user();
34  }
35 
37  $settings->parse();
38  $this->ui = $DIC->ui();
39  $this->ctrl = $DIC->ctrl();
40  $this->lng = $DIC->language();
41  $this->favoritesManager = new ilSelectedItemsBlockGUI();
42  $this->lng->loadLanguageModule('rep');
43 
44  }
45 
46  public function render(): string
47  {
48  $f = $this->ui->factory();
49  $item_groups = [];
50  $ctrl = $this->ctrl;
51  foreach ($this->favoritesManager->getItemGroups() as $key => $group) {
52  $items = [];
53  foreach ($group as $item) {
54  $items[] = $f->item()->standard(
55  $f->link()->standard($item->getTitle(), ilLink::_getLink($item->getRefId()))
56  )->withLeadIcon($f->symbol()->icon()->custom(ilObject::_getIcon((int) $item->getObjId()), $item->getTitle()));
57  }
58  if (count($items) > 0) {
59  $item_groups[] = $f->item()->group((string) $key, $items);
60  }
61  }
62  if (count($item_groups) > 0) {
63  $configureModal = $this->favoritesManager->getRemoveModal();
64 
65  $config_item = $f->item()->standard(
66  $f->button()->shy(
67  $this->favoritesManager->getRemoveMultipleActionText(),
68  $configureModal->getShowSignal()
69  )
70  );
71  array_unshift($item_groups, $f->item()->group($this->lng->txt(''), [$config_item]));
72  $panel = $f->panel()->secondary()->listing('', $item_groups);
73 
74  return $this->ui->renderer()->render([$panel, $configureModal]);
75  }
76 
77  return $this->favoritesManager->getNoItemFoundContent();
78  }
79 }
ilObjUser $user
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilSelectedItemsBlockGUI $favoritesManager
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
__construct(?ilObjUser $user=null)