ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 268 of file class.ilDclCache.php.

References ilDclFieldFactory\getFieldModelInstanceByClass(), and null.

Referenced by ilDclTable\loadCustomFields().

269  {
270  $fields_cache = &self::$fields_cache;
271  if (isset($fields_cache[$rec["id"]])) {
272  return $fields_cache[$rec["id"]];
273  }
275  $field->setId($rec["id"]);
276  $field->setTableId($rec["table_id"]);
277  if (null !== $rec["title"]) {
278  $field->setTitle($rec["title"]);
279  }
280  if (null !== $rec["description"]) {
281  $field->setDescription($rec["description"]);
282  }
283  $field->setDatatypeId($rec["datatype_id"]);
284  $field->setUnique((bool) $rec["is_unique"]);
285  $fields_cache[$rec["id"]] = $field;
286 
287  return $field;
288  }
static array $fields_cache
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 94 of file class.ilDclCache.php.

References $id, and null.

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

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) {
118  case self::TYPE_DATACOLLECTION:
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);
124  case self::TYPE_RECORD:
125  return self::getRecordCache($clone_id);
126  }
127 
128  return null;
129  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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.

References ilDclDatatype\getAllDatatype(), and null.

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

255  : ilDclDatatype
256  {
257  if (self::$datatype_cache == null) {
258  self::$datatype_cache = ilDclDatatype::getAllDatatype();
259  }
260 
261  if (!isset(self::$datatype_cache[$datatyp_id])) {
262  return new ilDclDatatype();
263  }
264 
265  return self::$datatype_cache[$datatyp_id];
266  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getAllDatatype(bool $force=false)
Get all possible Datatypes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldCache()

◆ getFieldProperties()

static ilDclCache::getFieldProperties ( string  $field_id)
static

Cache Field properties.

Returns
ilDclFieldProperty[]

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

References ActiveRecord\where().

Referenced by ilDclBaseFieldModel\loadProperties().

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

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

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

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)
+ 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 154 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(), ilDclFileFieldRepresentation\requiredWorkaroundForInputField(), ilDclRecordEditGUI\save(), ilDclRecordEditGUI\sendFailure(), ilDclRecordListGUI\sendFile(), and ilDclRecordEditGUI\setFormValues().

155  {
156  $records_cache = &self::$records_cache;
157  if (!$record_id || !isset($records_cache[$record_id])) {
159  }
160 
161  return $records_cache[$record_id];
162  }
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 164 of file class.ilDclCache.php.

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

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

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

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

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

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

Referenced by ilDclIliasReferenceRecordFieldModel\__construct(), ilDclRatingRecordFieldModel\__construct(), ilDclReferenceRecordFieldModel\__construct(), ilDclFieldListTableGUI\__construct(), ilDclFieldListGUI\__construct(), ilDclFieldEditGUI\__construct(), ilDclTableEditGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilDclTableViewGUI\__construct(), ilDclRecordListGUI\__construct(), ilDclReferenceFieldRepresentation\addFilterInputFieldToTable(), ilDclStandardField\allowFilterInListView(), ilDclFormulaFieldRepresentation\buildFieldCreationInput(), ilDclBaseFieldModel\checkValidity(), ilDclTableListGUI\confirmDeleteTables(), ilDclTableView\createDefaultSettings(), ilDclFieldListGUI\deleteFields(), ilDclTableListGUI\deleteTables(), ilObjDataCollection\doCreate(), ilDclBaseRecordModel\doDelete(), ilObjDataCollection\doUpdate(), ilObjDataCollectionGUI\emptyInfo(), ilDclDetailedViewDefinition\getAvailablePlaceholders(), ILIAS\components\DataCollection\Fields\Formula\FormulaParser\Substitution\FieldSubstitution\getFieldFromPlaceholder(), 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(), ilDclSelectionFieldModel\reorderExistingValues(), ilObjDataCollection\reorderTables(), ilDclFieldListGUI\save(), and ilDclTableListGUI\save().

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

◆ preloadFieldProperties()

static ilDclCache::preloadFieldProperties ( array  $fields)
static

Preloads field properties.

Parameters
ilDclBaseFieldModel[]$fields

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

References ActiveRecord\where().

Referenced by ilDclTable\loadCustomFields().

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

Referenced by ilDclContentExporter\export().

293  : void
294  {
295  self::$fields_cache = [];
296  self::$record_field_cache = [];
297  self::$records_cache = [];
298  }
+ 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.

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

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

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

◆ $tables_cache

array ilDclCache::$tables_cache = []
staticprotected

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

◆ TYPE_DATACOLLECTION

const ilDclCache::TYPE_DATACOLLECTION = 'dcl'

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

Referenced by ilObjDataCollection\cloneStructure().

◆ TYPE_FIELD

◆ TYPE_RECORD

◆ TYPE_TABLE

const ilDclCache::TYPE_TABLE = 'table'

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

Referenced by ilDclTable\cloneStructure().

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