ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 303 of file class.ilDclCache.php.

304 {
306 if (isset($fields_cache[$rec["id"]])) {
307 return $fields_cache[$rec["id"]];
308 }
310 $field->setId($rec["id"]);
311 $field->setTableId($rec["table_id"]);
312 $field->setTitle($rec["title"]);
313 $field->setDescription($rec["description"]);
314 $field->setDatatypeId($rec["datatype_id"]);
315 $field->setRequired($rec["required"]);
316 $field->setUnique($rec["is_unique"]);
317 $field->setLocked($rec["is_locked"]);
318 $fields_cache[$rec["id"]] = $field;
319
320 return $field;
321 }
Class ilDclBaseFieldModel.
static $fields_cache
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...

References $fields_cache, and ilDclFieldFactory\getFieldModelInstanceByClass().

+ Here is the call graph for this function:

◆ getCloneOf()

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

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

90 {
91 $type_cache = self::$clone_mapping[$type];
92 if (!is_array($type_cache)) {
93 return false;
94 }
95
96 if (isset($type_cache[$id])) {
97 $clone_id = $type_cache[$id];
98 } else {
99 foreach ($type_cache as $key => $mapping) {
100 if ($mapping == $id) {
101 $clone_id = $key;
102 }
103 }
104 }
105
106 if (!$clone_id) {
107 return false;
108 }
109
110
111 switch ($type) {
113 return new ilObjDataCollection($clone_id);
114 case self::TYPE_FIELD:
115 return self::getFieldCache($clone_id);
116 case self::TYPE_TABLE:
117 return self::getTableCache($clone_id);
119 return self::getRecordCache($clone_id);
120 }
121 }
static getTableCache($table_id=0)
static getRecordCache($record_id=0)
const TYPE_DATACOLLECTION
static getFieldCache($field_id=0)
Class ilObjDataCollection.
$key
Definition: croninfo.php:18
if(!array_key_exists('StateId', $_REQUEST)) $id
$type

References $id, $key, $type, getFieldCache(), getRecordCache(), getTableCache(), TYPE_DATACOLLECTION, TYPE_FIELD, TYPE_RECORD, and TYPE_TABLE.

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

+ Here is the call graph for this function:
+ 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 285 of file class.ilDclCache.php.

286 {
287 if (self::$datatype_cache == null) {
288 self::$datatype_cache = ilDclDatatype::getAllDatatype();
289 }
290
291 if (!isset(self::$datatype_cache[$datatyp_id])) {
292 return new ilDclDatatype();
293 }
294 return self::$datatype_cache[$datatyp_id];
295 }
Class ilDclDatatype.
static getAllDatatype()
Get all possible Datatypes.

References ilDclDatatype\getAllDatatype().

Referenced by ilDclBaseFieldModel\loadDatatype().

+ 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 236 of file class.ilDclCache.php.

237 {
238 if (!isset(self::$field_properties_cache[$field_id])) {
239 self::$field_properties_cache[$field_id] = array();
240 $result = ilDclFieldProperty::where(array('field_id'=>$field_id))->get();
241 foreach ($result as $prop) {
242 self::$field_properties_cache[$field_id][$prop->getName()] = $prop;
243 }
244 }
245 return self::$field_properties_cache[$field_id];
246 }
$result
static where($where, $operator=null)

References $result, and ActiveRecord\where().

Referenced by ilDclBaseFieldModel\loadProperties().

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

202 {
203 if (!isset(self::$field_representation_cache[$field->getId()])) {
204 self::$field_representation_cache[$field->getId()] = ilDclFieldFactory::getFieldRepresentationInstance($field);
205 }
206 return self::$field_representation_cache[$field->getId()];
207 }
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordCache()

static ilDclCache::getRecordCache (   $record_id = 0)
static

◆ getRecordFieldCache()

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

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

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.

References ilDclFieldFactory\getRecordFieldInstance().

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

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

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 return self::$record_representation_cache[$record_field->getId()];
227 }
Class ilDclException.
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.

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

Referenced by ilDclRecordEditGUI\confirmDelete().

+ 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 128 of file class.ilDclCache.php.

129 {
130 if ($table_id == 0) {
131 return new ilDclTable();
132 }
134 if (!isset($tables_cache[$table_id])) {
135 $tables_cache[$table_id] = new ilDclTable($table_id);
136 }
137
138 return $tables_cache[$table_id];
139 }
static $tables_cache
Class ilDclBaseFieldModel.

References $tables_cache.

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

+ Here is the caller graph for this function:

◆ initCloneMapping()

static ilDclCache::initCloneMapping ( )
staticprotected

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

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

Referenced by setCloneOf().

+ Here is the caller graph for this function:

◆ preloadFieldProperties()

static ilDclCache::preloadFieldProperties ( array  $fields)
static

Preloads field properties.

Parameters
ilDclBaseFieldModel[]$fields

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

254 {
255 foreach ($fields as $field_key => $field) {
256 if (isset(self::$field_properties_cache[$field->getId()])) {
257 unset($fields[$field_key]);
258 }
259 }
260
261 if (count($fields) > 0) {
262 $field_ids = array();
263 foreach ($fields as $field) {
264 $field_ids[] = $field->getId();
265 }
266 $result = ilDclFieldProperty::where(array('field_id'=>$field_ids), 'IN')->get();
267 foreach ($result as $prop) {
268 if (!isset(self::$field_properties_cache[$prop->getFieldId()])) {
269 self::$field_properties_cache[$prop->getFieldId()] = array();
270 }
271 self::$field_properties_cache[$prop->getFieldId()][$prop->getName()] = $prop;
272 }
273 }
274 }

References $result, and ActiveRecord\where().

+ Here is the call graph for this function:

◆ resetCache()

static ilDclCache::resetCache ( )
static

Resets all the cache fields.

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

328 {
329 self::$fields_cache = array();
330 self::$record_field_cache = array();
331 self::$records_cache = array();
332 }

Referenced by ilDclContentExporter\export().

+ Here is the caller graph for this function:

◆ setCloneOf()

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

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

71 {
72 if (!self::$clone_mapping) {
74 }
75 self::$clone_mapping[$type][$old] = $new;
76 }
static initCloneMapping()
$old

References $new, $old, $type, and initCloneMapping().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $clone_mapping

ilDclCache::$clone_mapping
staticprotected

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

◆ $datatype_cache

ilDclCache::$datatype_cache
staticprotected

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

◆ $field_properties_cache

ilDclCache::$field_properties_cache
staticprotected

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

◆ $field_representation_cache

ilDclCache::$field_representation_cache
staticprotected

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

◆ $fields_cache

ilDclCache::$fields_cache
staticprotected

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

Referenced by buildFieldFromRecord(), and getFieldCache().

◆ $record_field_cache

ilDclCache::$record_field_cache
staticprotected

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

◆ $record_representation_cache

ilDclCache::$record_representation_cache
staticprotected

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

◆ $records_cache

ilDclCache::$records_cache
staticprotected

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

Referenced by getRecordCache().

◆ $tables_cache

ilDclCache::$tables_cache
staticprotected

Definition at line 20 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(), and getCloneOf().

◆ TYPE_FIELD

◆ TYPE_RECORD

◆ TYPE_TABLE

const ilDclCache::TYPE_TABLE = 'table'

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

Referenced by ilDclTable\cloneStructure(), and getCloneOf().

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