ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjBibliographic Class Reference

Class ilObjBibliographic. More...

+ Inheritance diagram for ilObjBibliographic:
+ Collaboration diagram for ilObjBibliographic:

Public Member Functions

 initType ()
 initType
 __construct ($existant_bibl_id=0)
 If bibliographic object exists, read it's data from database, otherwise create it.
 doCreate ()
 Create object.
 doRead ()
 doUpdate ()
 Update data.
 doDelete ($leave_out_il_bibl_data=false, $leave_out_delete_file=false)
 getFileDirectory ()
 moveFile ($file_to_copy=false)
 deleteFile ()
 getFilePath ($without_filename=false)
 setFilename ($filename)
 getFilename ()
 getFileAbsolutePath ()
 getFiletype ()
 doCloneObject (ilObjBibliographic $new_obj, $a_target_id, $a_copy_id=0)
 Clone BIBL.
 cloneStructure ($original_id)
 Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollection; $x->cloneStructure($id))
 writeSourcefileEntriesToDb ()
 Reads out the source file and writes all entries to the database.
 setOnline ($a_online)
 Set Online.
 getOnline ()
 Get Online.
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 Read data from db.
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ($a_clone_mode=false)
 update ()
 update object in db
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
 createRoleFolder ()
 creates a local role folder
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneMetaData ($target_obj)
 Copy meta data.
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 Clone object permissions, put in tree ...
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 create ()
 create
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 getXMLZip ()
 getHTMLDirectory ()
 _lookupCreationDate ($a_id)
 Lookup creation date.

Static Public Member Functions

static __getAllOverviewModels ()
static __readRisFile ($full_filename)
static __readBibFile ($full_filename)
static __setCharsetToUtf8 ($full_filename)
static __convertBibSpecialChars ($file_content)
 Replace BibTeX Special Characters with real characters Most systems do not use this encoding.
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false)
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
- Static Public Member Functions inherited from ilObject
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

const ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH = 4000

Static Protected Member Functions

static __force_rmdir ($path)
 remove a directory recursively
static __removeSpacesAndDashesAtBeginning ($input)

Protected Attributes

 $filename
 $entries
 $overviewModels
 $is_online

Additional Inherited Members

- Protected Member Functions inherited from ilObject2
 beforeCreate ()
 beforeUpdate ()
 doMDUpdateListener ($a_element)
 beforeMDUpdateListener ($a_element)
 doCreateMetaData ()
 beforeCreateMetaData ()
 doUpdateMetaData ()
 beforeUpdateMetaData ()
 doDelete ()
 beforeDelete ()
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=null)
 beforeCloneObject ()

Detailed Description

Constructor & Destructor Documentation

ilObjBibliographic::__construct (   $existant_bibl_id = 0)

If bibliographic object exists, read it's data from database, otherwise create it.

Parameters
$existant_bibl_idint is not set when object is getting created
Returns

Definition at line 66 of file class.ilObjBibliographic.php.

References doRead(), and ilObject2\setId().

{
if ($existant_bibl_id) {
$this->setId($existant_bibl_id);
$this->doRead();
}
parent::__construct($existant_bibl_id, false);
}

+ Here is the call graph for this function:

Member Function Documentation

static ilObjBibliographic::__convertBibSpecialChars (   $file_content)
static

Replace BibTeX Special Characters with real characters Most systems do not use this encoding.

In those cases, nothing will be replaced

Parameters
String$file_contentThe string with containing encodings
Returns
String (UTF-8) without encodings

Definition at line 395 of file class.ilObjBibliographic.php.

Referenced by __readBibFile().

{
$bibtex_special_chars['ä'] = '{\"a}';
$bibtex_special_chars['ë'] = '{\"e}';
$bibtex_special_chars['ï'] = '{\"i}';
$bibtex_special_chars['ö'] = '{\"o}';
$bibtex_special_chars['ü'] = '{\"u}';
$bibtex_special_chars['Ä'] = '{\"A}';
$bibtex_special_chars['Ë'] = '{\"E}';
$bibtex_special_chars['Ï'] = '{\"I}';
$bibtex_special_chars['Ö'] = '{\"O}';
$bibtex_special_chars['Ü'] = '{\"U}';
$bibtex_special_chars['â'] = '{\^a}';
$bibtex_special_chars['ê'] = '{\^e}';
$bibtex_special_chars['î'] = '{\^i}';
$bibtex_special_chars['ô'] = '{\^o}';
$bibtex_special_chars['û'] = '{\^u}';
$bibtex_special_chars['Â'] = '{\^A}';
$bibtex_special_chars['Ê'] = '{\^E}';
$bibtex_special_chars['Î'] = '{\^I}';
$bibtex_special_chars['Ô'] = '{\^O}';
$bibtex_special_chars['Û'] = '{\^U}';
$bibtex_special_chars['à'] = '{\`a}';
$bibtex_special_chars['è'] = '{\`e}';
$bibtex_special_chars['ì'] = '{\`i}';
$bibtex_special_chars['ò'] = '{\`o}';
$bibtex_special_chars['ù'] = '{\`u}';
$bibtex_special_chars['À'] = '{\`A}';
$bibtex_special_chars['È'] = '{\`E}';
$bibtex_special_chars['Ì'] = '{\`I}';
$bibtex_special_chars['Ò'] = '{\`O}';
$bibtex_special_chars['Ù'] = '{\`U}';
$bibtex_special_chars['á'] = '{\\\'a}';
$bibtex_special_chars['é'] = '{\\\'e}';
$bibtex_special_chars['í'] = '{\\\'i}';
$bibtex_special_chars['ó'] = '{\\\'o}';
$bibtex_special_chars['ú'] = '{\\\'u}';
$bibtex_special_chars['Á'] = '{\\\'A}';
$bibtex_special_chars['É'] = '{\\\'E}';
$bibtex_special_chars['Í'] = '{\\\'I}';
$bibtex_special_chars['Ó'] = '{\\\'O}';
$bibtex_special_chars['Ú'] = '{\\\'U}';
$bibtex_special_chars['à'] = '{\`a}';
$bibtex_special_chars['è'] = '{\`e}';
$bibtex_special_chars['ì'] = '{\`i}';
$bibtex_special_chars['ò'] = '{\`o}';
$bibtex_special_chars['ù'] = '{\`u}';
$bibtex_special_chars['À'] = '{\`A}';
$bibtex_special_chars['È'] = '{\`E}';
$bibtex_special_chars['Ì'] = '{\`I}';
$bibtex_special_chars['Ò'] = '{\`O}';
$bibtex_special_chars['Ù'] = '{\`U}';
$bibtex_special_chars['ç'] = '{\c c}';
$bibtex_special_chars['ß'] = '{\ss}';
$bibtex_special_chars['ñ'] = '{\~n}';
$bibtex_special_chars['Ñ'] = '{\~N}';
return str_replace($bibtex_special_chars, array_keys($bibtex_special_chars), $file_content);
}

+ Here is the caller graph for this function:

static ilObjBibliographic::__force_rmdir (   $path)
staticprotected

remove a directory recursively

Parameters
$path
Returns
bool

Definition at line 275 of file class.ilObjBibliographic.php.

References $file, $path, and $result.

Referenced by deleteFile().

{
if (! file_exists($path)) {
return false;
}
if (is_file($path) || is_link($path)) {
return unlink($path);
}
if (is_dir($path)) {
$path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$result = true;
$dir = new DirectoryIterator($path);
foreach ($dir as $file) {
if (! $file->isDot()) {
$result &= self::__force_rmdir($path . $file->getFilename(), false);
}
}
$result &= rmdir($path);
return $result;
}
}

+ Here is the caller graph for this function:

static ilObjBibliographic::__getAllOverviewModels ( )
static

Definition at line 252 of file class.ilObjBibliographic.php.

References $overviewModels.

Referenced by ilBibliographicEntry\setOverwiew().

{
global $ilDB;
$set = $ilDB->query('SELECT * FROM il_bibl_overview_model');
while ($rec = $ilDB->fetchAssoc($set)) {
if ($rec['literature_type']) {
$overviewModels[$rec['filetype']][$rec['literature_type']] = $rec['pattern'];
} else {
$overviewModels[$rec['filetype']] = $rec['pattern'];
}
}
}

+ Here is the caller graph for this function:

static ilObjBibliographic::__readBibFile (   $full_filename)
static

Definition at line 317 of file class.ilObjBibliographic.php.

References __convertBibSpecialChars(), and __setCharsetToUtf8().

Referenced by writeSourcefileEntriesToDb().

{
self::__setCharsetToUtf8($full_filename);
require_once 'Modules/Bibliographic/lib/PEAR_BibTex_1.0.0RC5/Structures/BibTex.php';
$bibtex_reader = new Structures_BibTex();
//Loading and parsing the file example.bib
$bibtex_reader->loadFile($full_filename);
//replace bibtex special chars with the real characters
$bibtex_reader->content = self::__convertBibSpecialChars($bibtex_reader->content);
$bibtex_reader->setOption('extractAuthor', false);
$bibtex_reader->parse();
// Remove library-bug: if there is no cite, the library mixes up the key for the type and the first attribute.
// It also shows an empty and therefore unwanted cite in the array.
//
// The cite is the text coming right after the type. Example:
// @book {cite,
// author = { "...."},
foreach ($bibtex_reader->data as $key => $entry) {
if (empty($entry['cite'])) {
unset($bibtex_reader->data[$key]['cite']);
foreach ($entry as $attr_key => $attribute) {
if (strpos($attr_key, '{') !== false) {
unset($bibtex_reader->data[$key][$attr_key]);
$attr_key_exploaded = explode('{', $attr_key);
$bibtex_reader->data[$key]['entryType'] = trim($attr_key_exploaded[0]);
$bibtex_reader->data[$key][trim($attr_key_exploaded[1])] = $attribute;
}
}
}
// formating the author to the following type of string
// Smith, John / Comte, Gabriel / von Gunten Jr, Thomas
foreach ($entry as $attr_key => $attribute) {
if ($attr_key == 'author' && is_array($attribute)) {
$attribute_string = array();
foreach ($attribute as $author_key => $author) {
$lastname = array($author['von'], $author['last'], $author['jr']);
$attribute_string[$author_key] = implode(' ', array_filter($lastname));
if(!empty($author['first'])){
$attribute_string[$author_key] .= ', ' . $author['first'];
}
}
$bibtex_reader->data[$key][$attr_key] = implode(' / ', $attribute_string);
}
}
}
return $bibtex_reader->data;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjBibliographic::__readRisFile (   $full_filename)
static

Definition at line 304 of file class.ilObjBibliographic.php.

References __setCharsetToUtf8().

Referenced by writeSourcefileEntriesToDb().

{
self::__setCharsetToUtf8($full_filename);
require_once "./Modules/Bibliographic/lib/LibRIS/src/LibRIS/RISReader.php";
$ris_reader = new RISReader();
$ris_reader->parseFile($full_filename);
return $ris_reader->getRecords();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjBibliographic::__removeSpacesAndDashesAtBeginning (   $input)
staticprotected

Definition at line 504 of file class.ilObjBibliographic.php.

{
for ($i = 0; $i < strlen($input); $i ++) {
if ($input[$i] != " " && $input[$i] != "-") {
return substr($input, $i);
}
}
}
static ilObjBibliographic::__setCharsetToUtf8 (   $full_filename)
static

Definition at line 376 of file class.ilObjBibliographic.php.

Referenced by __readBibFile(), and __readRisFile().

{
//If file charset does not seem to be Unicode, we assume that it is ISO-8859-1, and convert it to UTF-8.
$filedata = file_get_contents($full_filename);
if (strlen($filedata) == strlen(utf8_decode($filedata))) {
// file charset is not UTF-8
$filedata = mb_convert_encoding($filedata, 'UTF-8', 'ISO-8859-1');
file_put_contents($full_filename, $filedata);
}
}

+ Here is the caller graph for this function:

ilObjBibliographic::cloneStructure (   $original_id)

Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollection; $x->cloneStructure($id))

Parameters
$original_idThe original ID of the dataselection you want to clone it's structure
Returns
void

Definition at line 490 of file class.ilObjBibliographic.php.

References doUpdate(), moveFile(), ilObject2\setDescription(), setOnline(), ilObject2\setTitle(), and ilObject2\setType().

Referenced by doCloneObject().

{
$original = new ilObjBibliographic($original_id);
$this->moveFile($original->getFileAbsolutePath());
$this->setOnline($original->getOnline());
$this->setDescription($original->getDescription());
$this->setTitle($original->getTitle());
$this->setType($original->getType());
$this->doUpdate();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::deleteFile ( )

Definition at line 195 of file class.ilObjBibliographic.php.

References $path, __force_rmdir(), and getFilePath().

Referenced by doDelete(), and doUpdate().

{
$path = $this->getFilePath(true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::doCloneObject ( ilObjBibliographic  $new_obj,
  $a_target_id,
  $a_copy_id = 0 
)

Clone BIBL.

Parameters
ilObjBibliographic$new_obj
$a_target_id
int$a_copy_idcopy id

Definition at line 476 of file class.ilObjBibliographic.php.

References cloneStructure(), and ilObject2\getId().

{
$new_obj->cloneStructure($this->getId());
return $new_obj;
}

+ Here is the call graph for this function:

ilObjBibliographic::doCreate ( )

Create object.

Returns
void

Reimplemented from ilObject2.

Definition at line 81 of file class.ilObjBibliographic.php.

{
global $ilDB;
$ilDB->manipulate("INSERT INTO il_bibl_data " . "(id, filename, is_online) VALUES ("
. $ilDB->quote($this->getId(), "integer") . "," . // id
$ilDB->quote($this->getFilename(), "text") . "," . // filename
$ilDB->quote($this->getOnline(), "integer") . // is_online
")");
}
ilObjBibliographic::doDelete (   $leave_out_il_bibl_data = false,
  $leave_out_delete_file = false 
)

Definition at line 130 of file class.ilObjBibliographic.php.

References ilHistory\_removeEntriesForObject(), deleteFile(), and ilObject2\getId().

{
global $ilDB;
if (! $leave_out_delete_file) {
$this->deleteFile();
}
//il_bibl_attribute
$ilDB->manipulate("DELETE FROM il_bibl_attribute WHERE il_bibl_attribute.entry_id IN "
. "(SELECT il_bibl_entry.id FROM il_bibl_entry WHERE il_bibl_entry.data_id = "
. $ilDB->quote($this->getId(), "integer") . ");");
//il_bibl_entry
$ilDB->manipulate("DELETE FROM il_bibl_entry WHERE data_id = " . $ilDB->quote($this->getId(), "integer"));
if (! $leave_out_il_bibl_data) {
//il_bibl_data
$ilDB->manipulate("DELETE FROM il_bibl_data WHERE id = " . $ilDB->quote($this->getId(), "integer"));
}
// delete history entries
require_once("./Services/History/classes/class.ilHistory.php");
}

+ Here is the call graph for this function:

ilObjBibliographic::doRead ( )

Reimplemented from ilObject2.

Definition at line 92 of file class.ilObjBibliographic.php.

References getFilename(), setFilename(), and setOnline().

Referenced by __construct().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM il_bibl_data " . " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
while ($rec = $ilDB->fetchAssoc($set)) {
if (! $this->getFilename()) {
$this->setFilename($rec["filename"]);
}
$this->setOnline($rec['is_online']);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::doUpdate ( )

Update data.

Reimplemented from ilObject2.

Definition at line 108 of file class.ilObjBibliographic.php.

References deleteFile(), ilObject2\doDelete(), moveFile(), and writeSourcefileEntriesToDb().

Referenced by cloneStructure().

{
global $ilDB;
if (! empty($_FILES['bibliographic_file']['name'])) {
$this->deleteFile();
$this->moveFile();
}
// Delete the object, but leave the db table 'il_bibl_data' for being able to update it using WHERE, and also leave the file
$this->doDelete(true, true);
$ilDB->manipulate("UPDATE il_bibl_data SET " . "filename = " . $ilDB->quote($this->getFilename(), "text") . ", "
. // filename
"is_online = " . $ilDB->quote($this->getOnline(), "integer") . // is_online
" WHERE id = " . $ilDB->quote($this->getId(), "integer"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::getFileAbsolutePath ( )
Returns
string returns the absolute filepath of the bib/ris file. it's build as follows: $ILIAS-data-folder/bibl/$id/$filename

Definition at line 236 of file class.ilObjBibliographic.php.

References getFileDirectory(), and getFilename().

Referenced by writeSourcefileEntriesToDb().

{
return $this->getFileDirectory() . DIRECTORY_SEPARATOR . $this->getFilename();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::getFileDirectory ( )
Returns
string the folder is: $ILIAS-data-folder/bibl/$id

Definition at line 159 of file class.ilObjBibliographic.php.

References ilUtil\getDataDir(), ilObject2\getId(), and ilObject2\getType().

Referenced by getFileAbsolutePath(), and moveFile().

{
return ilUtil::getDataDir() . DIRECTORY_SEPARATOR . $this->getType() . DIRECTORY_SEPARATOR . $this->getId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::getFilename ( )

Definition at line 228 of file class.ilObjBibliographic.php.

References $filename.

Referenced by doRead(), getFileAbsolutePath(), and getFiletype().

{
}

+ Here is the caller graph for this function:

ilObjBibliographic::getFilePath (   $without_filename = false)
Parameters
bool$without_filename
Returns
array with all filepath

Definition at line 206 of file class.ilObjBibliographic.php.

Referenced by deleteFile().

{
global $ilDB;
$set = $ilDB->query("SELECT filename FROM il_bibl_data " . " WHERE id = "
. $ilDB->quote($this->getId(), "integer"));
$rec = $ilDB->fetchAssoc($set);
{
if ($without_filename) {
return substr($rec['filename'], 0, strrpos($rec['filename'], DIRECTORY_SEPARATOR));
} else {
return $rec['filename'];
}
}
}

+ Here is the caller graph for this function:

ilObjBibliographic::getFiletype ( )

Definition at line 241 of file class.ilObjBibliographic.php.

References getFilename().

Referenced by ilBibliographicDetailsGUI\showDetails(), and writeSourcefileEntriesToDb().

{
//return bib for filetype .bibtex:
if (strtolower(substr($this->getFilename(), - 6)) == "bibtex") {
return "bib";
}
//else return its true filetype
return strtolower(substr($this->getFilename(), - 3));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::getOnline ( )

Get Online.

Returns
boolean Online

Definition at line 584 of file class.ilObjBibliographic.php.

References $is_online.

{
}
ilObjBibliographic::initType ( )

initType

Returns
void

Reimplemented from ilObject2.

Definition at line 54 of file class.ilObjBibliographic.php.

{
$this->type = "bibl";
}
ilObjBibliographic::moveFile (   $file_to_copy = false)

Definition at line 164 of file class.ilObjBibliographic.php.

References $filename, getFileDirectory(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), ilUtil\sendSuccess(), and setFilename().

Referenced by cloneStructure(), and doUpdate().

{
$target_dir = $this->getFileDirectory();
if (! is_dir($target_dir)) {
ilUtil::makeDirParents($target_dir);
}
if ($_FILES['bibliographic_file']['name']) {
$filename = $_FILES['bibliographic_file']['name'];
} elseif ($file_to_copy) {
//file is not uploaded, but a clone is made out of another bibl
$split_path = explode(DIRECTORY_SEPARATOR, $file_to_copy);
$filename = $split_path[sizeof($split_path) - 1];
} else {
throw new Exception("Either a file must be delivered via \$_POST/\$_FILE or the file must be delivered via the method argument file_to_copy");
}
$target_full_filename = $target_dir . DIRECTORY_SEPARATOR . $filename;
//If there is no file_to_copy (which is used for clones), copy the file from the temporary upload directory (new creation of object).
//Therefore, a warning predicates nothing and can be suppressed.
if (@! copy($file_to_copy, $target_full_filename)) {
ilUtil::moveUploadedFile($_FILES['bibliographic_file']['tmp_name'], $_FILES['bibliographic_file']['name'], $target_full_filename);
}
ilUtil::sendSuccess($this->lng->txt("object_added"), true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBibliographic::setFilename (   $filename)

Definition at line 223 of file class.ilObjBibliographic.php.

References $filename.

Referenced by doRead(), and moveFile().

{
$this->filename = $filename;
}

+ Here is the caller graph for this function:

ilObjBibliographic::setOnline (   $a_online)

Set Online.

Parameters
boolean$a_onlineOnline
Returns
void

Definition at line 574 of file class.ilObjBibliographic.php.

Referenced by cloneStructure(), and doRead().

{
$this->is_online = $a_online;
}

+ Here is the caller graph for this function:

ilObjBibliographic::writeSourcefileEntriesToDb ( )

Reads out the source file and writes all entries to the database.

Returns
void

Definition at line 518 of file class.ilObjBibliographic.php.

References ilObject\$type, __readBibFile(), __readRisFile(), getFileAbsolutePath(), getFiletype(), and ilObject2\getId().

Referenced by doUpdate().

{
//Read File
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);
}
if(mb_strlen($attribute, 'UTF-8') > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH){
$attribute = mb_substr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH - 3, 'UTF-8') . '...';
}
// 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 = new ilBibliographicEntry($this->getFiletype());
$entry_model->setType($type);
$entry_model->setAttributes($parsed_entry);
$entry_model->setBibliographicObjId($this->getId());
$entry_model->doCreate();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjBibliographic::$entries
protected

Definition at line 34 of file class.ilObjBibliographic.php.

ilObjBibliographic::$filename
protected

Definition at line 28 of file class.ilObjBibliographic.php.

Referenced by getFilename(), moveFile(), and setFilename().

ilObjBibliographic::$is_online
protected

Definition at line 46 of file class.ilObjBibliographic.php.

Referenced by getOnline().

ilObjBibliographic::$overviewModels
protected

Definition at line 40 of file class.ilObjBibliographic.php.

Referenced by __getAllOverviewModels().

const ilObjBibliographic::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH = 4000

Definition at line 21 of file class.ilObjBibliographic.php.


The documentation for this class was generated from the following file: