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()) {
126 "id" => [
"integer", $this->
getId()],
128 "file_type" => [
"integer",
131 "rid" => [
"string", ($rid = $this->
getResourceId()) ? $rid->serialize() :
''],
138 protected function doRead():
void 142 if (!$this->
getFilename() && $bibl_data->getFilename() !== null) {
146 if (!empty($rid = $bibl_data->getResourceId()) &&
$id = $this->storage->manage()->find($rid)) {
154 $has_valid_upload = $this->upload_service->hasUploads() && !$this->upload_service->hasBeenProcessed();
156 if ($has_valid_upload) {
166 if ($has_valid_upload) {
177 "rid" => [
"string", ($rid = $this->
getResourceId()) ? $rid->serialize() :
''],
179 [
"id" => [
"integer", $this->
getId()]]
183 protected function doDelete(
bool $leave_out_il_bibl_data =
false,
bool $leave_out_delete_file =
false): void
185 if (!$leave_out_delete_file) {
189 $this->db->manipulate(
190 "DELETE FROM il_bibl_attribute WHERE il_bibl_attribute.entry_id IN " 191 .
"(SELECT il_bibl_entry.id FROM il_bibl_entry WHERE il_bibl_entry.data_id = " . $this->db->quote(
197 $this->bib_entry_factory->deleteEntryById($this->
getId());
199 if (!$leave_out_il_bibl_data) {
201 $this->db->manipulate(
202 "DELETE FROM il_bibl_data WHERE id = " . $this->db->quote($this->getId(),
"integer")
214 return "{$this->getType()}/{$this->getId()}";
220 private function copyFile(
string $file_to_copy): void
223 $this->
filesystem->copy($file_to_copy, $target);
245 if ($without_filename) {
246 return substr($file_name, 0, strrpos($file_name, DIRECTORY_SEPARATOR));
260 return $this->filename = $this->storage->manage()
280 $this->storage->consume()->stream($this->
getResourceId())->getStream() :
283 return $stream->getMetadata(
'uri');
293 return $this->bib_type_factory->getInstanceForType(
$type)->getStringRepresentation();
299 if ($filename === null) {
302 $instance = $this->bib_type_factory->getInstanceForFileName($filename);
304 return $instance->getId();
313 if (!$cp_options->isRootNode($this->getRefId())) {
317 $new_obj->cloneStructure($this->
getId());
318 $new_obj->parseFileToDatabase();
332 $this->
setTitle($original->getTitle());
333 $this->
setType($original->getType());
334 $identification = $original->getResourceId();
336 $new_identification = $this->storage->manage()->clone($identification);
339 $this->
copyFile($original->getFileAbsolutePath());
356 $reader = $this->bib_filereader_factory->getByType(
358 $this->bib_entry_factory,
359 $this->bib_field_factory,
360 $this->bib_attribute_factory
363 $this->entries = $reader->parseContentToEntries($this);
373 $this->resource_id = $identification;
389 return $this->storage->manage()->getResource($this->
getResourceId())->getStorageID();
399 $this->is_migrated = $migrated;
404 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)
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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.