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