ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilCmiXapiDateDurationInputGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
16 {
17  public function getValue()
18  {
19  $duration = array();
20 
21  if ($this->getStart() instanceof ilDateTime) {
22  $duration['start'] = $this->getStart()->get(IL_CAL_UNIX);
23  }
24 
25  if ($this->getEnd() instanceof ilDateTime) {
26  $duration['end'] = $this->getEnd()->get(IL_CAL_UNIX);
27  }
28 
29  return $duration;
30  }
31 
35  public function getStartXapiDateTime()
36  {
37  if ($this->getStart() instanceof ilDateTime) {
38  try {
39  $xapiDateTime = ilCmiXapiDateTime::fromIliasDateTime($this->getStart());
40  } catch (ilDateTimeException $e) {
41  return null;
42  }
43  }
44 
45  return $xapiDateTime;
46  }
47 
51  public function getEndXapiDateTime()
52  {
53  if ($this->getEnd() instanceof ilDateTime) {
54  try {
55  $xapiDateTime = ilCmiXapiDateTime::fromIliasDateTime($this->getEnd());
56  } catch (ilDateTimeException $e) {
57  return null;
58  }
59  }
60 
61  return $xapiDateTime;
62  }
63 }
Class for DateTime exceptions.
const IL_CAL_UNIX
input GUI for a time span (start and end date)
static fromIliasDateTime(ilDateTime $dateTime)