ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
6 require_once('./Modules/Bibliographic/classes/Types/class.ilBibTex.php');
7 require_once('./Modules/Bibliographic/classes/Types/class.ilRis.php');
8 
16 
20  public $bibl_obj;
24  public $entry;
25 
26 
33  public static function getInstance(ilObjBibliographic $bibl_obj, $entry_id) {
34  $obj = new self();
35  $obj->bibl_obj = $bibl_obj;
36  $obj->entry = ilBibliographicEntry::getInstance($obj->bibl_obj->getFiletype(), $entry_id);
37 
38  return $obj;
39  }
40 
41 
45  public function getHTML() {
46  global $tpl, $ilTabs, $ilCtrl, $lng, $ilHelp;
50  $ilHelp->setScreenIdComponent('bibl');
51 
52  $form = new ilPropertyFormGUI();
53  $ilTabs->clearTargets();
54  $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, 'showContent'));
55  $form->setTitle($lng->txt('detail_view'));
56  // add link button if a link is defined in the settings
57  $set = new ilSetting("bibl");
58  $link = $set->get(strtolower($this->bibl_obj->getFiletype()));
59  if (!empty($link)) {
60  $form->addCommandButton('autoLink', 'Link');
61  }
62 
63  $attributes = $this->entry->getAttributes();
64  //translate array key in order to sort by those keys
65  foreach ($attributes as $key => $attribute) {
66  //Check if there is a specific language entry
67  if ($lng->exists($key)) {
68  $strDescTranslated = $lng->txt($key);
69  } //If not: get the default language entry
70  else {
71  $arrKey = explode("_", $key);
72  $is_standard_field = false;
73  switch ($arrKey[0]) {
74  case 'bib':
75  $is_standard_field = ilBibTex::isStandardField($arrKey[2]);
76  break;
77  case 'ris':
78  $is_standard_field = ilRis::isStandardField($arrKey[2]);
79  break;
80  }
81  // var_dump($is_standard_field); // FSX
82  if ($is_standard_field) {
83  $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]);
84  } else {
85  $strDescTranslated = $arrKey[2];
86  }
87  }
88  unset($attributes[$key]);
89  $attributes[$strDescTranslated] = $attribute;
90  }
91  // sort attributes alphabetically by their array-key
92  ksort($attributes, SORT_STRING);
93  // render attributes to html
94  foreach ($attributes as $key => $attribute) {
95  $ci = new ilCustomInputGUI($key);
96  $ci->setHtml($attribute);
97  $form->addItem($ci);
98  }
99  // generate/render links to libraries
100  $settings = ilBibliographicSetting::getAll();
101  foreach ($settings as $set) {
102  $ci = new ilCustomInputGUI($set->getName());
103  $ci->setHtml($set->getButton($this->bibl_obj, $this->entry));
104  $form->addItem($ci);
105  }
106  $tpl->setPermanentLink("bibl", $this->bibl_obj->getRefId(), "_" . $_GET[ilObjBibliographicGUI::P_ENTRY_ID]);
107 
108  // set content and title
109  return $form->getHTML();
110  //Permanent Link
111  }
112 }
113 
114 ?>