Class ilDclFieldFactory This Class handles the creation of all field-classes.
More...
Class ilDclFieldFactory This Class handles the creation of all field-classes.
- Author
- Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
- Version
- 1.0.0
Definition at line 10 of file class.ilDclFieldFactory.php.
◆ getClassByInstance()
◆ getClassPathByInstance()
static ilDclFieldFactory::getClassPathByInstance |
( |
ilDclBaseFieldModel |
$field, |
|
|
|
$class_pattern |
|
) |
| |
|
static |
- Parameters
-
- Returns
- string
- Exceptions
-
Definition at line 357 of file class.ilDclFieldFactory.php.
358 {
360
361 if ($field->
getId() !=
null && !empty(self::$class_path_cache[$field->
getId()][$class_pattern])) {
362 return self::$class_path_cache[$field->
getId()][$class_pattern];
363 }
364
367 $plugin_data
369 if ($plugin_data == null) {
371 "Something went wrong by initializing the FieldHook-Plugin '"
375 );
376 }
377
378 $class_path = $plugin_data->getDirectory() . "/classes/";
379 } else {
380 $class_path = sprintf(self::$field_base_path_patter, ucfirst(self::parseDatatypeTitle($datatype->getTitle())));
381 }
382 } else {
383 $class_path = sprintf(self::$field_base_path_patter, ucfirst(self::parseDatatypeTitle($datatype->getTitle())));
384 }
385
387
388 if ($field->
getId() !=
null) {
389 self::$class_path_cache[$field->
getId()][$class_pattern] = $return;
390 }
391
392 return $return;
393 }
const PROP_PLUGIN_HOOK_NAME
hasProperty($key)
Checks if a certain property for a field is set.
getProperty($key)
Returns a certain property of a field.
static getFieldClassFile($datatype, $class_pattern)
Get Filename from datatype and pattern.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
References ilDclFieldTypePlugin\COMPONENT_NAME, ilDclBaseFieldModel\getDatatype(), getFieldClassFile(), ilDclBaseFieldModel\getId(), ilPlugin\getPluginObject(), ilDclBaseFieldModel\getProperty(), ilDclBaseFieldModel\getTitle(), ilDclBaseFieldModel\hasProperty(), IL_COMP_MODULE, ilDclDatatype\INPUTFORMAT_PLUGIN, ilDclBaseFieldModel\PROP_PLUGIN_HOOK_NAME, and ilDclFieldTypePlugin\SLOT_ID.
Referenced by getFieldModelInstanceByClass(), getFieldRepresentationInstance(), getRecordFieldInstance(), and getRecordRepresentationInstance().
◆ getFieldClass()
static ilDclFieldFactory::getFieldClass |
( |
|
$datatype, |
|
|
|
$class_pattern |
|
) |
| |
|
static |
◆ getFieldClassFile()
static ilDclFieldFactory::getFieldClassFile |
( |
|
$datatype, |
|
|
|
$class_pattern |
|
) |
| |
|
static |
◆ getFieldModelInstance()
static ilDclFieldFactory::getFieldModelInstance |
( |
|
$field_id, |
|
|
|
$datatype = null |
|
) |
| |
|
static |
◆ getFieldModelInstanceByClass()
static ilDclFieldFactory::getFieldModelInstanceByClass |
( |
ilDclBaseFieldModel |
$field, |
|
|
|
$field_id = null |
|
) |
| |
|
static |
◆ getFieldRepresentationInstance()
◆ getFieldTypeByInstance()
◆ getPluginNameFromFieldModel()
◆ getRecordFieldInstance()
Creates a RecordField instance and loads the field and record representation.
- Parameters
-
- Returns
- mixed
- Exceptions
-
Definition at line 56 of file class.ilDclFieldFactory.php.
57 {
58 if (!empty(self::$record_field_cache[$field->
getId()][$record->
getId()])) {
59 return self::$record_field_cache[$field->
getId()][$record->
getId()];
60 }
61
63 if (file_exists(
$path)) {
66 $instance = new $class($record, $field);
68 if (!$instance->getFieldRepresentation()) {
69 $instance->setFieldRepresentation(self::getFieldRepresentationInstance($field));
70 }
71
72 if (!$instance->getRecordRepresentation()) {
73 $instance->setRecordRepresentation(self::getRecordRepresentationInstance($instance));
74 }
75 self::$record_field_cache[$field->
getId()][$record->
getId()] = $instance;
76
77 return $instance;
78 }
79 }
80 }
Class ilDclBaseFieldModel.
References $path, getClassByInstance(), getClassPathByInstance(), ilDclBaseFieldModel\getId(), and ilDclBaseRecordModel\getId().
Referenced by ilDclCache\getRecordFieldCache().
◆ getRecordModelInstance()
static ilDclFieldFactory::getRecordModelInstance |
( |
|
$record_id | ) |
|
|
static |
◆ getRecordRepresentationInstance()
◆ parseDatatypeTitle()
static ilDclFieldFactory::parseDatatypeTitle |
( |
|
$title | ) |
|
|
static |
Parse string to FieldClass format Replaces _ with camelcase-notation.
- Parameters
-
- Returns
- string
Definition at line 404 of file class.ilDclFieldFactory.php.
405 {
406 $parts = explode(
"_",
$title);
407 $func = function ($value) {
408 return ucfirst($value);
409 };
410
411 $parts = array_map($func, $parts);
412 $title = implode(
"", $parts);
413
415 }
References $title.
◆ $class_path_cache
ilDclFieldFactory::$class_path_cache = array() |
|
staticprotected |
◆ $default_prefix
ilDclFieldFactory::$default_prefix = "ilDcl" |
|
static |
◆ $field_base_path_patter
ilDclFieldFactory::$field_base_path_patter = "./Modules/DataCollection/classes/Fields/%s/" |
|
static |
◆ $field_class_cache
ilDclFieldFactory::$field_class_cache = array() |
|
staticprotected |
◆ $field_class_patter
ilDclFieldFactory::$field_class_patter = "%sFieldModel" |
|
static |
◆ $field_model_cache
ilDclFieldFactory::$field_model_cache = array() |
|
staticprotected |
◆ $field_representation_cache
ilDclFieldFactory::$field_representation_cache = array() |
|
staticprotected |
◆ $field_representation_class_pattern
ilDclFieldFactory::$field_representation_class_pattern = "%sFieldRepresentation" |
|
static |
◆ $field_type_cache
ilDclFieldFactory::$field_type_cache = array() |
|
staticprotected |
◆ $record_class_patter
ilDclFieldFactory::$record_class_patter = "%sRecordModel" |
|
static |
◆ $record_field_cache
ilDclFieldFactory::$record_field_cache = array() |
|
staticprotected |
◆ $record_field_class_patter
ilDclFieldFactory::$record_field_class_patter = "%sRecordFieldModel" |
|
static |
◆ $record_representation_cache
ilDclFieldFactory::$record_representation_cache = array() |
|
staticprotected |
◆ $record_representation_class_pattern
ilDclFieldFactory::$record_representation_class_pattern = "%sRecordRepresentation" |
|
static |
The documentation for this class was generated from the following file: