function __construct() { if ($this->ansicht == null) { $this->ansicht = "monat"; } $display = mUserdata::getUDValueS("KalenderDisplay" . ucfirst($this->ansicht), "0"); switch ($this->ansicht) { case "jahr": $Date = new Datum(Datum::parseGerDate("1.1." . date("Y"))); for ($i = 0; $i < abs($display); $i++) { if ($display > 0) { $Date->addYear(); } else { $Date->subYear(); } } break; case "monat": $Date = new Datum(Datum::parseGerDate("1." . date("m.Y"))); for ($i = 0; $i < abs($display); $i++) { if ($display > 0) { $Date->addMonth(); } else { $Date->subMonth(); } } break; case "woche": $Date = new Datum(Datum::parseGerDate(date("d.m.Y"))); for ($i = 0; $i < abs($display); $i++) { if ($display > 0) { $Date->addWeek(true); } else { $Date->subWeek(); } } break; case "tag": $Date = new Datum(Datum::parseGerDate(date("d.m.Y"))); for ($i = 0; $i < abs($display); $i++) { if ($display > 0) { $Date->addDay(); } else { $Date->subDay(); } } break; } $this->current = clone $Date; if ($this->ansicht != "tag" and $this->ansicht != "jahr") { while (date("w", $Date->time()) > 1) { $Date->subDay(); } if (date("w", $Date->time()) == 0) { $Date->addDay(); } } $this->date = $Date; $this->first = $Date->time(); $D = clone $Date; $rows = 5; if ($this->ansicht == "woche") { $rows = 1; } $cols = 7; if ($this->ansicht == "tag") { $cols = 1; $rows = 1; } if ($this->ansicht == "jahr") { $cols = 31; $rows = 12; } if ($this->ansicht != "jahr") { for ($i = 0; $i < $rows; $i++) { if ($i > 0 and date("m.Y", $D->time()) != date("m.Y", $this->current->time())) { break; } for ($j = 0; $j < 7; $j++) { $D->addDay(); } } $D->subDay(); } if ($this->ansicht == "jahr") { $D->addYear(); $D->subDay(); } $this->rows = $rows; $this->cols = $cols; $this->last = $D->time(); }