1 | <?php
|
---|
2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Contains the Calendar_Engine_Interface class (interface)
|
---|
6 | *
|
---|
7 | * PHP versions 4 and 5
|
---|
8 | *
|
---|
9 | * LICENSE: Redistribution and use in source and binary forms, with or without
|
---|
10 | * modification, are permitted provided that the following conditions are met:
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
14 | * notice, this list of conditions and the following disclaimer in the
|
---|
15 | * documentation and/or other materials provided with the distribution.
|
---|
16 | * 3. The name of the author may not be used to endorse or promote products
|
---|
17 | * derived from this software without specific prior written permission.
|
---|
18 | *
|
---|
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
---|
20 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
---|
21 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
22 | * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
|
---|
23 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
---|
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
29 | *
|
---|
30 | * @category Date and Time
|
---|
31 | * @package Calendar
|
---|
32 | * @author Harry Fuecks <hfuecks@phppatterns.com>
|
---|
33 | * @author Lorenzo Alberton <l.alberton@quipo.it>
|
---|
34 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
---|
35 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
---|
36 | * @version CVS: $Id: Interface.php 269074 2008-11-15 21:21:42Z quipo $
|
---|
37 | * @link http://pear.php.net/package/Calendar
|
---|
38 | */
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * The methods the classes implementing the Calendar_Engine must implement.
|
---|
42 | * Note this class is not used but simply to help development
|
---|
43 | *
|
---|
44 | * @category Date and Time
|
---|
45 | * @package Calendar
|
---|
46 | * @author Harry Fuecks <hfuecks@phppatterns.com>
|
---|
47 | * @author Lorenzo Alberton <l.alberton@quipo.it>
|
---|
48 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
---|
49 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
---|
50 | * @link http://pear.php.net/package/Calendar
|
---|
51 | * @access protected
|
---|
52 | */
|
---|
53 | class Calendar_Engine_Interface
|
---|
54 | {
|
---|
55 | /**
|
---|
56 | * Provides a mechansim to make sure parsing of timestamps
|
---|
57 | * into human dates is only performed once per timestamp.
|
---|
58 | * Typically called "internally" by methods like stampToYear.
|
---|
59 | * Return value can vary, depending on the specific implementation
|
---|
60 | *
|
---|
61 | * @param int $stamp timestamp (depending on implementation)
|
---|
62 | *
|
---|
63 | * @return mixed
|
---|
64 | * @access protected
|
---|
65 | */
|
---|
66 | function stampCollection($stamp)
|
---|
67 | {
|
---|
68 | }
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Returns a numeric year given a timestamp
|
---|
72 | *
|
---|
73 | * @param int $stamp timestamp (depending on implementation)
|
---|
74 | *
|
---|
75 | * @return int year (e.g. 2003)
|
---|
76 | * @access protected
|
---|
77 | */
|
---|
78 | function stampToYear($stamp)
|
---|
79 | {
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Returns a numeric month given a timestamp
|
---|
84 | *
|
---|
85 | * @param int $stamp timestamp (depending on implementation)
|
---|
86 | *
|
---|
87 | * @return int month (e.g. 9)
|
---|
88 | * @access protected
|
---|
89 | */
|
---|
90 | function stampToMonth($stamp)
|
---|
91 | {
|
---|
92 | }
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Returns a numeric day given a timestamp
|
---|
96 | *
|
---|
97 | * @param int $stamp timestamp (depending on implementation)
|
---|
98 | *
|
---|
99 | * @return int day (e.g. 15)
|
---|
100 | * @access protected
|
---|
101 | */
|
---|
102 | function stampToDay($stamp)
|
---|
103 | {
|
---|
104 | }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Returns a numeric hour given a timestamp
|
---|
108 | *
|
---|
109 | * @param int $stamp timestamp (depending on implementation)
|
---|
110 | *
|
---|
111 | * @return int hour (e.g. 13)
|
---|
112 | * @access protected
|
---|
113 | */
|
---|
114 | function stampToHour($stamp)
|
---|
115 | {
|
---|
116 | }
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * Returns a numeric minute given a timestamp
|
---|
120 | *
|
---|
121 | * @param int $stamp timestamp (depending on implementation)
|
---|
122 | *
|
---|
123 | * @return int minute (e.g. 34)
|
---|
124 | * @access protected
|
---|
125 | */
|
---|
126 | function stampToMinute($stamp)
|
---|
127 | {
|
---|
128 | }
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * Returns a numeric second given a timestamp
|
---|
132 | *
|
---|
133 | * @param int $stamp timestamp (depending on implementation)
|
---|
134 | *
|
---|
135 | * @return int second (e.g. 51)
|
---|
136 | * @access protected
|
---|
137 | */
|
---|
138 | function stampToSecond($stamp)
|
---|
139 | {
|
---|
140 | }
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * Returns a timestamp. Can be worth "caching" generated timestamps in a
|
---|
144 | * static variable, identified by the params this method accepts,
|
---|
145 | * to timestamp will only be calculated once.
|
---|
146 | *
|
---|
147 | * @param int $y year (e.g. 2003)
|
---|
148 | * @param int $m month (e.g. 9)
|
---|
149 | * @param int $d day (e.g. 13)
|
---|
150 | * @param int $h hour (e.g. 13)
|
---|
151 | * @param int $i minute (e.g. 34)
|
---|
152 | * @param int $s second (e.g. 53)
|
---|
153 | *
|
---|
154 | * @return int (depends on implementation)
|
---|
155 | * @access protected
|
---|
156 | */
|
---|
157 | function dateToStamp($y, $m, $d, $h, $i, $s)
|
---|
158 | {
|
---|
159 | }
|
---|
160 |
|
---|
161 | /**
|
---|
162 | * The upper limit on years that the Calendar Engine can work with
|
---|
163 | *
|
---|
164 | * @return int (e.g. 2037)
|
---|
165 | * @access protected
|
---|
166 | */
|
---|
167 | function getMaxYears()
|
---|
168 | {
|
---|
169 | }
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * The lower limit on years that the Calendar Engine can work with
|
---|
173 | *
|
---|
174 | * @return int (e.g 1902)
|
---|
175 | * @access protected
|
---|
176 | */
|
---|
177 | function getMinYears()
|
---|
178 | {
|
---|
179 | }
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * Returns the number of months in a year
|
---|
183 | *
|
---|
184 | * @param int $y (optional) year to get months for
|
---|
185 | *
|
---|
186 | * @return int (e.g. 12)
|
---|
187 | * @access protected
|
---|
188 | */
|
---|
189 | function getMonthsInYear($y=null)
|
---|
190 | {
|
---|
191 | }
|
---|
192 |
|
---|
193 | /**
|
---|
194 | * Returns the number of days in a month, given year and month
|
---|
195 | *
|
---|
196 | * @param int $y year (e.g. 2003)
|
---|
197 | * @param int $m month (e.g. 9)
|
---|
198 | *
|
---|
199 | * @return int days in month
|
---|
200 | * @access protected
|
---|
201 | */
|
---|
202 | function getDaysInMonth($y, $m)
|
---|
203 | {
|
---|
204 | }
|
---|
205 |
|
---|
206 | /**
|
---|
207 | * Returns numeric representation of the day of the week in a month,
|
---|
208 | * given year and month
|
---|
209 | *
|
---|
210 | * @param int $y year (e.g. 2003)
|
---|
211 | * @param int $m month (e.g. 9)
|
---|
212 | *
|
---|
213 | * @return int
|
---|
214 | * @access protected
|
---|
215 | */
|
---|
216 | function getFirstDayInMonth ($y, $m)
|
---|
217 | {
|
---|
218 | }
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * Returns the number of days in a week
|
---|
222 | *
|
---|
223 | * @param int $y year (2003)
|
---|
224 | * @param int $m month (9)
|
---|
225 | * @param int $d day (4)
|
---|
226 | *
|
---|
227 | * @return int (e.g. 7)
|
---|
228 | * @access protected
|
---|
229 | */
|
---|
230 | function getDaysInWeek($y=null, $m=null, $d=null)
|
---|
231 | {
|
---|
232 | }
|
---|
233 |
|
---|
234 | /**
|
---|
235 | * Returns the number of the week in the year (ISO-8601), given a date
|
---|
236 | *
|
---|
237 | * @param int $y year (2003)
|
---|
238 | * @param int $m month (9)
|
---|
239 | * @param int $d day (4)
|
---|
240 | *
|
---|
241 | * @return int week number
|
---|
242 | * @access protected
|
---|
243 | */
|
---|
244 | function getWeekNInYear($y, $m, $d)
|
---|
245 | {
|
---|
246 | }
|
---|
247 |
|
---|
248 | /**
|
---|
249 | * Returns the number of the week in the month, given a date
|
---|
250 | *
|
---|
251 | * @param int $y year (2003)
|
---|
252 | * @param int $m month (9)
|
---|
253 | * @param int $d day (4)
|
---|
254 | * @param int $firstDay first day of the week (default: 1 - monday)
|
---|
255 | *
|
---|
256 | * @return int week number
|
---|
257 | * @access protected
|
---|
258 | */
|
---|
259 | function getWeekNInMonth($y, $m, $d, $firstDay=1)
|
---|
260 | {
|
---|
261 | }
|
---|
262 |
|
---|
263 | /**
|
---|
264 | * Returns the number of weeks in the month
|
---|
265 | *
|
---|
266 | * @param int $y year (2003)
|
---|
267 | * @param int $m month (9)
|
---|
268 | *
|
---|
269 | * @return int weeks number
|
---|
270 | * @access protected
|
---|
271 | */
|
---|
272 | function getWeeksInMonth($y, $m)
|
---|
273 | {
|
---|
274 | }
|
---|
275 |
|
---|
276 | /**
|
---|
277 | * Returns the number of the day of the week (0=sunday, 1=monday...)
|
---|
278 | *
|
---|
279 | * @param int $y year (2003)
|
---|
280 | * @param int $m month (9)
|
---|
281 | * @param int $d day (4)
|
---|
282 | *
|
---|
283 | * @return int weekday number
|
---|
284 | * @access protected
|
---|
285 | */
|
---|
286 | function getDayOfWeek($y, $m, $d)
|
---|
287 | {
|
---|
288 | }
|
---|
289 |
|
---|
290 | /**
|
---|
291 | * Returns the numeric values of the days of the week.
|
---|
292 | *
|
---|
293 | * @param int $y year (2003)
|
---|
294 | * @param int $m month (9)
|
---|
295 | * @param int $d day (4)
|
---|
296 | *
|
---|
297 | * @return array list of numeric values of days in week, beginning 0
|
---|
298 | * @access protected
|
---|
299 | */
|
---|
300 | function getWeekDays($y=null, $m=null, $d=null)
|
---|
301 | {
|
---|
302 | }
|
---|
303 |
|
---|
304 | /**
|
---|
305 | * Returns the default first day of the week as an integer. Must be a
|
---|
306 | * member of the array returned from getWeekDays
|
---|
307 | *
|
---|
308 | * @param int $y year (2003)
|
---|
309 | * @param int $m month (9)
|
---|
310 | * @param int $d day (4)
|
---|
311 | *
|
---|
312 | * @return int (e.g. 1 for Monday)
|
---|
313 | * @see getWeekDays
|
---|
314 | * @access protected
|
---|
315 | */
|
---|
316 | function getFirstDayOfWeek($y=null, $m=null, $d=null)
|
---|
317 | {
|
---|
318 | }
|
---|
319 |
|
---|
320 | /**
|
---|
321 | * Returns the number of hours in a day
|
---|
322 | *
|
---|
323 | * @param int $y year (2003)
|
---|
324 | * @param int $m month (9)
|
---|
325 | * @param int $d day (4)
|
---|
326 | *
|
---|
327 | * @return int (e.g. 24)
|
---|
328 | * @access protected
|
---|
329 | */
|
---|
330 | function getHoursInDay($y=null,$m=null,$d=null)
|
---|
331 | {
|
---|
332 | }
|
---|
333 |
|
---|
334 | /**
|
---|
335 | * Returns the number of minutes in an hour
|
---|
336 | *
|
---|
337 | * @param int $y year (2003)
|
---|
338 | * @param int $m month (9)
|
---|
339 | * @param int $d day (4)
|
---|
340 | * @param int $h hour
|
---|
341 | *
|
---|
342 | * @return int
|
---|
343 | * @access protected
|
---|
344 | */
|
---|
345 | function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
|
---|
346 | {
|
---|
347 | }
|
---|
348 |
|
---|
349 | /**
|
---|
350 | * Returns the number of seconds in a minutes
|
---|
351 | *
|
---|
352 | * @param int $y year (2003)
|
---|
353 | * @param int $m month (9)
|
---|
354 | * @param int $d day (4)
|
---|
355 | * @param int $h hour
|
---|
356 | * @param int $i minute
|
---|
357 | *
|
---|
358 | * @return int
|
---|
359 | * @access protected
|
---|
360 | */
|
---|
361 | function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
|
---|
362 | {
|
---|
363 | }
|
---|
364 |
|
---|
365 | /**
|
---|
366 | * Checks if the given day is the current day
|
---|
367 | *
|
---|
368 | * @param int timestamp (depending on implementation)
|
---|
369 | *
|
---|
370 | * @return boolean
|
---|
371 | * @access protected
|
---|
372 | */
|
---|
373 | function isToday($stamp)
|
---|
374 | {
|
---|
375 | }
|
---|
376 | }
|
---|
377 | ?> |
---|