1 | <?php |
||
17 | class Calendar extends Component |
||
18 | { |
||
19 | /** |
||
20 | * Methods for calendar components. |
||
21 | * |
||
22 | * According to RFP 5545: 3.7.2. Method |
||
23 | * |
||
24 | * @link http://tools.ietf.org/html/rfc5545#section-3.7.2 |
||
25 | * |
||
26 | * And then according to RFC 2446: 3 APPLICATION PROTOCOL ELEMENTS |
||
27 | * @link https://www.ietf.org/rfc/rfc2446.txt |
||
28 | */ |
||
29 | const METHOD_PUBLISH = 'PUBLISH'; |
||
30 | const METHOD_REQUEST = 'REQUEST'; |
||
31 | const METHOD_REPLY = 'REPLY'; |
||
32 | const METHOD_ADD = 'ADD'; |
||
33 | const METHOD_CANCEL = 'CANCEL'; |
||
34 | const METHOD_REFRESH = 'REFRESH'; |
||
35 | const METHOD_COUNTER = 'COUNTER'; |
||
36 | const METHOD_DECLINECOUNTER = 'DECLINECOUNTER'; |
||
37 | |||
38 | /** |
||
39 | * This property defines the calendar scale used for the calendar information specified in the iCalendar object. |
||
40 | * |
||
41 | * According to RFC 5545: 3.7.1. Calendar Scale |
||
42 | * |
||
43 | * @link http://tools.ietf.org/html/rfc5545#section-3.7 |
||
44 | */ |
||
45 | const CALSCALE_GREGORIAN = 'GREGORIAN'; |
||
46 | |||
47 | /** |
||
48 | * The Product Identifier. |
||
49 | * |
||
50 | * According to RFC 2445: 4.7.3 Product Identifier |
||
51 | * |
||
52 | * This property specifies the identifier for the product that created the Calendar object. |
||
53 | * |
||
54 | * @link http://www.ietf.org/rfc/rfc2445.txt |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $prodId = null; |
||
59 | protected $method = null; |
||
60 | protected $name = null; |
||
61 | protected $description = null; |
||
62 | protected $timezone = null; |
||
63 | |||
64 | /** |
||
65 | * This property defines the calendar scale used for the |
||
66 | * calendar information specified in the iCalendar object. |
||
67 | * |
||
68 | * Also identifies the calendar type of a non-Gregorian recurring appointment. |
||
69 | * |
||
70 | * @var string |
||
71 | * |
||
72 | * @see http://tools.ietf.org/html/rfc5545#section-3.7 |
||
73 | * @see http://msdn.microsoft.com/en-us/library/ee237520(v=exchg.80).aspx |
||
74 | */ |
||
75 | protected $calendarScale = null; |
||
76 | |||
77 | /** |
||
78 | * Specifies whether or not the iCalendar file only contains one appointment. |
||
79 | * |
||
80 | * @var bool |
||
81 | * |
||
82 | * @see http://msdn.microsoft.com/en-us/library/ee203486(v=exchg.80).aspx |
||
83 | */ |
||
84 | protected $forceInspectOrOpen = false; |
||
85 | |||
86 | /** |
||
87 | * Specifies a globally unique identifier for the calendar. |
||
88 | * |
||
89 | * @var string |
||
90 | * |
||
91 | * @see http://msdn.microsoft.com/en-us/library/ee179588(v=exchg.80).aspx |
||
92 | */ |
||
93 | protected $calId = null; |
||
94 | |||
95 | /** |
||
96 | * Specifies a suggested iCalendar file download frequency for clients and |
||
97 | * servers with sync capabilities. |
||
98 | * |
||
99 | * @var string |
||
100 | * |
||
101 | * @see http://msdn.microsoft.com/en-us/library/ee178699(v=exchg.80).aspx |
||
102 | */ |
||
103 | protected $publishedTTL = 'P1W'; |
||
104 | |||
105 | /** |
||
106 | * Specifies a color for the calendar in calendar for Apple/Outlook. |
||
107 | * |
||
108 | * @var string |
||
109 | * |
||
110 | * @see http://msdn.microsoft.com/en-us/library/ee179588(v=exchg.80).aspx |
||
111 | */ |
||
112 | protected $calendarColor = null; |
||
113 | |||
114 | 4 | public function __construct($prodId) |
|
115 | { |
||
116 | 4 | if (empty($prodId)) { |
|
117 | throw new \UnexpectedValueException('PRODID cannot be empty'); |
||
118 | } |
||
119 | |||
120 | 4 | $this->prodId = $prodId; |
|
121 | 4 | } |
|
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | 4 | public function getType() |
|
130 | |||
131 | /** |
||
132 | * @param $method |
||
133 | * |
||
134 | * @return $this |
||
135 | */ |
||
136 | public function setMethod($method) |
||
142 | |||
143 | /** |
||
144 | * @param $name |
||
145 | * |
||
146 | * @return $this |
||
147 | */ |
||
148 | public function setName($name) |
||
154 | |||
155 | /** |
||
156 | * @param $description |
||
157 | * |
||
158 | * @return $this |
||
159 | */ |
||
160 | public function setDescription($description) |
||
166 | |||
167 | /** |
||
168 | * @param $timezone |
||
169 | * |
||
170 | * @return $this |
||
171 | */ |
||
172 | public function setTimezone($timezone) |
||
178 | |||
179 | /** |
||
180 | * @param $calendarColor |
||
181 | * |
||
182 | * @return $this |
||
183 | */ |
||
184 | public function setCalendarColor($calendarColor) |
||
190 | |||
191 | /** |
||
192 | * @param $calendarScale |
||
193 | * |
||
194 | * @return $this |
||
195 | */ |
||
196 | public function setCalendarScale($calendarScale) |
||
202 | |||
203 | /** |
||
204 | * @param bool $forceInspectOrOpen |
||
205 | * |
||
206 | * @return $this |
||
207 | */ |
||
208 | public function setForceInspectOrOpen($forceInspectOrOpen) |
||
214 | |||
215 | /** |
||
216 | * @param string $calId |
||
217 | * |
||
218 | * @return $this |
||
219 | */ |
||
220 | public function setCalId($calId) |
||
226 | |||
227 | /** |
||
228 | * @param string $ttl |
||
229 | * |
||
230 | * @return $this |
||
231 | */ |
||
232 | public function setPublishedTTL($ttl) |
||
238 | |||
239 | /** |
||
240 | * {@inheritdoc} |
||
241 | */ |
||
242 | 4 | public function buildPropertyBag() |
|
295 | |||
296 | /** |
||
297 | * Adds an Event to the Calendar. |
||
298 | * |
||
299 | * Wrapper for addComponent() |
||
300 | * |
||
301 | * @see Eluceo\iCal::addComponent |
||
302 | * @deprecated Please, use public method addComponent() from abstract Component class |
||
303 | * |
||
304 | * @param Event $event |
||
305 | */ |
||
306 | public function addEvent(Event $event) |
||
310 | |||
311 | /** |
||
312 | * @return null|string |
||
313 | */ |
||
314 | public function getProdId() |
||
318 | |||
319 | public function getMethod() |
||
323 | } |
||
324 |