ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBiblEntryDetailPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
26 {
27  use \ILIAS\Modules\OrgUnit\ARHelper\DIC;
31  public $entry;
35  protected $facade;
36 
37 
45  {
46  $this->facade = $facade;
47  $this->entry = $entry;
48  }
49 
50 
51  private function initHelp()
52  {
53  global $DIC;
54 
55  $ilHelp = $DIC['ilHelp'];
59  $ilHelp->setScreenIdComponent('bibl');
60  }
61 
62 
63  private function initTabs()
64  {
65  $this->tabs()->clearTargets();
66  $this->tabs()->setBackTarget(
67  $this->lng()->txt("back"),
68  $this->ctrl()->getLinkTargetByClass(ilObjBibliographicGUI::class, ilObjBibliographicGUI::CMD_SHOW_CONTENT)
69  );
70  }
71 
72 
76  public function getHTML()
77  {
78  $this->initHelp();
79  $this->initTabs();
80 
81  $form = new ilPropertyFormGUI();
82  $form->setTitle($this->lng()->txt('detail_view'));
83 
84  $this->renderAttributes($form);
85  $this->renderLibraries($form);
86 
87  $this->tpl()->setPermanentLink(
88  "bibl",
89  $this->facade->iliasRefId(),
91  );
92 
93  return $form->getHTML();
94  }
95 
96 
100  protected function renderAttributes(ilPropertyFormGUI $form)
101  {
102  $attributes = $this->facade->attributeFactory()->getAttributesForEntry($this->entry);
103  $sorted = $this->facade->attributeFactory()->sortAttributes($attributes);
104 
105  foreach ($sorted as $attribute) {
106  $translated = $this->facade->translationFactory()->translateAttribute($attribute);
107  $ci = new ilNonEditableValueGUI($translated, '', true);
108  $ci->setValue(self::prepareLatex($attribute->getValue()));
109  $form->addItem($ci);
110  }
111  }
112 
113 
117  protected function renderLibraries(ilPropertyFormGUI $form)
118  {
119  // generate/render links to libraries
120  // TODO REFACTOR
121  $settings = $this->facade->libraryFactory()->getAll();
122  foreach ($settings as $set) {
123  $ci = new ilCustomInputGUI($set->getName());
124  $presentation = new ilBiblLibraryPresentationGUI($set, $this->facade);
125  $ci->setHtml($presentation->getButton($this->facade, $this->entry));
126  $form->addItem($ci);
127  }
128  }
129 
130 
138  public static function prepareLatex($string)
139  {
140  return $string;
141  static $init;
142  $ilMathJax = ilMathJax::getInstance();
143  if (!$init) {
144  $ilMathJax->init();
145  $init = true;
146  }
147 
148  // $string = preg_replace('/\\$\\\\(.*)\\$/u', '[tex]$1[/tex]', $string);
149  $string = preg_replace('/\\$(.*)\\$/u', '[tex]$1[/tex]', $string);
150 
151  return $ilMathJax->insertLatexImages($string);
152  }
153 }
$attributes
Definition: metadata.php:231
This class represents a property form user interface.
$_GET["client_id"]
addItem($a_item)
Add Item (Property, SectionHeader).
global $DIC
Definition: goto.php:24
Class ilBiblEntry.
This class represents a custom property in a property form.
This class represents a non editable value in a property form.
static getInstance()
Singleton: get instance.
static prepareLatex($string)
This feature has to be discussed by JF first.
__construct(\ilBiblEntry $entry, ilBiblFactoryFacade $facade)
ilBiblEntryPresentationGUI constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilBiblFactoryFacade.
Class ilBiblLibraryPresentationGUI.