ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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}
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseRecordRepresentation.
getHTML($link=true)
Outputs html of a certain field.
parseFormInput($value)
function parses stored value to the variable needed to fill into the form for editing.
$format
Definition: metadata.php:218
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46