ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilDclCache Class Reference

Class ilDclCache. More...

+ Collaboration diagram for ilDclCache:

Static Public Member Functions

static setCloneOf ($old, $new, $type)
 
static getCloneOf ($id, $type)
 
static getTableCache ($table_id=0)
 
static getFieldCache ($field_id=0)
 
static getRecordCache ($record_id=0)
 
static getRecordFieldCache ($record, $field)
 
static getFieldRepresentation (ilDclBaseFieldModel $field)
 
static getRecordRepresentation (ilDclBaseRecordFieldModel $record_field)
 Returns a record representation. More...
 
static getFieldProperties ($field_id)
 Cache Field properties. More...
 
static preloadFieldProperties (array $fields)
 Preloads field properties. More...
 
static getDatatype ($datatyp_id)
 Get cached datatypes. More...
 
static buildFieldFromRecord ($rec)
 
static resetCache ()
 Resets all the cache fields. More...
 

Data Fields

const TYPE_DATACOLLECTION = 'dcl'
 
const TYPE_TABLE = 'table'
 
const TYPE_FIELD = 'field'
 
const TYPE_RECORD = 'record'
 
const TYPE_TABLEVIEW = 'tableview'
 

Static Protected Member Functions

static initCloneMapping ()
 

Static Protected Attributes

static $tables_cache
 
static $fields_cache
 
static $records_cache
 
static $record_field_cache
 
static $field_representation_cache
 
static $record_representation_cache
 
static $field_properties_cache
 
static $datatype_cache
 
static $clone_mapping
 

Detailed Description

Member Function Documentation

◆ buildFieldFromRecord()

static ilDclCache::buildFieldFromRecord (   $rec)
static
Parameters
$rec
Returns
ilDclBaseFieldModel

Definition at line 298 of file class.ilDclCache.php.

References $fields_cache, and ilDclFieldFactory\getFieldModelInstanceByClass().

Referenced by ilDclTable\getFieldIds().

298  {
299  $fields_cache = &self::$fields_cache;
300  if (isset($fields_cache[$rec["id"]])) {
301  return $fields_cache[$rec["id"]];
302  }
304  $field->setId($rec["id"]);
305  $field->setTableId($rec["table_id"]);
306  $field->setTitle($rec["title"]);
307  $field->setDescription($rec["description"]);
308  $field->setDatatypeId($rec["datatype_id"]);
309  $field->setRequired($rec["required"]);
310  $field->setUnique($rec["is_unique"]);
311  $field->setLocked($rec["is_locked"]);
312  $fields_cache[$rec["id"]] = $field;
313 
314  return $field;
315  }
Class ilDclBaseFieldModel.
static getFieldModelInstanceByClass(ilDclBaseFieldModel $field, $field_id=null)
Gets the correct instance of a fieldModel class Checks if a field is a plugin a replaces the fieldMod...
static $fields_cache
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCloneOf()

static ilDclCache::getCloneOf (   $id,
  $type 
)
static

Definition at line 94 of file class.ilDclCache.php.

Referenced by ilDclFileuploadRecordFieldModel\afterClone(), ilDclReferenceRecordFieldModel\afterClone(), ilDclMobRecordFieldModel\afterClone(), and ilDclReferenceFieldModel\getFieldRef().

94  {
95  $type_cache = self::$clone_mapping[$type];
96  if (!is_array($type_cache)) {
97  return false;
98  }
99 
100  if (isset($type_cache[$id])) {
101  $clone_id = $type_cache[$id];
102  } else {
103  foreach ($type_cache as $key => $mapping) {
104  if ($mapping == $id) {
105  $clone_id = $key;
106  }
107  }
108  }
109 
110  if (!$clone_id) {
111  return false;
112  }
113 
114 
115  switch ($type) {
116  case self::TYPE_DATACOLLECTION:
117  return new ilObjDataCollection($clone_id);
118  case self::TYPE_FIELD:
119  return self::getFieldCache($clone_id);
120  case self::TYPE_TABLE:
121  return self::getTableCache($clone_id);
122  case self::TYPE_RECORD:
123  return self::getRecordCache($clone_id);
124  }
125  }
Class ilObjDataCollection.
+ Here is the caller graph for this function:

◆ getDatatype()

static ilDclCache::getDatatype (   $datatyp_id)
static

Get cached datatypes.

Parameters
$datatyp_id
Returns
mixed
Exceptions
ilDclException

Definition at line 281 of file class.ilDclCache.php.

References ilDclDatatype\getAllDatatype().

Referenced by ilDclBaseFieldModel\loadDatatype().

281  {
282  if(self::$datatype_cache == NULL) {
283  self::$datatype_cache = ilDclDatatype::getAllDatatype();
284  }
285 
286  if(!isset(self::$datatype_cache[$datatyp_id])) {
287  return new ilDclDatatype();
288  }
289  return self::$datatype_cache[$datatyp_id];
290  }
static getAllDatatype()
Get all possible Datatypes.
Class ilDclDatatype.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldCache()

◆ getFieldProperties()

static ilDclCache::getFieldProperties (   $field_id)
static

Cache Field properties.

Parameters
$field_id
Returns
ilDclFieldProperty

Definition at line 234 of file class.ilDclCache.php.

References $result, array, and ActiveRecord\where().

Referenced by ilDclBaseFieldModel\loadProperties().

234  {
235  if(!isset(self::$field_properties_cache[$field_id])) {
236  self::$field_properties_cache[$field_id] = array();
237  $result = ilDclFieldProperty::where(array('field_id'=>$field_id))->get();
238  foreach($result as $prop) {
239  self::$field_properties_cache[$field_id][$prop->getName()] = $prop;
240  }
241  }
242  return self::$field_properties_cache[$field_id];
243  }
$result
static where($where, $operator=null)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldRepresentation()

static ilDclCache::getFieldRepresentation ( ilDclBaseFieldModel  $field)
static
Parameters
ilDclBaseFieldModel$field
Returns
ilDclBaseFieldRepresentation
Exceptions
ilDclException

Definition at line 201 of file class.ilDclCache.php.

References ilDclFieldFactory\getFieldRepresentationInstance(), and ilDclBaseFieldModel\getId().

Referenced by ilDclRecordListTableGUI\initFilter(), ilDclRecordListTableGUI\initFilterFromTableView(), ilDclRecordEditGUI\initForm(), and ilDclBaseRecordModel\passThroughFilter().

201  {
202  if(!isset(self::$field_representation_cache[$field->getId()])) {
203  self::$field_representation_cache[$field->getId()] = ilDclFieldFactory::getFieldRepresentationInstance($field);
204  }
205  return self::$field_representation_cache[$field->getId()];
206  }
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordCache()

static ilDclCache::getRecordCache (   $record_id = 0)
static
Parameters
int$record_id
Returns
ilDclBaseRecordModel

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

References $records_cache, and ilDclFieldFactory\getRecordModelInstance().

Referenced by ilDclDetailedViewGUI\__construct(), ilDclTable\_hasFieldByTitle(), ilDclNReferenceFieldGUI\buildTemplate(), ilDclBaseRecordModel\cloneStructure(), ilDclRecordEditGUI\confirmDelete(), ilDclRecordEditGUI\delete(), ilDclDetailedViewGUI\doExtReplace(), ilObjDataCollection\doUpdate(), ilDclReferenceRecordFieldModel\getExportValue(), ilDclNReferenceRecordFieldModel\getExportValue(), ilDclReferenceRecordRepresentation\getHTML(), ilDclNReferenceFieldGUI\getHTML(), ilDclReferenceRecordRepresentation\getLinkHTML(), ilDclRecordEditGUI\getRecord(), ilDclRecordEditGUI\getRecordData(), ilDataCollectionDataSet\getXmlNamespace(), ilDclTable\loadRecords(), ilDclFileuploadFieldRepresentation\requiredWorkaroundForInputField(), ilDclRecordEditGUI\save(), ilDclRecordListGUI\sendFile(), and ilDclRecordEditGUI\setFormValues().

165  {
166  $records_cache = &self::$records_cache;
167  if (!isset($records_cache[$record_id])) {
169  }
170 
171  return $records_cache[$record_id];
172  }
static $records_cache
static getRecordModelInstance($record_id)
Creates a RecordModel instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordFieldCache()

static ilDclCache::getRecordFieldCache (   $record,
  $field 
)
static
Parameters
$fieldilDclBaseFieldModel
$recordilDclBaseRecordModel
Returns
ilDclBaseRecordFieldModel

Definition at line 181 of file class.ilDclCache.php.

References array, and ilDclFieldFactory\getRecordFieldInstance().

Referenced by ilDclFileuploadRecordFieldModel\afterClone(), ilDclReferenceRecordFieldModel\afterClone(), ilDclMobRecordFieldModel\afterClone(), ilDclBaseFieldModel\afterClone(), ilDclFormulaRecordQueryObject\applyCustomSorting(), ilDclTextRecordQueryObject\applyCustomSorting(), ilDclBaseRecordModel\cloneStructure(), ilDclRecordEditGUI\confirmDelete(), ilDclRecordListTableGUI\getStatus(), ilDclBaseRecordModel\loadRecordFields(), and ilDclRecordListGUI\sendFile().

181  {
182  $fid = $field->getId();
183  $rid = $record->getId();
184  if (!isset(self::$record_field_cache[$rid])) {
185  self::$record_field_cache[$rid] = array();
186  self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
187  } elseif (!isset(self::$record_field_cache[$rid][$fid])) {
188  self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
189  }
190 
191  return self::$record_field_cache[$rid][$fid];
192  }
static getRecordFieldInstance(ilDclBaseFieldModel $field, ilDclBaseRecordModel $record)
Creates a RecordField instance and loads the field and record representation.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordRepresentation()

static ilDclCache::getRecordRepresentation ( ilDclBaseRecordFieldModel  $record_field)
static

Returns a record representation.

Parameters
ilDclBaseRecordFieldModel$record_field
Returns
ilDclBaseRecordRepresentation
Exceptions
ilDclException

Definition at line 216 of file class.ilDclCache.php.

References ilDclBaseRecordFieldModel\getId(), and ilDclFieldFactory\getRecordRepresentationInstance().

Referenced by ilDclRecordEditGUI\confirmDelete(), and ilDclRecordListGUI\sendFile().

216  {
217  if($record_field == null) {
218  throw new ilDclException("Cannot get Representation of null object!");
219  }
220 
221  if(!isset(self::$record_representation_cache[$record_field->getId()])) {
222  self::$record_representation_cache[$record_field->getId()] = ilDclFieldFactory::getRecordRepresentationInstance($record_field);
223  }
224  return self::$record_representation_cache[$record_field->getId()];
225  }
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.
Class ilDclException.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableCache()

static ilDclCache::getTableCache (   $table_id = 0)
static
Parameters
int$table_id
Returns
ilDclTable

Definition at line 132 of file class.ilDclCache.php.

References $tables_cache.

Referenced by ilDclIliasReferenceRecordFieldModel\__construct(), ilDclRatingRecordFieldModel\__construct(), ilDclFieldListTableGUI\__construct(), ilDclReferenceRecordFieldModel\__construct(), ilDclTableViewGUI\__construct(), ilDclTableEditGUI\__construct(), ilDclFieldListGUI\__construct(), ilDclFieldEditGUI\__construct(), ilDclRecordListGUI\__construct(), ilDclReferenceFieldRepresentation\addFilterInputFieldToTable(), ilDclStandardField\allowFilterInListView(), ilDclFormulaFieldRepresentation\buildFieldCreationInput(), ilDclDatetimeFieldModel\checkValidity(), ilDclTextFieldModel\checkValidity(), ilDclFileuploadFieldModel\checkValidity(), ilDclBaseFieldModel\checkValidity(), ilDclTextFieldModel\checkValidityOfURLField(), ilDclTableListGUI\confirmDeleteTables(), ilDclTableView\createDefaultSettings(), ilDclFieldListGUI\deleteFields(), ilDclTableListGUI\deleteTables(), ilObjDataCollection\doCreate(), ilDclBaseRecordModel\doDelete(), ilObjDataCollection\doUpdate(), ilDclTableEditGUI\edit(), ilObjDataCollectionGUI\emptyInfo(), ilDclDetailedViewDefinition\getAvailablePlaceholders(), ilDclReferenceFieldRepresentation\getInputField(), ilDclRecordEditGUI\getRecord(), ilDclReferenceRecordFieldModel\getReferenceFromValue(), ilDclTableView\getTable(), ilObjDataCollection\getTableById(), ilObjDataCollection\getTables(), ilDataCollectionDataSet\getXmlNamespace(), ilObjDataCollectionAccess\hasAccessToField(), ilObjDataCollectionAccess\hasAccessToFields(), ilObjDataCollectionAccess\hasAccessToTable(), ilObjDataCollectionAccess\hasPermissionToAddRecord(), ilDclBaseRecordModel\loadTable(), ilDclDetailedViewGUI\renderRecord(), ilObjDataCollection\reorderTables(), ilDclFieldListGUI\save(), ilDclTableListGUI\save(), ilDclTableEditGUI\save(), and ilDclExpressionParser\substituteFieldValues().

132  {
133  if ($table_id == 0) {
134  return new ilDclTable();
135  }
136  $tables_cache = &self::$tables_cache;
137  if (!isset($tables_cache[$table_id])) {
138  $tables_cache[$table_id] = new ilDclTable($table_id);
139  }
140 
141  return $tables_cache[$table_id];
142  }
Class ilDclBaseFieldModel.
static $tables_cache
+ Here is the caller graph for this function:

◆ initCloneMapping()

static ilDclCache::initCloneMapping ( )
staticprotected

Definition at line 84 of file class.ilDclCache.php.

References array.

84  {
85  self::$clone_mapping = array(
86  self::TYPE_DATACOLLECTION => array(),
87  self::TYPE_TABLE => array(),
88  self::TYPE_FIELD => array(),
89  self::TYPE_RECORD => array(),
90  self::TYPE_TABLEVIEW => array(),
91  );
92  }
Create styles array
The data for the language used.

◆ preloadFieldProperties()

static ilDclCache::preloadFieldProperties ( array  $fields)
static

Preloads field properties.

Parameters
ilDclBaseFieldModel[]$fields

Definition at line 250 of file class.ilDclCache.php.

References $result, array, and ActiveRecord\where().

Referenced by ilDclTable\getFieldIds().

250  {
251  foreach($fields as $field_key => $field) {
252  if(isset(self::$field_properties_cache[$field->getId()])) {
253  unset($fields[$field_key]);
254  }
255  }
256 
257  if(count($fields) > 0) {
258  $field_ids = array();
259  foreach ($fields as $field) {
260  $field_ids[] = $field->getId();
261  }
262  $result = ilDclFieldProperty::where(array('field_id'=>$field_ids), 'IN')->get();
263  foreach($result as $prop) {
264  if(!isset(self::$field_properties_cache[$prop->getFieldId()])) {
265  self::$field_properties_cache[$prop->getFieldId()] = array();
266  }
267  self::$field_properties_cache[$prop->getFieldId()][$prop->getName()] = $prop;
268  }
269  }
270  }
$result
static where($where, $operator=null)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCache()

static ilDclCache::resetCache ( )
static

Resets all the cache fields.

Definition at line 321 of file class.ilDclCache.php.

References array.

Referenced by ilDclContentExporter\export().

321  {
322  self::$fields_cache = array();
323  self::$record_field_cache = array();
324  self::$records_cache = array();
325  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setCloneOf()

static ilDclCache::setCloneOf (   $old,
  $new,
  $type 
)
static

Definition at line 77 of file class.ilDclCache.php.

References $new, and $old.

Referenced by ilObjDataCollection\cloneStructure(), ilDclTableView\cloneStructure(), ilDclBaseFieldModel\cloneStructure(), ilDclBaseRecordModel\cloneStructure(), and ilDclTable\cloneStructure().

77  {
78  if (!self::$clone_mapping) {
79  self::initCloneMapping();
80  }
81  self::$clone_mapping[$type][$old] = $new;
82  }
$old
+ Here is the caller graph for this function:

Field Documentation

◆ $clone_mapping

ilDclCache::$clone_mapping
staticprotected

Definition at line 75 of file class.ilDclCache.php.

◆ $datatype_cache

ilDclCache::$datatype_cache
staticprotected

Definition at line 60 of file class.ilDclCache.php.

◆ $field_properties_cache

ilDclCache::$field_properties_cache
staticprotected

Definition at line 55 of file class.ilDclCache.php.

◆ $field_representation_cache

ilDclCache::$field_representation_cache
staticprotected

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

◆ $fields_cache

ilDclCache::$fields_cache
staticprotected

Definition at line 31 of file class.ilDclCache.php.

Referenced by buildFieldFromRecord(), and getFieldCache().

◆ $record_field_cache

ilDclCache::$record_field_cache
staticprotected

Definition at line 41 of file class.ilDclCache.php.

◆ $record_representation_cache

ilDclCache::$record_representation_cache
staticprotected

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

◆ $records_cache

ilDclCache::$records_cache
staticprotected

Definition at line 35 of file class.ilDclCache.php.

Referenced by getRecordCache().

◆ $tables_cache

ilDclCache::$tables_cache
staticprotected

Definition at line 27 of file class.ilDclCache.php.

Referenced by getTableCache().

◆ TYPE_DATACOLLECTION

const ilDclCache::TYPE_DATACOLLECTION = 'dcl'

Definition at line 18 of file class.ilDclCache.php.

Referenced by ilObjDataCollection\cloneStructure().

◆ TYPE_FIELD

◆ TYPE_RECORD

◆ TYPE_TABLE

const ilDclCache::TYPE_TABLE = 'table'

Definition at line 19 of file class.ilDclCache.php.

Referenced by ilDclTable\cloneStructure().

◆ TYPE_TABLEVIEW

const ilDclCache::TYPE_TABLEVIEW = 'tableview'

Definition at line 22 of file class.ilDclCache.php.

Referenced by ilDclTableView\cloneStructure().


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