ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 // #15666 - generic fix in 5.1+, but float/location needs this
18 setlocale(LC_NUMERIC, 'C');
19 }

Member Function Documentation

◆ getActiveRecordBridgeForInstance()

ilADTFactory::getActiveRecordBridgeForInstance ( ilADT  $a_adt)

Get active record instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTActiveRecordBridge

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

213 {
214 $class = $this->initTypeClass($a_adt->getType(), "ActiveRecordBridge");
215 return new $class($a_adt);
216 }
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 249 of file class.ilADTFactory.php.

250 {
252 return new ilADTActiveRecordByType($a_properties);
253 }
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 229 of file class.ilADTFactory.php.

230 {
231 require_once "Services/ADT/classes/ActiveRecord/class.ilADTActiveRecord.php";
232 return new ilADTActiveRecord($a_properties);
233 }
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 139 of file class.ilADTFactory.php.

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

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 88 of file class.ilADTFactory.php.

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

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 126 of file class.ilADTFactory.php.

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

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 26 of file class.ilADTFactory.php.

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

References $instance.

Referenced by ilAdvancedMDValues\_cloneValues(), ilAdvancedMDValues\_deleteByFieldId(), ilAdvancedMDValues\_deleteByObjId(), ilADTGroup\addElement(), ilADTEnumSearchBridgeMulti\convertADTDefinitionToMulti(), ilWikiAdvMetaDataBlockGUI\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(), ilObjOrgUnitGUI\parseInfoScreen(), 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 101 of file class.ilADTFactory.php.

102 {
103 if(!method_exists($a_def, "getADTInstance"))
104 {
105 $class = $this->initTypeClass($a_def->getType());
106 return new $class($a_def);
107 }
108 else
109 {
110 return $a_def->getADTInstance();
111 }
112 }
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 152 of file class.ilADTFactory.php.

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

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 166 of file class.ilADTFactory.php.

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

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 40 of file class.ilADTFactory.php.

41 {
42 return array("Float", "Integer", "Location", "Text", "Boolean",
43 "MultiText", "Date", "DateTime", "Enum", "MultiEnum", "Group");
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 238 of file class.ilADTFactory.php.

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

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 65 of file class.ilADTFactory.php.

66 {
67 if($this->isValidType($a_type))
68 {
69 $class = "ilADT".$a_type.$a_class;
70 $file = "Services/ADT/classes/Types/".$a_type."/class.".$class.".php";
71 if(file_exists($file))
72 {
73 require_once $file;
74 return $class;
75 }
76 }
77
78 throw new Exception("ilADTFactory unknown type");
79 }
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 52 of file class.ilADTFactory.php.

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