ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclDatetimeSelectionFieldModel.php
Go to the documentation of this file.
1<?php
2
19declare(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
@classDescription Date and time handling
User class.