ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilBibliographicDetailsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 require_once "./Modules/Bibliographic/classes/class.ilBibliographicEntry.php";
4 require_once "./Modules/Bibliographic/classes/Admin/class.ilBibliographicSetting.php";
5 
13 {
14 
18  public $bibl_obj;
22  public $entry;
23 
24 
31  public static function getInstance(ilObjBibliographic $bibl_obj, $entry_id)
32  {
33  $obj = new self();
34  $obj->bibl_obj = $bibl_obj;
35  $obj->entry = ilBibliographicEntry::getInstance($obj->bibl_obj->getFiletype(), $entry_id);
36 
37  return $obj;
38  }
39 
40 
44  public function getHTML()
45  {
46  global $DIC;
47  $tpl = $DIC['tpl'];
48  $ilTabs = $DIC['ilTabs'];
49  $ilCtrl = $DIC['ilCtrl'];
50  $lng = $DIC['lng'];
51  $ilHelp = $DIC['ilHelp'];
55  $ilHelp->setScreenIdComponent('bibl');
56 
57  $form = new ilPropertyFormGUI();
58  $ilTabs->clearTargets();
59  $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, 'showContent'));
60  $form->setTitle($lng->txt('detail_view'));
61  // add link button if a link is defined in the settings
62  $set = new ilSetting("bibl");
63  $link = $set->get(strtolower($this->bibl_obj->getFiletype()));
64  if (!empty($link)) {
65  $form->addCommandButton('autoLink', 'Link');
66  }
67 
68  $attributes = $this->entry->getAttributes();
69  //translate array key in order to sort by those keys
70  foreach ($attributes as $key => $attribute) {
71  //Check if there is a specific language entry
72  if ($lng->exists($key)) {
73  $strDescTranslated = $lng->txt($key);
74  } //If not: get the default language entry
75  else {
76  $arrKey = explode("_", $key);
77  $is_standard_field = false;
78  switch ($arrKey[0]) {
79  case 'bib':
80  $is_standard_field = ilBibTex::isStandardField($arrKey[2]);
81  break;
82  case 'ris':
83  $is_standard_field = ilRis::isStandardField($arrKey[2]);
84  break;
85  }
86  if ($is_standard_field) {
87  $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]);
88  } else {
89  $strDescTranslated = $arrKey[2];
90  }
91  }
92  unset($attributes[$key]);
93  $attributes[$strDescTranslated] = $attribute;
94  }
95  // sort attributes alphabetically by their array-key
96  ksort($attributes, SORT_STRING);
97  // render attributes to html
98  foreach ($attributes as $key => $attribute) {
99  $ci = new ilCustomInputGUI($key);
100  $ci->setHTML(self::prepareLatex($attribute));
101  $form->addItem($ci);
102  }
103  // generate/render links to libraries
104  $settings = ilBibliographicSetting::getAll();
105  foreach ($settings as $set) {
106  $ci = new ilCustomInputGUI($set->getName());
107  $ci->setHtml($set->getButton($this->bibl_obj, $this->entry));
108  $form->addItem($ci);
109  }
110  $tpl->setPermanentLink("bibl", $this->bibl_obj->getRefId(), "_"
112 
113  // set content and title
114  return $form->getHTML();
115  //Permanent Link
116  }
117 
118 
126  public static function prepareLatex($string)
127  {
128  return $string;
129  static $init;
130  $ilMathJax = ilMathJax::getInstance();
131  if (!$init) {
132  $ilMathJax->init();
133  $init = true;
134  }
135 
136  // $string = preg_replace('/\\$\\\\(.*)\\$/u', '[tex]$1[/tex]', $string);
137  $string = preg_replace('/\\$(.*)\\$/u', '[tex]$1[/tex]', $string);
138 
139  return $ilMathJax->insertLatexImages($string);
140  }
141 }
setHtml($a_html)
Set Html.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
$tpl
Definition: ilias.php:10
static isStandardField($field_name)
$attributes
static getInstance(ilObjBibliographic $bibl_obj, $entry_id)
global $ilCtrl
Definition: ilias.php:18
Class ilBibliographicDetailsGUI The detailled view on each entry.
static prepareLatex($string)
This feature has to be discussed by JF first.
if(isset($_POST['submit'])) $form
static getInstance($file_type, $entry_id=null)
This class represents a custom property in a property form.
static getInstance()
Singleton: get instance.
global $lng
Definition: privfeed.php:17
Class ilObjBibliographic.
$key
Definition: croninfo.php:18
static isStandardField($field_name)