ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBiblEntryDetailPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
30 {
31  public \ilBiblEntry $entry;
32  protected \ILIAS\UI\Renderer $ui_renderer;
33  protected \ILIAS\UI\Factory $ui_factory;
36  protected ilLanguage $lng;
37  protected ilTabsGUI $tabs;
38  protected ilHelpGUI $help;
39  protected \ilBiblFactoryFacade $facade;
40 
41 
45  public function __construct(\ilBiblEntry $entry, ilBiblFactoryFacade $facade)
46  {
47  global $DIC;
48  $this->help = $DIC['ilHelp'];
49  $this->facade = $facade;
50  $this->entry = $entry;
51  $this->tabs = $DIC->tabs();
52  $this->lng = $DIC->language();
53  $this->ctrl = $DIC->ctrl();
54  $this->main_tpl = $DIC->ui()->mainTemplate();
55  $this->ui_factory = $DIC->ui()->factory();
56  $this->ui_renderer = $DIC->ui()->renderer();
57  $this->initHelp();
58  $this->initTabs();
59  $this->initPermanentLink();
60  }
61 
62 
63  private function initHelp(): void
64  {
65  $this->help->setScreenIdComponent('bibl');
66  }
67 
68 
69  private function initTabs(): void
70  {
71  $this->tabs->clearTargets();
72  $this->tabs->setBackTarget(
73  $this->lng->txt("back"),
74  $this->ctrl->getLinkTargetByClass(ilObjBibliographicGUI::class, ilObjBibliographicGUI::CMD_SHOW_CONTENT)
75  );
76  }
77 
78  private function initPermanentLink(): void
79  {
80  $this->main_tpl->setPermanentLink(
81  "bibl",
82  $this->facade->iliasRefId(),
83  "_" . $this->entry->getId()
84  );
85  }
86 
87 
88  public function getHTML(): string
89  {
90  $sub_panels = [
91  $this->getOverviewPanel()
92  ];
93 
94  if (($libraries = $this->getLibrariesDeck()) !== null) {
95  $sub_panels[] = $libraries;
96  }
97 
98  return $this->ui_renderer->render(
99  $this->ui_factory->panel()->report($this->lng->txt('detail_view'), $sub_panels)
100  );
101  }
102 
103  private function getLibrariesDeck(): ?Sub
104  {
105  $settings = $this->facade->libraryFactory()->getAll();
106  if (count($settings) === 0) {
107  return null;
108  }
109 
110  $data = [];
111 
112  foreach ($settings as $set) {
113  $presentation = new ilBiblLibraryPresentationGUI($set, $this->facade);
114  $data[$set->getName()] = $presentation->getButton($this->facade, $this->entry);
115  }
116 
117  return $this->ui_factory->panel()->sub(
118  $this->lng->txt('bibl_settings_libraries'),
119  $this->ui_factory->listing()->characteristicValue()->text($data)
120  );
121  }
122 
123  private function getOverviewPanel(): Sub
124  {
125  $attributes = $this->facade->attributeFactory()->getAttributesForEntry($this->entry);
126  $sorted = $this->facade->attributeFactory()->sortAttributes($attributes);
127  $data = [];
128  foreach ($sorted as $attribute) {
129  $translated = $this->facade->translationFactory()->translateAttribute($attribute);
130  $data[$translated] = $attribute->getValue();
131  }
132 
133  $content = $this->ui_factory->listing()->characteristicValue()->text($data);
134 
135  return $this->ui_factory->panel()->sub('', $content);
136  }
137 }
$attributes
Definition: metadata.php:248
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
This describes a Sub Panel.
Definition: Sub.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Help GUI class.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(\ilBiblEntry $entry, ilBiblFactoryFacade $facade)
ilBiblEntryPresentationGUI constructor.
Class ilBiblEntryDetailPresentationGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...