ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBiblAttributeFactory Class Reference

Class ilBiblAttributeFactory. More...

+ Inheritance diagram for ilBiblAttributeFactory:
+ Collaboration diagram for ilBiblAttributeFactory:

Public Member Functions

 __construct (ilBiblFieldFactoryInterface $field_factory)
 
 getPossibleValuesForFieldAndObject (ilBiblFieldInterface $field, $object_id)
 
 getAttributesForEntry (ilBiblEntryInterface $entry)
 
 createAttribute ($name, $value, $entry_id)
 
- Public Member Functions inherited from ilBiblAttributeFactoryInterface
 sortAttributes (array $attributes)
 

Protected Attributes

 $field_factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblAttributeFactory::__construct ( ilBiblFieldFactoryInterface  $field_factory)

Definition at line 16 of file class.ilBiblAttributeFactory.php.

References $field_factory.

17  {
18  $this->field_factory = $field_factory;
19  }

Member Function Documentation

◆ createAttribute()

ilBiblAttributeFactory::createAttribute (   $name,
  $value,
  $entry_id 
)

Implements ilBiblAttributeFactoryInterface.

Definition at line 87 of file class.ilBiblAttributeFactory.php.

References $name.

88  {
89  $ilBiblAttribute = new ilBiblAttribute();
90  $ilBiblAttribute->setName($name);
91  $ilBiblAttribute->setValue($value);
92  $ilBiblAttribute->setEntryId($entry_id);
93  $ilBiblAttribute->store();
94 
95  $this->field_factory->findOrCreateFieldOfAttribute($ilBiblAttribute);
96  }
Class ilBiblAttribute.

◆ getAttributesForEntry()

ilBiblAttributeFactory::getAttributesForEntry ( ilBiblEntryInterface  $entry)

Implements ilBiblAttributeFactoryInterface.

Definition at line 49 of file class.ilBiblAttributeFactory.php.

References $attributes, ilBiblEntryInterface\getId(), ilBiblAttributeFactoryInterface\sortAttributes(), and ActiveRecord\where().

50  {
51  return ilBiblAttribute::where([ 'entry_id' => $entry->getId() ])->get();
52  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getPossibleValuesForFieldAndObject()

ilBiblAttributeFactory::getPossibleValuesForFieldAndObject ( ilBiblFieldInterface  $field,
  $object_id 
)

Implements ilBiblAttributeFactoryInterface.

Definition at line 25 of file class.ilBiblAttributeFactory.php.

References $data, $DIC, $res, $result, and ilBiblFieldInterface\getIdentifier().

26  {
27  global $DIC;
28  $q = "SELECT DISTINCT(a.value) FROM il_bibl_data AS d
29 JOIN il_bibl_entry AS e ON e.data_id = d.id
30 JOIN il_bibl_attribute AS a on a.entry_id = e.id
31 WHERE a.name = %s AND d.id = %s";
32 
33  $res = $DIC->database()->queryF($q, [ 'text', 'integer' ], [
34  $field->getIdentifier(),
35  $object_id,
36  ]);
37  $result = [];
38  while ($data = $DIC->database()->fetchObject($res)) {
39  $result[$data->value] = $data->value;
40  }
41 
42  return $result;
43  }
$result
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$data
Definition: bench.php:6
+ Here is the call graph for this function:

Field Documentation

◆ $field_factory

ilBiblAttributeFactory::$field_factory
protected

Definition at line 14 of file class.ilBiblAttributeFactory.php.

Referenced by __construct().


The documentation for this class was generated from the following file: