/** * @return string */ public function getHTML() { global $tpl, $ilTabs, $ilCtrl, $lng; $form = new ilPropertyFormGUI(); $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, 'showContent')); $form->setTitle($lng->txt('detail_view')); // add link button if a link is defined in the settings $set = new ilSetting("bibl"); $link = $set->get(strtolower($this->bibl_obj->getFiletype())); if (!empty($link)) { $form->addCommandButton('autoLink', 'Link'); } $attributes = $this->entry->getAttributes(); //translate array key in order to sort by those keys foreach ($attributes as $key => $attribute) { //Check if there is a specific language entry if ($lng->exists($key)) { $strDescTranslated = $lng->txt($key); } else { $arrKey = explode("_", $key); $is_standard_field = false; switch ($arrKey[0]) { case 'bib': $is_standard_field = ilBibTex::isStandardField($arrKey[2]); break; case 'ris': $is_standard_field = ilRis::isStandardField($arrKey[2]); break; } // var_dump($is_standard_field); // FSX if ($is_standard_field) { $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]); } else { $strDescTranslated = $arrKey[2]; } } unset($attributes[$key]); $attributes[$strDescTranslated] = $attribute; } // sort attributes alphabetically by their array-key ksort($attributes, SORT_STRING); // render attributes to html foreach ($attributes as $key => $attribute) { $ci = new ilCustomInputGUI($key); $ci->setHtml($attribute); $form->addItem($ci); } // generate/render links to libraries $settings = ilBibliographicSetting::getAll(); foreach ($settings as $set) { $ci = new ilCustomInputGUI($set->getName()); $ci->setHtml($set->getButton($this->bibl_obj, $this->entry)); $form->addItem($ci); } $tpl->setPermanentLink("bibl", $this->bibl_obj->getRefId(), "_" . $_GET[ilObjBibliographicGUI::P_ENTRY_ID]); // set content and title return $form->getHTML(); //Permanent Link }
/** * @param ilObjBibliographic $bibl_obj * @return void * */ public function showDetails(ilObjBibliographic $bibl_obj) { global $tpl, $ilTabs, $ilCtrl, $lng; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $ilTabs->clearTargets(); $ilTabs->setBackTarget("back", $ilCtrl->getLinkTarget($this, 'showContent')); $form->setTitle($lng->txt('detail_view')); $entry = new ilBibliographicEntry($bibl_obj->getFiletype(), $_GET['entryId']); $attributes = $entry->getAttributes(); //translate array key in order to sort by those keys foreach ($attributes as $key => $attribute) { //Check if there is a specific language entry if ($lng->exists($key)) { $strDescTranslated = $lng->txt($key); } else { $arrKey = explode("_", $key); $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]); } unset($attributes[$key]); $attributes[$strDescTranslated] = $attribute; } // sort attributes alphabetically by their array-key ksort($attributes, SORT_STRING); // render attributes to html foreach ($attributes as $key => $attribute) { $ci = new ilCustomInputGUI($key); $ci->setHtml($attribute); $form->addItem($ci); } // set content and title $tpl->setContent($form->getHTML()); //Permanent Link $tpl->setPermanentLink("bibl", $bibl_obj->getRefId(), "_" . $_GET['entryId']); }
/** * @param ilBibliographicEntry $entry * @param string $type (bib|ris) * * @return string */ public function generateLibraryLink(ilBibliographicEntry $entry, $type) { $attributes = $entry->getAttributes(); switch ($type) { case 'bib': $prefix = "bib_default_"; if (!empty($attributes[$prefix . "isbn"])) { $attr = array("isbn"); } elseif (!empty($attributes[$prefix . "issn"])) { $attr = array("issn"); } else { $attr = array("title", "author", "year", "number", "volume"); } break; case 'ris': $prefix = "ris_" . strtolower($entry->getType()) . "_"; if (!empty($attributes[$prefix . "sn"])) { $attr = array("sn"); } else { $attr = array("ti", "t1", "au", "py", "is", "vl"); } break; } $url_params = "?"; if (sizeof($attr) == 1) { $url_params .= $this->formatAttribute($attr[0], $type, $attributes, $prefix) . "=" . urlencode($attributes[$prefix . $attr[0]]); } else { foreach ($attr as $a) { if (array_key_exists($prefix . $a, $attributes)) { if (strlen($url_params) > 1) { $url_params .= "&"; } $url_params .= $this->formatAttribute($a, $type, $attributes, $prefix) . "=" . urlencode($attributes[$prefix . $a]); } } } // return full link $full_link = $this->getUrl() . $url_params; return $full_link; }