ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  }

Member Function Documentation

◆ getActiveRecordBridgeForInstance()

ilADTFactory::getActiveRecordBridgeForInstance ( ilADT  $a_adt)

Get active record instance for ADT.

Parameters
ilADT$a_adt
Returns
ilADTActiveRecordBridge

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

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

197  {
198  $class = $this->initTypeClass($a_adt->getType(), "ActiveRecordBridge");
199  return new $class($a_adt);
200  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:53
+ 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 233 of file class.ilADTFactory.php.

234  {
235  self::initActiveRecordByType();
236  return new ilADTActiveRecordByType($a_properties);
237  }
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 213 of file class.ilADTFactory.php.

214  {
215  require_once "Services/ADT/classes/ActiveRecord/class.ilADTActiveRecord.php";
216  return new ilADTActiveRecord($a_properties);
217  }
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 134 of file class.ilADTFactory.php.

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

135  {
136  $class = $this->initTypeClass($a_adt->getType(), "DBBridge");
137  return new $class($a_adt);
138  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:53
+ 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 86 of file class.ilADTFactory.php.

References $a_type, and initTypeClass().

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

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

122  {
123  $class = $this->initTypeClass($a_adt->getType(), "FormBridge");
124  return new $class($a_adt);
125  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:53
+ Here is the call graph for this function:

◆ getInstance()

static ilADTFactory::getInstance ( )
static

Get singleton.

Returns
self

Definition at line 24 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(), ilAdvancedMDFieldDefinitionInternalLink\initADTDefinition(), ilAdvancedMDFieldDefinitionExternalLink\initADTDefinition(), ilAdvancedMDFieldDefinitionDate\initADTDefinition(), ilAdvancedMDFieldDefinitionDateTime\initADTDefinition(), ilAdvancedMDFieldDefinitionSelectMulti\initADTDefinition(), ilAdvancedMDFieldDefinitionText\initADTDefinition(), ilAdvancedMDFieldDefinitionLocation\initADTDefinition(), ilAdvancedMDFieldDefinitionSelect\initADTDefinition(), ilAdvancedMDFieldDefinitionInteger\initADTDefinition(), ilAdvancedMDFieldDefinitionFloat\initADTDefinition(), ilADTBasedObjectGUI\initForm(), ilADTTest\initProperties(), ilAdvancedMDRecordGUI\parseAppointmentPresentation(), ilAdvancedMDRecordGUI\parseEditor(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseInfoPage(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDSubstitution\parseValue(), ilAdvancedMDValues\preloadByObjIds(), ilADTGroupPresentationBridge\prepareElements(), ilADTGroupFormBridge\prepareElements(), ilADTGroupActiveRecordBridge\prepareElements(), ilADTGroupDBBridge\prepareElements(), ilAdvancedMDValues\queryForRecords(), ilAdvancedSearchGUI\searchAdvancedMD(), ilADTSearchBridgeMulti\setDefinition(), ilADTSearchBridgeSingle\setDefinition(), ilADTSearchBridgeRange\setDefinition(), and ilAdvancedMDFieldDefinitionSelectMulti\update().

25  {
26  if (self::$instance === null) {
27  self::$instance = new self;
28  }
29  return self::$instance;
30  }
+ 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 99 of file class.ilADTFactory.php.

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

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

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

148  {
149  $class = $this->initTypeClass($a_adt->getType(), "PresentationBridge");
150  return new $class($a_adt);
151  }
initTypeClass($a_type, $a_class=null)
Init type-specific class.
getType()
Get type (from class/instance)
Definition: class.ilADT.php:53
+ 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 161 of file class.ilADTFactory.php.

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

162  {
163  if ($a_range) {
164  try {
165  $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeRange");
166  return new $class($a_adt_def);
167  } catch (Exception $e) {
168  }
169  }
170 
171  // multi enum search (single) == enum search (multi)
172  if (!$a_multi &&
173  $a_adt_def->getType() == "MultiEnum") {
174  $class = $this->initTypeClass("Enum", "SearchBridgeMulti");
175  return new $class($a_adt_def);
176  }
177 
178  if ($a_multi) {
179  try {
180  $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeMulti");
181  return new $class($a_adt_def);
182  } catch (Exception $e) {
183  }
184  }
185  $class = $this->initTypeClass($a_adt_def->getType(), "SearchBridgeSingle");
186  return new $class($a_adt_def);
187  }
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 37 of file class.ilADTFactory.php.

References array.

Referenced by isValidType().

38  {
39  return array(
40  "Float", "Integer", "Location", "Text", "Boolean",
41  "MultiText", "Date", "DateTime", "Enum", "MultiEnum", "Group",
42  'ExternalLink','InternalLink'
43  );
44  }
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 222 of file class.ilADTFactory.php.

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

223  {
224  require_once "Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php";
225  }
+ 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.

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

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

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

References $a_type, and getValidTypes().

Referenced by initTypeClass().

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