@@ -83,41 +83,41 @@ |
||
| 83 | 83 | { |
| 84 | 84 | $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1; |
| 85 | 85 | switch ($type) { |
| 86 | - case 'Day': |
|
| 87 | - return new Day($y, $m, $d); |
|
| 88 | - case 'Month': |
|
| 89 | - // Set default state for which month type to build |
|
| 90 | - if (!defined('CALENDAR_MONTH_STATE')) { |
|
| 91 | - define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
|
| 92 | - } |
|
| 93 | - switch (CALENDAR_MONTH_STATE) { |
|
| 94 | - case CALENDAR_USE_MONTH_WEEKDAYS: |
|
| 95 | - $class = 'PEAR\Calendar\Month\Weekdays'; |
|
| 96 | - break; |
|
| 97 | - case CALENDAR_USE_MONTH_WEEKS: |
|
| 98 | - $class = 'PEAR\Calendar\Month\Weeks'; |
|
| 99 | - break; |
|
| 100 | - case CALENDAR_USE_MONTH: |
|
| 101 | - default: |
|
| 102 | - $class = 'PEAR\Calendar\Month'; |
|
| 103 | - break; |
|
| 104 | - } |
|
| 86 | + case 'Day': |
|
| 87 | + return new Day($y, $m, $d); |
|
| 88 | + case 'Month': |
|
| 89 | + // Set default state for which month type to build |
|
| 90 | + if (!defined('CALENDAR_MONTH_STATE')) { |
|
| 91 | + define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
|
| 92 | + } |
|
| 93 | + switch (CALENDAR_MONTH_STATE) { |
|
| 94 | + case CALENDAR_USE_MONTH_WEEKDAYS: |
|
| 95 | + $class = 'PEAR\Calendar\Month\Weekdays'; |
|
| 96 | + break; |
|
| 97 | + case CALENDAR_USE_MONTH_WEEKS: |
|
| 98 | + $class = 'PEAR\Calendar\Month\Weeks'; |
|
| 99 | + break; |
|
| 100 | + case CALENDAR_USE_MONTH: |
|
| 101 | + default: |
|
| 102 | + $class = 'PEAR\Calendar\Month'; |
|
| 103 | + break; |
|
| 104 | + } |
|
| 105 | 105 | return new $class($y, $m, $firstDay); |
| 106 | - case 'Week': |
|
| 107 | - return new Week($y, $m, $d, $firstDay); |
|
| 108 | - case 'Hour': |
|
| 109 | - return new Hour($y, $m, $d, $h); |
|
| 110 | - case 'Minute': |
|
| 111 | - return new Minute($y, $m, $d, $h, $i); |
|
| 112 | - case 'Second': |
|
| 113 | - return new Second($y, $m, $d, $h, $i, $s); |
|
| 114 | - case 'Year': |
|
| 115 | - return new Year($y); |
|
| 116 | - default: |
|
| 117 | - include_once 'PEAR.php'; |
|
| 118 | - PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
| 119 | - null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
|
| 120 | - return false; |
|
| 106 | + case 'Week': |
|
| 107 | + return new Week($y, $m, $d, $firstDay); |
|
| 108 | + case 'Hour': |
|
| 109 | + return new Hour($y, $m, $d, $h); |
|
| 110 | + case 'Minute': |
|
| 111 | + return new Minute($y, $m, $d, $h, $i); |
|
| 112 | + case 'Second': |
|
| 113 | + return new Second($y, $m, $d, $h, $i, $s); |
|
| 114 | + case 'Year': |
|
| 115 | + return new Year($y); |
|
| 116 | + default: |
|
| 117 | + include_once 'PEAR.php'; |
|
| 118 | + PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
| 119 | + null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
|
| 120 | + return false; |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @access public |
| 68 | 68 | */ |
| 69 | - function __construct($y, $m, $firstDay=null) |
|
| 69 | + function __construct($y, $m, $firstDay = null) |
|
| 70 | 70 | { |
| 71 | 71 | parent::__construct($y, $m); |
| 72 | 72 | $this->firstDay = $this->defineFirstDayOfWeek($firstDay); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | function build($sDates = array()) |
| 85 | 85 | { |
| 86 | 86 | $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); |
| 87 | - for ($i=1; $i<=$daysInMonth; $i++) { |
|
| 87 | + for ($i = 1; $i <= $daysInMonth; $i++) { |
|
| 88 | 88 | $this->children[$i] = new Day($this->year, $this->month, $i); |
| 89 | 89 | } |
| 90 | 90 | if (count($sDates) > 0) { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | function build($sDates = array()) |
| 112 | 112 | { |
| 113 | 113 | $hID = $this->cE->getHoursInDay($this->year, $this->month, $this->day); |
| 114 | - for ($i=0; $i < $hID; $i++) { |
|
| 114 | + for ($i = 0; $i < $hID; $i++) { |
|
| 115 | 115 | $this->children[$i] = |
| 116 | 116 | new Hour($this->year, $this->month, $this->day, $i); |
| 117 | 117 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @return void |
| 207 | 207 | * @access private |
| 208 | 208 | */ |
| 209 | - function setEmpty ($state = true) |
|
| 209 | + function setEmpty($state = true) |
|
| 210 | 210 | { |
| 211 | 211 | $this->empty = $state; |
| 212 | 212 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | $sIM = $this->cE->getSecondsInMinute($this->year, $this->month, |
| 87 | 87 | $this->day, $this->hour, $this->minute); |
| 88 | - for ($i=0; $i < $sIM; $i++) { |
|
| 88 | + for ($i = 0; $i < $sIM; $i++) { |
|
| 89 | 89 | $this->children[$i] = new Second($this->year, $this->month, |
| 90 | 90 | $this->day, $this->hour, $this->minute, $i); |
| 91 | 91 | } |