This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
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.ilDclFieldFactory.php.
◆ getClassByInstance()
| static ilDclFieldFactory::getClassByInstance |
( |
ilDclBaseFieldModel |
$field, |
|
|
string |
$class_pattern |
|
) |
| |
|
static |
◆ getClassPathByInstance()
| static ilDclFieldFactory::getClassPathByInstance |
( |
ilDclBaseFieldModel |
$field, |
|
|
string |
$class_pattern |
|
) |
| |
|
static |
◆ getFieldClass()
| static ilDclFieldFactory::getFieldClass |
( |
string |
$datatype, |
|
|
string |
$class_pattern |
|
) |
| |
|
static |
Concatenates Classname from datatype and pattern.
Definition at line 68 of file class.ilDclFieldFactory.php.
68 : string
69 {
70 if (!empty(self::$field_class_cache[$datatype . $class_pattern])) {
71 return self::$field_class_cache[$datatype . $class_pattern];
72 }
73
74 $fieldtype = $datatype;
75
76 $class = sprintf($class_pattern, $fieldtype);
77 self::$field_class_cache[$datatype . $class_pattern] = $class;
78
79 return $class;
80 }
Referenced by getFieldClassFile().
◆ getFieldClassFile()
| static ilDclFieldFactory::getFieldClassFile |
( |
string |
$datatype, |
|
|
string |
$class_pattern |
|
) |
| |
|
static |
◆ getFieldModelInstance()
| static ilDclFieldFactory::getFieldModelInstance |
( |
int |
$field_id, |
|
|
?int |
$datatype = null |
|
) |
| |
|
static |
Get FieldModel from field-id and datatype.
- Exceptions
-
Definition at line 160 of file class.ilDclFieldFactory.php.
161 {
163 if ($datatype != null) {
164 $base->setDatatypeId($datatype);
165 }
166
168
169 return $ilDclBaseFieldModel;
170 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 $base.
Referenced by ilDclFieldEditGUI\__construct(), and ilDclCache\getFieldCache().
◆ getFieldModelInstanceByClass()
| static ilDclFieldFactory::getFieldModelInstanceByClass |
( |
ilDclBaseFieldModel |
$field, |
|
|
?int |
$field_id = null |
|
) |
| |
|
static |
Gets the correct instance of a fieldModel class Checks if a field is a plugin a replaces the fieldModel with the necessary class.
- Exceptions
-
Definition at line 179 of file class.ilDclFieldFactory.php.
183 if ($field->
getId() !=
null && !empty(self::$field_model_cache[$field->
getId()])) {
184 return self::$field_model_cache[$field->
getId()];
185 }
186
188
189 if (file_exists($path_type)) {
191 } else {
193 }
194
195 if ($field_id) {
196 $instance = new $class($field_id);
197 } else {
198 $instance = new $class();
199 }
200
201 if ($instance == null) {
202 throw new ilDclException(
"Could not create FieldModel of " . $class);
203 }
205
206 if ($field->
getId() !=
null) {
207 self::$field_model_cache[$field->
getId()] = $instance;
208 }
209
210 return $instance;
211 }
getDatatypeId()
Get datatype_id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getClassByInstance(ilDclBaseFieldModel $field, string $class_pattern)
static getClassPathByInstance(ilDclBaseFieldModel $field, string $class_pattern)
References ilDclBaseFieldModel\getId().
Referenced by ilDclCache\buildFieldFromRecord(), ilDclFieldEditGUI\checkInput(), and ilDclFieldEditGUI\initForm().
◆ getFieldRepresentationInstance()
◆ getFieldTypeByInstance()
Definition at line 215 of file class.ilDclFieldFactory.php.
215 : string
216 {
219
220 if (!empty(self::$field_type_cache[$datatype->getId()])) {
221 return self::$field_type_cache[$datatype->getId()];
222 }
223
226 if (
$DIC[
"component.repository"]->hasActivatedPlugin($plugin_id)) {
227 $fieldtype =
'il' .
$DIC[
"component.repository"]->getPluginById($plugin_id)->getName();
228 } else {
229 $fieldtype = '';
230 }
231 } else {
232 $fieldtype = self::$default_prefix . ucfirst(self::parseDatatypeTitle($datatype->getTitle()));
233 }
234 self::$field_type_cache[$datatype->getId()] = $fieldtype;
235 return $fieldtype;
236 }
References $DIC, ilDclBaseFieldModel\getDatatype(), ilDclFieldTypePlugin\getPluginId(), and ilDclFieldTypePlugin\isPluginDatatype().
◆ getPluginNameFromFieldModel()
Definition at line 304 of file class.ilDclFieldFactory.php.
304 : string
305 {
306 $class_name = get_class($object);
307 $class_name = substr($class_name, 2, -(strlen(self::$field_class_patter) - 2));
308
309 return $class_name;
310 }
◆ getRecordFieldInstance()
| static ilDclFieldFactory::getRecordFieldInstance |
( |
object |
$field, |
|
|
object |
$record |
|
) |
| |
|
static |
Creates a RecordField instance and loads the field and record representation.
- Parameters
-
- Exceptions
-
Definition at line 36 of file class.ilDclFieldFactory.php.
37 {
38 if (!empty(self::$record_field_cache[$field->getId()][$record->getId()])) {
39 return self::$record_field_cache[$field->getId()][$record->getId()];
40 }
41
43 if (file_exists(
$path)) {
45 $instance = new $class($record, $field);
47 if (!$instance->getFieldRepresentation()) {
48 $instance->setFieldRepresentation(self::getFieldRepresentationInstance($field));
49 }
50
51 if (!$instance->getRecordRepresentation()) {
52 $instance->setRecordRepresentation(self::getRecordRepresentationInstance($instance));
53 }
54 self::$record_field_cache[$field->getId()][$record->getId()] = $instance;
55
56 return $instance;
57 }
58 }
59
60 throw new RuntimeException(
"file not found " .
$path);
61 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References $path, getClassByInstance(), and getClassPathByInstance().
Referenced by ilDclCache\getRecordFieldCache().
◆ getRecordModelInstance()
| static ilDclFieldFactory::getRecordModelInstance |
( |
?int |
$record_id | ) |
|
|
static |
◆ getRecordRepresentationInstance()
Get RecordRepresentation from RecordFieldModel.
- Exceptions
-
Definition at line 123 of file class.ilDclFieldFactory.php.
126
127 if ($record_field->
getId() !=
null && !empty(self::$record_representation_cache[$record_field->
getId()])) {
128 return self::$record_representation_cache[$record_field->
getId()];
129 }
130
133 self::$record_representation_class_pattern
134 );
135 $instance = null;
136
137 if (file_exists($class_path)) {
139 } else {
140 $class =
self::getFieldClass(self::$default_prefix .
"Base", self::$record_representation_class_pattern);
141 }
142
143 $instance = new $class($record_field);
144
145 if ($instance == null) {
146 throw new ilDclException(
"Could not create RecordRepresentation of " . $class_path .
" " . $record_field->
getField()->getDatatype()->getTitle());
147 }
148
149 if ($record_field->
getId() !=
null) {
150 self::$record_representation_cache[$record_field->
getId()] = $instance;
151 }
152
153 return $instance;
154 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References ilDclBaseRecordFieldModel\getId().
◆ parseDatatypeTitle()
| static ilDclFieldFactory::parseDatatypeTitle |
( |
string |
$title | ) |
|
|
static |
Parse string to FieldClass format Replaces _ with camelcase-notation.
Definition at line 286 of file class.ilDclFieldFactory.php.
286 : string
287 {
288 $parts = explode(
"_", $title);
289 $func = function ($value) {
290 return ucfirst($value);
291 };
292
294 $title = implode(
"",
$parts);
295
296 return $title;
297 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
References $parts.
◆ $class_path_cache
| array ilDclFieldFactory::$class_path_cache = array() |
|
staticprotected |
◆ $default_prefix
| string ilDclFieldFactory::$default_prefix = "ilDcl" |
|
static |
◆ $field_base_path_patter
| string ilDclFieldFactory::$field_base_path_patter = "./Modules/DataCollection/classes/Fields/%s/" |
|
static |
◆ $field_class_cache
| array ilDclFieldFactory::$field_class_cache = array() |
|
staticprotected |
◆ $field_class_patter
| string ilDclFieldFactory::$field_class_patter = "%sFieldModel" |
|
static |
◆ $field_model_cache
| array ilDclFieldFactory::$field_model_cache = array() |
|
staticprotected |
◆ $field_representation_cache
| array ilDclFieldFactory::$field_representation_cache = array() |
|
staticprotected |
◆ $field_representation_class_pattern
| string ilDclFieldFactory::$field_representation_class_pattern = "%sFieldRepresentation" |
|
static |
◆ $field_type_cache
| array ilDclFieldFactory::$field_type_cache = array() |
|
staticprotected |
◆ $record_field_cache
| array ilDclFieldFactory::$record_field_cache = array() |
|
staticprotected |
◆ $record_field_class_patter
| string ilDclFieldFactory::$record_field_class_patter = "%sRecordFieldModel" |
|
static |
◆ $record_representation_cache
| array ilDclFieldFactory::$record_representation_cache = array() |
|
staticprotected |
◆ $record_representation_class_pattern
| string ilDclFieldFactory::$record_representation_class_pattern = "%sRecordRepresentation" |
|
static |
The documentation for this class was generated from the following file: