89 if ($existant_bibl_id) {
90 $this->
setId($existant_bibl_id);
93 parent::__construct($existant_bibl_id,
false);
96 $this->bib_field_factory =
new ilBiblFieldFactory($this->bib_type_factory->getInstanceForType($this->getFileType()));
98 $this->bib_entry_factory =
new ilBiblEntryFactory($this->bib_field_factory, $this->bib_type_factory->getInstanceForType($this->getFileType()), $this->bib_overview_factory);
113 $upload = $DIC->upload();
114 if ($upload->hasUploads() && !$upload->hasBeenProcessed()) {
116 $this->moveUploadedFile($upload);
119 $DIC->database()->insert(
131 $ilDB = $DIC[
'ilDB'];
137 $this->
setOnline($ilBiblData->getIsOnline());
145 $upload = $DIC->upload();
147 $has_valid_upload =
false;
148 if ($upload->hasBeenProcessed()) {
150 $has_valid_upload =
true;
153 if ($upload->hasUploads()) {
154 $has_valid_upload =
true;
158 if (
$_POST[
'override_entries'] && $has_valid_upload) {
161 $this->moveUploadedFile($upload);
163 if ($has_valid_upload) {
169 $DIC->database()->update(
174 [
"id" => [
"integer", $this->
getId()]]
183 protected function doDelete($leave_out_il_bibl_data =
false, $leave_out_delete_file =
false)
186 $ilDB = $DIC[
'ilDB'];
187 if (!$leave_out_delete_file) {
192 "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") .
")" 195 $this->bib_entry_factory->deleteEntryById($this->
getId());
197 if (!$leave_out_il_bibl_data) {
200 "DELETE FROM il_bibl_data WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
213 return "{$this->getType()}/{$this->getId()}";
220 protected function moveUploadedFile(\
ILIAS\FileUpload\FileUpload $upload)
225 $result = array_values($upload->getResults())[0];
267 return $DIC[
"filesystem"]->storage();
280 if ($without_filename) {
281 return substr($file_name, 0, strrpos($file_name, DIRECTORY_SEPARATOR));
320 return $stream->getMetadata(
'uri');
332 return $this->bib_type_factory->getInstanceForType(
$type)->getStringRepresentation();
345 $instance = $this->bib_type_factory->getInstanceForFileName(
$filename);
347 return $instance->getId();
360 public function doCloneObject($new_obj, $a_target_id, $a_copy_id = null, $a_omit_tree =
false)
366 if (!$cp_options->isRootNode($this->getRefId())) {
370 $new_obj->cloneStructure($this->
getId());
372 $new_obj->parseFileToDatabase();
391 $this->
copyFile($original->getFileAbsolutePath());
393 $this->
setTitle($original->getTitle());
394 $this->
setType($original->getType());
408 $reader = $this->bib_filereader_factory->getByType(
$type, $this->bib_entry_factory, $this->bib_field_factory, $this->bib_attribute_factory);
410 $this->entries =
$reader->parseContentToEntries($this);
428 $this->is_online = $a_online;
448 return $this->bib_type_factory->getInstanceForFileName(
$filename)->getId();
determineFileTypeByFileName($filename)
doCloneObject($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
Clone BIBL.
static where($where, $operator=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.
Class ilBiblEntryFactory.
cloneStructure($original_id)
Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollec...
Class ilBiblAttributeFactory.
Class ilBiblFieldFactory.
static _removeEntriesForObject($a_obj_id)
remove all history entries for an object
Class ilObjBibliographic.
getFilePath($without_filename=false)
Class ilBiblFileReaderFactory.
Class ilBiblOverviewModelFactory.
Class FlySystemFileAccessTest.
parseFileToDatabase()
Reads out the source file and writes all entries to the database.