4 require_once
"Services/Object/classes/class.ilObject2.php";
5 require_once
"Modules/Bibliographic/classes/class.ilBibliographicEntry.php";
72 if ($existant_bibl_id) {
73 $this->
setId($existant_bibl_id);
76 parent::__construct($existant_bibl_id,
false);
89 $upload = $DIC->upload();
90 if ($upload->hasUploads() && !$upload->hasBeenProcessed()) {
95 $DIC->database()->insert(
"il_bibl_data", [
96 "id" => [
"integer", $this->
getId()],
98 "is_online" => [
"integer", $this->
getOnline()],
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)) {
122 $upload = $DIC->upload();
123 if (
$_POST[
'override_entries'] && $upload->hasUploads() && !$upload->hasBeenProcessed()) {
132 $DIC->database()->update(
"il_bibl_data", [
134 "is_online" => [
"integer", $this->
getOnline()],
135 ], [
"id" => [
"integer", $this->
getId()]]);
145 protected function doDelete($leave_out_il_bibl_data =
false, $leave_out_delete_file =
false)
148 $ilDB = $DIC[
'ilDB'];
149 if (!$leave_out_delete_file) {
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") .
")");
157 $ilDB->manipulate(
"DELETE FROM il_bibl_entry WHERE data_id = " 158 .
$ilDB->quote($this->getId(),
"integer"));
159 if (!$leave_out_il_bibl_data) {
161 $ilDB->manipulate(
"DELETE FROM il_bibl_data WHERE id = " 162 .
$ilDB->quote($this->getId(),
"integer"));
174 return "{$this->getType()}/{$this->getId()}";
183 $result = array_values($upload->getResults())[0];
225 return $DIC[
"filesystem"]->storage();
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);
242 if ($without_filename) {
243 return substr($rec[
'filename'], 0, strrpos($rec[
'filename'], DIRECTORY_SEPARATOR));
245 return $rec[
'filename'];
283 return $stream->getMetadata(
'uri');
294 if (strtolower(substr(
$filename, -6)) ==
"bibtex") {
295 return self::FILETYPE_BIB;
299 return strtolower(substr(
$filename, -3));
309 $ilDB = $DIC[
'ilDB'];
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'];
332 public function doCloneObject($new_obj, $a_target_id, $a_copy_id = null, $a_omit_tree =
false)
338 if (!$cp_options->isRootNode($this->getRefId())) {
342 $new_obj->cloneStructure($this->
getId());
361 $this->
copyFile($original->getFileAbsolutePath());
363 $this->
setTitle($original->getTitle());
364 $this->
setType($original->getType());
377 for (
$i = 0;
$i < strlen($input);
$i++) {
378 if ($input[
$i] !=
" " && $input[
$i] !=
"-") {
379 return substr($input,
$i);
393 $entries_from_file =
array();
396 case(self::FILETYPE_RIS):
397 $ilRis =
new ilRis();
400 $entries_from_file = $ilRis->parseContent();
402 case(self::FILETYPE_BIB):
406 $entries_from_file = $bib->parseContent();
410 foreach ($entries_from_file as $file_entry) {
413 $parsed_entry =
array();
414 foreach ($file_entry as
$key => $attribute) {
416 if (is_array($attribute)) {
417 $attribute = implode(
", ", $attribute);
421 if (
ilStr::strLen($attribute) > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) {
423 $attribute =
ilStr::subStr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH
427 if (strtolower(
$key) ==
'ty' || strtolower(
$key) ==
'entrytype') {
433 $parsed_entry[
$x][
'name'] =
$key;
434 $parsed_entry[
$x++][
'value'] = $attribute;
438 $entry_model->setType(
$type);
439 $entry_model->setAttributes($parsed_entry);
440 $entry_model->setBibliographicObjId($this->
getId());
441 $entry_model->doCreate();
451 $this->is_online = $a_online;
const ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH
doCloneObject($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
Clone BIBL.
static subStr($a_str, $a_start, $a_length=null)
$stream
PHP stream implementation.
doDelete($leave_out_il_bibl_data=false, $leave_out_delete_file=false)
__construct($existant_bibl_id=0)
If bibliographic object exists, read it's data from database, otherwise create it.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
writeSourcefileEntriesToDb()
Reads out the source file and writes all entries to the database.
static __removeSpacesAndDashesAtBeginning($input)
static getInstance($file_type, $entry_id=null)
Create styles array
The data for the language used.
cloneStructure($original_id)
Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollec...
static _removeEntriesForObject($a_obj_id)
remove all history entries for an object
Class ilObject2 This is an intermediate progress of ilObject class.
Class ilObjBibliographic.
moveUploadedFile(\ILIAS\FileUpload\FileUpload $upload)
getFilePath($without_filename=false)
Class FlySystemFileAccessTest.
static getAllOverviewModels()