ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
VAvailability.php
Go to the documentation of this file.
1 <?php
2 
4 
6 use Sabre\VObject;
7 
19 
35 
36  list($effectiveStart, $effectiveEnd) = $this->getEffectiveStartEnd();
37  return (
38  (is_null($effectiveStart) || $start < $effectiveEnd) &&
39  (is_null($effectiveEnd) || $end > $effectiveStart)
40  );
41 
42  }
43 
56  function getEffectiveStartEnd() {
57 
58  $effectiveStart = null;
59  $effectiveEnd = null;
60 
61  if (isset($this->DTSTART)) {
62  $effectiveStart = $this->DTSTART->getDateTime();
63  }
64  if (isset($this->DTEND)) {
65  $effectiveEnd = $this->DTEND->getDateTime();
66  } elseif ($effectiveStart && isset($this->DURATION)) {
67  $effectiveEnd = $effectiveStart->add(VObject\DateTimeParser::parseDuration($this->DURATION));
68  }
69 
70  return [$effectiveStart, $effectiveEnd];
71 
72  }
73 
74 
90  function getValidationRules() {
91 
92  return [
93  'UID' => 1,
94  'DTSTAMP' => 1,
95 
96  'BUSYTYPE' => '?',
97  'CLASS' => '?',
98  'CREATED' => '?',
99  'DESCRIPTION' => '?',
100  'DTSTART' => '?',
101  'LAST-MODIFIED' => '?',
102  'ORGANIZER' => '?',
103  'PRIORITY' => '?',
104  'SEQUENCE' => '?',
105  'SUMMARY' => '?',
106  'URL' => '?',
107  'DTEND' => '?',
108  'DURATION' => '?',
109 
110  'CATEGORIES' => '*',
111  'COMMENT' => '*',
112  'CONTACT' => '*',
113  ];
114 
115  }
116 
141  function validate($options = 0) {
142 
143  $result = parent::validate($options);
144 
145  if (isset($this->DTEND) && isset($this->DURATION)) {
146  $result[] = [
147  'level' => 3,
148  'message' => 'DTEND and DURATION cannot both be present',
149  'node' => $this
150  ];
151  }
152 
153  return $result;
154 
155  }
156 }
$result
getEffectiveStartEnd()
Returns the &#39;effective start&#39; and &#39;effective end&#39; of this VAVAILABILITY component.
$start
Definition: bench.php:8
validate($options=0)
Validates the node for correctness.
isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
Returns true or false depending on if the event falls in the specified time-range.
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
The VAvailability component.