64 $this->storage = $DIC->resourceStorage();
65 $this->upload_service = $DIC->upload();
67 $this->
filesystem = $DIC->filesystem()->storage();
69 if ($existant_bibl_id) {
70 $this->
setId($existant_bibl_id);
76 $this->bib_field_factory =
new ilBiblFieldFactory($this->bib_type_factory->getInstanceForType($this->getFileType()));
79 $this->bib_field_factory,
80 $this->bib_type_factory->getInstanceForType($this->getFileType()),
81 $this->bib_overview_factory
93 if (!$this->upload_service->hasBeenProcessed()) {
94 $this->upload_service->process();
96 $array_result = $this->upload_service->getResults();
97 $result = reset($array_result);
98 if (!$result->isOK()) {
103 $this->storage->manage()->appendNewRevision(
111 return $this->storage->manage()->upload($result, $this->stakeholder);
118 protected function doCreate(
bool $clone_mode =
false): void
120 if ($this->upload_service->hasUploads()) {
127 "id" => [
"integer", $this->
getId()],
129 "is_online" => [
"integer", $this->
getOnline()],
130 "file_type" => [
"integer",
133 "rid" => [
"string", ($rid = $this->
getResourceId()) ? $rid->serialize() :
''],
139 protected function doRead():
void 143 if (!$this->
getFilename() && $bibl_data->getFilename() !== null) {
147 $this->
setOnline($bibl_data->isOnline());
148 if (!empty($rid = $bibl_data->getResourceId()) &&
$id = $this->storage->manage()->find($rid)) {
156 $has_valid_upload = $this->upload_service->hasUploads() && !$this->upload_service->hasBeenProcessed();
158 if ($has_valid_upload) {
168 if ($has_valid_upload) {
178 "is_online" => [
"integer", $this->
getOnline()],
180 "rid" => [
"string", ($rid = $this->
getResourceId()) ? $rid->serialize() :
''],
182 [
"id" => [
"integer", $this->
getId()]]
186 protected function doDelete(
bool $leave_out_il_bibl_data =
false,
bool $leave_out_delete_file =
false): void
188 if (!$leave_out_delete_file) {
192 $this->db->manipulate(
193 "DELETE FROM il_bibl_attribute WHERE il_bibl_attribute.entry_id IN " 194 .
"(SELECT il_bibl_entry.id FROM il_bibl_entry WHERE il_bibl_entry.data_id = " . $this->db->quote(
200 $this->bib_entry_factory->deleteEntryById($this->
getId());
202 if (!$leave_out_il_bibl_data) {
204 $this->db->manipulate(
205 "DELETE FROM il_bibl_data WHERE id = " . $this->db->quote($this->getId(),
"integer")
217 return "{$this->getType()}/{$this->getId()}";
223 private function copyFile(
string $file_to_copy): void
226 $this->
filesystem->copy($file_to_copy, $target);
248 if ($without_filename) {
249 return substr($file_name, 0, strrpos($file_name, DIRECTORY_SEPARATOR));
263 return $this->filename = $this->storage->manage()
283 $this->storage->consume()->stream($this->
getResourceId())->getStream() :
286 return $stream->getMetadata(
'uri');
296 return $this->bib_type_factory->getInstanceForType(
$type)->getStringRepresentation();
302 if ($filename === null) {
305 $instance = $this->bib_type_factory->getInstanceForFileName($filename);
307 return $instance->getId();
316 if (!$cp_options->isRootNode($this->getRefId())) {
320 $new_obj->cloneStructure($this->
getId());
321 $new_obj->parseFileToDatabase();
335 $this->
setTitle($original->getTitle());
336 $this->
setType($original->getType());
337 $identification = $original->getResourceId();
339 $new_identification = $this->storage->manage()->clone($identification);
342 $this->
copyFile($original->getFileAbsolutePath());
359 $reader = $this->bib_filereader_factory->getByType(
361 $this->bib_entry_factory,
362 $this->bib_field_factory,
363 $this->bib_attribute_factory
366 $this->entries = $reader->parseContentToEntries($this);
376 $this->is_online = $a_online;
386 $this->resource_id = $identification;
402 return $this->storage->manage()->getResource($this->
getResourceId())->getStorageID();
412 $this->is_migrated = $migrated;
417 return $this->bib_type_factory->getInstanceForFileName($filename)->getId();
setFileType(int $file_type)
ILIAS Filesystem Filesystem $filesystem
cloneStructure(int $original_id)
Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollec...
ilBiblFieldFactory $bib_field_factory
__construct(int $existant_bibl_id=0)
If bibliographic object exists, read it's data from database, otherwise create it.
handleUpload()
handles a FileUpload and returns an IRSS identification string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFilePath(bool $without_filename=false)
ilBiblEntryFactory $bib_entry_factory
ilBiblAttributeFactory $bib_attribute_factory
Class ChatMainBarProvider .
setFilename(string $filename)
ilBiblFileReaderFactory $bib_filereader_factory
static where($where, $operator=null)
determineFileTypeByFileName(string $filename)
setMigrated(bool $migrated)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjBibliographicStakeholder $stakeholder
setDescription(string $desc)
setResourceId(ResourceIdentification $identification)
static _removeEntriesForObject(int $a_obj_id)
remove all history entries for an object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
doCloneObject(ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
ILIAS ResourceStorage Identification ResourceIdentification $resource_id
Class ilObjBibliographicStakeholder.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ResourceIdentification.
setOnline(bool $a_online)
doDelete(bool $leave_out_il_bibl_data=false, bool $leave_out_delete_file=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
copyFile(string $file_to_copy)
ilBiblOverviewModelFactory $bib_overview_factory
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilBiblTypeFactory $bib_type_factory
static _getInstance(int $a_copy_id)
Class ilObjBibliographic.
FileUpload $upload_service
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class FlySystemFileAccessTest disabled disabled disabled.
parseFileToDatabase()
Reads out the source file and writes all entries to the database.
ilBiblDataFactoryInterface $bib_data_factory
doCreate(bool $clone_mode=false)
Create object.