43 protected \ILIAS\ResourceStorage\Services
$storage;
60 $this->storage = $DIC[
"resource_storage"];
66 $stream = $this->storage->consume()->stream($identification)->getStream();
97 $this->entry_factory->deleteEntriesById($bib->
getId());
100 $entry_instances = [];
103 foreach ($entries_from_file as $file_entry) {
106 $parsed_entry = array();
107 foreach ($file_entry as
$key => $attribute) {
109 if (is_string($attribute)) {
110 $attribute = $this->secure($attribute);
113 if (is_array($attribute)) {
114 $attribute = array_map(
function (
string $a):
string {
115 return $this->secure($a);
117 $attribute = implode(
", ", $attribute);
121 if (
ilStr::strLen($attribute) > self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH) {
123 $attribute =
ilStr::subStr($attribute, 0, self::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH - 3) .
'...';
126 if (strtolower(
$key) ===
'ty' || strtolower(
$key) ===
'entrytype') {
132 $parsed_entry[$x][
'name'] =
$key;
133 $parsed_entry[$x][
'value'] = $attribute;
137 if ($type === null) {
142 $entry_model = $entry_factory->getEmptyInstance();
143 $entry_model->setType($type);
144 $entry_model->setDataId($bib->
getId());
145 $entry_model->store();
146 foreach ($parsed_entry as $entry) {
147 $this->
getAttributeFactory()->createAttribute($entry[
'name'], $entry[
'value'], $entry_model->getId());
149 $entry_instances[] = $entry_model;
152 return $entry_instances;
Interface ilBiblFileReaderInterface.
const ENCODING_ISO_8859_1
static subStr(string $a_str, int $a_start, ?int $a_length=null)
__construct(ilBiblEntryFactoryInterface $entry_factory, ilBiblFieldFactoryInterface $field_factory, ilBiblAttributeFactoryInterface $attribute_factory)
ilBiblFileReaderBase constructor.
Class ilBiblFileReaderBase.
ilBiblAttributeFactoryInterface $attribute_factory
static strLen(string $a_string)
ILIAS Refinery Factory $refinery
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH
Class ResourceIdentification.
setFileContent(string $file_content)
parseContentToEntries(ilObjBibliographic $bib)
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...
readContent(ResourceIdentification $identification)
ILIAS ResourceStorage Services $storage
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
convertStringToUTF8(string $string)
ilBiblEntryFactoryInterface $entry_factory
ilBiblFieldFactoryInterface $field_factory
Class ilObjBibliographic.