public function getPDFContent($save = false) { if ($this->userdata == null or count($this->userdata) == 0) { die(Util::getBasicHTMLError("Bitte wählen Sie Monat und Jahr aus", "Fehler")); } self::$pdf->SetAutoPageBreak(false); $this->AddPage(); $D = new Datum(mktime(0, 0, 1, $this->userdata["lightCRMKalBerichtMonth"], 1, $this->userdata["lightCRMKalBerichtYear"])); $day = clone $D; $D->setToMonthLast(); $lastDay = $D; $Kalender = new mKalenderGUI(); $K = $Kalender->getData($day->time(), $lastDay->time()); $i = 0; while ($day->time() <= $lastDay->time()) { $events = $K->getEventsOnDay(date("dmY", $day->time())); if (count($events) == 0) { $day->addDay(); continue; } if (self::$pdf->getY() > $this->pageBreakMargin - 15) { $this->AddPage(); $i = 0; } if ($i > 0) { self::$pdf->ln(10); } self::$pdf->SetFont($this->defaultFont, "B", $this->defaultFontSize); self::$pdf->Cell(0, $this->defaultCellHeight, "Termine am " . Util::CLWeekdayName(date("w", $day->time())) . ", " . Util::CLFormatDate($day->time()), 0, 1); self::$pdf->Line(10, self::$pdf->GetY(), 200, self::$pdf->GetY()); self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize); foreach ($events as $time) { foreach ($time as $event) { if (self::$pdf->getY() > $this->pageBreakMargin) { $this->AddPage(); $i = 0; if ($this->between) { self::$pdf->SetFont($this->defaultFont, "B", $this->defaultFontSize); self::$pdf->Cell(0, $this->defaultCellHeight, "Termine am " . Util::CLWeekdayName(date("w", $day->time())) . ", " . Util::CLFormatDate($day->time()), 0, 1); self::$pdf->Line(10, self::$pdf->GetY(), 200, self::$pdf->GetY()); self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize); } } $this->between = true; self::$pdf->Cell8(isset($this->widths["time"]) ? $this->widths["time"] : 20, $this->defaultCellHeight, Util::CLTimeParser(Kalender::parseTime($event->getTime())) . " - " . Util::CLTimeParser(Kalender::parseTime($event->getEndTime())), 0, 0); self::$pdf->Cell8(isset($this->widths["title"]) ? $this->widths["title"] : 20, $this->defaultCellHeight, $event->title(), 0, 0); self::$pdf->Cell8(isset($this->widths["location"]) ? $this->widths["location"] : 20, $this->defaultCellHeight, $event->location(), 0, 1); $summary = $event->summary(); if ($summary != "") { self::$pdf->setTextColor(100, 100, 100); self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize - 1); self::$pdf->MultiCell8(isset($this->widths["summary"]) ? $this->widths["summary"] : 20, $this->defaultCellHeight - 1, trim(str_replace("<br />", "", $summary)), 0, 1); self::$pdf->setTextColor(0, 0, 0); self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize); } self::$pdf->SetDrawColor(150, 150, 150); self::$pdf->Line(10, self::$pdf->GetY(), 200, self::$pdf->GetY()); self::$pdf->SetDrawColor(0, 0, 0); self::$pdf->ln(5); } } $this->between = false; $day->addDay(); $i++; } $tmpfname = Util::getTempFilename("Bericht"); self::$pdf->Output($tmpfname, $save ? "F" : "I"); if ($save) { return $tmpfname; } }