[17073] | 1 | <?php |
---|
| 2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
---|
[23143] | 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.5 2004/08/16 12:29:18 hfuecks Exp $ |
---|
| 21 | // |
---|
[17073] | 22 | /** |
---|
[23143] | 23 | * @package Calendar |
---|
| 24 | * @version $Id: Interface.php,v 1.5 2004/08/16 12:29:18 hfuecks Exp $ |
---|
[17073] | 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 |
---|
[23143] | 29 | * @package Calendar |
---|
[17073] | 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 |
---|
[23143] | 39 | * @param int timestamp (depending on implementation) |
---|
[17073] | 40 | * @return mixed |
---|
| 41 | * @access protected |
---|
| 42 | */ |
---|
| 43 | function stampCollection($stamp) |
---|
| 44 | { |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * Returns a numeric year given a timestamp |
---|
[23143] | 49 | * @param int timestamp (depending on implementation) |
---|
[17073] | 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 |
---|
[23143] | 59 | * @param int timestamp (depending on implementation) |
---|
[17073] | 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 |
---|
[23143] | 69 | * @param int timestamp (depending on implementation) |
---|
[17073] | 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 |
---|
[23143] | 79 | * @param int timestamp (depending on implementation) |
---|
[17073] | 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 |
---|
[23143] | 89 | * @param int timestamp (depending on implementation) |
---|
[17073] | 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 |
---|
[23143] | 99 | * @param int timestamp (depending on implementation) |
---|
[17073] | 100 | * @return int second (e.g. 51) |
---|
| 101 | * @access protected |
---|
| 102 | */ |
---|
| 103 | function stampToSecond($stamp) |
---|
| 104 | { |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | /** |
---|
[23143] | 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) |
---|
[17073] | 118 | * @return int (depends on implementation) |
---|
| 119 | * @access protected |
---|
| 120 | */ |
---|
[23143] | 121 | function dateToStamp($y,$m,$d,$h,$i,$s) |
---|
[17073] | 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 |
---|
[23143] | 145 | * @param int (optional) year to get months for |
---|
[17073] | 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 |
---|
[23143] | 155 | * @param int year (e.g. 2003) |
---|
| 156 | * @param int month (e.g. 9) |
---|
[17073] | 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 |
---|
[23143] | 167 | * @param int year (e.g. 2003) |
---|
| 168 | * @param int month (e.g. 9) |
---|
[17073] | 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 |
---|
[23143] | 178 | * @param int year (2003) |
---|
| 179 | * @param int month (9) |
---|
| 180 | * @param int day (4) |
---|
[17073] | 181 | * @return int (e.g. 7) |
---|
| 182 | * @access protected |
---|
| 183 | */ |
---|
[23143] | 184 | function getDaysInWeek($y=NULL, $m=NULL, $d=NULL) |
---|
[17073] | 185 | { |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | /** |
---|
| 189 | * Returns the number of the week in the year (ISO-8601), given a date |
---|
[23143] | 190 | * @param int year (2003) |
---|
| 191 | * @param int month (9) |
---|
| 192 | * @param int day (4) |
---|
[17073] | 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 |
---|
[23143] | 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) |
---|
[17073] | 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 |
---|
[23143] | 215 | * @param int year (2003) |
---|
| 216 | * @param int month (9) |
---|
| 217 | * @param int first day of the week (default: 1 - monday) |
---|
[17073] | 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...) |
---|
[23143] | 227 | * @param int year (2003) |
---|
| 228 | * @param int month (9) |
---|
| 229 | * @param int day (4) |
---|
[17073] | 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. |
---|
[23143] | 239 | * @param int year (2003) |
---|
| 240 | * @param int month (9) |
---|
| 241 | * @param int day (4) |
---|
[17073] | 242 | * @return array list of numeric values of days in week, beginning 0 |
---|
| 243 | * @access protected |
---|
| 244 | */ |
---|
[23143] | 245 | function getWeekDays($y=NULL, $m=NULL, $d=NULL) |
---|
[17073] | 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 |
---|
[23143] | 252 | * @param int year (2003) |
---|
| 253 | * @param int month (9) |
---|
| 254 | * @param int day (4) |
---|
[17073] | 255 | * @return int (e.g. 1 for Monday) |
---|
| 256 | * @see getWeekDays |
---|
| 257 | * @access protected |
---|
| 258 | */ |
---|
[23143] | 259 | function getFirstDayOfWeek($y=NULL, $m=NULL, $d=NULL) |
---|
[17073] | 260 | { |
---|
| 261 | } |
---|
| 262 | |
---|
| 263 | /** |
---|
[23143] | 264 | * Returns the number of hours in a day<br> |
---|
| 265 | * @param int (optional) day to get hours for |
---|
[17073] | 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 |
---|
[23143] | 275 | * @param int (optional) hour to get minutes for |
---|
[17073] | 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 |
---|
[23143] | 285 | * @param int (optional) minute to get seconds for |
---|
[17073] | 286 | * @return int |
---|
| 287 | * @access protected |
---|
| 288 | */ |
---|
| 289 | function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null) |
---|
| 290 | { |
---|
| 291 | } |
---|
| 292 | } |
---|
[23143] | 293 | ?> |
---|