ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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  $items = [];
50  foreach ($this->favoritesManager->getItemGroups() as $key => $group) {
51  foreach ($group as $item) {
52  $items[] = $f->item()->standard(
53  $f->link()->standard($item->getTitle(), ilLink::_getLink($item->getRefId()))
54  )->withLeadIcon($f->symbol()->icon()->custom(ilObject::_getIcon((int) $item->getObjId()), $item->getTitle()));
55  }
56  }
57  return $items === [] ? '' : $this->ui->renderer()->render($f->panel()->secondary()->listing('', [$f->item()->group('', $items)]));
58  }
59 }
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:26
__construct(?ilObjUser $user=null)