ILIAS  release_8 Revision v8.24
ilADTFactory Class Reference

Class ilADTFactory. More...

+ Collaboration diagram for ilADTFactory:

Public Member Functions

 getValidTypes ()
 Get all ADT types. More...
 
 isValidType (string $a_type)
 
 initTypeClass (string $a_type, string $a_class=null)
 
 getDefinitionInstanceByType (string $a_type)
 Get instance of ADT definition. More...
 
 getInstanceByDefinition (ilADTDefinition $a_def)
 Get instance of ADT. More...
 
 getFormBridgeForInstance (ilADT $a_adt)
 Get form bridge instance for ADT. More...
 
 getDBBridgeForInstance (ilADT $a_adt)
 Get DB bridge instance for ADT. More...
 
 getPresentationBridgeForInstance (ilADT $a_adt)
 Get presentation bridge instance for ADT. More...
 
 getSearchBridgeForDefinitionInstance (ilADTDefinition $a_adt_def, bool $a_range=true, bool $a_multi=true)
 Get search bridge instance for ADT definition. More...
 
 getActiveRecordBridgeForInstance (ilADT $a_adt)
 Get active record instance for ADT. More...
 

Static Public Member Functions

static getInstance ()
 
static getActiveRecordInstance (ilADTGroupDBBridge $a_properties)
 Get active record instance. More...
 
static initActiveRecordByType ()
 Init active record by type. More...
 
static getActiveRecordByTypeInstance (ilADTDBBridge $a_properties)
 Get active record by type instance. More...
 

Data Fields

const TYPE_LOCALIZED_TEXT = 'LocalizedText'
 

Static Protected Attributes

static ilADTFactory $instance = null
 

Detailed Description

Class ilADTFactory.

Definition at line 8 of file class.ilADTFactory.php.

Member Function Documentation

◆ getActiveRecordBridgeForInstance()

ilADTFactory::getActiveRecordBridgeForInstance ( ilADT  $a_adt)

Get active record instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTActiveRecordBridge
Exceptions
InvalidArgumentException

Definition at line 176 of file class.ilADTFactory.php.

177 {
178 $class = $this->initTypeClass($a_adt->getType(), "ActiveRecordBridge");
179 return new $class($a_adt);
180 }
initTypeClass(string $a_type, string $a_class=null)
getType()
Get type (from class/instance)
Definition: class.ilADT.php:50

References ilADT\getType().

+ Here is the call graph for this function:

◆ getActiveRecordByTypeInstance()

static ilADTFactory::getActiveRecordByTypeInstance ( ilADTDBBridge  $a_properties)
static

Get active record by type instance.

Definition at line 207 of file class.ilADTFactory.php.

208 {
210 return new ilADTActiveRecordByType($a_properties);
211 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initActiveRecordByType()
Init active record by type.

◆ getActiveRecordInstance()

static ilADTFactory::getActiveRecordInstance ( ilADTGroupDBBridge  $a_properties)
static

Get active record instance.

Parameters
ilADTGroupDBBridge$a_properties
Returns
ilADTActiveRecord

Definition at line 192 of file class.ilADTFactory.php.

193 {
194 return new ilADTActiveRecord($a_properties);
195 }
ADT Active Record helper class This class expects a valid primary for all actions!

◆ getDBBridgeForInstance()

ilADTFactory::getDBBridgeForInstance ( ilADT  $a_adt)

Get DB bridge instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTDBBridge
Exceptions
InvalidArgumentException

Definition at line 107 of file class.ilADTFactory.php.

108 {
109 $class = $this->initTypeClass($a_adt->getType(), "DBBridge");
110 return new $class($a_adt);
111 }
ADT DB bridge base class.

References ilADT\getType(), and initTypeClass().

+ Here is the call graph for this function:

◆ getDefinitionInstanceByType()

ilADTFactory::getDefinitionInstanceByType ( string  $a_type)

Get instance of ADT definition.

Parameters
string$a_type
Returns
ilADTDefinition
Exceptions
InvalidArgumentException

Definition at line 67 of file class.ilADTFactory.php.

68 {
69 $class = $this->initTypeClass($a_type, "Definition");
70 return new $class();
71 }
ADT definition base class.

References initTypeClass().

+ Here is the call graph for this function:

◆ getFormBridgeForInstance()

ilADTFactory::getFormBridgeForInstance ( ilADT  $a_adt)

Get form bridge instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTFormBridge
Exceptions
InvalidArgumentException

Definition at line 95 of file class.ilADTFactory.php.

96 {
97 $class = $this->initTypeClass($a_adt->getType(), "FormBridge");
98 return new $class($a_adt);
99 }
ADT form bridge base class.

References ilADT\getType(), and initTypeClass().

+ Here is the call graph for this function:

◆ getInstance()

static ilADTFactory::getInstance ( )
static

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

15 {
16 if (self::$instance === null) {
17 self::$instance = new self();
18 }
19 return self::$instance;
20 }
Class ilADTFactory.
static ilADTFactory $instance

References $instance.

Referenced by ilAdvancedMDValues\_deleteByFieldId(), ilAdvancedMDValues\_deleteByObjId(), ilADTGroup\addElement(), ilADTEnumSearchBridgeMulti\convertADTDefinitionToMulti(), ilAdvancedMDFieldDefinitionGroupBased\exportOptionToTableGUI(), ilAdvancedMDValues\getActiveRecord(), ilAdvancedMDFieldDefinition\getADT(), ilAdvancedMDFieldDefinitionGroupBased\getADTForOption(), ilAdvancedMDFieldDefinitionAddress\getADTGroup(), ilAdvancedMDFieldDefinition\getADTGroupForDefinitions(), ilLuceneAdvancedSearchFields\getFormElement(), ilObjectMetaDataGUI\getKeyValueList(), ilObjectMetaDataBlockGUI\getLegacyContent(), ilADTBasedObject\initActiveRecordInstance(), ilAdvancedMDFieldDefinitionDate\initADTDefinition(), ilAdvancedMDFieldDefinitionDateTime\initADTDefinition(), ilAdvancedMDFieldDefinitionExternalLink\initADTDefinition(), ilAdvancedMDFieldDefinitionFloat\initADTDefinition(), ilAdvancedMDFieldDefinitionGroupBased\initADTDefinition(), ilAdvancedMDFieldDefinitionInteger\initADTDefinition(), ilAdvancedMDFieldDefinitionInternalLink\initADTDefinition(), ilAdvancedMDFieldDefinitionLocation\initADTDefinition(), ilAdvancedMDFieldDefinitionSelect\initADTDefinition(), ilAdvancedMDFieldDefinitionSelectMulti\initADTDefinition(), ilAdvancedMDFieldDefinitionText\initADTDefinition(), ilADTBasedObjectGUI\initForm(), ilAdvancedMDFieldDefinitionGroupBased\initOptionForm(), ilADTTest\initProperties(), ilAdvancedMDRecordGUI\parseAppointmentPresentationa(), ilAdvancedMDRecordGUI\parseEditor(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseInfoPage(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDSubstitution\parseValue(), ilAdvancedMDValues\preloadByObjIds(), ilADTGroupActiveRecordBridge\prepareElements(), ilADTGroupDBBridge\prepareElements(), ilADTGroupFormBridge\prepareElements(), ilADTGroupPresentationBridge\prepareElements(), ilAdvancedSearchGUI\searchAdvancedMD(), ilADTSearchBridgeMulti\setDefinition(), ilADTSearchBridgeRange\setDefinition(), ilADTSearchBridgeSingle\setDefinition(), ilADTFactoryTest\testConstruct(), ilAdvancedMDFieldDefinitionSelect\update(), and ilAdvancedMDFieldDefinitionGroupBased\updateComplexOption().

+ Here is the caller graph for this function:

◆ getInstanceByDefinition()

ilADTFactory::getInstanceByDefinition ( ilADTDefinition  $a_def)

Get instance of ADT.

Parameters
ilADTDefinition$a_def
Returns
ilADT
Exceptions
Exception

Definition at line 79 of file class.ilADTFactory.php.

79 : ilADT
80 {
81 if (!method_exists($a_def, "getADTInstance")) {
82 $class = $this->initTypeClass($a_def->getType());
83 return new $class($a_def);
84 } else {
85 return $a_def->getADTInstance();
86 }
87 }
getType()
Get type (from class/instance)
ADT base class.
Definition: class.ilADT.php:12

References ilADTDefinition\getType(), and initTypeClass().

+ Here is the call graph for this function:

◆ getPresentationBridgeForInstance()

ilADTFactory::getPresentationBridgeForInstance ( ilADT  $a_adt)

Get presentation bridge instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTPresentationBridge
Exceptions
InvalidArgumentException

Definition at line 119 of file class.ilADTFactory.php.

120 {
121 $class = $this->initTypeClass($a_adt->getType(), "PresentationBridge");
122 return new $class($a_adt);
123 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilADT\getType(), and initTypeClass().

+ Here is the call graph for this function:

◆ getSearchBridgeForDefinitionInstance()

ilADTFactory::getSearchBridgeForDefinitionInstance ( ilADTDefinition  $a_adt_def,
bool  $a_range = true,
bool  $a_multi = true 
)

Get search bridge instance for ADT definition.

Parameters
ilADTDefinition$a_adt_def
bool$a_range
bool$a_multi
Returns
ilADTSearchBridge
Exceptions
InvalidArgumentException

Definition at line 133 of file class.ilADTFactory.php.

138 if ($a_range) {
139 try {
140 $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeRange");
141 if (class_exists($class)) {
142 return new $class($a_adt_def);
143 }
144 } catch (Exception $e) {
145 }
146 }
147
148 // multi enum search (single) == enum search (multi)
149 if (!$a_multi &&
150 $a_adt_def->getType() == "MultiEnum") {
151 $class = $this->initTypeClass("Enum", "SearchBridgeMulti");
152 return new $class($a_adt_def);
153 }
154
155 if ($a_multi) {
156 try {
157 if ($a_adt_def->getType() == 'MultiEnum') {
158 $class = $this->initTypeClass('Enum', 'SearchBridgeMulti');
159 return new $class($a_adt_def);
160 }
161 $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeMulti");
162 return new $class($a_adt_def);
163 } catch (Exception $e) {
164 }
165 }
166 $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeSingle");
167 return new $class($a_adt_def);
168 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$e, ilADTDefinition\getType(), and initTypeClass().

+ Here is the call graph for this function:

◆ getValidTypes()

ilADTFactory::getValidTypes ( )

Get all ADT types.

Returns
string[]

Definition at line 26 of file class.ilADTFactory.php.

26 : array
27 {
28 return array(
29 "Float",
30 "Integer",
31 "Location",
32 "Text",
33 "Boolean",
34 "MultiText",
35 "Date",
36 "DateTime",
37 "Enum",
38 "MultiEnum",
39 "Group",
40 'ExternalLink',
41 'InternalLink',
42 self::TYPE_LOCALIZED_TEXT
43 );
44 }

Referenced by isValidType().

+ Here is the caller graph for this function:

◆ initActiveRecordByType()

static ilADTFactory::initActiveRecordByType ( )
static

Init active record by type.

Definition at line 200 of file class.ilADTFactory.php.

200 : void
201 {
202 }

Referenced by ilAdvancedMDValues\findByObjectId(), and ilAdvancedMDFieldDefinitionSelect\update().

+ Here is the caller graph for this function:

◆ initTypeClass()

ilADTFactory::initTypeClass ( string  $a_type,
string  $a_class = null 
)

Definition at line 51 of file class.ilADTFactory.php.

51 : string
52 {
53 $class = '';
54 if ($this->isValidType($a_type)) {
55 $class = "ilADT" . $a_type . $a_class;
56 return $class;
57 }
58 throw new InvalidArgumentException("ilADTFactory unknown type: " . $a_type);
59 }
isValidType(string $a_type)

References isValidType().

Referenced by getDBBridgeForInstance(), getDefinitionInstanceByType(), getFormBridgeForInstance(), getInstanceByDefinition(), getPresentationBridgeForInstance(), and getSearchBridgeForDefinitionInstance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidType()

ilADTFactory::isValidType ( string  $a_type)

Definition at line 46 of file class.ilADTFactory.php.

46 : bool
47 {
48 return in_array($a_type, $this->getValidTypes());
49 }
getValidTypes()
Get all ADT types.

References getValidTypes().

Referenced by initTypeClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $instance

ilADTFactory ilADTFactory::$instance = null
staticprotected

Definition at line 12 of file class.ilADTFactory.php.

Referenced by getInstance().

◆ TYPE_LOCALIZED_TEXT

const ilADTFactory::TYPE_LOCALIZED_TEXT = 'LocalizedText'

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