72 if (!self::$clone_mapping) {
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(),
91 $type_cache = self::$clone_mapping[
$type];
92 if (!is_array($type_cache)) {
96 if (isset($type_cache[
$id])) {
97 $clone_id = $type_cache[
$id];
99 foreach ($type_cache as
$key => $mapping) {
100 if ($mapping ==
$id) {
130 if ($table_id == 0) {
182 $fid = $field->getId();
183 $rid = $record->getId();
184 if (!isset(self::$record_field_cache[$rid])) {
185 self::$record_field_cache[$rid] = array();
187 } elseif (!isset(self::$record_field_cache[$rid][$fid])) {
191 return self::$record_field_cache[$rid][$fid];
203 if (!isset(self::$field_representation_cache[$field->
getId()])) {
206 return self::$field_representation_cache[$field->
getId()];
219 if ($record_field ==
null) {
220 throw new ilDclException(
"Cannot get Representation of null object!");
223 if (!isset(self::$record_representation_cache[$record_field->
getId()])) {
226 return self::$record_representation_cache[$record_field->
getId()];
238 if (!isset(self::$field_properties_cache[$field_id])) {
239 self::$field_properties_cache[$field_id] = array();
242 self::$field_properties_cache[$field_id][$prop->getName()] = $prop;
245 return self::$field_properties_cache[$field_id];
255 foreach ($fields as $field_key => $field) {
256 if (isset(self::$field_properties_cache[$field->getId()])) {
257 unset($fields[$field_key]);
261 if (count($fields) > 0) {
262 $field_ids = array();
263 foreach ($fields as $field) {
264 $field_ids[] = $field->getId();
268 if (!isset(self::$field_properties_cache[$prop->getFieldId()])) {
269 self::$field_properties_cache[$prop->getFieldId()] = array();
271 self::$field_properties_cache[$prop->getFieldId()][$prop->getName()] = $prop;
287 if (self::$datatype_cache ==
null) {
291 if (!isset(self::$datatype_cache[$datatyp_id])) {
294 return self::$datatype_cache[$datatyp_id];
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"]);
329 self::$fields_cache = array();
330 self::$record_field_cache = array();
331 self::$records_cache = array();
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldModel.
Class ilDclBaseFieldModel.
static getDatatype($datatyp_id)
Get cached datatypes.
static getRecordFieldCache($record, $field)
static getFieldProperties($field_id)
Cache Field properties.
static $field_properties_cache
static getTableCache($table_id=0)
static $field_representation_cache
static getRecordCache($record_id=0)
static resetCache()
Resets all the cache fields.
static $record_field_cache
static getRecordRepresentation(ilDclBaseRecordFieldModel $record_field)
Returns a record representation.
static getCloneOf($id, $type)
const TYPE_DATACOLLECTION
static initCloneMapping()
static buildFieldFromRecord($rec)
static setCloneOf($old, $new, $type)
static getFieldCache($field_id=0)
static preloadFieldProperties(array $fields)
Preloads field properties.
static getFieldRepresentation(ilDclBaseFieldModel $field)
static $record_representation_cache
static getAllDatatype()
Get all possible Datatypes.
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.
static getFieldModelInstance($field_id, $datatype=null)
Get FieldModel from field-id and datatype.
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
static getRecordFieldInstance(ilDclBaseFieldModel $field, ilDclBaseRecordModel $record)
Creates a RecordField instance and loads the field and record representation.
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...
static getRecordModelInstance($record_id)
Creates a RecordModel instance.
Class ilDclBaseFieldModel.
Class ilObjDataCollection.
if(!array_key_exists('StateId', $_REQUEST)) $id