52 $ilUser = $DIC[
'ilUser'];
53 $IRSS = $DIC[
'resource_storage'];
56 $this->
user = $ilUser;
57 $this->storage = $IRSS;
69 public function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
71 return 'http://www.ilias.de/xml/Modules/Bibliographic/' . $a_entity;
80 string $a_schema_version
82 if ($a_entity ===
'bibl') {
83 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'id'])) {
92 $new_obj->setTitle($a_rec[
'title']);
93 $new_obj->setDescription($a_rec[
'description']);
94 $new_obj->setFilename($a_rec[
'fileName']);
95 if ($new_obj->getId() === 0) {
98 $new_obj->getObjectProperties()->storePropertyIsOnline(
101 $this->import_bib_object = $new_obj;
102 $a_mapping->
addMapping(
'components/ILIAS/Bibliographic',
'bibl', $a_rec[
'id'], $new_obj->getId());
111 protected function getTypes(
string $a_entity,
string $a_version): array
113 return match ($a_entity) {
114 'bibl' => [
"id" =>
"integer",
"title" =>
"text",
"description" =>
"text",
"filename" =>
"text"],
127 ?array $a_rec = null,
134 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
137 if (!is_array($a_ids)) {
147 protected function _readData(
string $a_entity, array $a_ids): void
151 foreach ($a_ids as $bibl_id) {
154 $data = [
'id' => $bibl_id,
'title' => $obj->getTitle(),
'description' => $obj->getDescription(),
'fileName' => $obj->getFilename()];
155 $this->data[] =
$data;
167 if (($rid = $obj->getResourceId()) === null) {
170 $fileAbsolutePath = $this->irss->consume()->stream($rid)->getStream()->getMetadata()[
'uri'] ?? null;
172 copy($fileAbsolutePath, $absolute_export_dir . self::EXP_DIRECTORY_NEW . $obj->getFilename());
181 $bib_id = $this->import_bib_object->getId();
182 $filename = $this->import_bib_object->getFilename();
185 if (file_exists($import_path_legacy)) {
186 $import_path = $import_path_legacy;
187 } elseif (file_exists($import_path_new)) {
188 $import_path = $import_path_new;
194 $resource = @fopen($import_path,
'rb');
196 $stream = Streams::ofResource($resource);
197 $identification = $this->storage->manage()->stream($stream, $this->stakeholder,
$filename);
200 $this->db->manipulateF(
201 'UPDATE `il_bibl_data` SET `rid` = %s WHERE `id` = %s;',
204 $identification->serialize(),
208 $this->import_bib_object->setResourceId($identification);
209 $this->import_bib_object->setMigrated(
true);
210 $this->import_bib_object->update();
211 $this->import_bib_object->parseFileToDatabase();
importLibraryFile(\ilImportMapping $a_mapping)
readData(string $a_entity, string $a_version, array $a_ids)
array $import_temp_refs_props
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
_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)