ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

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
+ 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  {
250  self::initActiveRecordByType();
251  return new ilADTActiveRecordByType($a_properties);
252  }
ADT Active Record by type helper class.

◆ 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.

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

139  {
140  $class = $this->initTypeClass($a_adt->getType(), "DBBridge");
141  return new $class($a_adt);
142  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:51
+ 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.

References $a_type, and initTypeClass().

88  {
89  $class = $this->initTypeClass($a_type, "Definition");
90  return new $class();
91  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
$a_type
Definition: workflow.php:93
+ 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.

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

126  {
127  $class = $this->initTypeClass($a_adt->getType(), "FormBridge");
128  return new $class($a_adt);
129  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:51
+ 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.

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

26  {
27  if(self::$instance === null)
28  {
29  self::$instance = new self;
30  }
31  return self::$instance;
32  }
+ 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.

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

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  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
+ 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.

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

152  {
153  $class = $this->initTypeClass($a_adt->getType(), "PresentationBridge");
154  return new $class($a_adt);
155  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:51
+ 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.

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

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  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
+ 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.

References array.

Referenced by isValidType().

40  {
41  return array("Float", "Integer", "Location", "Text", "Boolean",
42  "MultiText", "Date", "DateTime", "Enum", "MultiEnum", "Group");
43  }
Create styles array
The data for the language used.
+ 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.

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

238  {
239  require_once "Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php";
240  }
+ 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.

References $a_type, $file, and isValidType().

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

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  }
isValidType($a_type)
Check if given type is valid.
$a_type
Definition: workflow.php:93
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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.

References $a_type, and getValidTypes().

Referenced by initTypeClass().

52  {
53  return in_array((string)$a_type, $this->getValidTypes());
54  }
getValidTypes()
Get all ADT types.
$a_type
Definition: workflow.php:93
+ 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.


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