1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the eluceo/iCal package. |
5
|
|
|
* |
6
|
|
|
* (c) Markus Poerschke <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Eluceo\iCal\Component; |
13
|
|
|
|
14
|
|
|
use Eluceo\iCal\Component; |
15
|
|
|
use Eluceo\iCal\PropertyBag; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Implementation of the VALARM component. |
19
|
|
|
*/ |
20
|
|
|
class Alarm extends Component |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Alarm ACTION property. |
24
|
|
|
* |
25
|
|
|
* According to RFC 5545: 3.8.6.1. Action |
26
|
|
|
* |
27
|
|
|
* @see http://tools.ietf.org/html/rfc5545#section-3.8.6.1 |
28
|
|
|
*/ |
29
|
|
|
const ACTION_AUDIO = 'AUDIO'; |
30
|
|
|
const ACTION_DISPLAY = 'DISPLAY'; |
31
|
|
|
const ACTION_EMAIL = 'EMAIL'; |
32
|
|
|
|
33
|
|
|
protected $action; |
34
|
|
|
protected $repeat; |
35
|
|
|
protected $duration; |
36
|
|
|
protected $description; |
37
|
|
|
protected $attendee; |
38
|
|
|
protected $trigger; |
39
|
|
|
|
40
|
1 |
|
public function getType() |
41
|
|
|
{ |
42
|
1 |
|
return 'VALARM'; |
43
|
|
|
} |
44
|
|
|
|
45
|
1 |
|
public function getAction() |
46
|
|
|
{ |
47
|
1 |
|
return $this->action; |
48
|
|
|
} |
49
|
|
|
|
50
|
1 |
|
public function getRepeat() |
51
|
|
|
{ |
52
|
1 |
|
return $this->repeat; |
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
public function getDuration() |
56
|
|
|
{ |
57
|
1 |
|
return $this->duration; |
58
|
|
|
} |
59
|
|
|
|
60
|
1 |
|
public function getDescription() |
61
|
|
|
{ |
62
|
1 |
|
return $this->description; |
63
|
|
|
} |
64
|
|
|
|
65
|
1 |
|
public function getAttendee() |
66
|
|
|
{ |
67
|
1 |
|
return $this->attendee; |
68
|
|
|
} |
69
|
|
|
|
70
|
1 |
|
public function getTrigger() |
71
|
|
|
{ |
72
|
1 |
|
return $this->trigger; |
73
|
|
|
} |
74
|
|
|
|
75
|
2 |
|
public function setAction($action) |
76
|
|
|
{ |
77
|
2 |
|
$this->action = $action; |
78
|
|
|
|
79
|
2 |
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
1 |
|
public function setRepeat($repeat) |
83
|
|
|
{ |
84
|
1 |
|
$this->repeat = $repeat; |
85
|
|
|
|
86
|
1 |
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
1 |
|
public function setDuration($duration) |
90
|
|
|
{ |
91
|
1 |
|
$this->duration = $duration; |
92
|
|
|
|
93
|
1 |
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
2 |
|
public function setDescription($description) |
97
|
|
|
{ |
98
|
2 |
|
$this->description = $description; |
99
|
|
|
|
100
|
2 |
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
1 |
|
public function setAttendee($attendee) |
104
|
|
|
{ |
105
|
1 |
|
$this->attendee = $attendee; |
106
|
|
|
|
107
|
1 |
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
2 |
|
public function setTrigger($trigger) |
111
|
|
|
{ |
112
|
2 |
|
$this->trigger = $trigger; |
113
|
|
|
|
114
|
2 |
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* {@inheritdoc} |
119
|
|
|
*/ |
120
|
7 |
|
public function buildPropertyBag() |
121
|
|
|
{ |
122
|
7 |
|
$propertyBag = new PropertyBag(); |
123
|
|
|
|
124
|
7 |
|
if (null != $this->trigger) { |
125
|
2 |
|
$propertyBag->set('TRIGGER', $this->trigger); |
126
|
|
|
} |
127
|
|
|
|
128
|
7 |
|
if (null != $this->action) { |
129
|
2 |
|
$propertyBag->set('ACTION', $this->action); |
130
|
|
|
} |
131
|
|
|
|
132
|
7 |
|
if (null != $this->repeat) { |
133
|
1 |
|
$propertyBag->set('REPEAT', $this->repeat); |
134
|
|
|
} |
135
|
|
|
|
136
|
7 |
|
if (null != $this->duration) { |
137
|
1 |
|
$propertyBag->set('DURATION', $this->duration); |
138
|
|
|
} |
139
|
|
|
|
140
|
7 |
|
if (null != $this->description) { |
141
|
2 |
|
$propertyBag->set('DESCRIPTION', $this->description); |
142
|
|
|
} |
143
|
|
|
|
144
|
7 |
|
if (null != $this->attendee) { |
145
|
1 |
|
$propertyBag->set('ATTENDEE', $this->attendee); |
146
|
|
|
} |
147
|
|
|
|
148
|
7 |
|
return $propertyBag; |
149
|
|
|
} |
150
|
|
|
} |
151
|
|
|
|