30 $this->db = $DIC->database();
38 $q =
"SELECT DISTINCT(a.value) FROM il_bibl_data AS d 39 JOIN il_bibl_entry AS e ON e.data_id = d.id 40 JOIN il_bibl_attribute AS a on a.entry_id = e.id 41 WHERE a.name = %s AND d.id = %s";
43 $res = $this->db->queryF(
$q, [
'text',
'integer'], [
48 while (
$data = $this->db->fetchObject(
$res)) {
65 $type_id = $this->field_factory->getType()->getId();
66 uksort($attributes,
function ($key_a, $key_b) use ($type_id):
int {
67 $field_a = $this->field_factory->findOrCreateFieldByTypeAndIdentifier($type_id, $key_a);
68 $field_b = $this->field_factory->findOrCreateFieldByTypeAndIdentifier($type_id, $key_b);
70 return $field_a->getPosition() - $field_b->getPosition();
78 $type_id = $this->field_factory->getType()->getId();
80 foreach ($attributes as $attribute) {
81 if (!$attribute->getName()) {
84 $field = $this->field_factory->findOrCreateFieldByTypeAndIdentifier($type_id, $attribute->getName());
85 $position = $field->getPosition();
86 $position = $position ?: $max + 1;
88 $max = (max($position, $max));
89 $sorted[$position] = $attribute;
103 $ilBiblAttribute->setName($name);
104 $ilBiblAttribute->setValue($value);
105 $ilBiblAttribute->setEntryId($entry_id);
106 $ilBiblAttribute->store();
108 $this->field_factory->findOrCreateFieldOfAttribute($ilBiblAttribute);
sortAttributes(array $attributes)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPossibleValuesForFieldAndObject(ilBiblFieldInterface $field, int $object_id)
static where($where, $operator=null)
createAttribute(string $name, string $value, int $entry_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(protected \ilBiblFieldFactoryInterface $field_factory)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
sortAttributesArray(array $attributes)
getAttributesForEntry(ilBiblEntryInterface $entry)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...