| @@ -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, | 
| @@ -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\\'; | 
| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | $i = 0; | 
| 16 | 16 |  while ($i < $length) { | 
| 17 | 17 | echo "<tr>"; | 
| 18 | -    echo "<td class='week'>v.{$dates[$i]['week']}</td>"; | |
| 19 | -    for ($d=1; $d < 8; $d++) { | |
| 20 | -        echo "<td class='day {$dates[$i]['class-red']} {$dates[$i]['class-today']} {$dates[$i]['class-in-month']}' >{$dates[$i]['date']}</td>"; | |
| 18 | +    echo "<td class='week'>v.{$dates[ $i ][ 'week' ]}</td>"; | |
| 19 | +    for ($d = 1; $d < 8; $d++) { | |
| 20 | +        echo "<td class='day {$dates[ $i ][ 'class-red' ]} {$dates[ $i ][ 'class-today' ]} {$dates[ $i ][ 'class-in-month' ]}' >{$dates[ $i ][ 'date' ]}</td>"; | |
| 21 | 21 | $i += 1; | 
| 22 | 22 | } | 
| 23 | 23 | echo "</tr>"; | 
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Sample configuration file for Anax webroot. | |
| 4 | - * | |
| 5 | - */ | |
| 3 | + * Sample configuration file for Anax webroot. | |
| 4 | + * | |
| 5 | + */ | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | /** |