@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | /** |
| 146 | 146 | * Returns the date as an associative array (helper method) |
| 147 | 147 | * |
| 148 | - * @param mixed $stamp timestamp (leave empty for current timestamp) |
|
| 148 | + * @param integer $stamp timestamp (leave empty for current timestamp) |
|
| 149 | 149 | * |
| 150 | 150 | * @return array |
| 151 | 151 | * @access public |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @param array $sDates array containing Calendar objects to select (optional) |
| 267 | 267 | * |
| 268 | - * @return boolean |
|
| 268 | + * @return boolean|null |
|
| 269 | 269 | * @access public |
| 270 | 270 | * @abstract |
| 271 | 271 | */ |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @return int e.g. 4 or Unix timestamp |
| 397 | 397 | * @access public |
| 398 | - */ |
|
| 398 | + */ |
|
| 399 | 399 | function prevMonth($format = 'int') |
| 400 | 400 | { |
| 401 | 401 | return $this->calendar->prevMonth($format); |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * |
| 435 | 435 | * @return int e.g. 4 or Unix timestamp |
| 436 | 436 | * @access public |
| 437 | - */ |
|
| 437 | + */ |
|
| 438 | 438 | function prevWeek($format = 'n_in_month') |
| 439 | 439 | { |
| 440 | 440 | if ( method_exists($this->calendar, 'prevWeek')) { |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @return void |
| 241 | 241 | * @access private |
| 242 | 242 | */ |
| 243 | - function setEmpty ($state = true) |
|
| 243 | + function setEmpty($state = true) |
|
| 244 | 244 | { |
| 245 | 245 | if (method_exists($this->calendar, 'setEmpty')) { |
| 246 | 246 | $this->calendar->setEmpty($state); |
@@ -437,12 +437,12 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | function prevWeek($format = 'n_in_month') |
| 439 | 439 | { |
| 440 | - if ( method_exists($this->calendar, 'prevWeek')) { |
|
| 440 | + if (method_exists($this->calendar, 'prevWeek')) { |
|
| 441 | 441 | return $this->calendar->prevWeek($format); |
| 442 | 442 | } else { |
| 443 | 443 | include_once 'PEAR.php'; |
| 444 | 444 | PEAR::raiseError( |
| 445 | - 'Cannot call prevWeek on Calendar object of type: '. |
|
| 445 | + 'Cannot call prevWeek on Calendar object of type: ' . |
|
| 446 | 446 | get_class($this->calendar), 133, PEAR_ERROR_TRIGGER, |
| 447 | 447 | E_USER_NOTICE, 'Calendar_Decorator::prevWeek()'); |
| 448 | 448 | |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | function thisWeek($format = 'n_in_month') |
| 462 | 462 | { |
| 463 | - if ( method_exists($this->calendar, 'thisWeek')) { |
|
| 463 | + if (method_exists($this->calendar, 'thisWeek')) { |
|
| 464 | 464 | return $this->calendar->thisWeek($format); |
| 465 | 465 | } else { |
| 466 | 466 | include_once 'PEAR.php'; |
| 467 | 467 | PEAR::raiseError( |
| 468 | - 'Cannot call thisWeek on Calendar object of type: '. |
|
| 468 | + 'Cannot call thisWeek on Calendar object of type: ' . |
|
| 469 | 469 | get_class($this->calendar), 133, PEAR_ERROR_TRIGGER, |
| 470 | 470 | E_USER_NOTICE, 'Calendar_Decorator::thisWeek()'); |
| 471 | 471 | |
@@ -483,12 +483,12 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | function nextWeek($format = 'n_in_month') |
| 485 | 485 | { |
| 486 | - if ( method_exists($this->calendar, 'nextWeek')) { |
|
| 486 | + if (method_exists($this->calendar, 'nextWeek')) { |
|
| 487 | 487 | return $this->calendar->nextWeek($format); |
| 488 | 488 | } else { |
| 489 | 489 | include_once 'PEAR.php'; |
| 490 | 490 | PEAR::raiseError( |
| 491 | - 'Cannot call thisWeek on Calendar object of type: '. |
|
| 491 | + 'Cannot call thisWeek on Calendar object of type: ' . |
|
| 492 | 492 | get_class($this->calendar), 133, PEAR_ERROR_TRIGGER, |
| 493 | 493 | E_USER_NOTICE, 'Calendar_Decorator::nextWeek()'); |
| 494 | 494 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | var $entry; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @param $calendar |
|
| 22 | + * @param Calendar_Day $calendar |
|
| 23 | 23 | */ |
| 24 | 24 | function DiaryEvent($calendar) |
| 25 | 25 | { |
@@ -4,11 +4,11 @@ discard block |
||
| 4 | 4 | * to make it available when iterating over calendar children |
| 5 | 5 | */ |
| 6 | 6 | if (!@include 'Calendar/Calendar.php') { |
| 7 | - define('CALENDAR_ROOT','../../'); |
|
| 7 | + define('CALENDAR_ROOT', '../../'); |
|
| 8 | 8 | } |
| 9 | -require_once CALENDAR_ROOT.'Day.php'; |
|
| 10 | -require_once CALENDAR_ROOT.'Hour.php'; |
|
| 11 | -require_once CALENDAR_ROOT.'Decorator.php'; |
|
| 9 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
| 10 | +require_once CALENDAR_ROOT . 'Hour.php'; |
|
| 11 | +require_once CALENDAR_ROOT . 'Decorator.php'; |
|
| 12 | 12 | |
| 13 | 13 | // Decorator to "attach" functionality to selected hours |
| 14 | 14 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // Create a day to view the hours for |
| 43 | -$Day = new Calendar_Day(2003,10,24); |
|
| 43 | +$Day = new Calendar_Day(2003, 10, 24); |
|
| 44 | 44 | |
| 45 | 45 | // A sample query to get the data for today (NOT ACTUALLY USED HERE) |
| 46 | 46 | $sql = " |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | FROM |
| 50 | 50 | diary |
| 51 | 51 | WHERE |
| 52 | - eventtime >= '".$Day->thisDay(TRUE)."' |
|
| 52 | + eventtime >= '".$Day->thisDay(TRUE) . "' |
|
| 53 | 53 | AND |
| 54 | - eventtime < '".$Day->nextDay(TRUE)."';"; |
|
| 54 | + eventtime < '".$Day->nextDay(TRUE) . "';"; |
|
| 55 | 55 | |
| 56 | 56 | // An array simulating data from a database |
| 57 | -$result = array ( |
|
| 58 | - array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'), |
|
| 59 | - array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'), |
|
| 60 | - array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors') |
|
| 57 | +$result = array( |
|
| 58 | + array('eventtime'=>mktime(9, 0, 0, 10, 24, 2003), 'entry'=>'Meeting with sales team'), |
|
| 59 | + array('eventtime'=>mktime(11, 0, 0, 10, 24, 2003), 'entry'=>'Conference call with Widget Inc.'), |
|
| 60 | + array('eventtime'=>mktime(15, 0, 0, 10, 24, 2003), 'entry'=>'Presentation to board of directors') |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | // An array to place selected hours in |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | // Loop through the "database result" |
| 67 | 67 | foreach ($result as $row) { |
| 68 | - $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values |
|
| 68 | + $Hour = new Calendar_Hour(2000, 1, 1, 1); // Create Hour with dummy values |
|
| 69 | 69 | $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp |
| 70 | 70 | |
| 71 | 71 | // Create the decorator, passing it the Hour |
@@ -89,36 +89,36 @@ discard block |
||
| 89 | 89 | <body> |
| 90 | 90 | <h1>Passing a Selection "Payload" using a Decorator</h1> |
| 91 | 91 | <table> |
| 92 | -<caption><b>Your Schedule for <?php echo ( date('D nS F Y',$Day->thisDay(TRUE)) ); ?></b></caption> |
|
| 92 | +<caption><b>Your Schedule for <?php echo (date('D nS F Y', $Day->thisDay(TRUE))); ?></b></caption> |
|
| 93 | 93 | <tr> |
| 94 | 94 | <th width="5%">Time</th> |
| 95 | 95 | <th>Entry</th> |
| 96 | 96 | </tr> |
| 97 | 97 | <?php |
| 98 | -while ( $Hour = & $Day->fetch() ) { |
|
| 98 | +while ($Hour = & $Day->fetch()) { |
|
| 99 | 99 | |
| 100 | 100 | $hour = $Hour->thisHour(); |
| 101 | 101 | $minute = $Hour->thisMinute(); |
| 102 | 102 | |
| 103 | 103 | // Office hours only... |
| 104 | 104 | if ($hour >= 8 && $hour <= 18) { |
| 105 | - echo ( "<tr>\n" ); |
|
| 106 | - echo ( "<td>$hour:$minute</td>\n" ); |
|
| 105 | + echo ("<tr>\n"); |
|
| 106 | + echo ("<td>$hour:$minute</td>\n"); |
|
| 107 | 107 | |
| 108 | 108 | // If the hour is selected, call the decorator method... |
| 109 | - if ( $Hour->isSelected() ) { |
|
| 110 | - echo ( "<td bgcolor=\"silver\">".$Hour->getEntry()."</td>\n" ); |
|
| 109 | + if ($Hour->isSelected()) { |
|
| 110 | + echo ("<td bgcolor=\"silver\">" . $Hour->getEntry() . "</td>\n"); |
|
| 111 | 111 | } else { |
| 112 | - echo ( "<td> </td>\n" ); |
|
| 112 | + echo ("<td> </td>\n"); |
|
| 113 | 113 | } |
| 114 | - echo ( "</tr>\n" ); |
|
| 114 | + echo ("</tr>\n"); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | ?> |
| 118 | 118 | </table> |
| 119 | 119 | <p>The query to fetch this data, with help from PEAR::Calendar, might be;</p> |
| 120 | 120 | <pre> |
| 121 | -<?php echo ( $sql ); ?> |
|
| 121 | +<?php echo ($sql); ?> |
|
| 122 | 122 | </pre> |
| 123 | 123 | </body> |
| 124 | 124 | </html> |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | var $entries = array(); |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * @param $calendar |
|
| 27 | + * @param Calendar_Day $calendar |
|
| 28 | 28 | */ |
| 29 | 29 | function DiaryEvent($calendar) |
| 30 | 30 | { |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | define('CALENDAR_ENGINE', 'PearDate'); |
| 9 | 9 | |
| 10 | 10 | if (!@include 'Calendar/Calendar.php') { |
| 11 | - define('CALENDAR_ROOT','../../'); |
|
| 11 | + define('CALENDAR_ROOT', '../../'); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return bool |
| 75 | 75 | */ |
| 76 | - function build($events=array()) |
|
| 76 | + function build($events = array()) |
|
| 77 | 77 | { |
| 78 | 78 | require_once CALENDAR_ROOT . 'Day.php'; |
| 79 | - require_once CALENDAR_ROOT . 'Table/Helper.php'; |
|
| 79 | + require_once CALENDAR_ROOT . 'Table/Helper.php'; |
|
| 80 | 80 | |
| 81 | 81 | $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay); |
| 82 | 82 | $this->cE = & $this->getEngine(); |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | $this->month = $this->thisMonth(); |
| 85 | 85 | |
| 86 | 86 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
| 87 | - for ($i=1; $i<=$daysInMonth; ++$i) { |
|
| 88 | - $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values |
|
| 87 | + for ($i = 1; $i <= $daysInMonth; ++$i) { |
|
| 88 | + $Day = new Calendar_Day(2000, 1, 1); // Create Day with dummy values |
|
| 89 | 89 | $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); |
| 90 | 90 | $this->children[$i] = new DiaryEvent($Day); |
| 91 | 91 | } |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | function setSelection($events) |
| 107 | 107 | { |
| 108 | 108 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
| 109 | - for ($i=1; $i<=$daysInMonth; ++$i) { |
|
| 109 | + for ($i = 1; $i <= $daysInMonth; ++$i) { |
|
| 110 | 110 | $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i); |
| 111 | - $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1); |
|
| 111 | + $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i + 1); |
|
| 112 | 112 | foreach ($events as $event) { |
| 113 | 113 | if (($stamp1 >= $event['start'] && $stamp1 < $event['end']) || |
| 114 | 114 | ($stamp2 >= $event['start'] && $stamp2 < $event['end']) || |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | <h2>Sample Calendar Payload Decorator (using <?php echo CALENDAR_ENGINE; ?> engine)</h2> |
| 222 | 222 | <table class="calendar" width="98%" cellspacing="0" cellpadding="0"> |
| 223 | 223 | <caption> |
| 224 | - <?php echo $MonthDecorator->thisMonth().' / '.$MonthDecorator->thisYear(); ?> |
|
| 224 | + <?php echo $MonthDecorator->thisMonth() . ' / ' . $MonthDecorator->thisYear(); ?> |
|
| 225 | 225 | </caption> |
| 226 | 226 | <tr> |
| 227 | 227 | <th>Monday</th> |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | echo ' calCellEmpty'; |
| 247 | 247 | } |
| 248 | 248 | echo '">'; |
| 249 | - echo '<div class="dayNumber">'.$Day->thisDay().'</div>'; |
|
| 249 | + echo '<div class="dayNumber">' . $Day->thisDay() . '</div>'; |
|
| 250 | 250 | |
| 251 | 251 | if ($Day->isEmpty()) { |
| 252 | 252 | echo ' '; |
| 253 | 253 | } else { |
| 254 | 254 | echo '<div class="dayContents"><ul>'; |
| 255 | 255 | while ($entry = $Day->getEntry()) { |
| 256 | - echo '<li>'.$entry['desc'].'</li>'; |
|
| 256 | + echo '<li>' . $entry['desc'] . '</li>'; |
|
| 257 | 257 | //you can print the time range as well |
| 258 | 258 | } |
| 259 | 259 | echo '</ul></div>'; |
@@ -367,7 +367,7 @@ |
||
| 367 | 367 | * |
| 368 | 368 | * @param int timestamp (depending on implementation) |
| 369 | 369 | * |
| 370 | - * @return boolean |
|
| 370 | + * @return boolean|null |
|
| 371 | 371 | * @access protected |
| 372 | 372 | */ |
| 373 | 373 | function isToday($stamp) |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @return int (e.g. 12) |
| 187 | 187 | * @access protected |
| 188 | 188 | */ |
| 189 | - function getMonthsInYear($y=null) |
|
| 189 | + function getMonthsInYear($y = null) |
|
| 190 | 190 | { |
| 191 | 191 | } |
| 192 | 192 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @return int |
| 214 | 214 | * @access protected |
| 215 | 215 | */ |
| 216 | - function getFirstDayInMonth ($y, $m) |
|
| 216 | + function getFirstDayInMonth($y, $m) |
|
| 217 | 217 | { |
| 218 | 218 | } |
| 219 | 219 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @return int (e.g. 7) |
| 228 | 228 | * @access protected |
| 229 | 229 | */ |
| 230 | - function getDaysInWeek($y=null, $m=null, $d=null) |
|
| 230 | + function getDaysInWeek($y = null, $m = null, $d = null) |
|
| 231 | 231 | { |
| 232 | 232 | } |
| 233 | 233 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @return int week number |
| 257 | 257 | * @access protected |
| 258 | 258 | */ |
| 259 | - function getWeekNInMonth($y, $m, $d, $firstDay=1) |
|
| 259 | + function getWeekNInMonth($y, $m, $d, $firstDay = 1) |
|
| 260 | 260 | { |
| 261 | 261 | } |
| 262 | 262 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @return array list of numeric values of days in week, beginning 0 |
| 298 | 298 | * @access protected |
| 299 | 299 | */ |
| 300 | - function getWeekDays($y=null, $m=null, $d=null) |
|
| 300 | + function getWeekDays($y = null, $m = null, $d = null) |
|
| 301 | 301 | { |
| 302 | 302 | } |
| 303 | 303 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * @see getWeekDays |
| 314 | 314 | * @access protected |
| 315 | 315 | */ |
| 316 | - function getFirstDayOfWeek($y=null, $m=null, $d=null) |
|
| 316 | + function getFirstDayOfWeek($y = null, $m = null, $d = null) |
|
| 317 | 317 | { |
| 318 | 318 | } |
| 319 | 319 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @return int (e.g. 24) |
| 328 | 328 | * @access protected |
| 329 | 329 | */ |
| 330 | - function getHoursInDay($y=null,$m=null,$d=null) |
|
| 330 | + function getHoursInDay($y = null, $m = null, $d = null) |
|
| 331 | 331 | { |
| 332 | 332 | } |
| 333 | 333 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | * @return int |
| 343 | 343 | * @access protected |
| 344 | 344 | */ |
| 345 | - function getMinutesInHour($y=null,$m=null,$d=null,$h=null) |
|
| 345 | + function getMinutesInHour($y = null, $m = null, $d = null, $h = null) |
|
| 346 | 346 | { |
| 347 | 347 | } |
| 348 | 348 | |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @return int |
| 359 | 359 | * @access protected |
| 360 | 360 | */ |
| 361 | - function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null) |
|
| 361 | + function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null) |
|
| 362 | 362 | { |
| 363 | 363 | } |
| 364 | 364 | |
@@ -200,6 +200,9 @@ discard block |
||
| 200 | 200 | * @param int &$h hour (13) |
| 201 | 201 | * @param int &$i minute (34) |
| 202 | 202 | * @param int &$s second (53) |
| 203 | + * @param integer $y |
|
| 204 | + * @param integer $m |
|
| 205 | + * @param integer $d |
|
| 203 | 206 | * |
| 204 | 207 | * @return void |
| 205 | 208 | * @access protected |
@@ -425,7 +428,7 @@ discard block |
||
| 425 | 428 | * @param int $m month (9) |
| 426 | 429 | * @param int $d day (4) |
| 427 | 430 | * |
| 428 | - * @return array (0, 1, 2, 3, 4, 5, 6) 1 = Monday |
|
| 431 | + * @return integer[] (0, 1, 2, 3, 4, 5, 6) 1 = Monday |
|
| 429 | 432 | * @access protected |
| 430 | 433 | */ |
| 431 | 434 | function getWeekDays($y=null, $m=null, $d=null) |
@@ -499,7 +502,7 @@ discard block |
||
| 499 | 502 | /** |
| 500 | 503 | * Checks if the given day is the current day |
| 501 | 504 | * |
| 502 | - * @param mixed $stamp Any timestamp format recognized by Pear::Date |
|
| 505 | + * @param string $stamp Any timestamp format recognized by Pear::Date |
|
| 503 | 506 | * |
| 504 | 507 | * @return boolean |
| 505 | 508 | * @access protected |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | * @return string iso-8601 datetime |
| 179 | 179 | * @access protected |
| 180 | 180 | */ |
| 181 | - function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0) |
|
| 181 | + function dateToStamp($y, $m, $d, $h = 0, $i = 0, $s = 0) |
|
| 182 | 182 | { |
| 183 | 183 | $r = array(); |
| 184 | 184 | Calendar_Engine_PearDate::adjustDate($y, $m, $d, $h, $i, $s); |
| 185 | - $key = $y.$m.$d.$h.$i.$s; |
|
| 185 | + $key = $y . $m . $d . $h . $i . $s; |
|
| 186 | 186 | if (!isset($r[$key])) { |
| 187 | 187 | $r[$key] = sprintf("%04d-%02d-%02d %02d:%02d:%02d", |
| 188 | 188 | $y, $m, $d, $h, $i, $s); |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | $d += floor($h / 24); |
| 231 | 231 | $h %= 24; |
| 232 | 232 | } |
| 233 | - for(; $m < 1; $y--, $m+=12); |
|
| 234 | - for(; $m > 12; $y++, $m-=12); |
|
| 233 | + for (; $m < 1; $y--, $m += 12); |
|
| 234 | + for (; $m > 12; $y++, $m -= 12); |
|
| 235 | 235 | |
| 236 | 236 | while ($d < 1) { |
| 237 | 237 | if ($m > 1) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | $d += Date_Calc::daysInMonth($m, $y); |
| 244 | 244 | } |
| 245 | - for ($max_days = Date_Calc::daysInMonth($m, $y); $d > $max_days; ) { |
|
| 245 | + for ($max_days = Date_Calc::daysInMonth($m, $y); $d > $max_days;) { |
|
| 246 | 246 | $d -= $max_days; |
| 247 | 247 | if ($m < 12) { |
| 248 | 248 | $m++; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * @return int (12) |
| 284 | 284 | * @access protected |
| 285 | 285 | */ |
| 286 | - function getMonthsInYear($y=null) |
|
| 286 | + function getMonthsInYear($y = null) |
|
| 287 | 287 | { |
| 288 | 288 | return 12; |
| 289 | 289 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @return int (7) |
| 328 | 328 | * @access protected |
| 329 | 329 | */ |
| 330 | - function getDaysInWeek($y=null, $m=null, $d=null) |
|
| 330 | + function getDaysInWeek($y = null, $m = null, $d = null) |
|
| 331 | 331 | { |
| 332 | 332 | return 7; |
| 333 | 333 | } |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | * @return int week number |
| 362 | 362 | * @access protected |
| 363 | 363 | */ |
| 364 | - function getWeekNInMonth($y, $m, $d, $firstDay=1) |
|
| 364 | + function getWeekNInMonth($y, $m, $d, $firstDay = 1) |
|
| 365 | 365 | { |
| 366 | - $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek()-1 : $firstDay-1; |
|
| 366 | + $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek() - 1 : $firstDay - 1; |
|
| 367 | 367 | $end_of_week = (int) Date_Calc::nextDayOfWeek($weekEnd, 1, $m, $y, '%e', true); |
| 368 | 368 | $w = 1; |
| 369 | 369 | while ($d > $end_of_week) { |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @return int weeks number |
| 385 | 385 | * @access protected |
| 386 | 386 | */ |
| 387 | - function getWeeksInMonth($y, $m, $firstDay=1) |
|
| 387 | + function getWeeksInMonth($y, $m, $firstDay = 1) |
|
| 388 | 388 | { |
| 389 | 389 | $FDOM = Date_Calc::firstOfMonthWeekday($m, $y); |
| 390 | 390 | if ($FDOM == 0) { |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * @return array (0, 1, 2, 3, 4, 5, 6) 1 = Monday |
| 429 | 429 | * @access protected |
| 430 | 430 | */ |
| 431 | - function getWeekDays($y=null, $m=null, $d=null) |
|
| 431 | + function getWeekDays($y = null, $m = null, $d = null) |
|
| 432 | 432 | { |
| 433 | 433 | return array(0, 1, 2, 3, 4, 5, 6); |
| 434 | 434 | } |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | * @return int (default 1 = Monday) |
| 444 | 444 | * @access protected |
| 445 | 445 | */ |
| 446 | - function getFirstDayOfWeek($y=null, $m=null, $d=null) |
|
| 446 | + function getFirstDayOfWeek($y = null, $m = null, $d = null) |
|
| 447 | 447 | { |
| 448 | 448 | return 1; |
| 449 | 449 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @return int (24) |
| 459 | 459 | * @access protected |
| 460 | 460 | */ |
| 461 | - function getHoursInDay($y=null,$m=null,$d=null) |
|
| 461 | + function getHoursInDay($y = null, $m = null, $d = null) |
|
| 462 | 462 | { |
| 463 | 463 | return 24; |
| 464 | 464 | } |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | * @return int (_EXTCAL_TS_MINUTE) |
| 475 | 475 | * @access protected |
| 476 | 476 | */ |
| 477 | - function getMinutesInHour($y=null,$m=null,$d=null,$h=null) |
|
| 477 | + function getMinutesInHour($y = null, $m = null, $d = null, $h = null) |
|
| 478 | 478 | { |
| 479 | 479 | return _EXTCAL_TS_MINUTE; |
| 480 | 480 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | * @return int (_EXTCAL_TS_MINUTE) |
| 492 | 492 | * @access protected |
| 493 | 493 | */ |
| 494 | - function getSecondsInMinute($y=null,$m=null,$d=null,$h=null,$i=null) |
|
| 494 | + function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null) |
|
| 495 | 495 | { |
| 496 | 496 | return _EXTCAL_TS_MINUTE; |
| 497 | 497 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | } |
| 513 | 513 | $date = Calendar_Engine_PearDate::stampCollection($stamp); |
| 514 | 514 | |
| 515 | - return ( $date->day == $today->getDay() |
|
| 515 | + return ($date->day == $today->getDay() |
|
| 516 | 516 | && $date->month == $today->getMonth() |
| 517 | 517 | && $date->year == $today->getYear() |
| 518 | 518 | ); |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * @param int $m month (9) |
| 382 | 382 | * @param int $d day (4) |
| 383 | 383 | * |
| 384 | - * @return array (0,1,2,3,4,5,6) 1 = Monday |
|
| 384 | + * @return integer[] (0,1,2,3,4,5,6) 1 = Monday |
|
| 385 | 385 | * @access protected |
| 386 | 386 | */ |
| 387 | 387 | function getWeekDays($y=null, $m=null, $d=null) |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | /** |
| 456 | 456 | * Checks if the given day is the current day |
| 457 | 457 | * |
| 458 | - * @param mixed $stamp Any timestamp format recognized by Pear::Date |
|
| 458 | + * @param integer $stamp Any timestamp format recognized by Pear::Date |
|
| 459 | 459 | * |
| 460 | 460 | * @return boolean |
| 461 | 461 | * @access protected |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | function stampCollection($stamp) |
| 77 | 77 | { |
| 78 | 78 | static $stamps = array(); |
| 79 | - if ( !isset($stamps[$stamp]) ) { |
|
| 79 | + if (!isset($stamps[$stamp])) { |
|
| 80 | 80 | $date = @date('Y n j H i s t W w', $stamp); |
| 81 | 81 | $stamps[$stamp] = sscanf($date, "%d %d %d %d %d %d %d %d %d"); |
| 82 | 82 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @return int Unix timestamp |
| 188 | 188 | * @access protected |
| 189 | 189 | */ |
| 190 | - function dateToStamp($y, $m, $d, $h=0, $i=0, $s=0) |
|
| 190 | + function dateToStamp($y, $m, $d, $h = 0, $i = 0, $s = 0) |
|
| 191 | 191 | { |
| 192 | 192 | static $dates = array(); |
| 193 | 193 | if (!isset($dates[$y][$m][$d][$h][$i][$s])) { |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @return int (12) |
| 228 | 228 | * @access protected |
| 229 | 229 | */ |
| 230 | - function getMonthsInYear($y=null) |
|
| 230 | + function getMonthsInYear($y = null) |
|
| 231 | 231 | { |
| 232 | 232 | return 12; |
| 233 | 233 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @return int (7) |
| 278 | 278 | * @access protected |
| 279 | 279 | */ |
| 280 | - function getDaysInWeek($y=null, $m=null, $d=null) |
|
| 280 | + function getDaysInWeek($y = null, $m = null, $d = null) |
|
| 281 | 281 | { |
| 282 | 282 | return 7; |
| 283 | 283 | } |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | * @return int week number |
| 312 | 312 | * @access protected |
| 313 | 313 | */ |
| 314 | - function getWeekNInMonth($y, $m, $d, $firstDay=1) |
|
| 314 | + function getWeekNInMonth($y, $m, $d, $firstDay = 1) |
|
| 315 | 315 | { |
| 316 | - $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek()-1 : $firstDay-1; |
|
| 316 | + $weekEnd = (0 == $firstDay) ? $this->getDaysInWeek() - 1 : $firstDay - 1; |
|
| 317 | 317 | $end_of_week = 1; |
| 318 | 318 | while (@date('w', @mktime(0, 0, 0, $m, $end_of_week, $y)) != $weekEnd) { |
| 319 | 319 | ++$end_of_week; //find first weekend of the month |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @return array (0,1,2,3,4,5,6) 1 = Monday |
| 385 | 385 | * @access protected |
| 386 | 386 | */ |
| 387 | - function getWeekDays($y=null, $m=null, $d=null) |
|
| 387 | + function getWeekDays($y = null, $m = null, $d = null) |
|
| 388 | 388 | { |
| 389 | 389 | return array(0, 1, 2, 3, 4, 5, 6); |
| 390 | 390 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | * @return int (default 1 = Monday) |
| 400 | 400 | * @access protected |
| 401 | 401 | */ |
| 402 | - function getFirstDayOfWeek($y=null, $m=null, $d=null) |
|
| 402 | + function getFirstDayOfWeek($y = null, $m = null, $d = null) |
|
| 403 | 403 | { |
| 404 | 404 | return 1; |
| 405 | 405 | } |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * @return int (24) |
| 415 | 415 | * @access protected |
| 416 | 416 | */ |
| 417 | - function getHoursInDay($y=null, $m=null, $d=null) |
|
| 417 | + function getHoursInDay($y = null, $m = null, $d = null) |
|
| 418 | 418 | { |
| 419 | 419 | return 24; |
| 420 | 420 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | * @return int (_EXTCAL_TS_MINUTE) |
| 431 | 431 | * @access protected |
| 432 | 432 | */ |
| 433 | - function getMinutesInHour($y=null, $m=null, $d=null, $h=null) |
|
| 433 | + function getMinutesInHour($y = null, $m = null, $d = null, $h = null) |
|
| 434 | 434 | { |
| 435 | 435 | return _EXTCAL_TS_MINUTE; |
| 436 | 436 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @return int (_EXTCAL_TS_MINUTE) |
| 448 | 448 | * @access protected |
| 449 | 449 | */ |
| 450 | - function getSecondsInMinute($y=null, $m=null, $d=null, $h=null, $i=null) |
|
| 450 | + function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null) |
|
| 451 | 451 | { |
| 452 | 452 | return _EXTCAL_TS_MINUTE; |
| 453 | 453 | } |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | $date = Calendar_Engine_UnixTS::stampCollection($stamp); |
| 471 | 471 | |
| 472 | - return ( $date[2] == $today[2] |
|
| 472 | + return ($date[2] == $today[2] |
|
| 473 | 473 | && $date[1] == $today[1] |
| 474 | 474 | && $date[0] == $today[0] |
| 475 | 475 | ); |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | /** |
| 198 | 198 | * Returns the first day of the month |
| 199 | 199 | * |
| 200 | - * @return int |
|
| 200 | + * @return string |
|
| 201 | 201 | * @access protected |
| 202 | 202 | * @see Calendar_Engine_Interface::getFirstDayOfWeek() |
| 203 | 203 | */ |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @access protected |
| 116 | 116 | */ |
| 117 | - function Calendar_Table_Helper(& $calendar, $firstDay=null) |
|
| 117 | + function Calendar_Table_Helper(& $calendar, $firstDay = null) |
|
| 118 | 118 | { |
| 119 | 119 | $this->calendar = & $calendar; |
| 120 | 120 | $this->cE = & $calendar->getEngine(); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $this->calendar->thisYear(), $this->calendar->thisMonth()); |
| 173 | 173 | $firstDayInMonth = $this->cE->getFirstDayInMonth( |
| 174 | 174 | $this->calendar->thisYear(), $this->calendar->thisMonth()); |
| 175 | - $this->emptyBefore=0; |
|
| 175 | + $this->emptyBefore = 0; |
|
| 176 | 176 | foreach ($this->daysOfMonth as $dayOfWeek) { |
| 177 | 177 | if ($firstDayInMonth == $dayOfWeek) { |
| 178 | 178 | break; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $this->calendar->thisDay() |
| 189 | 189 | ) |
| 190 | 190 | ); |
| 191 | - for ($i=1; $i < $this->numWeeks; ++$i) { |
|
| 191 | + for ($i = 1; $i < $this->numWeeks; ++$i) { |
|
| 192 | 192 | $this->daysOfMonth = |
| 193 | 193 | array_merge($this->daysOfMonth, $this->daysOfWeek); |
| 194 | 194 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $this->calendar->thisYear(), |
| 285 | 285 | $this->calendar->thisMonth(), |
| 286 | 286 | $this->calendar->thisDay() |
| 287 | - ) * ($this->numWeeks-1)); |
|
| 287 | + ) * ($this->numWeeks - 1)); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @return int timestamp |
| 299 | 299 | */ |
| 300 | - function getWeekStart($y, $m, $d, $firstDay=1) |
|
| 300 | + function getWeekStart($y, $m, $d, $firstDay = 1) |
|
| 301 | 301 | { |
| 302 | 302 | $dow = $this->cE->getDayOfWeek($y, $m, $d); |
| 303 | 303 | if ($dow > $firstDay) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * Gets the URI string for the previous calendar unit |
| 131 | 131 | * |
| 132 | - * @param object $Calendar subclassed from Calendar e.g. Calendar_Month |
|
| 132 | + * @param Calendar_Decorator_Uri $Calendar subclassed from Calendar e.g. Calendar_Month |
|
| 133 | 133 | * @param string $unit calendar unit (year|month|week|day|hour|minute|second) |
| 134 | 134 | * |
| 135 | 135 | * @return string |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | /** |
| 164 | 164 | * Gets the URI string for the next calendar unit |
| 165 | 165 | * |
| 166 | - * @param object $Calendar subclassed from Calendar e.g. Calendar_Month |
|
| 166 | + * @param Calendar_Decorator_Uri $Calendar subclassed from Calendar e.g. Calendar_Month |
|
| 167 | 167 | * @param string $unit calendar unit (year|month|week|day|hour|minute|second) |
| 168 | 168 | * |
| 169 | 169 | * @return string |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @access public |
| 100 | 100 | */ |
| 101 | - function Calendar_Util_Uri($y, $m=null, $d=null, $h=null, $i=null, $s=null) |
|
| 101 | + function Calendar_Util_Uri($y, $m = null, $d = null, $h = null, $i = null, $s = null) |
|
| 102 | 102 | { |
| 103 | 103 | $this->setFragments($y, $m, $d, $h, $i, $s); |
| 104 | 104 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @return void |
| 117 | 117 | * @access public |
| 118 | 118 | */ |
| 119 | - function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) |
|
| 119 | + function setFragments($y, $m = null, $d = null, $h = null, $i = null, $s = null) |
|
| 120 | 120 | { |
| 121 | 121 | if (!is_null($y)) $this->uris['Year'] = $y; |
| 122 | 122 | if (!is_null($m)) $this->uris['Month'] = $m; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | function prev($Calendar, $unit) |
| 139 | 139 | { |
| 140 | - $method = 'prev'.$unit; |
|
| 140 | + $method = 'prev' . $unit; |
|
| 141 | 141 | $stamp = $Calendar->{$method}('timestamp'); |
| 142 | 142 | |
| 143 | 143 | return $this->buildUriString($Calendar, $method, $stamp); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | function this($Calendar, $unit) |
| 156 | 156 | { |
| 157 | - $method = 'this'.$unit; |
|
| 157 | + $method = 'this' . $unit; |
|
| 158 | 158 | $stamp = $Calendar->{$method}('timestamp'); |
| 159 | 159 | |
| 160 | 160 | return $this->buildUriString($Calendar, $method, $stamp); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | function next($Calendar, $unit) |
| 173 | 173 | { |
| 174 | - $method = 'next'.$unit; |
|
| 174 | + $method = 'next' . $unit; |
|
| 175 | 175 | $stamp = $Calendar->{$method}('timestamp'); |
| 176 | 176 | |
| 177 | 177 | return $this->buildUriString($Calendar, $method, $stamp); |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | $cE = & $Calendar->getEngine(); |
| 194 | 194 | $separator = ''; |
| 195 | 195 | foreach ($this->uris as $unit => $uri) { |
| 196 | - $call = 'stampTo'.$unit; |
|
| 196 | + $call = 'stampTo' . $unit; |
|
| 197 | 197 | $uriString .= $separator; |
| 198 | 198 | if (!$this->scalar) { |
| 199 | - $uriString .= $uri.'='; |
|
| 199 | + $uriString .= $uri . '='; |
|
| 200 | 200 | } |
| 201 | 201 | $uriString .= $cE->{$call}($stamp); |
| 202 | 202 | $separator = $this->separator; |
@@ -118,12 +118,24 @@ |
||
| 118 | 118 | */ |
| 119 | 119 | function setFragments($y, $m=null, $d=null, $h=null, $i=null, $s=null) |
| 120 | 120 | { |
| 121 | - if (!is_null($y)) $this->uris['Year'] = $y; |
|
| 122 | - if (!is_null($m)) $this->uris['Month'] = $m; |
|
| 123 | - if (!is_null($d)) $this->uris['Day'] = $d; |
|
| 124 | - if (!is_null($h)) $this->uris['Hour'] = $h; |
|
| 125 | - if (!is_null($i)) $this->uris['Minute'] = $i; |
|
| 126 | - if (!is_null($s)) $this->uris['Second'] = $s; |
|
| 121 | + if (!is_null($y)) { |
|
| 122 | + $this->uris['Year'] = $y; |
|
| 123 | + } |
|
| 124 | + if (!is_null($m)) { |
|
| 125 | + $this->uris['Month'] = $m; |
|
| 126 | + } |
|
| 127 | + if (!is_null($d)) { |
|
| 128 | + $this->uris['Day'] = $d; |
|
| 129 | + } |
|
| 130 | + if (!is_null($h)) { |
|
| 131 | + $this->uris['Hour'] = $h; |
|
| 132 | + } |
|
| 133 | + if (!is_null($i)) { |
|
| 134 | + $this->uris['Minute'] = $i; |
|
| 135 | + } |
|
| 136 | + if (!is_null($s)) { |
|
| 137 | + $this->uris['Second'] = $s; |
|
| 138 | + } |
|
| 127 | 139 | } |
| 128 | 140 | |
| 129 | 141 | /** |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * |
| 44 | 44 | * @internal param bool $encode To sanitizer the text? |
| 45 | 45 | * |
| 46 | - * @return array array of name/value pairs assigned to form elements |
|
| 46 | + * @return boolean array of name/value pairs assigned to form elements |
|
| 47 | 47 | */ |
| 48 | 48 | function getAddBaliseTable() |
| 49 | 49 | { |