@@ -55,6 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | return ["year" => $year, "month"=>$month]; |
| 57 | 57 | } |
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @param CWeek|null $week |
|
| 61 | + */ |
|
| 58 | 62 | public function addWeek($week) |
| 59 | 63 | {
|
| 60 | 64 | $this->weeks[] = $week; |
@@ -135,6 +139,9 @@ discard block |
||
| 135 | 139 | } |
| 136 | 140 | |
| 137 | 141 | |
| 142 | + /** |
|
| 143 | + * @param string $firstDayOfMonth |
|
| 144 | + */ |
|
| 138 | 145 | private function getAmountOfEmptyDays($firstDayOfMonth){
|
| 139 | 146 | $number = 0; |
| 140 | 147 | if($firstDayOfMonth == 0){
|
@@ -32,27 +32,27 @@ |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function prev(){
|
| 35 | - $year = $this->year; |
|
| 36 | - $month = $this->month; |
|
| 35 | + $year = $this->year; |
|
| 36 | + $month = $this->month; |
|
| 37 | 37 | |
| 38 | 38 | if($month == 1){
|
| 39 | 39 | $month = 12; |
| 40 | - $year--; |
|
| 40 | + $year--; |
|
| 41 | 41 | } else {
|
| 42 | 42 | $month--; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - return ["year" => $year, "month"=>$month]; |
|
| 45 | + return ["year" => $year, "month"=>$month]; |
|
| 46 | 46 | } |
| 47 | 47 | public function next(){
|
| 48 | - $year = $this->year; |
|
| 48 | + $year = $this->year; |
|
| 49 | 49 | $month = $this->month; |
| 50 | - if($month == 12){
|
|
| 51 | - $month = 1; |
|
| 52 | - $year++; |
|
| 53 | - } else {
|
|
| 54 | - $month++; |
|
| 55 | - } |
|
| 50 | + if($month == 12){
|
|
| 51 | + $month = 1; |
|
| 52 | + $year++; |
|
| 53 | + } else {
|
|
| 54 | + $month++; |
|
| 55 | + } |
|
| 56 | 56 | return ["year" => $year, "month"=>$month]; |
| 57 | 57 | } |
| 58 | 58 | public function addWeek($week) |
@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | private $year; |
| 11 | 11 | private $events = array(); |
| 12 | 12 | |
| 13 | - public function setEvents($values = []){
|
|
| 13 | + public function setEvents($values = []) {
|
|
| 14 | 14 | $this->events = $values; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function getValues($year = null, $month = null){
|
|
| 18 | - if($year && $month){
|
|
| 17 | + public function getValues($year = null, $month = null) {
|
|
| 18 | + if ($year && $month) {
|
|
| 19 | 19 | $this->setYear($year)->setMonth($month); |
| 20 | 20 | } |
| 21 | - else if(isset($_GET['year']) && isset($_GET['month'])){
|
|
| 21 | + else if (isset($_GET['year']) && isset($_GET['month'])) {
|
|
| 22 | 22 | $this->setYear($_GET['year'])->setMonth($_GET['month']); |
| 23 | 23 | } |
| 24 | 24 | else {
|
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | return $this->weeks; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function prev(){
|
|
| 34 | + public function prev() {
|
|
| 35 | 35 | $year = $this->year; |
| 36 | 36 | $month = $this->month; |
| 37 | 37 | |
| 38 | - if($month == 1){
|
|
| 38 | + if ($month == 1) {
|
|
| 39 | 39 | $month = 12; |
| 40 | 40 | $year--; |
| 41 | 41 | } else {
|
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | return ["year" => $year, "month"=>$month]; |
| 46 | 46 | } |
| 47 | - public function next(){
|
|
| 47 | + public function next() {
|
|
| 48 | 48 | $year = $this->year; |
| 49 | 49 | $month = $this->month; |
| 50 | - if($month == 12){
|
|
| 50 | + if ($month == 12) {
|
|
| 51 | 51 | $month = 1; |
| 52 | 52 | $year++; |
| 53 | 53 | } else {
|
@@ -62,58 +62,58 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function setMonth($month) |
| 64 | 64 | {
|
| 65 | - $this->month = (int)$month; |
|
| 65 | + $this->month = (int) $month; |
|
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function getMonthNumber(){
|
|
| 69 | + public function getMonthNumber() {
|
|
| 70 | 70 | $dateString = strtotime(sprintf('%s-%s-01', $this->year, $this->month));
|
| 71 | 71 | return $month = date('m', $dateString);
|
| 72 | 72 | } |
| 73 | - public function getMonthName(){
|
|
| 73 | + public function getMonthName() {
|
|
| 74 | 74 | $dateString = strtotime(sprintf('%s-%s-01', $this->year, $this->month));
|
| 75 | 75 | return $month = date('F', $dateString);
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function setYear($year){
|
|
| 78 | + public function setYear($year) {
|
|
| 79 | 79 | $this->year = $year; |
| 80 | 80 | return $this; |
| 81 | 81 | } |
| 82 | - public function getMonth(){
|
|
| 82 | + public function getMonth() {
|
|
| 83 | 83 | return $this->month; |
| 84 | 84 | } |
| 85 | - public function getYear(){
|
|
| 85 | + public function getYear() {
|
|
| 86 | 86 | return $this->year; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function generateCalenderData(){
|
|
| 89 | + public function generateCalenderData() {
|
|
| 90 | 90 | $daysUsed = 0; |
| 91 | 91 | $dateString = strtotime(sprintf('%s-%s-01', $this->year, $this->month));
|
| 92 | 92 | $monthDays = date('t', $dateString);
|
| 93 | 93 | $dayOfWeek = date('w', $dateString);
|
| 94 | 94 | $firstWeek = new CWeek(); |
| 95 | 95 | $emptyDays = $this->getAmountOfEmptyDays($dayOfWeek); |
| 96 | - for($i = 1; $i<=$emptyDays; $i++){
|
|
| 96 | + for ($i = 1; $i <= $emptyDays; $i++) {
|
|
| 97 | 97 | $firstWeek->addWeekday(new CDay()); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - for($i = 1; $i<=7-$emptyDays;$i++){
|
|
| 100 | + for ($i = 1; $i <= 7 - $emptyDays; $i++) {
|
|
| 101 | 101 | $dateString = strtotime(sprintf('%s-%s-%s', $this->year, $this->month, $i));
|
| 102 | 102 | $day = new CDay(); |
| 103 | 103 | $day->setName(date('l', $dateString));
|
| 104 | 104 | $day->setDayOfMonthNumber($i); |
| 105 | 105 | $firstWeek->addWeekday($day); |
| 106 | - $daysUsed ++; |
|
| 106 | + $daysUsed++; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $this->addWeek($firstWeek); |
| 110 | 110 | $week = null; |
| 111 | 111 | |
| 112 | - for($date = $daysUsed+1;$date<=$monthDays;$date++){
|
|
| 112 | + for ($date = $daysUsed + 1; $date <= $monthDays; $date++) {
|
|
| 113 | 113 | $dateString = strtotime(sprintf('%s-%s-%s', $this->year, $this->month, $date));
|
| 114 | 114 | $dayOfWeek = date('w', $dateString);
|
| 115 | - if($dayOfWeek == 1){
|
|
| 116 | - if($week){
|
|
| 115 | + if ($dayOfWeek == 1) {
|
|
| 116 | + if ($week) {
|
|
| 117 | 117 | $this->addWeek($week); |
| 118 | 118 | } |
| 119 | 119 | $week = new CWeek(); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | $week->addWeekday($day); |
| 126 | 126 | |
| 127 | 127 | } |
| 128 | - $extraDays = 7-$week->getLengthOfDayArray(); |
|
| 128 | + $extraDays = 7 - $week->getLengthOfDayArray(); |
|
| 129 | 129 | |
| 130 | - for($i = 0;$i<$extraDays;$i++){
|
|
| 130 | + for ($i = 0; $i < $extraDays; $i++) {
|
|
| 131 | 131 | $week->addWeekday(new CDay()); |
| 132 | 132 | } |
| 133 | 133 | $this->addWeek($week); |
@@ -135,47 +135,47 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| 138 | - private function getAmountOfEmptyDays($firstDayOfMonth){
|
|
| 138 | + private function getAmountOfEmptyDays($firstDayOfMonth) {
|
|
| 139 | 139 | $number = 0; |
| 140 | - if($firstDayOfMonth == 0){
|
|
| 140 | + if ($firstDayOfMonth == 0) {
|
|
| 141 | 141 | $number = 6; |
| 142 | 142 | } else {
|
| 143 | - $number = $firstDayOfMonth -1; |
|
| 143 | + $number = $firstDayOfMonth - 1; |
|
| 144 | 144 | } |
| 145 | 145 | return $number; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - public function printCalendar(){
|
|
| 148 | + public function printCalendar() {
|
|
| 149 | 149 | $prevData = $this->prev(); |
| 150 | 150 | $nextData = $this->next(); |
| 151 | 151 | $html = "<div class='headerCalendar'> |
| 152 | - <p class='year'> $this->year</p><p class='month'>" . $this->getMonthName() . "</p> |
|
| 152 | + <p class='year'> $this->year</p><p class='month'>".$this->getMonthName()."</p> |
|
| 153 | 153 | </div> |
| 154 | 154 | <div> |
| 155 | 155 | <table class='bordered'>"; |
| 156 | 156 | |
| 157 | - foreach($this->getWeeks() as $week){
|
|
| 157 | + foreach ($this->getWeeks() as $week) {
|
|
| 158 | 158 | $html .= "<tr>"; |
| 159 | - foreach($week -> getWeekdays() as $day){
|
|
| 159 | + foreach ($week -> getWeekdays() as $day) {
|
|
| 160 | 160 | $currentDay = $day->getName(); |
| 161 | 161 | $todaysDay = date('j');
|
| 162 | 162 | $currentMonth = date('m');
|
| 163 | 163 | $html .= "<td>"; |
| 164 | 164 | |
| 165 | - if($currentDay == "Sunday"){
|
|
| 166 | - $html .= "<div class='redNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 167 | - $html .= "<div class='redName'>" . $day->getName() . "</div>"; |
|
| 165 | + if ($currentDay == "Sunday") {
|
|
| 166 | + $html .= "<div class='redNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 167 | + $html .= "<div class='redName'>".$day->getName()."</div>"; |
|
| 168 | 168 | } else {
|
| 169 | - if($day->getDayOfMonthNumber() == $todaysDay && $this->month == $currentMonth) {
|
|
| 170 | - $html .= "<div class='current'><div class='monthNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 171 | - $html .= "<div class='monthName'>" . $day->getName() . "</div></div>"; |
|
| 169 | + if ($day->getDayOfMonthNumber() == $todaysDay && $this->month == $currentMonth) {
|
|
| 170 | + $html .= "<div class='current'><div class='monthNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 171 | + $html .= "<div class='monthName'>".$day->getName()."</div></div>"; |
|
| 172 | 172 | } else {
|
| 173 | - if($this->month == 12 && $day->getDayOfMonthNumber() == 24){
|
|
| 174 | - $html .= "<div class='christmas'><div class='monthNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 175 | - $html .= "<div class='monthName'>" . $day->getName() . "</div></div>"; |
|
| 173 | + if ($this->month == 12 && $day->getDayOfMonthNumber() == 24) {
|
|
| 174 | + $html .= "<div class='christmas'><div class='monthNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 175 | + $html .= "<div class='monthName'>".$day->getName()."</div></div>"; |
|
| 176 | 176 | } else {
|
| 177 | - $html .= "<div class='monthNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 178 | - $html .= "<div class='monthName'>" . $day->getName() . "</div>"; |
|
| 177 | + $html .= "<div class='monthNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 178 | + $html .= "<div class='monthName'>".$day->getName()."</div>"; |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -188,37 +188,37 @@ discard block |
||
| 188 | 188 | return $html; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - public function printMiniCalendar(){
|
|
| 191 | + public function printMiniCalendar() {
|
|
| 192 | 192 | $img = $this->month; |
| 193 | 193 | $prevData = $this->prev(); |
| 194 | 194 | $nextData = $this->next(); |
| 195 | 195 | $html = " |
| 196 | - <div class='leftArrow'> <a href='?month=". $prevData["month"] ."&year=" . $prevData["year"] . "'><img src='./img/orangeArrow.png'></a></div> |
|
| 197 | - <div class='rightArrow'> <a href='?month=". $nextData["month"] ."&year=" . $nextData["year"] . "'><img src='./img/orangeArrow.png'></a></div> |
|
| 196 | + <div class='leftArrow'> <a href='?month=". $prevData["month"]."&year=".$prevData["year"]."'><img src='./img/orangeArrow.png'></a></div> |
|
| 197 | + <div class='rightArrow'> <a href='?month=". $nextData["month"]."&year=".$nextData["year"]."'><img src='./img/orangeArrow.png'></a></div> |
|
| 198 | 198 | <div class='bordered'> |
| 199 | 199 | <table>"; |
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | |
| 204 | - foreach($this -> getWeeks() as $week){
|
|
| 204 | + foreach ($this -> getWeeks() as $week) {
|
|
| 205 | 205 | $html .= "<tr>"; |
| 206 | - foreach($week -> getWeekdays() as $day){
|
|
| 206 | + foreach ($week -> getWeekdays() as $day) {
|
|
| 207 | 207 | $currentDay = $day->getName(); |
| 208 | 208 | $todaysDay = date('j');
|
| 209 | 209 | $currentMonth = date('m');
|
| 210 | 210 | $html .= "<td>"; |
| 211 | 211 | |
| 212 | - if($currentDay == "Sunday"){
|
|
| 213 | - $html .= "<div class='redNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 212 | + if ($currentDay == "Sunday") {
|
|
| 213 | + $html .= "<div class='redNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 214 | 214 | } else {
|
| 215 | - if($day->getDayOfMonthNumber() == $todaysDay && $this->month == $currentMonth) {
|
|
| 216 | - $html .= "<div class='current'><div class='monthNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 215 | + if ($day->getDayOfMonthNumber() == $todaysDay && $this->month == $currentMonth) {
|
|
| 216 | + $html .= "<div class='current'><div class='monthNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 217 | 217 | } else {
|
| 218 | - if($this->month == 12 && $day->getDayOfMonthNumber() == 24){
|
|
| 219 | - $html .= "<div class='christmas'><div class='monthNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 218 | + if ($this->month == 12 && $day->getDayOfMonthNumber() == 24) {
|
|
| 219 | + $html .= "<div class='christmas'><div class='monthNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 220 | 220 | } else {
|
| 221 | - $html .= "<div class='monthNumber'>" . $day->getDayOfMonthNumber() . "</div>"; |
|
| 221 | + $html .= "<div class='monthNumber'>".$day->getDayOfMonthNumber()."</div>"; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -231,18 +231,18 @@ discard block |
||
| 231 | 231 | return $html; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function printResponsiveCalendar($count){
|
|
| 234 | + public function printResponsiveCalendar($count) {
|
|
| 235 | 235 | $prevData = $this->prev(); |
| 236 | 236 | $nextData = $this->next(); |
| 237 | 237 | |
| 238 | 238 | $html = " |
| 239 | 239 | <div class='page-header'> |
| 240 | - <h1 class='text-center'>" . $this->getMonthName() ." ". $this->year ."</h1> |
|
| 240 | + <h1 class='text-center'>" . $this->getMonthName()." ".$this->year."</h1> |
|
| 241 | 241 | <button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\".bd-example-modal-sm\">Add Event</button> |
| 242 | 242 | <div class='btn-group '> |
| 243 | 243 | |
| 244 | - <a href='?month=". $prevData["month"] ."&year=" . $prevData["year"] . "' class='btn btn-primary btn-md'>Previus</a> |
|
| 245 | - <a href='?month=". $nextData["month"] ."&year=" . $nextData["year"] . "' class='btn btn-primary btn-md'>Next</a> |
|
| 244 | + <a href='?month=". $prevData["month"]."&year=".$prevData["year"]."' class='btn btn-primary btn-md'>Previus</a> |
|
| 245 | + <a href='?month=". $nextData["month"]."&year=".$nextData["year"]."' class='btn btn-primary btn-md'>Next</a> |
|
| 246 | 246 | </div> |
| 247 | 247 | </div> |
| 248 | 248 | <div class='col-md-8'> |
@@ -261,34 +261,34 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | |
| 264 | - foreach($this->getWeeks() as $week){
|
|
| 264 | + foreach ($this->getWeeks() as $week) {
|
|
| 265 | 265 | $html .= "<ul class='days'>"; |
| 266 | - foreach($week -> getWeekdays() as $day){
|
|
| 267 | - if($day->getDayOfMonthNumber() == null){
|
|
| 266 | + foreach ($week -> getWeekdays() as $day) {
|
|
| 267 | + if ($day->getDayOfMonthNumber() == null) {
|
|
| 268 | 268 | $id = 0; |
| 269 | 269 | |
| 270 | 270 | } else {
|
| 271 | - if($count[$day->getDayOfMonthNumber()] == null){
|
|
| 271 | + if ($count[$day->getDayOfMonthNumber()] == null) {
|
|
| 272 | 272 | $id = 0; |
| 273 | 273 | } |
| 274 | - else{
|
|
| 274 | + else {
|
|
| 275 | 275 | $id = $day->getDayOfMonthNumber(); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | } |
| 279 | - if($day->getDayOfMonthNumber() == null){
|
|
| 279 | + if ($day->getDayOfMonthNumber() == null) {
|
|
| 280 | 280 | $html .= "<li class='day-empty'></li>"; |
| 281 | 281 | } else {
|
| 282 | 282 | |
| 283 | 283 | $html .= " |
| 284 | - <a href='calendar?month=".$this->month."&year=".$this->year."&date=". $day->getDayOfMonthNumber() ."'><li class='days'>"; |
|
| 285 | - if($id == 0){
|
|
| 284 | + <a href='calendar?month=".$this->month."&year=".$this->year."&date=".$day->getDayOfMonthNumber()."'><li class='days'>"; |
|
| 285 | + if ($id == 0) {
|
|
| 286 | 286 | $html .= "<span class='label label-danger label-pill pull-xs-left'></span>"; |
| 287 | 287 | } else {
|
| 288 | 288 | $html .= "<span class='label label-danger label-pill pull-right '>$count[$id]</span>"; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $html .="<div class='date'>". $day->getDayOfMonthNumber() ."</div> |
|
| 291 | + $html .= "<div class='date'>".$day->getDayOfMonthNumber()."</div> |
|
| 292 | 292 | </li> |
| 293 | 293 | </a> |
| 294 | 294 | "; |
@@ -17,11 +17,9 @@ discard block |
||
| 17 | 17 | public function getValues($year = null, $month = null){
|
| 18 | 18 | if($year && $month){
|
| 19 | 19 | $this->setYear($year)->setMonth($month); |
| 20 | - } |
|
| 21 | - else if(isset($_GET['year']) && isset($_GET['month'])){
|
|
| 20 | + } else if(isset($_GET['year']) && isset($_GET['month'])){
|
|
| 22 | 21 | $this->setYear($_GET['year'])->setMonth($_GET['month']); |
| 23 | - } |
|
| 24 | - else {
|
|
| 22 | + } else {
|
|
| 25 | 23 | $this->setYear(date('Y'))->setMonth(date('m'));
|
| 26 | 24 | } |
| 27 | 25 | } |
@@ -270,8 +268,7 @@ discard block |
||
| 270 | 268 | } else {
|
| 271 | 269 | if($count[$day->getDayOfMonthNumber()] == null){
|
| 272 | 270 | $id = 0; |
| 273 | - } |
|
| 274 | - else{
|
|
| 271 | + } else{
|
|
| 275 | 272 | $id = $day->getDayOfMonthNumber(); |
| 276 | 273 | } |
| 277 | 274 | |
@@ -64,8 +64,6 @@ |
||
| 64 | 64 | /** |
| 65 | 65 | * Execute the query built. |
| 66 | 66 | * |
| 67 | - * @param string $query custom query. |
|
| 68 | - * |
|
| 69 | 67 | * @return $this |
| 70 | 68 | */ |
| 71 | 69 | public function execute($params = []) |
@@ -73,6 +73,10 @@ |
||
| 73 | 73 | |
| 74 | 74 | return $eventsPerDayForMonth; |
| 75 | 75 | } |
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @param string $date |
|
| 79 | + */ |
|
| 76 | 80 | public function getEventCount($date){
|
| 77 | 81 | $this->db->select() |
| 78 | 82 | ->from($this->getSource()) |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function findAllOfMonth($month, $year) |
| 36 | 36 | {
|
| 37 | - $start_date = "showdate >= '".$year ."-".$month ."-01'"; |
|
| 38 | - $end_date = "showdate <= '".$year ."-".$month ."-31'"; |
|
| 37 | + $start_date = "showdate >= '".$year."-".$month."-01'"; |
|
| 38 | + $end_date = "showdate <= '".$year."-".$month."-31'"; |
|
| 39 | 39 | |
| 40 | 40 | $this->db->select() |
| 41 | 41 | ->from($this->getSource()) |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | return $this->db->fetchAll($this); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function findEventsOfDay($date){
|
|
| 49 | + public function findEventsOfDay($date) {
|
|
| 50 | 50 | |
| 51 | - $currentDate = "'". $date ."'" ; |
|
| 51 | + $currentDate = "'".$date."'"; |
|
| 52 | 52 | $this->db->select() |
| 53 | 53 | ->from($this->getSource()) |
| 54 | 54 | ->where('showdate = '.$currentDate)
|
@@ -61,19 +61,19 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return array with eventcount per day. |
| 63 | 63 | */ |
| 64 | - public function getEventCountPerDayOfMonth($month,$year = '2016'){
|
|
| 64 | + public function getEventCountPerDayOfMonth($month, $year = '2016') {
|
|
| 65 | 65 | $eventsPerDayForMonth = []; |
| 66 | 66 | |
| 67 | - for($i = 1;$i < 32;$i++){
|
|
| 67 | + for ($i = 1; $i < 32; $i++) {
|
|
| 68 | 68 | $day = sprintf('%02s', $i);
|
| 69 | - $date = "'".$year ."-".$month ."-".$day."'"; |
|
| 69 | + $date = "'".$year."-".$month."-".$day."'"; |
|
| 70 | 70 | $count = $this->getEventCount($date); |
| 71 | 71 | $eventsPerDayForMonth[$i] = $count; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $eventsPerDayForMonth; |
| 75 | 75 | } |
| 76 | - public function getEventCount($date){
|
|
| 76 | + public function getEventCount($date) {
|
|
| 77 | 77 | $this->db->select() |
| 78 | 78 | ->from($this->getSource()) |
| 79 | 79 | ->where('showdate = '.$date)
|
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | - public function viewAction(){
|
|
| 31 | + public function viewAction() {
|
|
| 32 | 32 | |
| 33 | 33 | $this->initialize(); |
| 34 | 34 | $calendar = new \Anax\Calendar\CCalendar(); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $date = $this->dispatcher->getParam('date');
|
| 41 | 41 | $_GET = array(); |
| 42 | - $currentDate = $year ."-". $month ."-". sprintf('%02s',$date);
|
|
| 42 | + $currentDate = $year."-".$month."-".sprintf('%02s', $date);
|
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | $events = $this->events->findEventsOfDay($currentDate); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function addAction(){
|
|
| 102 | + public function addAction() {
|
|
| 103 | 103 | |
| 104 | 104 | $now = gmdate('Y-m-d H:i:s');
|
| 105 | 105 | |
@@ -5,13 +5,13 @@ |
||
| 5 | 5 | private $weekdays = array(); |
| 6 | 6 | private $weekNr; |
| 7 | 7 | |
| 8 | - public function addWeekday($day){
|
|
| 8 | + public function addWeekday($day) {
|
|
| 9 | 9 | $this->weekdays[] = $day; |
| 10 | 10 | } |
| 11 | - public function getWeekdays(){
|
|
| 11 | + public function getWeekdays() {
|
|
| 12 | 12 | return $this->weekdays; |
| 13 | 13 | } |
| 14 | - public function getLengthOfDayArray(){
|
|
| 14 | + public function getLengthOfDayArray() {
|
|
| 15 | 15 | return count($this->weekdays); |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | $di->setShared('db', function() {
|
| 10 | 10 | $db = new \Mos\Database\CDatabaseBasic(); |
| 11 | - $db->setOptions(require ANAX_APP_PATH . 'config/events_sqlite.php'); |
|
| 11 | + $db->setOptions(require ANAX_APP_PATH.'config/events_sqlite.php'); |
|
| 12 | 12 | $db->connect(); |
| 13 | 13 | return $db; |
| 14 | 14 | }); |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | * @param string $class The fully-qualified class name. |
| 12 | 12 | * @return void |
| 13 | 13 | */ |
| 14 | -spl_autoload_register(function ($class) { |
|
| 14 | +spl_autoload_register(function($class) { |
|
| 15 | 15 | // project-specific namespace prefix |
| 16 | 16 | //$prefix = 'Foo\\Bar\\'; |
| 17 | 17 | $prefix = 'qcode\\eventCalendar\\'; |
| 18 | 18 | // base directory for the namespace prefix |
| 19 | - $base_dir = __DIR__ . '/src/'; |
|
| 19 | + $base_dir = __DIR__.'/src/'; |
|
| 20 | 20 | // does the class use the namespace prefix? |
| 21 | 21 | $len = strlen($prefix); |
| 22 | 22 | if (strncmp($prefix, $class, $len) !== 0) { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // replace the namespace prefix with the base directory, replace namespace |
| 29 | 29 | // separators with directory separators in the relative class name, append |
| 30 | 30 | // with .php |
| 31 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 31 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
| 32 | 32 | // if the file exists, require it |
| 33 | 33 | if (file_exists($file)) { |
| 34 | 34 | require $file; |
@@ -59,6 +59,9 @@ |
||
| 59 | 59 | ), |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | + /** |
|
| 63 | + * @return callable |
|
| 64 | + */ |
|
| 62 | 65 | public static function getInitializer(ClassLoader $loader) |
| 63 | 66 | { |
| 64 | 67 | return \Closure::bind(function () use ($loader) { |
@@ -6,62 +6,62 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInit7b593c329d00694ef3fa74c9b77a3c76 |
| 8 | 8 | { |
| 9 | - public static $files = array ( |
|
| 10 | - '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', |
|
| 9 | + public static $files = array( |
|
| 10 | + '2cffec82183ee1cea088009cef9a6fc3' => __DIR__.'/..'.'/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', |
|
| 11 | 11 | ); |
| 12 | 12 | |
| 13 | - public static $prefixLengthsPsr4 = array ( |
|
| 13 | + public static $prefixLengthsPsr4 = array( |
|
| 14 | 14 | 'M' => |
| 15 | - array ( |
|
| 15 | + array( |
|
| 16 | 16 | 'Mos\\TextFilter\\' => 15, |
| 17 | 17 | 'Mos\\' => 4, |
| 18 | 18 | ), |
| 19 | 19 | 'A' => |
| 20 | - array ( |
|
| 20 | + array( |
|
| 21 | 21 | 'Anax\\' => 5, |
| 22 | 22 | ), |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | - public static $prefixDirsPsr4 = array ( |
|
| 25 | + public static $prefixDirsPsr4 = array( |
|
| 26 | 26 | 'Mos\\TextFilter\\' => |
| 27 | - array ( |
|
| 28 | - 0 => __DIR__ . '/..' . '/mos/ctextfilter/src/TextFilter', |
|
| 27 | + array( |
|
| 28 | + 0 => __DIR__.'/..'.'/mos/ctextfilter/src/TextFilter', |
|
| 29 | 29 | ), |
| 30 | 30 | 'Mos\\' => |
| 31 | - array ( |
|
| 32 | - 0 => __DIR__ . '/..' . '/mos/cdatabase/src', |
|
| 33 | - 1 => __DIR__ . '/..' . '/mos/cform/src', |
|
| 31 | + array( |
|
| 32 | + 0 => __DIR__.'/..'.'/mos/cdatabase/src', |
|
| 33 | + 1 => __DIR__.'/..'.'/mos/cform/src', |
|
| 34 | 34 | ), |
| 35 | 35 | 'Anax\\' => |
| 36 | - array ( |
|
| 37 | - 0 => __DIR__ . '/..' . '/anax/mvc/src', |
|
| 36 | + array( |
|
| 37 | + 0 => __DIR__.'/..'.'/anax/mvc/src', |
|
| 38 | 38 | ), |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - public static $prefixesPsr0 = array ( |
|
| 41 | + public static $prefixesPsr0 = array( |
|
| 42 | 42 | 'M' => |
| 43 | - array ( |
|
| 43 | + array( |
|
| 44 | 44 | 'Monolog' => |
| 45 | - array ( |
|
| 46 | - 0 => __DIR__ . '/../..' . '/src', |
|
| 45 | + array( |
|
| 46 | + 0 => __DIR__.'/../..'.'/src', |
|
| 47 | 47 | ), |
| 48 | 48 | 'Michelf' => |
| 49 | - array ( |
|
| 50 | - 0 => __DIR__ . '/..' . '/michelf/php-markdown', |
|
| 49 | + array( |
|
| 50 | + 0 => __DIR__.'/..'.'/michelf/php-markdown', |
|
| 51 | 51 | ), |
| 52 | 52 | ), |
| 53 | 53 | 'H' => |
| 54 | - array ( |
|
| 54 | + array( |
|
| 55 | 55 | 'HTMLPurifier' => |
| 56 | - array ( |
|
| 57 | - 0 => __DIR__ . '/..' . '/ezyang/htmlpurifier/library', |
|
| 56 | + array( |
|
| 57 | + 0 => __DIR__.'/..'.'/ezyang/htmlpurifier/library', |
|
| 58 | 58 | ), |
| 59 | 59 | ), |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | 62 | public static function getInitializer(ClassLoader $loader) |
| 63 | 63 | { |
| 64 | - return \Closure::bind(function () use ($loader) { |
|
| 64 | + return \Closure::bind(function() use ($loader) { |
|
| 65 | 65 | $loader->prefixLengthsPsr4 = ComposerStaticInit7b593c329d00694ef3fa74c9b77a3c76::$prefixLengthsPsr4; |
| 66 | 66 | $loader->prefixDirsPsr4 = ComposerStaticInit7b593c329d00694ef3fa74c9b77a3c76::$prefixDirsPsr4; |
| 67 | 67 | $loader->prefixesPsr0 = ComposerStaticInit7b593c329d00694ef3fa74c9b77a3c76::$prefixesPsr0; |
@@ -341,6 +341,10 @@ |
||
| 341 | 341 | return $file; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $class |
|
| 346 | + * @param string $ext |
|
| 347 | + */ |
|
| 344 | 348 | private function findFileWithExtension($class, $ext) |
| 345 | 349 | { |
| 346 | 350 | // PSR-4 lookup |
@@ -344,14 +344,14 @@ discard block |
||
| 344 | 344 | private function findFileWithExtension($class, $ext) |
| 345 | 345 | { |
| 346 | 346 | // PSR-4 lookup |
| 347 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 347 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
| 348 | 348 | |
| 349 | 349 | $first = $class[0]; |
| 350 | 350 | if (isset($this->prefixLengthsPsr4[$first])) { |
| 351 | 351 | foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { |
| 352 | 352 | if (0 === strpos($class, $prefix)) { |
| 353 | 353 | foreach ($this->prefixDirsPsr4[$prefix] as $dir) { |
| 354 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { |
|
| 354 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) { |
|
| 355 | 355 | return $file; |
| 356 | 356 | } |
| 357 | 357 | } |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | // PSR-4 fallback dirs |
| 363 | 363 | foreach ($this->fallbackDirsPsr4 as $dir) { |
| 364 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 364 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
| 365 | 365 | return $file; |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -373,14 +373,14 @@ discard block |
||
| 373 | 373 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
| 374 | 374 | } else { |
| 375 | 375 | // PEAR-like class name |
| 376 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 376 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | if (isset($this->prefixesPsr0[$first])) { |
| 380 | 380 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
| 381 | 381 | if (0 === strpos($class, $prefix)) { |
| 382 | 382 | foreach ($dirs as $dir) { |
| 383 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 383 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
| 384 | 384 | return $file; |
| 385 | 385 | } |
| 386 | 386 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // PSR-0 fallback dirs |
| 392 | 392 | foreach ($this->fallbackDirsPsr0 as $dir) { |
| 393 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 393 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
| 394 | 394 | return $file; |
| 395 | 395 | } |
| 396 | 396 | } |