ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilDclDatetimeRecordFieldModel.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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('Y-m-d', strtotime($value));
37  } else {
38  return "";
39  }
40  }
41 
46  public function parseExportValue($value): ?string
47  {
48  return (new ilDate($value, IL_CAL_DATE))->get(IL_CAL_DATE);
49  }
50 
55  public function parseSortingValue($value, bool $link = true): ?int
56  {
57  return strtotime($value);
58  }
59 
60  public function getFormulaValue(): string
61  {
62  // getValue returns the field value, but in this case it is formatted. For the calculations in Formelns the value is needed as Unix timestamp (as string).
63  $value = $this->getValue();
64  return (string) strtotime($value ? $value : '');
65  }
66 }
parseSortingValue($value, bool $link=true)
Returns sortable value for the specific field-types.
getValueFromExcel(ilExcel $excel, int $row, int $col)
const IL_CAL_DATE
parseExportValue($value)
Function to parse incoming data from form input value $value.