ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
class.ilDclDatetimeSelectionFieldModel.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  public const PROP_SELECTION_TYPE = 'datetime_selection_type';
24  public const PROP_SELECTION_OPTIONS = 'datetime_selection_options';
25 
26  public function sanitizeOptionValue(string $value): string
27  {
28  return (new ilDateTime(strtotime($value), IL_CAL_UNIX))->get(IL_CAL_FKT_DATE, ilDclDatetimeFieldModel::FORMAT);
29  }
30 
31  public function personalizeOptionValue(string $value, ilObjUser $user): string
32  {
33  $value = parent::personalizeOptionValue($value, $user);
34  return (strtotime($value) === false) ? $value : date($user->getDateTimeFormat()->toString(), strtotime($value));
35  }
36 }
const IL_CAL_UNIX
const IL_CAL_FKT_DATE