Example #1
0
 private function _showDays($month)
 {
     $allDays = "";
     $firstDay = date("w", mktime(0, 1, 0, $month, 1, $this->currentYear));
     $daysInMonth = date("t", mktime(0, 1, 0, $month, 1, $this->currentYear));
     $weeksInMonth = $this->_weeksInMonth($month);
     $db = new Database();
     $this->holidaysArray = $db->getHolidaysInMonth($this->currentYear, $month, $daysInMonth);
     $day = 1;
     for ($row = 1; $row <= $weeksInMonth; $row++) {
         if ($row == 1) {
             $allDays .= "<tr>\n";
             for ($cell = 1; $cell <= 7; $cell++) {
                 if ($cell == 7 && $firstDay == 0 || $cell == $firstDay || $day > 1) {
                     $allDays .= $this->_fillDayCell($day, $cell, $month);
                     $day++;
                 } else {
                     $allDays .= $this->_fillDayCell(0, $cell, $month);
                 }
             }
             $allDays .= "</tr>\n";
         } else {
             $allDays .= "<tr>\n";
             for ($cell = 1; $cell <= 7; $cell++) {
                 if ($day > $daysInMonth) {
                     $allDays .= $this->_fillDayCell(0, $cell, $month);
                 } else {
                     $allDays .= $this->_fillDayCell($day, $cell, $month);
                     $day++;
                 }
             }
             $allDays .= "</tr>\n";
         }
     }
     return $allDays;
 }