ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDclCache Class Reference
+ 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 (string $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

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

Member Function Documentation

◆ buildFieldFromRecord()

static ilDclCache::buildFieldFromRecord ( array  $rec)
static

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

273 {
275 if (isset($fields_cache[$rec["id"]])) {
276 return $fields_cache[$rec["id"]];
277 }
279 $field->setId($rec["id"]);
280 $field->setTableId($rec["table_id"]);
281 if (null !== $rec["title"]) {
282 $field->setTitle($rec["title"]);
283 }
284 if (null !== $rec["description"]) {
285 $field->setDescription($rec["description"]);
286 }
287 $field->setDatatypeId($rec["datatype_id"]);
288 $fields_cache[$rec["id"]] = $field;
289
290 return $field;
291 }
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 94 of file class.ilDclCache.php.

94 : ?object
95 {
96 $type_cache = self::$clone_mapping[$type];
97 $clone_id = null;
98
99 if (!is_array($type_cache)) {
100 return null;
101 }
102
103 if (isset($type_cache[$id])) {
104 $clone_id = $type_cache[$id];
105 } else {
106 foreach ($type_cache as $key => $mapping) {
107 if ($mapping == $id) {
108 $clone_id = $key;
109 }
110 }
111 }
112
113 if (!$clone_id) {
114 return null;
115 }
116
117 switch ($type) {
119 return new ilObjDataCollection($clone_id);
120 case self::TYPE_FIELD:
121 return self::getFieldCache($clone_id);
122 case self::TYPE_TABLE:
123 return self::getTableCache($clone_id);
125 return self::getRecordCache($clone_id);
126 }
127
128 return null;
129 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getRecordCache(?int $record_id)
static getTableCache(?int $table_id=null)
static getFieldCache(int $field_id=0)
const TYPE_DATACOLLECTION

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

Referenced by ilDclFileRecordFieldModel\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 255 of file class.ilDclCache.php.

256 {
257 if (self::$datatype_cache == null) {
258 self::$datatype_cache = ilDclDatatype::getAllDatatype();
259 }
260
261 if (!isset(self::$datatype_cache[$datatyp_id])) {
262 $unknown = new ilDclDatatype();
263 if ($datatyp_id > ilDclFieldTypePlugin::ID_BUFFER) {
264 $unknown->setTitle('unknown_plugin');
265 }
266 return $unknown;
267 }
268
269 return self::$datatype_cache[$datatyp_id];
270 }
static getAllDatatype(bool $force=false)
Get all possible Datatypes.

References ilDclDatatype\getAllDatatype(), and ilDclFieldTypePlugin\ID_BUFFER.

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 ( string  $field_id)
static

Cache Field properties.

Returns
ilDclFieldProperty[]

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

211 : array
212 {
213 if (!isset(self::$field_properties_cache[$field_id])) {
214 self::$field_properties_cache[$field_id] = [];
215 $result = ilDclFieldProperty::where(['field_id' => $field_id])->get();
216 foreach ($result as $prop) {
217 self::$field_properties_cache[$field_id][$prop->getName()] = $prop;
218 }
219 }
220
221 return self::$field_properties_cache[$field_id];
222 }
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 183 of file class.ilDclCache.php.

184 {
185 if (!isset(self::$field_representation_cache[$field->getId()])) {
186 self::$field_representation_cache[$field->getId()] = ilDclFieldFactory::getFieldRepresentationInstance($field);
187 }
188
189 return self::$field_representation_cache[$field->getId()];
190 }
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)

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

Referenced by ilDclRecordListTableGUI\initFilter(), 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 164 of file class.ilDclCache.php.

168 $fid = $field->getId();
169 $rid = $record->getId();
170 if (!isset(self::$record_field_cache[$rid])) {
171 self::$record_field_cache[$rid] = [];
172 self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
173 } elseif (!isset(self::$record_field_cache[$rid][$fid])) {
174 self::$record_field_cache[$rid][$fid] = ilDclFieldFactory::getRecordFieldInstance($field, $record);
175 }
176
177 return self::$record_field_cache[$rid][$fid];
178 }
static getRecordFieldInstance(object $field, object $record)
Creates a RecordField instance and loads the field and record representation.

References ilDclFieldFactory\getRecordFieldInstance().

Referenced by ilDclFileRecordFieldModel\afterClone(), ilDclMobRecordFieldModel\afterClone(), ilDclReferenceRecordFieldModel\afterClone(), ilDclBaseFieldModel\afterClone(), 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 196 of file class.ilDclCache.php.

199
200 if (!isset(self::$record_representation_cache[$record_field->getId()])) {
201 self::$record_representation_cache[$record_field->getId()] = ilDclFieldFactory::getRecordRepresentationInstance($record_field);
202 }
203
204 return self::$record_representation_cache[$record_field->getId()];
205 }
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 ( ?int  $table_id = null)
static

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

131 : ilDclTable
132 {
133 if (is_null($table_id) === true || $table_id === 0) {
134 return new ilDclTable();
135 }
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 }
static array $tables_cache

References $tables_cache.

Referenced by ilDclIliasReferenceRecordFieldModel\__construct(), ilDclRatingRecordFieldModel\__construct(), ilDclReferenceRecordFieldModel\__construct(), ilDclFieldListTableGUI\__construct(), ilDclFieldEditGUI\__construct(), ilDclFieldListGUI\__construct(), ilDclTableEditGUI\__construct(), ilDclTableViewGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilDclRecordListGUI\__construct(), ilDclReferenceFieldRepresentation\addFilterInputFieldToTable(), ilDclStandardField\allowFilterInListView(), ilDclFormulaFieldRepresentation\buildFieldCreationInput(), ilDclBaseFieldModel\checkUnique(), ilDclBaseFieldModel\checkUniqueProp(), ilDclTableView\createDefaultSettings(), ilDclFieldListGUI\deleteFields(), ilObjDataCollection\doCreate(), ilDclBaseRecordModel\doDelete(), ilDclDetailedViewDefinition\getAvailablePlaceholders(), getCloneOf(), ILIAS\components\DataCollection\Fields\Formula\FormulaParser\Substitution\FieldSubstitution\getFieldFromPlaceholder(), ilDclCopyFieldRepresentation\getInputField(), ilDclReferenceFieldRepresentation\getInputField(), ilDclRecordEditGUI\getRecord(), ilDclReferenceRecordFieldModel\getReferenceFromValue(), ilDclTableView\getTable(), ilObjDataCollection\getTableById(), ilObjDataCollectionGUI\getTableViewId(), ilObjDataCollectionAccess\hasAccessToField(), ilObjDataCollectionAccess\hasAccessToFields(), ilObjDataCollectionAccess\hasAccessToTable(), ilObjDataCollectionAccess\hasPermissionToAddRecord(), ilDclBaseRecordModel\loadTable(), ilDclFieldListGUI\save(), and ilDclTableListGUI\save().

+ Here is the caller graph for this function:

◆ initCloneMapping()

static ilDclCache::initCloneMapping ( )
staticprotected

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

83 : void
84 {
85 self::$clone_mapping = [
86 self::TYPE_DATACOLLECTION => [],
87 self::TYPE_TABLE => [],
88 self::TYPE_FIELD => [],
89 self::TYPE_RECORD => [],
90 self::TYPE_TABLEVIEW => [],
91 ];
92 }

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

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

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

296 : void
297 {
298 self::$fields_cache = [];
299 self::$record_field_cache = [];
300 self::$records_cache = [];
301 }

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

75 : void
76 {
77 if (!self::$clone_mapping) {
79 }
80 self::$clone_mapping[$type][$old] = $new;
81 }
static initCloneMapping()

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

◆ $datatype_cache

array ilDclCache::$datatype_cache = []
staticprotected

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

◆ $field_properties_cache

array ilDclCache::$field_properties_cache = []
staticprotected

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

◆ $field_representation_cache

array ilDclCache::$field_representation_cache = []
staticprotected

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

◆ $fields_cache

array ilDclCache::$fields_cache = []
staticprotected

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

Referenced by getFieldCache().

◆ $record_field_cache

array ilDclCache::$record_field_cache = []
staticprotected

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

◆ $record_representation_cache

array ilDclCache::$record_representation_cache = []
staticprotected

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

◆ $records_cache

array ilDclCache::$records_cache = []
staticprotected

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

Referenced by getRecordCache().

◆ $tables_cache

array ilDclCache::$tables_cache = []
staticprotected

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

Referenced by getTableCache().

◆ TYPE_DATACOLLECTION

const ilDclCache::TYPE_DATACOLLECTION = 'dcl'

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

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

◆ TYPE_TABLEVIEW

const ilDclCache::TYPE_TABLEVIEW = 'tableview'

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

Referenced by ilDclTableView\cloneStructure().


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