60 $ilUser = $DIC[
'ilUser'];
61 $IRSS = $DIC[
'resource_storage'];
64 $this->
user = $ilUser;
65 $this->storage = $IRSS;
77 public function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
79 return 'http://www.ilias.de/xml/Modules/Bibliographic/' . $a_entity;
88 string $a_schema_version
90 if ($a_entity ===
'bibl') {
91 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'id'])) {
100 $new_obj->setTitle($a_rec[
'title']);
101 $new_obj->setDescription($a_rec[
'description']);
102 $new_obj->setFilename($a_rec[
'fileName']);
103 if ($new_obj->getId() === 0) {
106 $new_obj->getObjectProperties()->storePropertyIsOnline(
109 $this->import_bib_object = $new_obj;
110 $a_mapping->
addMapping(
'components/ILIAS/Bibliographic',
'bibl', $a_rec[
'id'], $new_obj->getId());
119 protected function getTypes(
string $a_entity,
string $a_version): array
121 return match ($a_entity) {
122 'bibl' => [
"id" =>
"integer",
"title" =>
"text",
"description" =>
"text",
"filename" =>
"text"],
136 ?array $a_rec =
null,
143 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
146 if (!is_array($a_ids)) {
156 protected function _readData(
string $a_entity, array $a_ids): void
160 foreach ($a_ids as $bibl_id) {
163 $data = [
'id' => $bibl_id,
'title' => $obj->getTitle(),
'description' => $obj->getDescription(),
'fileName' => $obj->getFilename()];
164 $this->data[] =
$data;
176 if (($rid = $obj->getResourceId()) ===
null) {
179 $fileAbsolutePath = $this->irss->consume()->stream($rid)->getStream()->getMetadata()[
'uri'] ??
null;
181 copy($fileAbsolutePath, $absolute_export_dir . self::EXP_DIRECTORY_NEW . $obj->getFilename());
190 $bib_id = $this->import_bib_object->getId();
191 $filename = $this->import_bib_object->getFilename();
194 if (file_exists($import_path_legacy)) {
195 $import_path = $import_path_legacy;
196 } elseif (file_exists($import_path_new)) {
197 $import_path = $import_path_new;
203 $resource = @fopen($import_path,
'rb');
205 $stream = Streams::ofResource($resource);
206 $identification = $this->storage->manage()->stream($stream, $this->stakeholder,
$filename);
209 $this->db->manipulateF(
210 'UPDATE `il_bibl_data` SET `rid` = %s WHERE `id` = %s;',
213 $identification->serialize(),
217 $this->import_bib_object->setResourceId($identification);
218 $this->import_bib_object->setMigrated(
true);
219 $this->import_bib_object->update();
220 $this->import_bib_object->parseFileToDatabase();
importLibraryFile(\ilImportMapping $a_mapping)
readData(string $a_entity, string $a_version, array $a_ids)
array $import_temp_refs_props
Bibliographic dataset class.
getXmlNamespace(string $a_entity, string $a_schema_version)
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Return dependencies form entities to other entities (in our case these are all the DB relations) ...
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
_readData(string $a_entity, array $a_ids)
Build data array, data is read from cache except bibl object itself.
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTypes(string $a_entity, string $a_version)
Map XML attributes of entities to datatypes (text, integer...)
Class ilObjBibliographicStakeholder.
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Needs to be overwritten for import use case.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
__construct(Container $dic, ilPlugin $plugin)
ilObjBibliographicStakeholder $stakeholder
Class ilObjBibliographic.
static _lookupType(int $id, bool $reference=false)
exportLibraryFile(int $a_id, string $absolute_export_dir)