ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ScheduleCalendarTransp.php
Go to the documentation of this file.
1 <?php
2 
4 
10 
27 class ScheduleCalendarTransp implements Element {
28 
29  const TRANSPARENT = 'transparent';
30  const OPAQUE = 'opaque';
31 
37  protected $value;
38 
44  function __construct($value) {
45 
46  if ($value !== self::TRANSPARENT && $value !== self::OPAQUE) {
47  throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"');
48  }
49  $this->value = $value;
50 
51  }
52 
58  function getValue() {
59 
60  return $this->value;
61 
62  }
63 
83  function xmlSerialize(Writer $writer) {
84 
85  switch ($this->value) {
86  case self::TRANSPARENT :
87  $writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
88  break;
89  case self::OPAQUE :
90  $writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
91  break;
92  }
93 
94  }
95 
117  static function xmlDeserialize(Reader $reader) {
118 
119  $elems = Deserializer\enum($reader, Plugin::NS_CALDAV);
120 
121  if (in_array('transparent', $elems)) {
122  $value = self::TRANSPARENT;
123  } else {
124  $value = self::OPAQUE;
125  }
126  return new self($value);
127 
128  }
129 
130 }
enum(Reader $reader, $namespace=null)
The &#39;enum&#39; deserializer parses elements into a simple list without values or attributes.
Definition: functions.php:140
iCalendar/vCard/jCal/jCard/xCal/xCard reader object.
Definition: Reader.php:15
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
This is the XML element interface.
Definition: Element.php:18
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33
writeElement($name, $content=null)
Write a full element tag and it&#39;s contents.
Definition: Writer.php:189
The XML Writer class.
Definition: Writer.php:31