ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclDatetimeRecordRepresentation.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
20  public function getHTML($link = true)
21  {
22  global $DIC;
23  $ilUser = $DIC['ilUser'];
24 
25  $value = $this->getRecordField()->getValue();
26  if ($value == '0000-00-00 00:00:00' or !$value) {
27  return $this->lng->txt('no_date');
28  }
29 
30  return $this->formatDate($value, $ilUser->getDateFormat());
31  }
32 
33 
40  protected function formatDate($value, $format)
41  {
42  $timestamp = strtotime($value);
43  switch ($format) {
45  return date("d.m.Y", $timestamp);
47  return date("Y-m-d", $timestamp);
49  return date("m/d/Y", $timestamp);
50  }
51 
52  return $this->lng->txt('no_date');
53  }
54 
55 
63  public function parseFormInput($value)
64  {
65  if (!$value || $value == "-") {
66  return null;
67  }
68 
69  return substr($value, 0, -9);
70  }
71 }
parseFormInput($value)
function parses stored value to the variable needed to fill into the form for editing.
$format
Definition: metadata.php:141
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
getHTML($link=true)
Outputs html of a certain field.
Class ilDclBaseRecordRepresentation.
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
Class ilDclDateTimeRecordRepresentation.