| 493 |
ddelon |
1 |
<?php
|
|
|
2 |
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
//
|
|
|
4 |
// +----------------------------------------------------------------------+
|
|
|
5 |
// | PHP Version 4 |
|
|
|
6 |
// +----------------------------------------------------------------------+
|
|
|
7 |
// | Copyright (c) 1997-2002 The PHP Group |
|
|
|
8 |
// +----------------------------------------------------------------------+
|
|
|
9 |
// | This source file is subject to version 2.02 of the PHP license, |
|
|
|
10 |
// | that is bundled with this package in the file LICENSE, and is |
|
|
|
11 |
// | available at through the world-wide-web at |
|
|
|
12 |
// | http://www.php.net/license/3_0.txt. |
|
|
|
13 |
// | If you did not receive a copy of the PHP license and are unable to |
|
|
|
14 |
// | obtain it through the world-wide-web, please send a note to |
|
|
|
15 |
// | license@php.net so we can mail you a copy immediately. |
|
|
|
16 |
// +----------------------------------------------------------------------+
|
|
|
17 |
// | Authors: Harry Fuecks <hfuecks@phppatterns.com> |
|
|
|
18 |
// +----------------------------------------------------------------------+
|
|
|
19 |
//
|
|
|
20 |
// $Id: Interface.php,v 1.1 2005-09-30 14:58:00 ddelon Exp $
|
|
|
21 |
//
|
|
|
22 |
/**
|
|
|
23 |
* @package Calendar
|
|
|
24 |
* @version $Id: Interface.php,v 1.1 2005-09-30 14:58:00 ddelon Exp $
|
|
|
25 |
*/
|
|
|
26 |
/**
|
|
|
27 |
* The methods the classes implementing the Calendar_Engine must implement.
|
|
|
28 |
* Note this class is not used but simply to help development
|
|
|
29 |
* @package Calendar
|
|
|
30 |
* @access protected
|
|
|
31 |
*/
|
|
|
32 |
class Calendar_Engine_Interface
|
|
|
33 |
{
|
|
|
34 |
/**
|
|
|
35 |
* Provides a mechansim to make sure parsing of timestamps
|
|
|
36 |
* into human dates is only performed once per timestamp.
|
|
|
37 |
* Typically called "internally" by methods like stampToYear.
|
|
|
38 |
* Return value can vary, depending on the specific implementation
|
|
|
39 |
* @param int timestamp (depending on implementation)
|
|
|
40 |
* @return mixed
|
|
|
41 |
* @access protected
|
|
|
42 |
*/
|
|
|
43 |
function stampCollection($stamp)
|
|
|
44 |
{
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* Returns a numeric year given a timestamp
|
|
|
49 |
* @param int timestamp (depending on implementation)
|
|
|
50 |
* @return int year (e.g. 2003)
|
|
|
51 |
* @access protected
|
|
|
52 |
*/
|
|
|
53 |
function stampToYear($stamp)
|
|
|
54 |
{
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Returns a numeric month given a timestamp
|
|
|
59 |
* @param int timestamp (depending on implementation)
|
|
|
60 |
* @return int month (e.g. 9)
|
|
|
61 |
* @access protected
|
|
|
62 |
*/
|
|
|
63 |
function stampToMonth($stamp)
|
|
|
64 |
{
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
* Returns a numeric day given a timestamp
|
|
|
69 |
* @param int timestamp (depending on implementation)
|
|
|
70 |
* @return int day (e.g. 15)
|
|
|
71 |
* @access protected
|
|
|
72 |
*/
|
|
|
73 |
function stampToDay($stamp)
|
|
|
74 |
{
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
/**
|
|
|
78 |
* Returns a numeric hour given a timestamp
|
|
|
79 |
* @param int timestamp (depending on implementation)
|
|
|
80 |
* @return int hour (e.g. 13)
|
|
|
81 |
* @access protected
|
|
|
82 |
*/
|
|
|
83 |
function stampToHour($stamp)
|
|
|
84 |
{
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
/**
|
|
|
88 |
* Returns a numeric minute given a timestamp
|
|
|
89 |
* @param int timestamp (depending on implementation)
|
|
|
90 |
* @return int minute (e.g. 34)
|
|
|
91 |
* @access protected
|
|
|
92 |
*/
|
|
|
93 |
function stampToMinute($stamp)
|
|
|
94 |
{
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
/**
|
|
|
98 |
* Returns a numeric second given a timestamp
|
|
|
99 |
* @param int timestamp (depending on implementation)
|
|
|
100 |
* @return int second (e.g. 51)
|
|
|
101 |
* @access protected
|
|
|
102 |
*/
|
|
|
103 |
function stampToSecond($stamp)
|
|
|
104 |
{
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
/**
|
|
|
108 |
* Returns a timestamp. Can be worth "caching" generated
|
|
|
109 |
* timestamps in a static variable, identified by the
|
|
|
110 |
* params this method accepts, to timestamp will only
|
|
|
111 |
* be calculated once.
|
|
|
112 |
* @param int year (e.g. 2003)
|
|
|
113 |
* @param int month (e.g. 9)
|
|
|
114 |
* @param int day (e.g. 13)
|
|
|
115 |
* @param int hour (e.g. 13)
|
|
|
116 |
* @param int minute (e.g. 34)
|
|
|
117 |
* @param int second (e.g. 53)
|
|
|
118 |
* @return int (depends on implementation)
|
|
|
119 |
* @access protected
|
|
|
120 |
*/
|
|
|
121 |
function dateToStamp($y,$m,$d,$h,$i,$s)
|
|
|
122 |
{
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
/**
|
|
|
126 |
* The upper limit on years that the Calendar Engine can work with
|
|
|
127 |
* @return int (e.g. 2037)
|
|
|
128 |
* @access protected
|
|
|
129 |
*/
|
|
|
130 |
function getMaxYears()
|
|
|
131 |
{
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
/**
|
|
|
135 |
* The lower limit on years that the Calendar Engine can work with
|
|
|
136 |
* @return int (e.g 1902)
|
|
|
137 |
* @access protected
|
|
|
138 |
*/
|
|
|
139 |
function getMinYears()
|
|
|
140 |
{
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
/**
|
|
|
144 |
* Returns the number of months in a year
|
|
|
145 |
* @param int (optional) year to get months for
|
|
|
146 |
* @return int (e.g. 12)
|
|
|
147 |
* @access protected
|
|
|
148 |
*/
|
|
|
149 |
function getMonthsInYear($y=null)
|
|
|
150 |
{
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
/**
|
|
|
154 |
* Returns the number of days in a month, given year and month
|
|
|
155 |
* @param int year (e.g. 2003)
|
|
|
156 |
* @param int month (e.g. 9)
|
|
|
157 |
* @return int days in month
|
|
|
158 |
* @access protected
|
|
|
159 |
*/
|
|
|
160 |
function getDaysInMonth($y, $m)
|
|
|
161 |
{
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
/**
|
|
|
165 |
* Returns numeric representation of the day of the week in a month,
|
|
|
166 |
* given year and month
|
|
|
167 |
* @param int year (e.g. 2003)
|
|
|
168 |
* @param int month (e.g. 9)
|
|
|
169 |
* @return int
|
|
|
170 |
* @access protected
|
|
|
171 |
*/
|
|
|
172 |
function getFirstDayInMonth ($y, $m)
|
|
|
173 |
{
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
/**
|
|
|
177 |
* Returns the number of days in a week
|
|
|
178 |
* @param int year (2003)
|
|
|
179 |
* @param int month (9)
|
|
|
180 |
* @param int day (4)
|
|
|
181 |
* @return int (e.g. 7)
|
|
|
182 |
* @access protected
|
|
|
183 |
*/
|
|
|
184 |
function getDaysInWeek($y=NULL, $m=NULL, $d=NULL)
|
|
|
185 |
{
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
/**
|
|
|
189 |
* Returns the number of the week in the year (ISO-8601), given a date
|
|
|
190 |
* @param int year (2003)
|
|
|
191 |
* @param int month (9)
|
|
|
192 |
* @param int day (4)
|
|
|
193 |
* @return int week number
|
|
|
194 |
* @access protected
|
|
|
195 |
*/
|
|
|
196 |
function getWeekNInYear($y, $m, $d)
|
|
|
197 |
{
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
/**
|
|
|
201 |
* Returns the number of the week in the month, given a date
|
|
|
202 |
* @param int year (2003)
|
|
|
203 |
* @param int month (9)
|
|
|
204 |
* @param int day (4)
|
|
|
205 |
* @param int first day of the week (default: 1 - monday)
|
|
|
206 |
* @return int week number
|
|
|
207 |
* @access protected
|
|
|
208 |
*/
|
|
|
209 |
function getWeekNInMonth($y, $m, $d, $firstDay=1)
|
|
|
210 |
{
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
/**
|
|
|
214 |
* Returns the number of weeks in the month
|
|
|
215 |
* @param int year (2003)
|
|
|
216 |
* @param int month (9)
|
|
|
217 |
* @param int first day of the week (default: 1 - monday)
|
|
|
218 |
* @return int weeks number
|
|
|
219 |
* @access protected
|
|
|
220 |
*/
|
|
|
221 |
function getWeeksInMonth($y, $m)
|
|
|
222 |
{
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
/**
|
|
|
226 |
* Returns the number of the day of the week (0=sunday, 1=monday...)
|
|
|
227 |
* @param int year (2003)
|
|
|
228 |
* @param int month (9)
|
|
|
229 |
* @param int day (4)
|
|
|
230 |
* @return int weekday number
|
|
|
231 |
* @access protected
|
|
|
232 |
*/
|
|
|
233 |
function getDayOfWeek($y, $m, $d)
|
|
|
234 |
{
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
/**
|
|
|
238 |
* Returns the numeric values of the days of the week.
|
|
|
239 |
* @param int year (2003)
|
|
|
240 |
* @param int month (9)
|
|
|
241 |
* @param int day (4)
|
|
|
242 |
* @return array list of numeric values of days in week, beginning 0
|
|
|
243 |
* @access protected
|
|
|
244 |
*/
|
|
|
245 |
function getWeekDays($y=NULL, $m=NULL, $d=NULL)
|
|
|
246 |
{
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
/**
|
|
|
250 |
* Returns the default first day of the week as an integer. Must be a
|
|
|
251 |
* member of the array returned from getWeekDays
|
|
|
252 |
* @param int year (2003)
|
|
|
253 |
* @param int month (9)
|
|
|
254 |
* @param int day (4)
|
|
|
255 |
* @return int (e.g. 1 for Monday)
|
|
|
256 |
* @see getWeekDays
|
|
|
257 |
* @access protected
|
|
|
258 |
*/
|
|
|
259 |
function getFirstDayOfWeek($y=NULL, $m=NULL, $d=NULL)
|
|
|
260 |
{
|
|
|
261 |
}
|
|
|
262 |
|
|
|
263 |
/**
|
|
|
264 |
* Returns the number of hours in a day<br>
|
|
|
265 |
* @param int (optional) day to get hours for
|
|
|
266 |
* @return int (e.g. 24)
|
|
|
267 |
* @access protected
|
|
|
268 |
*/
|
|
|
269 |
function getHoursInDay($y=null,$m=null,$d=null)
|
|
|
270 |
{
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
/**
|
|
|
274 |
* Returns the number of minutes in an hour
|
|
|
275 |
* @param int (optional) hour to get minutes for
|
|
|
276 |
* @return int
|
|
|
277 |
* @access protected
|
|
|
278 |
*/
|
|
|
279 |
function getMinutesInHour($y=null,$m=null,$d=null,$h=null)
|
|
|
280 |
{
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
/**
|
|
|
284 |
* Returns the number of seconds in a minutes
|
|
|
285 |
* @param int (optional) minute to get seconds for
|
|
|
286 |
* @return int
|
|
|
287 |
* @access protected
|
|
|
288 |
*/
|
|
|
289 |
function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null)
|
|
|
290 |
{
|
|
|
291 |
}
|
|
|
292 |
}
|
|
|
293 |
?>
|