y = $year; for($month=1; $month<=12; $month++) { $date = mktime(12, 0, 0, $month, 1, $year); $ldom = date("t", $date); for($day=1; $day<=$ldom; $day++) { $this->arr[$month][$day][0] = 1 /*+*/ ; } } } function __toString() { $date = mktime(12, 0, 0, 1, 1, $this->y); $ret = "

Kalendarz dla " . date("Y", $date) . "

\n"; for($month=1; $month<=12; $month++) { $date = mktime(12, 0, 0, $month, 1, $this->y); $ret.= "

Miesiąc ". date("m", $date) . "

\n"; $ret.= "\n"; $ret.= "\t"; $date = mktime(12, 0, 0, $month, 1, $this->y); $start = date("N", $date); $ret.= "\n\t"; for($i = 1; $i < $start; $i++) { $ret.= ""; } $rows = 1; for($day=1; $this->arr[$month][$day][0] > 0; $day++) { if($this->arr[$month][$day][1]) { $title = $this->arr[$month][$day][1]; $class = "yellow"; } else { $class = "white"; $title = ""; } $ret.= ''; if( ($day + $start - 1) % 7 == 0) { $ret.= "\n\t"; $rows++; } } while( ($day + $start-1) <= $rows * 7) { $ret.= ""; $day++; } $ret.= ""; $ret.="\n
Pon Wt Śr Czw Pt Sob Nd
 '.$day.'
 
\n"; } return $ret; } private function parseOffset($offset) { $args = explode("-", $offset); $this->m = $args[0]; $this->d = $args[1]; } function offsetSet($offset, $value) { $this->parseOffset($offset); $this->arr[$this->m][$this->d][1] = $value; } function offsetGet($offset) { $this->parseOffset($offset); return $this->arr[$this->m][$this->d][1]; } function offsetUnset($offset) { $this->parseOffset($offset); $this->arr[$this->m][$this->d][1] = null; } function offsetExists($offset) { parseOffset($offset); if($this->arr[$this->m][$this->d][0] > 0) return true; else return false; } private $y, $m, $d; //year, month, day private $arr; } ?> getMessage()); } ?>