ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 308 of file class.ilDclCache.php.

References $fields_cache, and ilDclFieldFactory\getFieldModelInstanceByClass().

Referenced by ilDclTable\getFieldIds().

309  {
310  $fields_cache = &self::$fields_cache;
311  if (isset($fields_cache[$rec["id"]])) {
312  return $fields_cache[$rec["id"]];
313  }
315  $field->setId($rec["id"]);
316  $field->setTableId($rec["table_id"]);
317  $field->setTitle($rec["title"]);
318  $field->setDescription($rec["description"]);
319  $field->setDatatypeId($rec["datatype_id"]);
320  $field->setRequired($rec["required"]);
321  $field->setUnique($rec["is_unique"]);
322  $field->setLocked($rec["is_locked"]);
323  $fields_cache[$rec["id"]] = $field;
324 
325  return $field;
326  }
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 87 of file class.ilDclCache.php.

References $id, $key, and $type.

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

88  {
89  $type_cache = self::$clone_mapping[$type];
90  if (!is_array($type_cache)) {
91  return false;
92  }
93 
94  if (isset($type_cache[$id])) {
95  $clone_id = $type_cache[$id];
96  } else {
97  foreach ($type_cache as $key => $mapping) {
98  if ($mapping == $id) {
99  $clone_id = $key;
100  }
101  }
102  }
103 
104  if (!$clone_id) {
105  return false;
106  }
107 
108  switch ($type) {
109  case self::TYPE_DATACOLLECTION:
110  return new ilObjDataCollection($clone_id);
111  case self::TYPE_FIELD:
112  return self::getFieldCache($clone_id);
113  case self::TYPE_TABLE:
114  return self::getTableCache($clone_id);
115  case self::TYPE_RECORD:
116  return self::getRecordCache($clone_id);
117  }
118  }
$type
if(!array_key_exists('StateId', $_REQUEST)) $id
$key
Definition: croninfo.php:18
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 289 of file class.ilDclCache.php.

References ilDclDatatype\getAllDatatype().

Referenced by ilDclBaseFieldModel\loadDatatype().

290  {
291  if (self::$datatype_cache == null) {
292  self::$datatype_cache = ilDclDatatype::getAllDatatype();
293  }
294 
295  if (!isset(self::$datatype_cache[$datatyp_id])) {
296  return new ilDclDatatype();
297  }
298 
299  return self::$datatype_cache[$datatyp_id];
300  }
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 238 of file class.ilDclCache.php.

References $result, and ActiveRecord\where().

Referenced by ilDclBaseFieldModel\loadProperties().

239  {
240  if (!isset(self::$field_properties_cache[$field_id])) {
241  self::$field_properties_cache[$field_id] = array();
242  $result = ilDclFieldProperty::where(array('field_id' => $field_id))->get();
243  foreach ($result as $prop) {
244  self::$field_properties_cache[$field_id][$prop->getName()] = $prop;
245  }
246  }
247 
248  return self::$field_properties_cache[$field_id];
249  }
$result
static where($where, $operator=null)
+ 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 199 of file class.ilDclCache.php.

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

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

200  {
201  if (!isset(self::$field_representation_cache[$field->getId()])) {
202  self::$field_representation_cache[$field->getId()] = ilDclFieldFactory::getFieldRepresentationInstance($field);
203  }
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 161 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().

162  {
163  $records_cache = &self::$records_cache;
164  if (!isset($records_cache[$record_id])) {
166  }
167 
168  return $records_cache[$record_id];
169  }
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 178 of file class.ilDclCache.php.

References 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().

179  {
180  $fid = $field->getId();
181  $rid = $record->getId();
182  if (!isset(self::$record_field_cache[$rid])) {
183  self::$record_field_cache[$rid] = array();
184  self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
185  } elseif (!isset(self::$record_field_cache[$rid][$fid])) {
186  self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
187  }
188 
189  return self::$record_field_cache[$rid][$fid];
190  }
static getRecordFieldInstance(ilDclBaseFieldModel $field, ilDclBaseRecordModel $record)
Creates a RecordField instance and loads the field and record representation.
+ 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 217 of file class.ilDclCache.php.

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

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

218  {
219  if ($record_field == null) {
220  throw new ilDclException("Cannot get Representation of null object!");
221  }
222 
223  if (!isset(self::$record_representation_cache[$record_field->getId()])) {
224  self::$record_representation_cache[$record_field->getId()] = ilDclFieldFactory::getRecordRepresentationInstance($record_field);
225  }
226 
227  return self::$record_representation_cache[$record_field->getId()];
228  }
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 126 of file class.ilDclCache.php.

References $tables_cache.

Referenced by ilDclIliasReferenceRecordFieldModel\__construct(), ilDclRatingRecordFieldModel\__construct(), ilDclFieldListTableGUI\__construct(), ilDclReferenceRecordFieldModel\__construct(), ilDclTableViewGUI\__construct(), ilDclFieldListGUI\__construct(), ilDclFieldEditGUI\__construct(), ilDclTableEditGUI\__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(), ilDclSelectionFieldModel\multiPropertyChanged(), ilDclDetailedViewGUI\renderRecord(), ilDclSelectionFieldModel\reorderExistingValues(), ilObjDataCollection\reorderTables(), ilDclFieldListGUI\save(), ilDclTableListGUI\save(), ilDclTableEditGUI\save(), and ilDclExpressionParser\substituteFieldValues().

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

◆ initCloneMapping()

static ilDclCache::initCloneMapping ( )
staticprotected

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

76  {
77  self::$clone_mapping = array(
78  self::TYPE_DATACOLLECTION => array(),
79  self::TYPE_TABLE => array(),
80  self::TYPE_FIELD => array(),
81  self::TYPE_RECORD => array(),
82  self::TYPE_TABLEVIEW => array(),
83  );
84  }

◆ preloadFieldProperties()

static ilDclCache::preloadFieldProperties ( array  $fields)
static

Preloads field properties.

Parameters
ilDclBaseFieldModel[]$fields

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

References $result, and ActiveRecord\where().

Referenced by ilDclTable\getFieldIds().

258  {
259  foreach ($fields as $field_key => $field) {
260  if (isset(self::$field_properties_cache[$field->getId()])) {
261  unset($fields[$field_key]);
262  }
263  }
264 
265  if (count($fields) > 0) {
266  $field_ids = array();
267  foreach ($fields as $field) {
268  $field_ids[] = $field->getId();
269  }
270  $result = ilDclFieldProperty::where(array('field_id' => $field_ids), 'IN')->get();
271  foreach ($result as $prop) {
272  if (!isset(self::$field_properties_cache[$prop->getFieldId()])) {
273  self::$field_properties_cache[$prop->getFieldId()] = array();
274  }
275  self::$field_properties_cache[$prop->getFieldId()][$prop->getName()] = $prop;
276  }
277  }
278  }
$result
static where($where, $operator=null)
+ 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 332 of file class.ilDclCache.php.

Referenced by ilDclContentExporter\export().

333  {
334  self::$fields_cache = array();
335  self::$record_field_cache = array();
336  self::$records_cache = array();
337  }
+ Here is the caller graph for this function:

◆ setCloneOf()

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

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

References $type.

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

67  {
68  if (!self::$clone_mapping) {
69  self::initCloneMapping();
70  }
71  self::$clone_mapping[$type][$old] = $new;
72  }
$type
+ Here is the caller graph for this function:

Field Documentation

◆ $clone_mapping

ilDclCache::$clone_mapping
staticprotected

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

◆ $datatype_cache

ilDclCache::$datatype_cache
staticprotected

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

◆ $field_properties_cache

ilDclCache::$field_properties_cache
staticprotected

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

◆ $field_representation_cache

ilDclCache::$field_representation_cache
staticprotected

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

◆ $fields_cache

ilDclCache::$fields_cache
staticprotected

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

Referenced by buildFieldFromRecord(), and getFieldCache().

◆ $record_field_cache

ilDclCache::$record_field_cache
staticprotected

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

◆ $record_representation_cache

ilDclCache::$record_representation_cache
staticprotected

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

◆ $records_cache

ilDclCache::$records_cache
staticprotected

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

Referenced by getRecordCache().

◆ $tables_cache

ilDclCache::$tables_cache
staticprotected

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

Referenced by getTableCache().

◆ TYPE_DATACOLLECTION

const ilDclCache::TYPE_DATACOLLECTION = 'dcl'

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

Referenced by ilObjDataCollection\cloneStructure().

◆ TYPE_FIELD

◆ TYPE_RECORD

◆ TYPE_TABLE

const ilDclCache::TYPE_TABLE = 'table'

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

Referenced by ilDclTable\cloneStructure().

◆ TYPE_TABLEVIEW

const ilDclCache::TYPE_TABLEVIEW = 'tableview'

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

Referenced by ilDclTableView\cloneStructure().


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