ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Available.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Sabre\VObject;
6 
18 
31  function getEffectiveStartEnd() {
32 
33  $effectiveStart = $this->DTSTART->getDateTime();
34  if (isset($this->DTEND)) {
35  $effectiveEnd = $this->DTEND->getDateTime();
36  } else {
37  $effectiveEnd = $effectiveStart->add(VObject\DateTimeParser::parseDuration($this->DURATION));
38  }
39 
40  return [$effectiveStart, $effectiveEnd];
41 
42  }
43 
59  function getValidationRules() {
60 
61  return [
62  'UID' => 1,
63  'DTSTART' => 1,
64  'DTSTAMP' => 1,
65 
66  'DTEND' => '?',
67  'DURATION' => '?',
68 
69  'CREATED' => '?',
70  'DESCRIPTION' => '?',
71  'LAST-MODIFIED' => '?',
72  'RECURRENCE-ID' => '?',
73  'RRULE' => '?',
74  'SUMMARY' => '?',
75 
76  'CATEGORIES' => '*',
77  'COMMENT' => '*',
78  'CONTACT' => '*',
79  'EXDATE' => '*',
80  'RDATE' => '*',
81 
82  'AVAILABLE' => '*',
83  ];
84 
85  }
86 
111  function validate($options = 0) {
112 
113  $result = parent::validate($options);
114 
115  if (isset($this->DTEND) && isset($this->DURATION)) {
116  $result[] = [
117  'level' => 3,
118  'message' => 'DTEND and DURATION cannot both be present',
119  'node' => $this
120  ];
121  }
122 
123  return $result;
124 
125  }
126 }
$result
The Available sub-component.
Definition: Available.php:17
getEffectiveStartEnd()
Returns the &#39;effective start&#39; and &#39;effective end&#39; of this VAVAILABILITY component.
Definition: Available.php:31
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
validate($options=0)
Validates the node for correctness.
Definition: Available.php:111