ILIAS  release_8 Revision v8.24
ilDclCache Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilDclCache:

Static Public Member Functions

static setCloneOf (int $old, int $new, string $type)
 
static getCloneOf (int $id, string $type)
 
static getTableCache (int $table_id=null)
 
static getFieldCache (int $field_id=0)
 
static getRecordCache (?int $record_id)
 
static getRecordFieldCache (object $record, object $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 (int $datatyp_id)
 Get cached datatypes. More...
 
static buildFieldFromRecord (array $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 array $tables_cache = []
 
static array $fields_cache = []
 
static array $records_cache = []
 
static array $record_field_cache = []
 
static array $field_representation_cache = []
 
static array $record_representation_cache = []
 
static array $field_properties_cache = []
 
static array $datatype_cache = []
 
static array $clone_mapping = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

Member Function Documentation

◆ buildFieldFromRecord()

static ilDclCache::buildFieldFromRecord ( array  $rec)
static

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

271 {
273 if (isset($fields_cache[$rec["id"]])) {
274 return $fields_cache[$rec["id"]];
275 }
277 $field->setId($rec["id"]);
278 $field->setTableId($rec["table_id"]);
279 if (null !== $rec["title"]) {
280 $field->setTitle($rec["title"]);
281 }
282 if (null !== $rec["description"]) {
283 $field->setDescription($rec["description"]);
284 }
285 $field->setDatatypeId($rec["datatype_id"]);
286 $field->setUnique($rec["is_unique"]);
287 $fields_cache[$rec["id"]] = $field;
288
289 return $field;
290 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static array $fields_cache
static getFieldModelInstanceByClass(ilDclBaseFieldModel $field, ?int $field_id=null)
Gets the correct instance of a fieldModel class Checks if a field is a plugin a replaces the fieldMod...

References ilDclFieldFactory\getFieldModelInstanceByClass().

Referenced by ilDclTable\loadCustomFields().

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

◆ getCloneOf()

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

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

92 : ?object
93 {
94 $type_cache = self::$clone_mapping[$type];
95 $clone_id = null;
96
97 if (!is_array($type_cache)) {
98 return null;
99 }
100
101 if (isset($type_cache[$id])) {
102 $clone_id = $type_cache[$id];
103 } else {
104 foreach ($type_cache as $key => $mapping) {
105 if ($mapping == $id) {
106 $clone_id = $key;
107 }
108 }
109 }
110
111 if (!$clone_id) {
112 return null;
113 }
114
115 switch ($type) {
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);
123 return self::getRecordCache($clone_id);
124 }
125
126 return null;
127 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getRecordCache(?int $record_id)
static getFieldCache(int $field_id=0)
const TYPE_DATACOLLECTION
static getTableCache(int $table_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $key
Consumer key/client ID value.
Definition: System.php:193
$type

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

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

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

◆ getDatatype()

static ilDclCache::getDatatype ( int  $datatyp_id)
static

Get cached datatypes.

Exceptions
ilDclException

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

258 {
259 if (self::$datatype_cache == null) {
260 self::$datatype_cache = ilDclDatatype::getAllDatatype();
261 }
262
263 if (!isset(self::$datatype_cache[$datatyp_id])) {
264 return new ilDclDatatype();
265 }
266
267 return self::$datatype_cache[$datatyp_id];
268 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllDatatype(bool $force=false)
Get all possible Datatypes.

References ilDclDatatype\getAllDatatype().

Referenced by ilDclDefaultValueFactory\create(), ilDclTableViewBaseDefaultValue\findAll(), and ilDclBaseFieldModel\loadDatatype().

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

◆ getFieldCache()

static ilDclCache::getFieldCache ( int  $field_id = 0)
static

◆ getFieldProperties()

static ilDclCache::getFieldProperties (   $field_id)
static

Cache Field properties.

Parameters
int | string$field_id
Returns
ilDclFieldProperty[]

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

213 : array
214 {
215 if (!isset(self::$field_properties_cache[$field_id])) {
216 self::$field_properties_cache[$field_id] = array();
217 $result = ilDclFieldProperty::where(array('field_id' => $field_id))->get();
218 foreach ($result as $prop) {
219 self::$field_properties_cache[$field_id][$prop->getName()] = $prop;
220 }
221 }
222
223 return self::$field_properties_cache[$field_id];
224 }
static where($where, $operator=null)

References 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
Exceptions
ilDclException

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

182 {
183 if (!isset(self::$field_representation_cache[$field->getId()])) {
184 self::$field_representation_cache[$field->getId()] = ilDclFieldFactory::getFieldRepresentationInstance($field);
185 }
186
187 return self::$field_representation_cache[$field->getId()];
188 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)

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

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

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

◆ getRecordCache()

◆ getRecordFieldCache()

static ilDclCache::getRecordFieldCache ( object  $record,
object  $field 
)
static

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

166 $fid = $field->getId();
167 $rid = $record->getId();
168 if (!isset(self::$record_field_cache[$rid])) {
169 self::$record_field_cache[$rid] = [];
170 self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
171 } elseif (!isset(self::$record_field_cache[$rid][$fid])) {
172 self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
173 }
174
175 return self::$record_field_cache[$rid][$fid];
176 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRecordFieldInstance(object $field, object $record)
Creates a RecordField instance and loads the field and record representation.

References ilDclFieldFactory\getRecordFieldInstance().

Referenced by ilDclFileuploadRecordFieldModel\afterClone(), ilDclMobRecordFieldModel\afterClone(), ilDclReferenceRecordFieldModel\afterClone(), ilDclBaseFieldModel\afterClone(), ilDclTextRecordQueryObject\applyCustomSorting(), ilDclFormulaRecordQueryObject\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.

Exceptions
ilDclException

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

197 if ($record_field == null) {
198 throw new ilDclException("Cannot get Representation of null object!");
199 }
200
201 if (!isset(self::$record_representation_cache[$record_field->getId()])) {
202 self::$record_representation_cache[$record_field->getId()] = ilDclFieldFactory::getRecordRepresentationInstance($record_field);
203 }
204
205 return self::$record_representation_cache[$record_field->getId()];
206 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.

Referenced by ilDclRecordEditGUI\confirmDelete().

+ Here is the caller graph for this function:

◆ getTableCache()

static ilDclCache::getTableCache ( int  $table_id = null)
static

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

129 : ilDclTable
130 {
131 if (is_null($table_id) === true || $table_id === 0) {
132 return new ilDclTable();
133 }
135 if (!isset($tables_cache[$table_id])) {
136 $tables_cache[$table_id] = new ilDclTable($table_id);
137 }
138
139 return $tables_cache[$table_id];
140 }
static array $tables_cache
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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(), ilDclCreateViewDefinition\getAvailablePlaceholders(), ilDclDetailedViewDefinition\getAvailablePlaceholders(), ilDclEditViewDefinition\getAvailablePlaceholders(), getCloneOf(), ilDclCopyFieldRepresentation\getInputField(), ilDclReferenceFieldRepresentation\getInputField(), ilDclRecordEditGUI\getRecord(), ilDclReferenceRecordFieldModel\getReferenceFromValue(), ilDclTableView\getTable(), ilObjDataCollection\getTableById(), ilObjDataCollection\getTables(), ilObjDataCollectionGUI\getTableViewId(), ilObjDataCollectionAccess\hasAccessToField(), ilObjDataCollectionAccess\hasAccessToFields(), ilObjDataCollectionAccess\hasAccessToTable(), ilObjDataCollectionAccess\hasPermissionToAddRecord(), ilDclBaseRecordModel\loadTable(), ilDclSelectionFieldModel\multiPropertyChanged(), ilDclDetailedViewGUI\renderRecord(), ilDclSelectionFieldModel\reorderExistingValues(), ilObjDataCollection\reorderTables(), ilDclFieldListGUI\save(), ilDclTableListGUI\save(), and ilDclTableEditGUI\save().

+ Here is the caller graph for this function:

◆ initCloneMapping()

static ilDclCache::initCloneMapping ( )
staticprotected

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

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

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

230 : void
231 {
232 foreach ($fields as $field_key => $field) {
233 if (isset(self::$field_properties_cache[$field->getId()])) {
234 unset($fields[$field_key]);
235 }
236 }
237
238 if (count($fields) > 0) {
239 $field_ids = array();
240 foreach ($fields as $field) {
241 $field_ids[] = $field->getId();
242 }
243 $result = ilDclFieldProperty::where(array('field_id' => $field_ids), 'IN')->get();
244 foreach ($result as $prop) {
245 if (!isset(self::$field_properties_cache[$prop->getFieldId()])) {
246 self::$field_properties_cache[$prop->getFieldId()] = array();
247 }
248 self::$field_properties_cache[$prop->getFieldId()][$prop->getName()] = $prop;
249 }
250 }
251 }

References ActiveRecord\where().

Referenced by ilDclTable\loadCustomFields().

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

295 : void
296 {
297 self::$fields_cache = array();
298 self::$record_field_cache = array();
299 self::$records_cache = array();
300 }

Referenced by ilDclContentExporter\export().

+ Here is the caller graph for this function:

◆ setCloneOf()

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

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

73 : void
74 {
75 if (!self::$clone_mapping) {
77 }
78 self::$clone_mapping[$type][$old] = $new;
79 }
static initCloneMapping()

References $type, and initCloneMapping().

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

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

Field Documentation

◆ $clone_mapping

array ilDclCache::$clone_mapping = []
staticprotected

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

◆ $datatype_cache

array ilDclCache::$datatype_cache = []
staticprotected

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

◆ $field_properties_cache

array ilDclCache::$field_properties_cache = []
staticprotected

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

◆ $field_representation_cache

array ilDclCache::$field_representation_cache = []
staticprotected

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

◆ $fields_cache

array ilDclCache::$fields_cache = []
staticprotected

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

Referenced by getFieldCache().

◆ $record_field_cache

array ilDclCache::$record_field_cache = []
staticprotected

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

◆ $record_representation_cache

array ilDclCache::$record_representation_cache = []
staticprotected

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

◆ $records_cache

array ilDclCache::$records_cache = []
staticprotected

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

Referenced by getRecordCache().

◆ $tables_cache

array ilDclCache::$tables_cache = []
staticprotected

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

Referenced by getTableCache().

◆ TYPE_DATACOLLECTION

const ilDclCache::TYPE_DATACOLLECTION = 'dcl'

Definition at line 21 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 22 of file class.ilDclCache.php.

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

◆ TYPE_TABLEVIEW

const ilDclCache::TYPE_TABLEVIEW = 'tableview'

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

Referenced by ilDclTableView\cloneStructure().


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