ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilBiblEntryDetailPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
10 {
11  use \ILIAS\Modules\OrgUnit\ARHelper\DIC;
15  public $entry;
19  protected $facade;
20 
21 
29  {
30  $this->facade = $facade;
31  $this->entry = $entry;
32  }
33 
34 
35  private function initHelp()
36  {
37  global $DIC;
38 
39  $ilHelp = $DIC['ilHelp'];
43  $ilHelp->setScreenIdComponent('bibl');
44  }
45 
46 
47  private function initTabs()
48  {
49  $this->tabs()->clearTargets();
50  $this->tabs()->setBackTarget(
51  $this->lng()->txt("back"),
52  $this->ctrl()->getLinkTargetByClass(ilObjBibliographicGUI::class, ilObjBibliographicGUI::CMD_SHOW_CONTENT)
53  );
54  }
55 
56 
60  public function getHTML()
61  {
62  $this->initHelp();
63  $this->initTabs();
64 
65  $form = new ilPropertyFormGUI();
66  $form->setTitle($this->lng()->txt('detail_view'));
67 
68  $this->renderAttributes($form);
69  $this->renderLibraries($form);
70 
71  $this->tpl()->setPermanentLink(
72  "bibl",
73  $this->facade->iliasRefId(),
75  );
76 
77  return $form->getHTML();
78  }
79 
80 
85  {
86  $attributes = $this->facade->attributeFactory()->getAttributesForEntry($this->entry);
87  $sorted = $this->facade->attributeFactory()->sortAttributes($attributes);
88 
89  foreach ($sorted as $attribute) {
90  $translated = $this->facade->translationFactory()->translateAttribute($attribute);
91  $ci = new ilNonEditableValueGUI($translated);
92  $ci->setValue(self::prepareLatex($attribute->getValue()));
93  $form->addItem($ci);
94  }
95  }
96 
97 
102  {
103  // generate/render links to libraries
104  // TODO REFACTOR
105  $settings = $this->facade->libraryFactory()->getAll();
106  foreach ($settings as $set) {
107  $ci = new ilCustomInputGUI($set->getName());
108  $presentation = new ilBiblLibraryPresentationGUI($set, $this->facade);
109  $ci->setHtml($presentation->getButton($this->facade, $this->entry));
110  $form->addItem($ci);
111  }
112  }
113 
114 
122  public static function prepareLatex($string)
123  {
124  return $string;
125  static $init;
126  $ilMathJax = ilMathJax::getInstance();
127  if (!$init) {
128  $ilMathJax->init();
129  $init = true;
130  }
131 
132  // $string = preg_replace('/\\$\\\\(.*)\\$/u', '[tex]$1[/tex]', $string);
133  $string = preg_replace('/\\$(.*)\\$/u', '[tex]$1[/tex]', $string);
134 
135  return $ilMathJax->insertLatexImages($string);
136  }
137 }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
addItem($a_item)
Add Item (Property, SectionHeader).
if(isset($_POST['submit'])) $form
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
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.
Class ilBiblEntryDetailPresentationGUI.
Class ilBiblFactoryFacade.
Class ilBiblLibraryPresentationGUI.