@@ -5,10 +5,10 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | // Get environment & autoloader and the $app-object. |
| 8 | -require __DIR__.'/config.php'; |
|
| 8 | +require __DIR__ . '/config.php'; |
|
| 9 | 9 | |
| 10 | 10 | // Create services and inject into the app. |
| 11 | -$di = new \Anax\DI\CDIFactory(); |
|
| 11 | +$di = new \Anax\DI\CDIFactory(); |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | // On production server, set pretty urls and use rewrite in .htaccess |
| 20 | 20 | $app->url->setUrlType( |
| 21 | - ($_SERVER['SERVER_NAME']=='localhost') ? |
|
| 21 | + ($_SERVER[ 'SERVER_NAME' ] == 'localhost') ? |
|
| 22 | 22 | \Anax\Url\CUrl::URL_APPEND : \Anax\Url\CUrl::URL_CLEAN |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | |
| 26 | -$app->router->add('', function () use ($app) { |
|
| 26 | +$app->router->add('', function() use ($app) { |
|
| 27 | 27 | $app->theme->setTitle("Calendar test"); |
| 28 | 28 | |
| 29 | 29 | $app->views->add('default/page', [ |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | 41 | // Route to calendar |
| 42 | -$app->router->add('calendar', function () use ($app) { |
|
| 42 | +$app->router->add('calendar', function() use ($app) { |
|
| 43 | 43 | $app->theme->addStylesheet('css/calendar.css'); |
| 44 | 44 | $app->theme->setTitle("Calendar"); |
| 45 | 45 | |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Properties |
|
| 15 | - * |
|
| 16 | - */ |
|
| 14 | + * Properties |
|
| 15 | + * |
|
| 16 | + */ |
|
| 17 | 17 | private $today; |
| 18 | 18 | private $firstDayInWeekOfMonth; |
| 19 | 19 | private $lastDayInLastWeek; |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | private $nextMonth; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * Constructor |
|
| 27 | - * |
|
| 28 | - * @param string date in month to display. Format yyyy-mm-dd |
|
| 29 | - * |
|
| 30 | - */ |
|
| 26 | + * Constructor |
|
| 27 | + * |
|
| 28 | + * @param string date in month to display. Format yyyy-mm-dd |
|
| 29 | + * |
|
| 30 | + */ |
|
| 31 | 31 | public function __construct($displayDate = null) |
| 32 | 32 | { |
| 33 | 33 | // setlocale(LC_TIME, "Swedish"); |
@@ -80,49 +80,49 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | - * Get current month with month and year |
|
| 84 | - */ |
|
| 83 | + * Get current month with month and year |
|
| 84 | + */ |
|
| 85 | 85 | public function thisMonth() |
| 86 | 86 | { |
| 87 | 87 | return utf8_encode(strftime("%B %Y", strtotime($this->thisMonth->format('Y-m-d')))); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Get previous month in text format |
|
| 92 | - */ |
|
| 91 | + * Get previous month in text format |
|
| 92 | + */ |
|
| 93 | 93 | public function prevMonth() |
| 94 | 94 | { |
| 95 | 95 | return utf8_encode(strftime("%B", strtotime($this->prevMonth->format('Y-m-d')))); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Get previous month in format yyyy-mm-dd |
|
| 100 | - */ |
|
| 99 | + * Get previous month in format yyyy-mm-dd |
|
| 100 | + */ |
|
| 101 | 101 | public function prevMonthDate() |
| 102 | 102 | { |
| 103 | 103 | return $this->prevMonth->format('Y-m-d'); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | - * Get next month in text format |
|
| 108 | - */ |
|
| 107 | + * Get next month in text format |
|
| 108 | + */ |
|
| 109 | 109 | public function nextMonth() |
| 110 | 110 | { |
| 111 | 111 | return utf8_encode(strftime("%B", strtotime($this->nextMonth->format('Y-m-d')))); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * Get next month in format yyyy-mm-dd |
|
| 116 | - */ |
|
| 115 | + * Get next month in format yyyy-mm-dd |
|
| 116 | + */ |
|
| 117 | 117 | public function nextMonthDate() |
| 118 | 118 | { |
| 119 | 119 | return $this->nextMonth->format('Y-m-d'); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * Get all dates in month with additional days in first and last week. |
|
| 124 | - * |
|
| 125 | - */ |
|
| 123 | + * Get all dates in month with additional days in first and last week. |
|
| 124 | + * |
|
| 125 | + */ |
|
| 126 | 126 | public function datesInMonth() |
| 127 | 127 | { |
| 128 | 128 | $date = $this->firstDayInWeekOfMonth; |
@@ -128,17 +128,17 @@ |
||
| 128 | 128 | $date = $this->firstDayInWeekOfMonth; |
| 129 | 129 | while ($date <= $this->lastDayInLastWeek) { |
| 130 | 130 | $w = ltrim($date->format('W'), 0); |
| 131 | - for ($d=1; $d < 8; $d++) { |
|
| 131 | + for ($d = 1; $d < 8; $d++) { |
|
| 132 | 132 | // $dateText = utf8_encode(strftime("%A %e %B", strtotime($date->format('Y-m-d')))); |
| 133 | 133 | // %e does not work on windows, use %d instead |
| 134 | 134 | $dateText = utf8_encode(strftime("%A %#d %B", strtotime($date->format('Y-m-d')))); |
| 135 | 135 | $dateText = $date->format('d M'); |
| 136 | 136 | // $dateText = $date->format('D d M'); |
| 137 | - $redDay = (7==$d) ? "red-day" : ""; |
|
| 137 | + $redDay = (7 == $d) ? "red-day" : ""; |
|
| 138 | 138 | $classToday = ($date == $this->today) ? "today" : ""; |
| 139 | 139 | $classThisMonth = ($date < $this->firstDayInMonth || $date > $this->lastDayInMonth) ? "class-outside-month" : "class-inside-month"; |
| 140 | 140 | $date->modify("+1 day"); |
| 141 | - $dates[] = array( |
|
| 141 | + $dates[ ] = array( |
|
| 142 | 142 | 'week' => $w, |
| 143 | 143 | 'date' => $dateText, |
| 144 | 144 | 'class-red' => $redDay, |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * An example of a project-specific implementation. |
|
| 4 | - * |
|
| 5 | - * After registering this autoload function with SPL, the following line |
|
| 6 | - * would cause the function to attempt to load the \Foo\Bar\Baz\Qux class |
|
| 7 | - * from /path/to/project/src/Baz/Qux.php: |
|
| 8 | - * |
|
| 9 | - * new \Foo\Bar\Baz\Qux; |
|
| 10 | - * |
|
| 11 | - * @param string $class The fully-qualified class name. |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 3 | + * An example of a project-specific implementation. |
|
| 4 | + * |
|
| 5 | + * After registering this autoload function with SPL, the following line |
|
| 6 | + * would cause the function to attempt to load the \Foo\Bar\Baz\Qux class |
|
| 7 | + * from /path/to/project/src/Baz/Qux.php: |
|
| 8 | + * |
|
| 9 | + * new \Foo\Bar\Baz\Qux; |
|
| 10 | + * |
|
| 11 | + * @param string $class The fully-qualified class name. |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | 14 | spl_autoload_register( |
| 15 | 15 | function ($class) { |
| 16 | 16 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | * @return void |
| 13 | 13 | */ |
| 14 | 14 | spl_autoload_register( |
| 15 | - function ($class) { |
|
| 15 | + function($class) { |
|
| 16 | 16 | |
| 17 | 17 | // project-specific namespace prefix |
| 18 | 18 | //$prefix = 'Foo\\Bar\\'; |