ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SystemStatus.php
Go to the documentation of this file.
1<?php
2
4
7
19
20 const TYPE_LOW = 1;
21 const TYPE_MEDIUM = 2;
22 const TYPE_HIGH = 3;
23
29 protected $id;
30
36 protected $type;
37
43 protected $description;
44
50 protected $href;
51
57 protected $etag;
58
71 function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null) {
72
73 $this->id = $id;
74 $this->type = $type;
75 $this->description = $description;
76 $this->href = $href;
77 $this->etag = $etag;
78
79 }
80
96 function xmlSerialize(Writer $writer) {
97
98 switch ($this->type) {
99 case self::TYPE_LOW :
100 $type = 'low';
101 break;
102 case self::TYPE_MEDIUM :
103 $type = 'medium';
104 break;
105 default :
106 case self::TYPE_HIGH :
107 $type = 'high';
108 break;
109 }
110
111 $writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}systemstatus');
112 $writer->writeAttribute('type', $type);
113 $writer->endElement();
114
115 }
116
124 function xmlSerializeFull(Writer $writer) {
125
126 $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
127 switch ($this->type) {
128 case self::TYPE_LOW :
129 $type = 'low';
130 break;
131 case self::TYPE_MEDIUM :
132 $type = 'medium';
133 break;
134 default :
135 case self::TYPE_HIGH :
136 $type = 'high';
137 break;
138 }
139
140 $writer->startElement($cs . 'systemstatus');
141 $writer->writeAttribute('type', $type);
142
143
144 if ($this->description) {
145 $writer->writeElement($cs . 'description', $this->description);
146 }
147 if ($this->href) {
148 $writer->writeElement('{DAV:}href', $this->href);
149 }
150
151 $writer->endElement(); // systemstatus
152
153 }
154
163 function getId() {
164
165 return $this->id;
166
167 }
168
169 /*
170 * Returns the ETag for this notification.
171 *
172 * The ETag must be surrounded by literal double-quotes.
173 *
174 * @return string
175 */
176 function getETag() {
177
178 return $this->etag;
179
180 }
181
182}
An exception for terminatinating execution or to throw for unit testing.
CalDAV plugin.
Definition: Plugin.php:28
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
Definition: Plugin.php:38
getId()
Returns a unique id for this notification.
__construct($id, $etag, $type=self::TYPE_HIGH, $description=null, $href=null)
Creates the notification.
xmlSerialize(Writer $writer)
The serialize method is called during xml writing.
getETag()
Returns the ETag for this notification.
xmlSerializeFull(Writer $writer)
This method serializes the entire notification, as it is used in the response body.
The XML Writer class.
Definition: Writer.php:31
writeAttribute($name, $value)
Writes a new attribute.
Definition: Writer.php:230
writeElement($name, $content=null)
Write a full element tag and it's contents.
Definition: Writer.php:189
startElement($name)
Opens a new element.
Definition: Writer.php:121
This interface reflects a single notification type.