Definition at line 21 of file class.ilDclFieldFactory.php.
 
◆ getClassByInstance()
  
  
      
        
          | static ilDclFieldFactory::getClassByInstance  | 
          ( | 
          ilDclBaseFieldModel  | 
          $field,  | 
         
        
           | 
           | 
          string  | 
          $class_pattern  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 243 of file class.ilDclFieldFactory.php.
  245         $fieldtype = self::getFieldTypeByInstance($field);
   247         return self::getFieldClass($fieldtype, $class_pattern);
  
 
 
◆ getClassPathByInstance()
  
  
      
        
          | static ilDclFieldFactory::getClassPathByInstance  | 
          ( | 
          ilDclBaseFieldModel  | 
          $field,  | 
         
        
           | 
           | 
          string  | 
          $class_pattern  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
- Exceptions
 - 
  
  
 
Definition at line 255 of file class.ilDclFieldFactory.php.
References $DIC, ilDclBaseFieldModel\getDatatype(), ilDclBaseFieldModel\getDatatypeId(), ilDclBaseFieldModel\getId(), ilDclFieldTypePlugin\getPluginId(), ilDclDatatype\INPUTFORMAT_FILEUPLOAD, and ilDclFieldTypePlugin\isPluginDatatype().
  260         if ($field->
getId() != null && !empty(self::$class_path_cache[$field->
getId()][$class_pattern])) {
   261             return self::$class_path_cache[$field->
getId()][$class_pattern];
   266             if ($DIC[
"component.repository"]->hasActivatedPlugin($plugin_id)) {
   267                 $class_path = $DIC[
"component.repository"]->getPluginById($plugin_id)->getPath() . 
'/classes/';
   275             $class_path = sprintf(
   276                 self::$field_base_path_patter,
   277                 ucfirst(self::parseDatatypeTitle(
'Fileupload'))
   280             $class_name = sprintf(
   281                 'class.' . self::$default_prefix . 
'%s.php',
   284                     ucfirst(
'Fileupload'),
   288             $return = $class_path . $class_name;
   289             if ($field->
getId() != null) {
   290                 self::$class_path_cache[$field->
getId()][$class_pattern] = $return;
   295             $class_path = sprintf(
   296                 self::$field_base_path_patter,
   297                 ucfirst(self::parseDatatypeTitle($datatype->getTitle()))
   301         $return = $class_path . self::getFieldClassFile(self::getFieldTypeByInstance($field), $class_pattern);
   303         if ($field->
getId() != null) {
   304             self::$class_path_cache[$field->
getId()][$class_pattern] = $return;
 
static isPluginDatatype(string $datatype)
 
static getPluginId(string $datatype)
 
const INPUTFORMAT_FILEUPLOAD
 
getDatatypeId()
Get datatype_id. 
 
 
 
 
◆ getFieldClass()
  
  
      
        
          | static ilDclFieldFactory::getFieldClass  | 
          ( | 
          string  | 
          $datatype,  | 
         
        
           | 
           | 
          string  | 
          $class_pattern  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Concatenates Classname from datatype and pattern. 
Definition at line 72 of file class.ilDclFieldFactory.php.
   74         if (!empty(self::$field_class_cache[$datatype . $class_pattern])) {
    75             return self::$field_class_cache[$datatype . $class_pattern];
    78         $fieldtype = $datatype;
    80         $class = sprintf($class_pattern, $fieldtype);
    81         self::$field_class_cache[$datatype . $class_pattern] = $class;
  
 
 
◆ getFieldClassFile()
  
  
      
        
          | static ilDclFieldFactory::getFieldClassFile  | 
          ( | 
          string  | 
          $datatype,  | 
         
        
           | 
           | 
          string  | 
          $class_pattern  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ getFieldModelInstance()
  
  
      
        
          | static ilDclFieldFactory::getFieldModelInstance  | 
          ( | 
          int  | 
          $field_id,  | 
         
        
           | 
           | 
          ?int  | 
          $datatype = null  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
◆ 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.
References ilDclBaseFieldModel\getDatatypeId(), and ilDclBaseFieldModel\getId().
Referenced by ilDclCache\buildFieldFromRecord(), ilDclFieldEditGUI\checkInput(), and ilDclFieldEditGUI\initForm().
  183         if ($field->
getId() != null && !empty(self::$field_model_cache[$field->
getId()])) {
   184             return self::$field_model_cache[$field->
getId()];
   187         $path_type = self::getClassPathByInstance($field, self::$field_class_patter);
   189         if (file_exists($path_type)) {
   190             $class = self::getClassByInstance($field, self::$field_class_patter);
   192             $class = self::getFieldClass(self::$default_prefix . 
"Base", self::$field_class_patter);
   196             $instance = 
new $class($field_id);
   198             $instance = 
new $class();
   201         if ($instance == null) {
   202             throw new ilDclException(
"Could not create FieldModel of " . $class);
   206         if ($field->
getId() != null) {
   207             self::$field_model_cache[$field->
getId()] = $instance;
 
getDatatypeId()
Get datatype_id. 
 
 
 
 
◆ getFieldRepresentationInstance()
◆ getFieldTypeByInstance()
◆ getPluginNameFromFieldModel()
Definition at line 330 of file class.ilDclFieldFactory.php.
  332         $class_name = get_class($object);
   333         return substr($class_name, 2, -(strlen(self::$field_class_patter) - 2));
  
 
 
◆ 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 38 of file class.ilDclFieldFactory.php.
References $path.
Referenced by ilDclCache\getRecordFieldCache().
   40         if (!empty(self::$record_field_cache[$field->getId()][$record->getId()])) {
    41             return self::$record_field_cache[$field->getId()][$record->getId()];
    44         $path = self::getClassPathByInstance($field, self::$record_field_class_patter);
    45         if (file_exists(
$path)) {
    46             $class = self::getClassByInstance($field, self::$record_field_class_patter);
    47             $instance = 
new $class($record, $field);
    49                 if (!$instance->getFieldRepresentation()) {
    50                     $instance->setFieldRepresentation(self::getFieldRepresentationInstance($field));
    53                 if (!$instance->getRecordRepresentation()) {
    54                     $instance->setRecordRepresentation(self::getRecordRepresentationInstance($instance));
    56                 self::$record_field_cache[$field->getId()][$record->getId()] = $instance;
    61             throw new RuntimeException(
"instance is no base field " . $instance->getField()->getTitle());
 
 
 
 
◆ getRecordModelInstance()
  
  
      
        
          | static ilDclFieldFactory::getRecordModelInstance  | 
          ( | 
          ?int  | 
          $record_id | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
◆ getRecordRepresentationInstance()
Get RecordRepresentation from RecordFieldModel. 
- Exceptions
 - 
  
  
 
Definition at line 126 of file class.ilDclFieldFactory.php.
References ilDclBaseRecordFieldModel\getField(), and ilDclBaseRecordFieldModel\getId().
Referenced by ilDclRecordEditGUI\cancelSave(), and ilDclCache\getRecordRepresentation().
  130         if ($record_field->
getId() != null && !empty(self::$record_representation_cache[$record_field->
getId()])) {
   131             return self::$record_representation_cache[$record_field->
getId()];
   134         $class_path = self::getClassPathByInstance(
   136             self::$record_representation_class_pattern
   139         if (file_exists($class_path)) {
   140             $class = self::getClassByInstance($record_field->
getField(), self::$record_representation_class_pattern);
   142             $class = self::getFieldClass(self::$default_prefix . 
"Base", self::$record_representation_class_pattern);
   145         $instance = 
new $class($record_field);
   147         if ($instance == null) {
   148             throw new ilDclException(
"Could not create RecordRepresentation of " . $class_path . 
" " . $record_field->
getField()->getDatatype()->getTitle());
   151         if ($record_field->
getId() != null) {
   152             self::$record_representation_cache[$record_field->
getId()] = $instance;
 
 
 
 
◆ parseDatatypeTitle()
  
  
      
        
          | static ilDclFieldFactory::parseDatatypeTitle  | 
          ( | 
          string  | 
          $title | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Parse string to FieldClass format Replaces _ with camelcase-notation. 
Definition at line 314 of file class.ilDclFieldFactory.php.
References $parts.
  316         $parts = explode(
"_", $title);
   317         $func = 
function ($value) {
   318             return ucfirst($value);
   322         return implode(
"", 
$parts);
 if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
 
 
 
 
◆ $class_path_cache
  
  
      
        
          | array ilDclFieldFactory::$class_path_cache = [] | 
         
       
   | 
  
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 = [] | 
         
       
   | 
  
staticprotected   | 
  
 
 
◆ $field_class_patter
  
  
      
        
          | string ilDclFieldFactory::$field_class_patter = "%sFieldModel" | 
         
       
   | 
  
static   | 
  
 
 
◆ $field_model_cache
  
  
      
        
          | array ilDclFieldFactory::$field_model_cache = [] | 
         
       
   | 
  
staticprotected   | 
  
 
 
◆ $field_representation_cache
  
  
      
        
          | array ilDclFieldFactory::$field_representation_cache = [] | 
         
       
   | 
  
staticprotected   | 
  
 
 
◆ $field_representation_class_pattern
  
  
      
        
          | string ilDclFieldFactory::$field_representation_class_pattern = "%sFieldRepresentation" | 
         
       
   | 
  
static   | 
  
 
 
◆ $field_type_cache
  
  
      
        
          | array ilDclFieldFactory::$field_type_cache = [] | 
         
       
   | 
  
staticprotected   | 
  
 
 
◆ $record_field_cache
  
  
      
        
          | array ilDclFieldFactory::$record_field_cache = [] | 
         
       
   | 
  
staticprotected   | 
  
 
 
◆ $record_field_class_patter
  
  
      
        
          | string ilDclFieldFactory::$record_field_class_patter = "%sRecordFieldModel" | 
         
       
   | 
  
static   | 
  
 
 
◆ $record_representation_cache
  
  
      
        
          | array ilDclFieldFactory::$record_representation_cache = [] | 
         
       
   | 
  
staticprotected   | 
  
 
 
◆ $record_representation_class_pattern
  
  
      
        
          | string ilDclFieldFactory::$record_representation_class_pattern = "%sRecordRepresentation" | 
         
       
   | 
  
static   | 
  
 
 
The documentation for this class was generated from the following file: