ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilBiblEntryDetailPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
30 {
34  public function __construct(
35  public \ilBiblEntry $entry,
36  protected ilBiblFactoryFacade $facade,
37  protected ilCtrlInterface $ctrl,
38  protected ilHelpGUI $help,
39  protected ilLanguage $lng,
40  protected ilGlobalTemplateInterface $main_tpl,
41  protected ilTabsGUI $tabs,
42  protected \ILIAS\DI\UIServices $ui
43  ) {
44  $this->initHelp();
45  $this->initTabs();
46  $this->initPermanentLink();
47  }
48 
49 
50  private function initHelp(): void
51  {
52  $this->help->setScreenIdComponent('bibl');
53  }
54 
55 
56  private function initTabs(): void
57  {
58  $this->tabs->clearTargets();
59  $this->tabs->setBackTarget(
60  $this->lng->txt("back"),
61  $this->ctrl->getLinkTargetByClass(ilObjBibliographicGUI::class, ilObjBibliographicGUI::CMD_SHOW_CONTENT)
62  );
63  }
64 
65  private function initPermanentLink(): void
66  {
67  $this->main_tpl->setPermanentLink(
68  "bibl",
69  $this->facade->iliasRefId(),
70  "_" . $this->entry->getId()
71  );
72  }
73 
74 
75  public function getHTML(): string
76  {
77  $sub_panels = [
78  $this->getOverviewPanel()
79  ];
80 
81  if (($libraries = $this->getLibrariesDeck()) !== null) {
82  $sub_panels[] = $libraries;
83  }
84 
85  return $this->ui->renderer()->render(
86  $this->ui->factory()->panel()->report($this->lng->txt('detail_view'), $sub_panels)
87  );
88  }
89 
90  private function getLibrariesDeck(): ?Sub
91  {
92  $settings = $this->facade->libraryFactory()->getAll();
93  if (count($settings) === 0) {
94  return null;
95  }
96 
97  $data = [];
98 
99  foreach ($settings as $set) {
100  $presentation = new ilBiblLibraryPresentationGUI($set, $this->facade, $this->ctrl, $this->lng, $this->ui);
101  $data[$set->getName()] = $presentation->getButton($this->facade, $this->entry);
102  }
103 
104  return $this->ui->factory()->panel()->sub(
105  $this->lng->txt('bibl_settings_libraries'),
106  $this->ui->factory()->listing()->characteristicValue()->text($data)
107  );
108  }
109 
110  private function getOverviewPanel(): Sub
111  {
112  $attributes = $this->facade->attributeFactory()->getAttributesForEntry($this->entry);
113  $sorted = $this->facade->attributeFactory()->sortAttributes($attributes);
114  $data = [];
115  foreach ($sorted as $attribute) {
116  $translated = $this->facade->translationFactory()->translateAttribute($attribute);
117  $data[$translated] = $attribute->getValue();
118  }
119 
120  $content = $this->ui->factory()->listing()->characteristicValue()->text($data);
121 
122  return $this->ui->factory()->panel()->sub('', $content);
123  }
124 }
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...
Interface Observer Contains several chained tasks and infos about them.
Help GUI class.
Class HTTPServicesTest.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:32
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...
__construct(public \ilBiblEntry $entry, protected ilBiblFactoryFacade $facade, protected ilCtrlInterface $ctrl, protected ilHelpGUI $help, protected ilLanguage $lng, protected ilGlobalTemplateInterface $main_tpl, protected ilTabsGUI $tabs, protected \ILIAS\DI\UIServices $ui)
ilBiblEntryPresentationGUI constructor.