ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclDatetimeRecordFieldModel.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
26 public function parseValue($value): string
27 {
28 return (string) $value;
29 }
30
31 public function getValueFromExcel(ilExcel $excel, int $row, int $col): ?string
32 {
33 $value = parent::getValueFromExcel($excel, $row, $col);
34
35 if ($value) {
36 return date(ilDclDatetimeFieldModel::FORMAT, strtotime($value));
37 } else {
38 return "";
39 }
40 }
41
46 public function setValueFromForm(ilPropertyFormGUI $form): void
47 {
48 parent::setValueFromForm($form);
49 $date = new ilDateTime(strtotime($this->getValue()), IL_CAL_UNIX);
50 $this->setValue($date->get(IL_CAL_FKT_DATE, ilDclDatetimeFieldModel::FORMAT, $this->user->getTimeZone()));
51 }
52
56 public function parseSortingValue($value, bool $link = true): ?int
57 {
58 return strtotime($value);
59 }
60
61 public function getFormulaValue(): string
62 {
63 return (string) strtotime($this->getValue() ?: '');
64 }
65}
const IL_CAL_UNIX
const IL_CAL_FKT_DATE
@classDescription Date and time handling
setValue($value, bool $omit_parsing=false)
Set value for record field.
getValueFromExcel(ilExcel $excel, int $row, int $col)
setValueFromForm(ilPropertyFormGUI $form)
This value should be UTC but the current ilDateTimeInputGUI enforces the users timezone on an input.
This class represents a property form user interface.