1: <?php
2: /**
3: * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (LGPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
7: *
8: * @package Alarm
9: */
10:
11: /**
12: * Null Alarm driver.
13: *
14: * @author Jan Schneider <jan@horde.org>
15: * @package Alarm
16: */
17: class Horde_Alarm_Null extends Horde_Alarm
18: {
19: /**
20: * Returns a list of alarms from the backend.
21: *
22: * @param Horde_Date $time The time when the alarms should be active.
23: * @param string $user Return alarms for this user, all users if
24: * null, or global alarms if empty.
25: *
26: * @return array A list of alarm hashes.
27: * @throws Horde_Alarm_Exception
28: */
29: protected function _list($user, Horde_Date $time)
30: {
31: return array();
32: }
33:
34: /**
35: * Returns a list of all global alarms from the backend.
36: *
37: * @return array A list of alarm hashes.
38: */
39: protected function _global()
40: {
41: return array();
42: }
43:
44: /**
45: * Returns an alarm hash from the backend.
46: *
47: * @param string $id The alarm's unique id.
48: * @param string $user The alarm's user
49: *
50: * @return array An alarm hash.
51: * @throws Horde_Alarm_Exception
52: */
53: protected function _get($id, $user)
54: {
55: throw new Horde_Alarm_Exception('Alarm not found');
56: }
57:
58: /**
59: * Adds an alarm hash to the backend.
60: *
61: * @param array $alarm An alarm hash.
62: *
63: * @throws Horde_Alarm_Exception
64: */
65: protected function _add(array $alarm)
66: {
67: }
68:
69: /**
70: * Updates an alarm hash in the backend.
71: *
72: * @param array $alarm An alarm hash.
73: * @param boolean $keepsnooze Whether to keep the snooze value unchanged.
74: *
75: * @throws Horde_Alarm_Exception
76: */
77: protected function _update(array $alarm, $keepsnooze = false)
78: {
79: }
80:
81: /**
82: * Updates internal alarm properties, i.e. properties not determined by
83: * the application setting the alarm.
84: *
85: * @param string $id The alarm's unique id.
86: * @param string $user The alarm's user
87: * @param array $internal A hash with the internal data.
88: *
89: * @throws Horde_Alarm_Exception
90: */
91: public function internal($id, $user, array $internal)
92: {
93: }
94:
95: /**
96: * Returns whether an alarm with the given id exists already.
97: *
98: * @param string $id The alarm's unique id.
99: * @param string $user The alarm's user
100: *
101: * @return boolean True if the specified alarm exists.
102: * @throws Horde_Alarm_Exception
103: */
104: protected function _exists($id, $user)
105: {
106: return false;
107: }
108:
109: /**
110: * Delays (snoozes) an alarm for a certain period.
111: *
112: * @param string $id The alarm's unique id.
113: * @param string $user The alarm's user
114: * @param Horde_Date $snooze The snooze time.
115: *
116: * @throws Horde_Alarm_Exception
117: */
118: protected function _snooze($id, $user, Horde_Date $snooze)
119: {
120: }
121:
122: /**
123: * Returns whether an alarm is snoozed.
124: *
125: * @param string $id The alarm's unique id.
126: * @param string $user The alarm's user
127: * @param Horde_Date $time The time when the alarm may be snoozed.
128: *
129: * @return boolean True if the alarm is snoozed.
130: * @throws Horde_Alarm_Exception
131: */
132: protected function _isSnoozed($id, $user, Horde_Date $time)
133: {
134: return false;
135: }
136:
137: /**
138: * Dismisses an alarm.
139: *
140: * @param string $id The alarm's unique id.
141: * @param string $user The alarm's user
142: *
143: * @throws Horde_Alarm_Exception
144: */
145: protected function _dismiss($id, $user)
146: {
147: }
148:
149: /**
150: * Deletes an alarm from the backend.
151: *
152: * @param string $id The alarm's unique id.
153: * @param string $user The alarm's user. All users' alarms if null.
154: *
155: * @throws Horde_Alarm_Exception
156: */
157: protected function _delete($id, $user = null)
158: {
159: }
160:
161: /**
162: * Garbage collects old alarms in the backend.
163: *
164: * @throws Horde_Alarm_Exception
165: */
166: protected function _gc()
167: {
168: }
169:
170: /**
171: * Attempts to initialize the backend.
172: *
173: * @throws Horde_Alarm_Exception
174: */
175: public function initialize()
176: {
177: }
178:
179: /**
180: * Converts a value from the driver's charset.
181: *
182: * @param mixed $value Value to convert.
183: *
184: * @return mixed Converted value.
185: */
186: protected function _fromDriver($value)
187: {
188: return $value;
189: }
190:
191: /**
192: * Converts a value to the driver's charset.
193: *
194: * @param mixed $value Value to convert.
195: *
196: * @return mixed Converted value.
197: */
198: protected function _toDriver($value)
199: {
200: return $value;
201: }
202:
203: }
204: