ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References ilDclFieldFactory\getFieldModelInstanceByClass().

Referenced by ilDclTable\loadCustomFields().

271  {
272  $fields_cache = &self::$fields_cache;
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...
+ 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.

References $id, ILIAS\LTI\ToolProvider\$key, and $type.

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

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) {
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 
126  return null;
127  }
$type
string $key
Consumer key/client ID value.
Definition: System.php:193
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

References ilDclDatatype\getAllDatatype().

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

257  : ilDclDatatype
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  }
static getAllDatatype(bool $force=false)
Get all possible Datatypes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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

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

References ilDclFieldFactory\getFieldModelInstance().

Referenced by ilDclFieldEditGUI\__construct(), ilDclReferenceFieldRepresentation\addFilterInputFieldToTable(), ilDclBaseFieldModel\cloneStructure(), ilDclTable\deleteField(), ilDclFieldListGUI\deleteFields(), ilDataCollectionDataSet\getDependencies(), ilDclTableViewFieldSetting\getFieldObject(), ilDclReferenceFieldModel\getFieldRef(), ilDclReferenceFieldRepresentation\getInputField(), ilDclCopyFieldRepresentation\getInputField(), ilDclReferenceFieldModel\getRecordQuerySortObject(), ilDclReferenceRecordFieldModel\getReferenceFromValue(), and ilDataCollectionDataSet\getXmlNamespace().

143  {
144  $fields_cache = &self::$fields_cache;
145  if (!isset($fields_cache[$field_id])) {
147  }
148 
149  return $fields_cache[$field_id];
150  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static array $fields_cache
static getFieldModelInstance(int $field_id, ?int $datatype=null)
Get FieldModel from field-id and datatype.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

References ActiveRecord\where().

Referenced by ilDclBaseFieldModel\loadProperties().

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

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

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

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  }
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordCache()

static ilDclCache::getRecordCache ( ?int  $record_id)
static

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

References ilDclFieldFactory\getRecordModelInstance().

Referenced by ilDclDetailedViewGUI\__construct(), ilDclBaseRecordModel\cloneStructure(), ilDclRecordEditGUI\confirmDelete(), ilDclRecordEditGUI\delete(), ilDclDetailedViewGUI\doExtReplace(), ilObjDataCollection\doUpdate(), ilDclReferenceRecordFieldModel\getExportValue(), ilDclReferenceRecordRepresentation\getHTML(), ilDclCopyFieldRepresentation\getInputField(), ilDclTable\getPartialRecords(), ilDclRecordEditGUI\getRecord(), ilDclRecordEditGUI\getRecordData(), ilDataCollectionDataSet\getXmlNamespace(), ilDclTable\loadRecords(), ilDclFileuploadFieldRepresentation\requiredWorkaroundForInputField(), ilDclRecordEditGUI\save(), ilDclRecordEditGUI\sendFailure(), ilDclRecordListGUI\sendFile(), and ilDclRecordEditGUI\setFormValues().

153  {
154  $records_cache = &self::$records_cache;
155  if (!$record_id || !isset($records_cache[$record_id])) {
157  }
158 
159  return $records_cache[$record_id];
160  }
static array $records_cache
static getRecordModelInstance(?int $record_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordFieldCache()

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

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

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

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

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

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

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

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...
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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 129 of file class.ilDclCache.php.

Referenced by ilDclIliasReferenceRecordFieldModel\__construct(), ilDclRatingRecordFieldModel\__construct(), ilDclReferenceRecordFieldModel\__construct(), ilDclFieldListTableGUI\__construct(), ilDclFieldListGUI\__construct(), ilDclTableEditGUI\__construct(), ilDclFieldEditGUI\__construct(), ilDclTableViewGUI\__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(), ilDclCreateViewDefinition\getAvailablePlaceholders(), ilDclEditViewDefinition\getAvailablePlaceholders(), ilDclReferenceFieldRepresentation\getInputField(), ilDclCopyFieldRepresentation\getInputField(), ilDclRecordEditGUI\getRecord(), ilDclReferenceRecordFieldModel\getReferenceFromValue(), ilDclTableView\getTable(), ilObjDataCollection\getTableById(), ilObjDataCollection\getTables(), ilObjDataCollectionGUI\getTableViewId(), 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().

129  : ilDclTable
130  {
131  if (is_null($table_id) === true || $table_id === 0) {
132  return new ilDclTable();
133  }
134  $tables_cache = &self::$tables_cache;
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...
+ 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  }

◆ preloadFieldProperties()

static ilDclCache::preloadFieldProperties ( array  $fields)
static

Preloads field properties.

Parameters
ilDclBaseFieldModel[]$fields

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

References ActiveRecord\where().

Referenced by ilDclTable\loadCustomFields().

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

Referenced by ilDclContentExporter\export().

295  : void
296  {
297  self::$fields_cache = array();
298  self::$record_field_cache = array();
299  self::$records_cache = array();
300  }
+ 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.

References $type.

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

73  : void
74  {
75  if (!self::$clone_mapping) {
76  self::initCloneMapping();
77  }
78  self::$clone_mapping[$type][$old] = $new;
79  }
$type
+ 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.

◆ $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.

◆ $tables_cache

array ilDclCache::$tables_cache = []
staticprotected

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

◆ TYPE_DATACOLLECTION

const ilDclCache::TYPE_DATACOLLECTION = 'dcl'

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

Referenced by ilObjDataCollection\cloneStructure().

◆ TYPE_FIELD

◆ TYPE_RECORD

◆ TYPE_TABLE

const ilDclCache::TYPE_TABLE = 'table'

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

Referenced by ilDclTable\cloneStructure().

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