ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilDclDefaultValueFactory.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  public const STORAGE_LOCATION_MAPPING = [
22  1 => ilDclTableViewTextDefaultValue::class,
23  2 => ilDclTableViewNumberDefaultValue::class,
24  3 => ilDclTableViewDateDefaultValue::class
25  ];
26 
27  public function create(int $data_type_id): ilDclTableViewBaseDefaultValue
28  {
29  $storage_location = ilDclCache::getDatatype($data_type_id)->getStorageLocation();
30  $class = self::STORAGE_LOCATION_MAPPING[$storage_location];
31  return new $class();
32  }
33 
34  public function createByTableName(string $table_name): ilDclTableViewBaseDefaultValue
35  {
36  switch ($table_name) {
38  return new ilDclTableViewTextDefaultValue();
42  default:
43  return new ilDclTableViewDateDefaultValue();
44  }
45  }
46 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getDatatype(int $datatyp_id)
Get cached datatypes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...