ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilADTFactory Class Reference
+ Collaboration diagram for ilADTFactory:

Public Member Functions

 getValidTypes ()
 Get all ADT types. More...
 
 isValidType ($a_type)
 Check if given type is valid. More...
 
 initTypeClass ($a_type, $a_class=null)
 Init type-specific class. More...
 
 getDefinitionInstanceByType ($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, $a_range=true, $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 ()
 Get singleton. More...
 
static getActiveRecordInstance (ilADTGroupDBBridge $a_properties)
 Get active record instance. More...
 
static initActiveRecordByType ()
 Init active record by type. More...
 
static getActiveRecordByTypeInstance (ilADTGroupDBBridge $a_properties)
 Get active record by type instance. More...
 

Protected Member Functions

 __construct ()
 Constructor. More...
 

Static Protected Attributes

static $instance
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilADTFactory::__construct ( )
protected

Constructor.

Returns
self

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

16 {
17
18 }

Member Function Documentation

◆ getActiveRecordBridgeForInstance()

ilADTFactory::getActiveRecordBridgeForInstance ( ilADT  $a_adt)

Get active record instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTActiveRecordBridge

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

212 {
213 $class = $this->initTypeClass($a_adt->getType(), "ActiveRecordBridge");
214 return new $class($a_adt);
215 }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:51

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

+ Here is the call graph for this function:

◆ getActiveRecordByTypeInstance()

static ilADTFactory::getActiveRecordByTypeInstance ( ilADTGroupDBBridge  $a_properties)
static

Get active record by type instance.

Parameters
ilADTGroupDBBridge$a_properties
Returns
ilADTActiveRecordByType

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

249 {
251 return new ilADTActiveRecordByType($a_properties);
252 }
ADT Active Record by type helper class.
static initActiveRecordByType()
Init active record by type.

References initActiveRecordByType().

+ Here is the call graph for this function:

◆ getActiveRecordInstance()

static ilADTFactory::getActiveRecordInstance ( ilADTGroupDBBridge  $a_properties)
static

Get active record instance.

Parameters
ilADTGroupDBBridge$a_properties
Returns
ilADTActiveRecord

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

229 {
230 require_once "Services/ADT/classes/ActiveRecord/class.ilADTActiveRecord.php";
231 return new ilADTActiveRecord($a_properties);
232 }
ADT Active Record helper class.

◆ getDBBridgeForInstance()

ilADTFactory::getDBBridgeForInstance ( ilADT  $a_adt)

Get DB bridge instance for ADT.

Exceptions
Exception
Parameters
ilADT$a_adt
Returns
ilADTDBBridge

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

139 {
140 $class = $this->initTypeClass($a_adt->getType(), "DBBridge");
141 return new $class($a_adt);
142 }

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

+ Here is the call graph for this function:

◆ getDefinitionInstanceByType()

ilADTFactory::getDefinitionInstanceByType (   $a_type)

Get instance of ADT definition.

Exceptions
Exception
Parameters
string$a_type
Returns
ilADTDefinition

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

88 {
89 $class = $this->initTypeClass($a_type, "Definition");
90 return new $class();
91 }

References initTypeClass().

+ Here is the call graph for this function:

◆ getFormBridgeForInstance()

ilADTFactory::getFormBridgeForInstance ( ilADT  $a_adt)

Get form bridge instance for ADT.

Exceptions
Exception
Parameters
ilADT$a_adt
Returns
ilADTFormBridge

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

126 {
127 $class = $this->initTypeClass($a_adt->getType(), "FormBridge");
128 return new $class($a_adt);
129 }

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

+ Here is the call graph for this function:

◆ getInstance()

static ilADTFactory::getInstance ( )
static

Get singleton.

Returns
self

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

26 {
27 if(self::$instance === null)
28 {
29 self::$instance = new self;
30 }
31 return self::$instance;
32 }

References $instance.

Referenced by ilAdvancedMDValues\_cloneValues(), ilAdvancedMDValues\_deleteByFieldId(), ilAdvancedMDValues\_deleteByObjId(), ilADTGroup\addElement(), ilADTEnumSearchBridgeMulti\convertADTDefinitionToMulti(), ilObjectMetaDataBlockGUI\fillDataSection(), ilPCAMDPageList\findPages(), ilAdvancedMDValues\getActiveRecord(), ilAdvancedMDFieldDefinition\getADT(), ilAdvancedMDFieldDefinition\getADTGroupForDefinitions(), ilLuceneAdvancedSearchFields\getFormElement(), ilAdvancedMDFieldDefinitionSelectMulti\importCustomDefinitionFormPostValues(), ilADTBasedObject\initActiveRecordInstance(), ilAdvancedMDFieldDefinitionDate\initADTDefinition(), ilAdvancedMDFieldDefinitionDateTime\initADTDefinition(), ilAdvancedMDFieldDefinitionFloat\initADTDefinition(), ilAdvancedMDFieldDefinitionInteger\initADTDefinition(), ilAdvancedMDFieldDefinitionLocation\initADTDefinition(), ilAdvancedMDFieldDefinitionSelect\initADTDefinition(), ilAdvancedMDFieldDefinitionSelectMulti\initADTDefinition(), ilAdvancedMDFieldDefinitionText\initADTDefinition(), ilADTBasedObjectGUI\initForm(), ilADTTest\initProperties(), ilAdvancedMDRecordGUI\parseEditor(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseInfoPage(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDSubstitution\parseValue(), ilAdvancedMDValues\preloadByObjIds(), ilADTGroupActiveRecordBridge\prepareElements(), ilADTGroupDBBridge\prepareElements(), ilADTGroupFormBridge\prepareElements(), ilADTGroupPresentationBridge\prepareElements(), ilAdvancedMDValues\queryForRecords(), ilAdvancedSearchGUI\searchAdvancedMD(), ilADTSearchBridgeMulti\setDefinition(), ilADTSearchBridgeRange\setDefinition(), ilADTSearchBridgeSingle\setDefinition(), and ilAdvancedMDFieldDefinitionSelectMulti\update().

+ Here is the caller graph for this function:

◆ getInstanceByDefinition()

ilADTFactory::getInstanceByDefinition ( ilADTDefinition  $a_def)

Get instance of ADT.

Exceptions
Exception
Parameters
ilADTDefinition$a_def
Returns
ilADT

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

101 {
102 if(!method_exists($a_def, "getADTInstance"))
103 {
104 $class = $this->initTypeClass($a_def->getType());
105 return new $class($a_def);
106 }
107 else
108 {
109 return $a_def->getADTInstance();
110 }
111 }
getType()
Get type (from class/instance)

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.

Exceptions
Exception
Parameters
ilADT$a_adt
Returns
ilADTPresentationBridge

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

152 {
153 $class = $this->initTypeClass($a_adt->getType(), "PresentationBridge");
154 return new $class($a_adt);
155 }

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

+ Here is the call graph for this function:

◆ getSearchBridgeForDefinitionInstance()

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

Get search bridge instance for ADT definition.

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

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

166 {
167 if($a_range)
168 {
169 try
170 {
171 $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeRange");
172 return new $class($a_adt_def);
173 }
174 catch(Exception $e)
175 {
176
177 }
178 }
179
180 // multi enum search (single) == enum search (multi)
181 if(!$a_multi &&
182 $a_adt_def->getType() == "MultiEnum")
183 {
184 $class = $this->initTypeClass("Enum", "SearchBridgeMulti");
185 return new $class($a_adt_def);
186 }
187
188 if($a_multi)
189 {
190 try
191 {
192 $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeMulti");
193 return new $class($a_adt_def);
194 }
195 catch(Exception $e)
196 {
197
198 }
199 }
200 $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeSingle");
201 return new $class($a_adt_def);
202 }

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

+ Here is the call graph for this function:

◆ getValidTypes()

ilADTFactory::getValidTypes ( )

Get all ADT types.

Returns
array

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

40 {
41 return array("Float", "Integer", "Location", "Text", "Boolean",
42 "MultiText", "Date", "DateTime", "Enum", "MultiEnum", "Group");
43 }

Referenced by isValidType().

+ Here is the caller graph for this function:

◆ initActiveRecordByType()

static ilADTFactory::initActiveRecordByType ( )
static

Init active record by type.

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

238 {
239 require_once "Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php";
240 }

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

+ Here is the caller graph for this function:

◆ initTypeClass()

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

Init type-specific class.

Exceptions
Exception
Parameters
string$a_type
string$a_class
Returns
string

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

65 {
66 if($this->isValidType($a_type))
67 {
68 $class = "ilADT".$a_type.$a_class;
69 $file = "Services/ADT/classes/Types/".$a_type."/class.".$class.".php";
70 if(file_exists($file))
71 {
72 require_once $file;
73 return $class;
74 }
75 }
76
77 throw new Exception("ilADTFactory unknown type");
78 }
print $file
isValidType($a_type)
Check if given type is valid.

References $file, and isValidType().

Referenced by getActiveRecordBridgeForInstance(), 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 (   $a_type)

Check if given type is valid.

Parameters
string$a_type
Returns
bool

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

52 {
53 return in_array((string)$a_type, $this->getValidTypes());
54 }
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::$instance
staticprotected

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

Referenced by getInstance().


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