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)
 @inheritDoc More...
 
 getAttributesForEntry (ilBiblEntryInterface $entry)
 @inheritDoc More...
 
 createAttribute ($name, $value, $entry_id)
 @inheritDoc More...
 
- Public Member Functions inherited from ilBiblAttributeFactoryInterface
 getPossibleValuesForFieldAndObject (ilBiblFieldInterface $field, $object_id)
 
 getAttributesForEntry (ilBiblEntryInterface $entry)
 
 sortAttributes (array $attributes)
 
 createAttribute ($name, $value, $entry_id)
 

Protected Attributes

 $field_factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblAttributeFactory::__construct ( ilBiblFieldFactoryInterface  $field_factory)

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

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

References $field_factory.

Member Function Documentation

◆ createAttribute()

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

@inheritDoc

Implements ilBiblAttributeFactoryInterface.

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

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.

References $name.

◆ getAttributesForEntry()

ilBiblAttributeFactory::getAttributesForEntry ( ilBiblEntryInterface  $entry)

@inheritDoc

Implements ilBiblAttributeFactoryInterface.

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

50 {
51 return ilBiblAttribute::where([ 'entry_id' => $entry->getId() ])->get();
52 }
static where($where, $operator=null)

References ilBiblEntryInterface\getId(), and ActiveRecord\where().

+ Here is the call graph for this function:

◆ getPossibleValuesForFieldAndObject()

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

@inheritDoc

Implements ilBiblAttributeFactoryInterface.

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

26 {
27 global $DIC;
28 $q = "SELECT DISTINCT(a.value) FROM il_bibl_data AS d
29JOIN il_bibl_entry AS e ON e.data_id = d.id
30JOIN il_bibl_attribute AS a on a.entry_id = e.id
31WHERE 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

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

+ 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: