ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjBibliographic Class Reference

Class ilObjBibliographic. More...

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

Public Member Functions

 initType ()
 initType More...
 
 __construct ($existant_bibl_id=0)
 If bibliographic object exists, read it's data from database, otherwise create it. More...
 
 doUpdate ()
 
 getFileDirectory ()
 
 getFilePath ($without_filename=false)
 
 setFilename ($filename)
 
 getFilename ()
 
 getFileAbsolutePath ()
 
 getLegacyAbsolutePath ()
 
 getFiletype ()
 
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
 Clone BIBL. More...
 
 cloneStructure ($original_id)
 @description Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollection; $x->cloneStructure($id)) More...
 
 writeSourcefileEntriesToDb ()
 Reads out the source file and writes all entries to the database. More...
 
 setOnline ($a_online)
 
 getOnline ()
 
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 Read data from db. More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 create ($a_clone_mode=false)
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 
 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) @access public More...
 
 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. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getAllOverviewModels ()
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $a_show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

const FILETYPE_RIS = "ris"
 
const FILETYPE_BIB = "bib"
 
const ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH = 4000
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 doCreate ()
 Create object. More...
 
 doRead ()
 
 doDelete ($leave_out_il_bibl_data=false, $leave_out_delete_file=false)
 
 moveUploadedFile (\ILIAS\FileUpload\FileUpload $upload)
 
 deleteFile ()
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate ()
 
 beforeCreate ()
 
 doUpdate ()
 
 beforeUpdate ()
 
 doMDUpdateListener ($a_element)
 
 beforeMDUpdateListener ($a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=null)
 
 beforeCloneObject ()
 

Static Protected Member Functions

static __removeSpacesAndDashesAtBeginning ($input)
 

Protected Attributes

 $filename
 
 $entries
 
 $overviewModels
 
 $is_online
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Private Member Functions

 copyFile ($file_to_copy)
 
 getFileSystem ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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
\ilObjBibliographic

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

71 {
72 if ($existant_bibl_id) {
73 $this->setId($existant_bibl_id);
74 $this->doRead();
75 }
76 parent::__construct($existant_bibl_id, false);
77 }
setId($a_id)
set object id @access public

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __removeSpacesAndDashesAtBeginning()

static ilObjBibliographic::__removeSpacesAndDashesAtBeginning (   $input)
staticprotected
Parameters
$input
Deprecated:
Returns
string

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

376 {
377 for ($i = 0; $i < strlen($input); $i++) {
378 if ($input[$i] != " " && $input[$i] != "-") {
379 return substr($input, $i);
380 }
381 }
382 }
$i
Definition: disco.tpl.php:19

References $i.

◆ cloneStructure()

ilObjBibliographic::cloneStructure (   $original_id)

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

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

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

358 {
359 $original = new ilObjBibliographic($original_id);
360 $this->setFilename($original->getFilename());
361 $this->copyFile($original->getFileAbsolutePath());
362 $this->setDescription($original->getDescription());
363 $this->setTitle($original->getTitle());
364 $this->setType($original->getType());
365 $this->doUpdate();
366 }
Class ilObjBibliographic.
setType($a_type)
set object type @access public
setTitle($a_title)
set object title
setDescription($a_desc)
set object description

References copyFile(), doUpdate(), ilObject2\setDescription(), setFilename(), ilObject2\setTitle(), and ilObject2\setType().

+ Here is the call graph for this function:

◆ copyFile()

ilObjBibliographic::copyFile (   $file_to_copy)
private
Parameters
$file_to_copy

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

196 {
197 $target = $this->getFileDirectory() . '/' . basename($file_to_copy);
198 $this->getFileSystem()->copy($file_to_copy, $target);
199 }

References $target, getFileDirectory(), and getFileSystem().

Referenced by cloneStructure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFile()

ilObjBibliographic::deleteFile ( )
protected
Returns
bool

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

206 {
207 $path = $this->getFileDirectory();
208 try {
209 $this->getFileSystem()->deleteDir($path);
210 } catch (\ILIAS\Filesystem\Exception\IOException $e) {
211 return false;
212 }
213
214 return true;
215 }
Class FlySystemFileAccessTest.
Class BaseForm.

References $path, getFileDirectory(), and getFileSystem().

Referenced by doDelete(), doUpdate(), and moveUploadedFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCloneObject()

ilObjBibliographic::doCloneObject (   $new_obj,
  $a_target_id,
  $a_copy_id = null,
  $a_omit_tree = false 
)

Clone BIBL.

Parameters
ilObjBibliographic$new_obj
$a_target_id
int$a_copy_idcopy id
Returns
ilObjPoll

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

333 {
334 assert($new_obj instanceof ilObjBibliographic);
335 //copy online status if object is not the root copy object
336 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
337
338 if (!$cp_options->isRootNode($this->getRefId())) {
339 $new_obj->setOnline($this->getOnline());
340 }
341
342 $new_obj->cloneStructure($this->getId());
343
344 return $new_obj;
345 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getId()
get object id @access public

References ilCopyWizardOptions\_getInstance(), ilObject2\getId(), and getOnline().

+ Here is the call graph for this function:

◆ doCreate()

ilObjBibliographic::doCreate ( )
protected

Create object.

Returns
void

Reimplemented from ilObject2.

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

86 {
87 global $DIC;
88
89 $upload = $DIC->upload();
90 if ($upload->hasUploads() && !$upload->hasBeenProcessed()) {
91 $upload->process();
92 $this->moveUploadedFile($upload);
93 }
94
95 $DIC->database()->insert("il_bibl_data", [
96 "id" => ["integer", $this->getId()],
97 "filename" => ["text", $this->getFilename()],
98 "is_online" => ["integer", $this->getOnline()],
99 ]);
100 }
moveUploadedFile(\ILIAS\FileUpload\FileUpload $upload)
global $DIC
Definition: saml.php:7

References $DIC, getFilename(), ilObject2\getId(), getOnline(), and moveUploadedFile().

+ Here is the call graph for this function:

◆ doDelete()

ilObjBibliographic::doDelete (   $leave_out_il_bibl_data = false,
  $leave_out_delete_file = false 
)
protected
Parameters
bool | false$leave_out_il_bibl_data
bool | false$leave_out_delete_file

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

146 {
147 global $DIC;
148 $ilDB = $DIC['ilDB'];
149 if (!$leave_out_delete_file) {
150 $this->deleteFile();
151 }
152 //il_bibl_attribute
153 $ilDB->manipulate("DELETE FROM il_bibl_attribute WHERE il_bibl_attribute.entry_id IN "
154 . "(SELECT il_bibl_entry.id FROM il_bibl_entry WHERE il_bibl_entry.data_id = "
155 . $ilDB->quote($this->getId(), "integer") . ")");
156 //il_bibl_entry
157 $ilDB->manipulate("DELETE FROM il_bibl_entry WHERE data_id = "
158 . $ilDB->quote($this->getId(), "integer"));
159 if (!$leave_out_il_bibl_data) {
160 //il_bibl_data
161 $ilDB->manipulate("DELETE FROM il_bibl_data WHERE id = "
162 . $ilDB->quote($this->getId(), "integer"));
163 }
164 // delete history entries
166 }
static _removeEntriesForObject($a_obj_id)
remove all history entries for an object
global $ilDB

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

+ Here is the call graph for this function:

◆ doRead()

ilObjBibliographic::doRead ( )
protected

Reimplemented from ilObject2.

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

104 {
105 global $DIC;
106 $ilDB = $DIC['ilDB'];
107 $set = $ilDB->query("SELECT * FROM il_bibl_data " . " WHERE id = "
108 . $ilDB->quote($this->getId(), "integer"));
109 while ($rec = $ilDB->fetchAssoc($set)) {
110 if (!$this->getFilename()) {
111 $this->setFilename($rec["filename"]);
112 }
113 $this->setOnline($rec['is_online']);
114 }
115 }

References $DIC, $ilDB, getFilename(), setFilename(), and setOnline().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilObjBibliographic::doUpdate ( )

Reimplemented from ilObject2.

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

119 {
120 global $DIC;
121
122 $upload = $DIC->upload();
123 if ($_POST['override_entries'] && $upload->hasUploads() && !$upload->hasBeenProcessed()) {
124 $upload->process();
125 $this->deleteFile();
126 $this->moveUploadedFile($upload);
127 }
128
129 // Delete the object, but leave the db table 'il_bibl_data' for being able to update it using WHERE, and also leave the file
130 $this->doDelete(true, true);
131
132 $DIC->database()->update("il_bibl_data", [
133 "filename" => ["text", $this->getFilename()],
134 "is_online" => ["integer", $this->getOnline()],
135 ], ["id" => ["integer", $this->getId()]]);
136
138 }
$_POST["username"]
writeSourcefileEntriesToDb()
Reads out the source file and writes all entries to the database.

References $_POST, $DIC, deleteFile(), ilObject2\doDelete(), getFilename(), ilObject2\getId(), getOnline(), moveUploadedFile(), and writeSourcefileEntriesToDb().

Referenced by cloneStructure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllOverviewModels()

static ilObjBibliographic::getAllOverviewModels ( )
static
Returns
array

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

307 {
308 global $DIC;
309 $ilDB = $DIC['ilDB'];
310 $overviewModels = array();
311 $set = $ilDB->query('SELECT * FROM il_bibl_overview_model');
312 while ($rec = $ilDB->fetchAssoc($set)) {
313 if ($rec['literature_type']) {
314 $overviewModels[$rec['filetype']][$rec['literature_type']] = $rec['pattern'];
315 } else {
316 $overviewModels[$rec['filetype']] = $rec['pattern'];
317 }
318 }
319
320 return $overviewModels;
321 }

References $DIC, $ilDB, and $overviewModels.

Referenced by ilBiblOverviewGUI\render().

+ Here is the caller graph for this function:

◆ getFileAbsolutePath()

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

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

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

References getFileDirectory(), and getFilename().

Referenced by getLegacyAbsolutePath(), and writeSourcefileEntriesToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFileDirectory()

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

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

173 {
174 return "{$this->getType()}/{$this->getId()}";
175 }

Referenced by copyFile(), deleteFile(), getFileAbsolutePath(), and moveUploadedFile().

+ Here is the caller graph for this function:

◆ getFilename()

ilObjBibliographic::getFilename ( )
Returns
int

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

References $filename.

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

+ Here is the caller graph for this function:

◆ getFilePath()

ilObjBibliographic::getFilePath (   $without_filename = false)
Parameters
bool$without_filename
Returns
string

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

235 {
236 global $DIC;
237 $ilDB = $DIC['ilDB'];
238 $set = $ilDB->query("SELECT filename FROM il_bibl_data " . " WHERE id = "
239 . $ilDB->quote($this->getId(), "integer"));
240 $rec = $ilDB->fetchAssoc($set);
241 {
242 if ($without_filename) {
243 return substr($rec['filename'], 0, strrpos($rec['filename'], DIRECTORY_SEPARATOR));
244 } else {
245 return $rec['filename'];
246 }
247 }
248 }

References $DIC, and $ilDB.

◆ getFileSystem()

ilObjBibliographic::getFileSystem ( )
private
Returns
\ILIAS\Filesystem\Filesystem

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

222 {
223 global $DIC;
224
225 return $DIC["filesystem"]->storage();
226 }

References $DIC.

Referenced by copyFile(), deleteFile(), and getLegacyAbsolutePath().

+ Here is the caller graph for this function:

◆ getFiletype()

ilObjBibliographic::getFiletype ( )
Returns
string

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

291 {
292 //return bib for filetype .bibtex:
293 $filename = $this->getFilename();
294 if (strtolower(substr($filename, -6)) == "bibtex") {
295 return self::FILETYPE_BIB;
296 }
297
298 //else return its true filetype
299 return strtolower(substr($filename, -3));
300 }

References $filename, FILETYPE_BIB, and getFilename().

Referenced by ilBibliographicSetting\getButton(), and writeSourcefileEntriesToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLegacyAbsolutePath()

ilObjBibliographic::getLegacyAbsolutePath ( )

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

280 {
281 $stream = $this->getFileSystem()->readStream($this->getFileAbsolutePath());
282
283 return $stream->getMetadata('uri');
284 }
$stream
PHP stream implementation.

References GuzzleHttp\Psr7\$stream, getFileAbsolutePath(), and getFileSystem().

+ Here is the call graph for this function:

◆ getOnline()

ilObjBibliographic::getOnline ( )
Returns
bool

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

References $is_online.

Referenced by doCloneObject(), doCreate(), and doUpdate().

+ Here is the caller graph for this function:

◆ initType()

ilObjBibliographic::initType ( )

initType

Returns
void

Reimplemented from ilObject2.

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

58 {
59 $this->type = "bibl";
60 }

◆ moveUploadedFile()

ilObjBibliographic::moveUploadedFile ( \ILIAS\FileUpload\FileUpload  $upload)
protected
Parameters
\ILIAS\FileUpload\FileUpload$upload

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

182 {
183 $result = array_values($upload->getResults())[0];
184 if ($result->getStatus() == \ILIAS\FileUpload\DTO\ProcessingStatus::OK) {
185 $this->deleteFile();
186 $upload->moveFilesTo($this->getFileDirectory(), \ILIAS\FileUpload\Location::STORAGE);
187 $this->setFilename($result->getName());
188 }
189 }
$result

References $result, deleteFile(), getFileDirectory(), and setFilename().

Referenced by doCreate(), and doUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFilename()

ilObjBibliographic::setFilename (   $filename)
Parameters
$filename

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

255 {
256 $this->filename = $filename;
257 }

References $filename.

Referenced by cloneStructure(), doRead(), and moveUploadedFile().

+ Here is the caller graph for this function:

◆ setOnline()

ilObjBibliographic::setOnline (   $a_online)
Parameters
$a_online

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

450 {
451 $this->is_online = $a_online;
452 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ writeSourcefileEntriesToDb()

ilObjBibliographic::writeSourcefileEntriesToDb ( )

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

Returns
void

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

391 {
392 //Read File
393 $entries_from_file = array();
394 $filetype = $this->getFiletype();
395 switch ($filetype) {
396 case(self::FILETYPE_RIS):
397 $ilRis = new ilRis();
398 $ilRis->readContent($this->getFileAbsolutePath());
399
400 $entries_from_file = $ilRis->parseContent();
401 break;
402 case(self::FILETYPE_BIB):
403 $bib = new ilBibTex();
404 $bib->readContent($this->getFileAbsolutePath());
405
406 $entries_from_file = $bib->parseContent();
407 break;
408 }
409 //fill each entry into a ilBibliographicEntry object and then write it to DB by executing doCreate()
410 foreach ($entries_from_file as $file_entry) {
411 $type = null;
412 $x = 0;
413 $parsed_entry = array();
414 foreach ($file_entry as $key => $attribute) {
415 // if the attribute is an array, make a comma separated string out of it
416 if (is_array($attribute)) {
417 $attribute = implode(", ", $attribute);
418 }
419 // reduce the attribute strings to a maximum of 4000 (ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) characters, in order to fit in the database
420 //if (mb_strlen($attribute, 'UTF-8') > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) {
421 if (ilStr::strLen($attribute) > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) {
422 // $attribute = mb_substr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH - 3, 'UTF-8') . '...';
423 $attribute = ilStr::subStr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH
424 - 3) . '...';
425 }
426 // ty (RIS) or entryType (BIB) is the type and is treated seperately
427 if (strtolower($key) == 'ty' || strtolower($key) == 'entrytype') {
428 $type = $attribute;
429 continue;
430 }
431 //TODO - Refactoring for ILIAS 4.5 - get rid off array restructuring
432 //change array structure (name not as the key, but under the key "name")
433 $parsed_entry[$x]['name'] = $key;
434 $parsed_entry[$x++]['value'] = $attribute;
435 }
436 //create the entry and fill data into database by executing doCreate()
437 $entry_model = ilBibliographicEntry::getInstance($this->getFiletype());
438 $entry_model->setType($type);
439 $entry_model->setAttributes($parsed_entry);
440 $entry_model->setBibliographicObjId($this->getId());
441 $entry_model->doCreate();
442 }
443 }
Class ilBibTex.
static getInstance($file_type, $entry_id=null)
Class ilRis.
Definition: class.ilRis.php:10
static subStr($a_str, $a_start, $a_length=null)
Definition: class.ilStr.php:15
static strLen($a_string)
Definition: class.ilStr.php:78
$key
Definition: croninfo.php:18
$x
Definition: example_009.php:98

References $key, ilObject\$type, $x, getFileAbsolutePath(), getFiletype(), ilObject2\getId(), ilBibliographicEntry\getInstance(), ilStr\strLen(), and ilStr\subStr().

Referenced by doUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $entries

ilObjBibliographic::$entries
protected

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

◆ $filename

ilObjBibliographic::$filename
protected

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

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

◆ $is_online

ilObjBibliographic::$is_online
protected

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

Referenced by getOnline().

◆ $overviewModels

ilObjBibliographic::$overviewModels
protected

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

Referenced by getAllOverviewModels().

◆ ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH

const ilObjBibliographic::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH = 4000

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

◆ FILETYPE_BIB

const ilObjBibliographic::FILETYPE_BIB = "bib"

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

Referenced by getFiletype().

◆ FILETYPE_RIS

const ilObjBibliographic::FILETYPE_RIS = "ris"

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


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