63 $this->storage = $DIC->resourceStorage();
64 $this->upload_service = $DIC->upload();
66 $this->
filesystem = $DIC->filesystem()->storage();
68 if ($existant_bibl_id) {
69 $this->
setId($existant_bibl_id);
75 $this->bib_field_factory =
new ilBiblFieldFactory($this->bib_type_factory->getInstanceForType($this->getFileType()));
78 $this->bib_field_factory,
79 $this->bib_type_factory->getInstanceForType($this->getFileType()),
80 $this->bib_overview_factory
92 if (!$this->upload_service->hasBeenProcessed()) {
93 $this->upload_service->process();
95 $array_result = $this->upload_service->getResults();
96 $result = reset($array_result);
97 if (!$result->isOK()) {
102 $this->storage->manage()->appendNewRevision(
110 return $this->storage->manage()->upload($result, $this->stakeholder);
117 protected function doCreate(
bool $clone_mode =
false): void
119 if ($this->upload_service->hasUploads()) {
120 if (!$this->upload_service->hasBeenProcessed()) {
121 $this->upload_service->process();
129 "id" => [
"integer", $this->
getId()],
131 "file_type" => [
"integer",
134 "rid" => [
"string", ($rid = $this->
getResourceId()) ? $rid->serialize() :
''],
141 protected function doRead():
void 145 if (!$this->
getFilename() && $bibl_data->getFilename() !== null) {
149 if (!empty($rid = $bibl_data->getResourceId()) &&
$id = $this->storage->manage()->find($rid)) {
157 $has_valid_upload = $this->upload_service->hasUploads() && !$this->upload_service->hasBeenProcessed();
159 if ($has_valid_upload) {
169 if ($has_valid_upload) {
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());
351 foreach ($filters->getAllForObjectId($original_id) as $filter) {
352 $cloned_filter = clone $filter;
353 $cloned_filter->setId(0);
354 $cloned_filter->setObjectId($this->
getId());
355 $cloned_filter->create();
369 $reader = $this->bib_filereader_factory->getByType(
371 $this->bib_entry_factory,
372 $this->bib_field_factory,
373 $this->bib_attribute_factory
376 $this->entries = $reader->parseContentToEntries($this);
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
Interface Observer Contains several chained tasks and infos about them.
setFilename(string $filename)
ilBiblFileReaderFactory $bib_filereader_factory
static where($where, $operator=null)
determineFileTypeByFileName(string $filename)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setMigrated(bool $migrated)
ilObjBibliographicStakeholder $stakeholder
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.
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
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__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...
setDescription(string $description)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parseFileToDatabase()
Reads out the source file and writes all entries to the database.
ilBiblDataFactoryInterface $bib_data_factory
doCreate(bool $clone_mode=false)
Create object.