/**
  * @param ilObjBibliographic $bibl_obj
  * @param                    $entry_id
  *
  * @return ilBibliographicDetailsGUI
  */
 public static function getInstance(ilObjBibliographic $bibl_obj, $entry_id)
 {
     $obj = new self();
     $obj->bibl_obj = $bibl_obj;
     $obj->entry = ilBibliographicEntry::getInstance($obj->bibl_obj->getFiletype(), $entry_id);
     return $obj;
 }
 protected function initData()
 {
     $entries = array();
     foreach (ilBibliographicEntry::getAllEntries($this->parent_obj->object->getId()) as $entry) {
         $ilBibliographicEntry = ilBibliographicEntry::getInstance($this->parent_obj->object->getFiletype(), $entry['entry_id']);
         $entry['content'] = strip_tags($ilBibliographicEntry->getOverwiew());
         $entries[] = $entry;
     }
     $this->setData($entries);
 }
 /**
  * Reads out the source file and writes all entries to the database
  *
  * @return void
  */
 public function writeSourcefileEntriesToDb()
 {
     //Read File
     $entries_from_file = array();
     switch ($this->getFiletype()) {
         case "ris":
             $entries_from_file = self::__readRisFile($this->getFileAbsolutePath());
             break;
         case "bib":
             $entries_from_file = self::__readBibFile($this->getFileAbsolutePath());
             break;
     }
     //fill each entry into a ilBibliographicEntry object and then write it to DB by executing doCreate()
     foreach ($entries_from_file as $file_entry) {
         $type = NULL;
         $x = 0;
         $parsed_entry = array();
         foreach ($file_entry as $key => $attribute) {
             // if the attribute is an array, make a comma separated string out of it
             if (is_array($attribute)) {
                 $attribute = implode(", ", $attribute);
             }
             // reduce the attribute strings to a maximum of 4000 (ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) characters, in order to fit in the database
             //if (mb_strlen($attribute, 'UTF-8') > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) {
             if (ilStr::strLen($attribute) > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) {
                 // $attribute = mb_substr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH - 3, 'UTF-8') . '...';
                 $attribute = ilStr::subStr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH - 3) . '...';
             }
             // ty (RIS) or entryType (BIB) is the type and is treated seperately
             if (strtolower($key) == 'ty' || strtolower($key) == 'entrytype') {
                 $type = $attribute;
                 continue;
             }
             //TODO - Refactoring for ILIAS 4.5 - get rid off array restructuring
             //change array structure (name not as the key, but under the key "name")
             $parsed_entry[$x]['name'] = $key;
             $parsed_entry[$x++]['value'] = $attribute;
         }
         //create the entry and fill data into database by executing doCreate()
         $entry_model = ilBibliographicEntry::getInstance($this->getFiletype());
         $entry_model->setType($type);
         $entry_model->setAttributes($parsed_entry);
         $entry_model->setBibliographicObjId($this->getId());
         $entry_model->doCreate();
     }
 }