@@ -14,18 +14,18 @@ |
||
| 14 | 14 | // Build the month |
| 15 | 15 | $Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']); |
| 16 | 16 | |
| 17 | -echo ( '<p>The current month is ' |
|
| 17 | +echo ('<p>The current month is ' |
|
| 18 | 18 | .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>'); |
| 19 | 19 | |
| 20 | 20 | $Uri = & new Calendar_Decorator_Uri($Calendar); |
| 21 | -$Uri->setFragments('jahr','monat'); |
|
| 21 | +$Uri->setFragments('jahr', 'monat'); |
|
| 22 | 22 | // $Uri->setSeperator('/'); // Default is & |
| 23 | 23 | // $Uri->setScalar(); // Omit variable names |
| 24 | -echo ( "<pre>Previous Uri:\t".$Uri->prev('month')."\n" ); |
|
| 25 | -echo ( "This Uri:\t".$Uri->this('month')."\n" ); |
|
| 26 | -echo ( "Next Uri:\t".$Uri->next('month')."\n</pre>" ); |
|
| 24 | +echo ("<pre>Previous Uri:\t".$Uri->prev('month')."\n"); |
|
| 25 | +echo ("This Uri:\t".$Uri->this('month')."\n"); |
|
| 26 | +echo ("Next Uri:\t".$Uri->next('month')."\n</pre>"); |
|
| 27 | 27 | ?> |
| 28 | 28 | <p> |
| 29 | -<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev('month'));?>">Prev</a> : |
|
| 30 | -<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next('month'));?>">Next</a> |
|
| 29 | +<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev('month')); ?>">Prev</a> : |
|
| 30 | +<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next('month')); ?>">Next</a> |
|
| 31 | 31 | </p> |
| 32 | 32 | \ No newline at end of file |
@@ -8,8 +8,12 @@ |
||
| 8 | 8 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
| 9 | 9 | require_once CALENDAR_ROOT.'Decorator/Uri.php'; |
| 10 | 10 | |
| 11 | -if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y'); |
|
| 12 | -if (!isset($_GET['monat'])) $_GET['monat'] = date('m'); |
|
| 11 | +if (!isset($_GET['jahr'])) { |
|
| 12 | + $_GET['jahr'] = date('Y'); |
|
| 13 | +} |
|
| 14 | +if (!isset($_GET['monat'])) { |
|
| 15 | + $_GET['monat'] = date('m'); |
|
| 16 | +} |
|
| 13 | 17 | |
| 14 | 18 | // Build the month |
| 15 | 19 | $Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']); |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | * Description: demonstrates a decorator used to "attach a payload" to a selection |
| 4 | 4 | * to make it available when iterating over calendar children |
| 5 | 5 | */ |
| 6 | -if ( !@include 'Calendar/Calendar.php' ) { |
|
| 7 | - define('CALENDAR_ROOT','../../'); |
|
| 6 | +if (!@include 'Calendar/Calendar.php') { |
|
| 7 | + define('CALENDAR_ROOT', '../../'); |
|
| 8 | 8 | } |
| 9 | 9 | require_once CALENDAR_ROOT.'Day.php'; |
| 10 | 10 | require_once CALENDAR_ROOT.'Hour.php'; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Create a day to view the hours for |
| 28 | -$Day = & new Calendar_Day(2003,10,24); |
|
| 28 | +$Day = & new Calendar_Day(2003, 10, 24); |
|
| 29 | 29 | |
| 30 | 30 | // A sample query to get the data for today (NOT ACTUALLY USED HERE) |
| 31 | 31 | $sql = " |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | eventtime < '".$Day->nextDay(TRUE)."';"; |
| 40 | 40 | |
| 41 | 41 | // An array simulating data from a database |
| 42 | -$result = array ( |
|
| 43 | - array('eventtime'=>mktime(9,0,0,10,24,2003),'entry'=>'Meeting with sales team'), |
|
| 44 | - array('eventtime'=>mktime(11,0,0,10,24,2003),'entry'=>'Conference call with Widget Inc.'), |
|
| 45 | - array('eventtime'=>mktime(15,0,0,10,24,2003),'entry'=>'Presentation to board of directors') |
|
| 42 | +$result = array( |
|
| 43 | + array('eventtime'=>mktime(9, 0, 0, 10, 24, 2003), 'entry'=>'Meeting with sales team'), |
|
| 44 | + array('eventtime'=>mktime(11, 0, 0, 10, 24, 2003), 'entry'=>'Conference call with Widget Inc.'), |
|
| 45 | + array('eventtime'=>mktime(15, 0, 0, 10, 24, 2003), 'entry'=>'Presentation to board of directors') |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | // An array to place selected hours in |
| 49 | 49 | $selection = array(); |
| 50 | 50 | |
| 51 | 51 | // Loop through the "database result" |
| 52 | -foreach ( $result as $row ) { |
|
| 53 | - $Hour = new Calendar_Hour(2000,1,1,1); // Create Hour with dummy values |
|
| 52 | +foreach ($result as $row) { |
|
| 53 | + $Hour = new Calendar_Hour(2000, 1, 1, 1); // Create Hour with dummy values |
|
| 54 | 54 | $Hour->setTimeStamp($row['eventtime']); // Set the real time with setTimeStamp |
| 55 | 55 | |
| 56 | 56 | // Create the decorator, passing it the Hour |
@@ -74,36 +74,36 @@ discard block |
||
| 74 | 74 | <body> |
| 75 | 75 | <h1>Passing a Selection "Payload" using a Decorator</h1> |
| 76 | 76 | <table> |
| 77 | -<caption><b>Your Schedule for <?php echo ( date('D nS F Y',$Day->thisDay(TRUE)) ); ?></b></caption> |
|
| 77 | +<caption><b>Your Schedule for <?php echo (date('D nS F Y', $Day->thisDay(TRUE))); ?></b></caption> |
|
| 78 | 78 | <tr> |
| 79 | 79 | <th width="5%">Time</th> |
| 80 | 80 | <th>Entry</th> |
| 81 | 81 | </tr> |
| 82 | 82 | <?php |
| 83 | -while ( $Hour = & $Day->fetch() ) { |
|
| 83 | +while ($Hour = & $Day->fetch()) { |
|
| 84 | 84 | |
| 85 | 85 | $hour = $Hour->thisHour(); |
| 86 | 86 | $minute = $Hour->thisMinute(); |
| 87 | 87 | |
| 88 | 88 | // Office hours only... |
| 89 | - if ( $hour >= 8 && $hour <= 18 ) { |
|
| 90 | - echo ( "<tr>\n" ); |
|
| 91 | - echo ( "<td>$hour:$minute</td>\n" ); |
|
| 89 | + if ($hour >= 8 && $hour <= 18) { |
|
| 90 | + echo ("<tr>\n"); |
|
| 91 | + echo ("<td>$hour:$minute</td>\n"); |
|
| 92 | 92 | |
| 93 | 93 | // If the hour is selected, call the decorator method... |
| 94 | - if ( $Hour->isSelected() ) { |
|
| 95 | - echo ( "<td bgcolor=\"silver\">".$Hour->getEntry()."</td>\n" ); |
|
| 94 | + if ($Hour->isSelected()) { |
|
| 95 | + echo ("<td bgcolor=\"silver\">".$Hour->getEntry()."</td>\n"); |
|
| 96 | 96 | } else { |
| 97 | - echo ( "<td> </td>\n" ); |
|
| 97 | + echo ("<td> </td>\n"); |
|
| 98 | 98 | } |
| 99 | - echo ( "</tr>\n" ); |
|
| 99 | + echo ("</tr>\n"); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | ?> |
| 103 | 103 | </table> |
| 104 | 104 | <p>The query to fetch this data, with help from PEAR::Calendar, might be;</p> |
| 105 | 105 | <pre> |
| 106 | -<?php echo ( $sql ); ?> |
|
| 106 | +<?php echo ($sql); ?> |
|
| 107 | 107 | </pre> |
| 108 | 108 | </body> |
| 109 | 109 | </html> |
| 110 | 110 | \ No newline at end of file |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />"; |
| 26 | 26 | $Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); |
| 27 | 27 | |
| 28 | -echo '<hr>Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'<br />'; |
|
| 29 | -echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'<br />'; |
|
| 28 | +echo '<hr>Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar, 'two').'<br />'; |
|
| 29 | +echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar, 'short').'<br />'; |
|
| 30 | 30 | echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'<br /><hr />'; |
| 31 | 31 | echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'<br />'; |
| 32 | -echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'<br />'; |
|
| 33 | -echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'<br /><hr />'; |
|
| 32 | +echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar, 'short').'<br />'; |
|
| 33 | +echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar, 'one').'<br /><hr />'; |
|
| 34 | 34 | |
| 35 | 35 | echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />"; |
| 36 | 36 | $Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | <caption><?php echo Calendar_Util_Textual::thisMonthName($Calendar).' '.$Calendar->thisYear(); ?></caption> |
| 42 | 42 | <tr> |
| 43 | 43 | <?php |
| 44 | -$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar,'short'); |
|
| 44 | +$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar, 'short'); |
|
| 45 | 45 | foreach ($dayheaders as $dayheader) { |
| 46 | 46 | echo '<th>'.$dayheader.'</th>'; |
| 47 | 47 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @access public |
| 81 | 81 | */ |
| 82 | - function Calendar_Month($y, $m, $firstDay=null) |
|
| 82 | + function Calendar_Month($y, $m, $firstDay = null) |
|
| 83 | 83 | { |
| 84 | 84 | parent::Calendar($y, $m); |
| 85 | 85 | $this->firstDay = $this->defineFirstDayOfWeek($firstDay); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | include_once CALENDAR_ROOT.'Day.php'; |
| 100 | 100 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
| 101 | - for ($i=1; $i<=$daysInMonth; $i++) { |
|
| 101 | + for ($i = 1; $i <= $daysInMonth; $i++) { |
|
| 102 | 102 | $this->children[$i] = new Calendar_Day($this->year, $this->month, $i); |
| 103 | 103 | } |
| 104 | 104 | if (count($sDates) > 0) { |
@@ -344,22 +344,22 @@ discard block |
||
| 344 | 344 | function prevWeek($format = 'n_in_month') |
| 345 | 345 | { |
| 346 | 346 | switch (strtolower($format)) { |
| 347 | - case 'int': |
|
| 348 | - case 'n_in_month': |
|
| 349 | - return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
| 350 | - case 'n_in_year': |
|
| 351 | - return $this->cE->getWeekNInYear( |
|
| 352 | - $this->cE->stampToYear($this->prevWeek), |
|
| 353 | - $this->cE->stampToMonth($this->prevWeek), |
|
| 354 | - $this->cE->stampToDay($this->prevWeek)); |
|
| 355 | - case 'array': |
|
| 356 | - return $this->toArray($this->prevWeek); |
|
| 357 | - case 'object': |
|
| 358 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
| 359 | - return Calendar_Factory::createByTimestamp('Week', $this->prevWeek); |
|
| 360 | - case 'timestamp': |
|
| 361 | - default: |
|
| 362 | - return $this->prevWeek; |
|
| 347 | + case 'int': |
|
| 348 | + case 'n_in_month': |
|
| 349 | + return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
| 350 | + case 'n_in_year': |
|
| 351 | + return $this->cE->getWeekNInYear( |
|
| 352 | + $this->cE->stampToYear($this->prevWeek), |
|
| 353 | + $this->cE->stampToMonth($this->prevWeek), |
|
| 354 | + $this->cE->stampToDay($this->prevWeek)); |
|
| 355 | + case 'array': |
|
| 356 | + return $this->toArray($this->prevWeek); |
|
| 357 | + case 'object': |
|
| 358 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
| 359 | + return Calendar_Factory::createByTimestamp('Week', $this->prevWeek); |
|
| 360 | + case 'timestamp': |
|
| 361 | + default: |
|
| 362 | + return $this->prevWeek; |
|
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
@@ -374,35 +374,35 @@ discard block |
||
| 374 | 374 | function thisWeek($format = 'n_in_month') |
| 375 | 375 | { |
| 376 | 376 | switch (strtolower($format)) { |
| 377 | - case 'int': |
|
| 378 | - case 'n_in_month': |
|
| 379 | - if ($this->firstWeek) { |
|
| 380 | - return 1; |
|
| 381 | - } |
|
| 382 | - if ($this->lastWeek) { |
|
| 383 | - return $this->cE->getWeeksInMonth( |
|
| 377 | + case 'int': |
|
| 378 | + case 'n_in_month': |
|
| 379 | + if ($this->firstWeek) { |
|
| 380 | + return 1; |
|
| 381 | + } |
|
| 382 | + if ($this->lastWeek) { |
|
| 383 | + return $this->cE->getWeeksInMonth( |
|
| 384 | + $this->thisYear(), |
|
| 385 | + $this->thisMonth(), |
|
| 386 | + $this->firstDay); |
|
| 387 | + } |
|
| 388 | + return $this->cE->getWeekNInMonth( |
|
| 384 | 389 | $this->thisYear(), |
| 385 | 390 | $this->thisMonth(), |
| 391 | + $this->thisDay(), |
|
| 386 | 392 | $this->firstDay); |
| 387 | - } |
|
| 388 | - return $this->cE->getWeekNInMonth( |
|
| 389 | - $this->thisYear(), |
|
| 390 | - $this->thisMonth(), |
|
| 391 | - $this->thisDay(), |
|
| 392 | - $this->firstDay); |
|
| 393 | - case 'n_in_year': |
|
| 394 | - return $this->cE->getWeekNInYear( |
|
| 395 | - $this->cE->stampToYear($this->thisWeek), |
|
| 396 | - $this->cE->stampToMonth($this->thisWeek), |
|
| 397 | - $this->cE->stampToDay($this->thisWeek)); |
|
| 398 | - case 'array': |
|
| 399 | - return $this->toArray($this->thisWeek); |
|
| 400 | - case 'object': |
|
| 401 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
| 402 | - return Calendar_Factory::createByTimestamp('Week', $this->thisWeek); |
|
| 403 | - case 'timestamp': |
|
| 404 | - default: |
|
| 405 | - return $this->thisWeek; |
|
| 393 | + case 'n_in_year': |
|
| 394 | + return $this->cE->getWeekNInYear( |
|
| 395 | + $this->cE->stampToYear($this->thisWeek), |
|
| 396 | + $this->cE->stampToMonth($this->thisWeek), |
|
| 397 | + $this->cE->stampToDay($this->thisWeek)); |
|
| 398 | + case 'array': |
|
| 399 | + return $this->toArray($this->thisWeek); |
|
| 400 | + case 'object': |
|
| 401 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
| 402 | + return Calendar_Factory::createByTimestamp('Week', $this->thisWeek); |
|
| 403 | + case 'timestamp': |
|
| 404 | + default: |
|
| 405 | + return $this->thisWeek; |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | |
@@ -417,22 +417,22 @@ discard block |
||
| 417 | 417 | function nextWeek($format = 'n_in_month') |
| 418 | 418 | { |
| 419 | 419 | switch (strtolower($format)) { |
| 420 | - case 'int': |
|
| 421 | - case 'n_in_month': |
|
| 422 | - return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
| 423 | - case 'n_in_year': |
|
| 424 | - return $this->cE->getWeekNInYear( |
|
| 425 | - $this->cE->stampToYear($this->nextWeek), |
|
| 426 | - $this->cE->stampToMonth($this->nextWeek), |
|
| 427 | - $this->cE->stampToDay($this->nextWeek)); |
|
| 428 | - case 'array': |
|
| 429 | - return $this->toArray($this->nextWeek); |
|
| 430 | - case 'object': |
|
| 431 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
| 432 | - return Calendar_Factory::createByTimestamp('Week', $this->nextWeek); |
|
| 433 | - case 'timestamp': |
|
| 434 | - default: |
|
| 435 | - return $this->nextWeek; |
|
| 420 | + case 'int': |
|
| 421 | + case 'n_in_month': |
|
| 422 | + return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
| 423 | + case 'n_in_year': |
|
| 424 | + return $this->cE->getWeekNInYear( |
|
| 425 | + $this->cE->stampToYear($this->nextWeek), |
|
| 426 | + $this->cE->stampToMonth($this->nextWeek), |
|
| 427 | + $this->cE->stampToDay($this->nextWeek)); |
|
| 428 | + case 'array': |
|
| 429 | + return $this->toArray($this->nextWeek); |
|
| 430 | + case 'object': |
|
| 431 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
| 432 | + return Calendar_Factory::createByTimestamp('Week', $this->nextWeek); |
|
| 433 | + case 'timestamp': |
|
| 434 | + default: |
|
| 435 | + return $this->nextWeek; |
|
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $this->thisDay() |
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - for ($i=1; $i <= $end; $i++) { |
|
| 224 | + for ($i = 1; $i <= $end; $i++) { |
|
| 225 | 225 | $stamp = $this->cE->dateToStamp($year, $month, $day++); |
| 226 | 226 | $this->children[$i] = new Calendar_Day( |
| 227 | 227 | $this->cE->stampToYear($stamp), |
@@ -233,13 +233,13 @@ discard block |
||
| 233 | 233 | //set empty days (@see Calendar_Month_Weeks::build()) |
| 234 | 234 | if ($this->firstWeek) { |
| 235 | 235 | $eBefore = $this->tableHelper->getEmptyDaysBefore(); |
| 236 | - for ($i=1; $i <= $eBefore; $i++) { |
|
| 236 | + for ($i = 1; $i <= $eBefore; $i++) { |
|
| 237 | 237 | $this->children[$i]->setEmpty(); |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | if ($this->lastWeek) { |
| 241 | 241 | $eAfter = $this->tableHelper->getEmptyDaysAfterOffset(); |
| 242 | - for ($i = $eAfter+1; $i <= $end; $i++) { |
|
| 242 | + for ($i = $eAfter + 1; $i <= $end; $i++) { |
|
| 243 | 243 | $this->children[$i]->setEmpty(); |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | switch (strtolower($format)) { |
| 347 | 347 | case 'int': |
| 348 | 348 | case 'n_in_month': |
| 349 | - return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1; |
|
| 349 | + return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') - 1; |
|
| 350 | 350 | case 'n_in_year': |
| 351 | 351 | return $this->cE->getWeekNInYear( |
| 352 | 352 | $this->cE->stampToYear($this->prevWeek), |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | switch (strtolower($format)) { |
| 420 | 420 | case 'int': |
| 421 | 421 | case 'n_in_month': |
| 422 | - return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1; |
|
| 422 | + return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') + 1; |
|
| 423 | 423 | case 'n_in_year': |
| 424 | 424 | return $this->cE->getWeekNInYear( |
| 425 | 425 | $this->cE->stampToYear($this->nextWeek), |
@@ -97,11 +97,11 @@ |
||
| 97 | 97 | { |
| 98 | 98 | include_once CALENDAR_ROOT.'Minute.php'; |
| 99 | 99 | $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day, |
| 100 | - $this->hour); |
|
| 100 | + $this->hour); |
|
| 101 | 101 | for ($i=0; $i < $mIH; $i++) { |
| 102 | 102 | $this->children[$i] = |
| 103 | 103 | new Calendar_Minute($this->year, $this->month, $this->day, |
| 104 | - $this->hour, $i); |
|
| 104 | + $this->hour, $i); |
|
| 105 | 105 | } |
| 106 | 106 | if (count($sDates) > 0) { |
| 107 | 107 | $this->setSelection($sDates); |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | include_once CALENDAR_ROOT.'Minute.php'; |
| 99 | 99 | $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day, |
| 100 | 100 | $this->hour); |
| 101 | - for ($i=0; $i < $mIH; $i++) { |
|
| 101 | + for ($i = 0; $i < $mIH; $i++) { |
|
| 102 | 102 | $this->children[$i] = |
| 103 | 103 | new Calendar_Minute($this->year, $this->month, $this->day, |
| 104 | 104 | $this->hour, $i); |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | $stamp = mktime(0, 0, 0, $i, 1, 2003); |
| 97 | 97 | $month = strftime($formats[$format], $stamp); |
| 98 | 98 | switch($format) { |
| 99 | - case 'one': |
|
| 100 | - $month = substr($month, 0, 1); |
|
| 101 | - break; |
|
| 102 | - case 'two': |
|
| 103 | - $month = substr($month, 0, 2); |
|
| 104 | - break; |
|
| 99 | + case 'one': |
|
| 100 | + $month = substr($month, 0, 1); |
|
| 101 | + break; |
|
| 102 | + case 'two': |
|
| 103 | + $month = substr($month, 0, 2); |
|
| 104 | + break; |
|
| 105 | 105 | } |
| 106 | 106 | $months[$i] = $month; |
| 107 | 107 | } |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | $stamp = mktime(0, 0, 0, 11, $i+2, 2003); |
| 134 | 134 | $day = strftime($formats[$format], $stamp); |
| 135 | 135 | switch($format) { |
| 136 | - case 'one': |
|
| 137 | - $day = substr($day, 0, 1); |
|
| 138 | - break; |
|
| 139 | - case 'two': |
|
| 140 | - $day = substr($day, 0, 2); |
|
| 141 | - break; |
|
| 136 | + case 'one': |
|
| 137 | + $day = substr($day, 0, 1); |
|
| 138 | + break; |
|
| 139 | + case 'two': |
|
| 140 | + $day = substr($day, 0, 2); |
|
| 141 | + break; |
|
| 142 | 142 | } |
| 143 | 143 | $days[$i] = $day; |
| 144 | 144 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $format = 'long'; |
| 93 | 93 | } |
| 94 | 94 | $months = array(); |
| 95 | - for ($i=1; $i<=12; $i++) { |
|
| 95 | + for ($i = 1; $i <= 12; $i++) { |
|
| 96 | 96 | $stamp = mktime(0, 0, 0, $i, 1, 2003); |
| 97 | 97 | $month = strftime($formats[$format], $stamp); |
| 98 | - switch($format) { |
|
| 98 | + switch ($format) { |
|
| 99 | 99 | case 'one': |
| 100 | 100 | $month = substr($month, 0, 1); |
| 101 | 101 | break; |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | $format = 'long'; |
| 130 | 130 | } |
| 131 | 131 | $days = array(); |
| 132 | - for ($i=0; $i<=6; $i++) { |
|
| 133 | - $stamp = mktime(0, 0, 0, 11, $i+2, 2003); |
|
| 132 | + for ($i = 0; $i <= 6; $i++) { |
|
| 133 | + $stamp = mktime(0, 0, 0, 11, $i + 2, 2003); |
|
| 134 | 134 | $day = strftime($formats[$format], $stamp); |
| 135 | - switch($format) { |
|
| 135 | + switch ($format) { |
|
| 136 | 136 | case 'one': |
| 137 | 137 | $day = substr($day, 0, 1); |
| 138 | 138 | break; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @access public |
| 227 | 227 | * @static |
| 228 | 228 | */ |
| 229 | - function thisDayName($Calendar, $format='long') |
|
| 229 | + function thisDayName($Calendar, $format = 'long') |
|
| 230 | 230 | { |
| 231 | 231 | $days = Calendar_Util_Textual::weekdayNames($format); |
| 232 | 232 | include_once 'Date/Calc.php'; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @access public |
| 245 | 245 | * @static |
| 246 | 246 | */ |
| 247 | - function nextDayName($Calendar, $format='long') |
|
| 247 | + function nextDayName($Calendar, $format = 'long') |
|
| 248 | 248 | { |
| 249 | 249 | $days = Calendar_Util_Textual::weekdayNames($format); |
| 250 | 250 | $stamp = $Calendar->nextDay('timestamp'); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | //check if defined / set |
| 280 | 280 | if (defined('CALENDAR_FIRST_DAY_OF_WEEK')) { |
| 281 | 281 | $firstDay = CALENDAR_FIRST_DAY_OF_WEEK; |
| 282 | - } elseif(isset($Calendar->firstDay)) { |
|
| 282 | + } elseif (isset($Calendar->firstDay)) { |
|
| 283 | 283 | $firstDay = $Calendar->firstDay; |
| 284 | 284 | } |
| 285 | 285 | $ordereddays = array(); |
@@ -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; |
@@ -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 | /** |
@@ -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 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $this->calendar->thisYear(), |
| 284 | 284 | $this->calendar->thisMonth(), |
| 285 | 285 | $this->calendar->thisDay() |
| 286 | - ) * ($this->numWeeks-1)); |
|
| 286 | + ) * ($this->numWeeks - 1)); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return int timestamp |
| 298 | 298 | */ |
| 299 | - function getWeekStart($y, $m, $d, $firstDay=1) |
|
| 299 | + function getWeekStart($y, $m, $d, $firstDay = 1) |
|
| 300 | 300 | { |
| 301 | 301 | $dow = $this->cE->getDayOfWeek($y, $m, $d); |
| 302 | 302 | if ($dow > $firstDay) { |