public function pdf_action() { $auswahlgeb = Request::option('gebaude'); if (isset($auswahlgeb)) { $doc = new ExportPDF(); $doc->addPage(); if (isset($_GET["von"]) and $_GET["von"] != "00.00.0000") { $von = raumbelegung::dateToUnix($_GET["von"]); } else { $von = time(); } if (isset($_GET["bis"]) and $_GET["bis"] != "00.00.0000") { $bis = raumbelegung::dateToUnix($_GET["bis"], "24"); } else { $bis = $von; } if ($_GET["nextwe"] == "1") { $we = raumbelegung::getNextWeekEnd(); $von = raumbelegung::dateToUnix($we["wevon"]); $bis = raumbelegung::dateToUnix($we["webis"]); } $termine = $this->getTermine($von, $bis, $auswahlgeb); $doc->SetFont('arial', '', 12, '', true); $doc->addContent("Raumbuchungen von " . $_GET["von"] . " bis " . $_GET["bis"] . " für das Gebäude: " . raumbelegung::getGebaeude($auswahlgeb)); $doc->SetFont('arial', '', 8, '', true); $i = 0; foreach ($termine as $termin) { if ($i == 0) { $doc->SetFont('arial', '', 11, '', true); $doc->addContent("Von - Bis - Raum - Vorlesungstitel - Dozent"); } $content = $termin["von"] . " - " . $termin["bis"] . " - " . $termin["raum"] . " - " . $termin["titel"] . " - "; if (is_array($termin["Dozent"])) { foreach ($termin["Dozent"] as $dozent) { $content .= $dozent["title_front"] . " " . $dozent["vorname"] . " " . $dozent["nachname"]; } } $doc->SetFont('arial', '', 8, '', true); $doc->addContent($content); if ($i >= 35) { $doc->AddPage(); $i = 0; } else { $i++; } } $doc->dispatch(raumbelegung::getGebaeude($auswahlgeb) . "-" . $von . "-" . $bis); } }
/** * Create a pdf of all postings belonging to the passed seminar located * under the passed topic_id. The PDF is dispatched automatically. * * BEWARE: This function never returns, it dies after the PDF has been * (succesfully or not) dispatched. * * @param string $seminar_id * @param string $parent_id */ static function createPdf($seminar_id, $parent_id = null) { $seminar_name = get_object_name($seminar_id, 'sem'); $data = ForumEntry::getList('dump', $parent_id ?: $seminar_id); $first_page = true; $document = new ExportPDF(); $document->SetTitle(_('Forum')); $document->setHeaderTitle(sprintf(_("Forum \"%s\""), $seminar_name['name'])); $document->addPage(); foreach ($data['list'] as $entry) { if (Config::get()->FORUM_ANONYMOUS_POSTINGS && $entry['anonymous']) { $author = _('anonym'); } else { $author = $entry['author']; } if ($entry['depth'] == 1) { if (!$first_page) { $document->addPage(); } $first_page = false; $document->addContent('++++**' . _('Bereich') . ': ' . $entry['name_raw'] . '**++++' . "\n"); $document->addContent($entry['content_raw']); $document->addContent("\n\n"); } else { if ($entry['depth'] == 2) { $document->addContent('++**' . _('Thema') . ': ' . $entry['name_raw'] . '**++' . "\n"); $document->addContent('%%' . sprintf(_('erstellt von %s am %s'), $author, strftime('%A %d. %B %Y, %H:%M', (int) $entry['mkdate'])) . '%%' . "\n"); $document->addContent($entry['content_raw']); $document->addContent("\n\n"); } else { if ($entry['depth'] == 3) { $document->addContent('**' . $entry['name_raw'] . '**' . "\n"); $document->addContent('%%' . sprintf(_('erstellt von %s am %s'), $author, strftime('%A %d. %B %Y, %H:%M', (int) $entry['mkdate'])) . '%%' . "\n"); $document->addContent($entry['content_raw']); $document->addContent("\n--\n"); } } } } $document->dispatch($seminar_name['name'] . " - Forum"); die; }
function exportAllWikiPagesPDF($mode, $sortby) { global $SessSemName; $titlesortlink = "title"; $versionsortlink = "version"; $changesortlink = "lastchange"; switch ($sortby) { case 'title': // sort by keyword, prepare link for descending sorting $sort = " ORDER BY keyword"; break; case 'titledesc': // sort descending by keyword, prep link for asc. sort $sort = " ORDER BY keyword DESC"; break; case 'version': $sort = " ORDER BY versions DESC, keyword ASC"; break; case 'versiondesc': $sort = " ORDER BY versions, keyword ASC"; break; case 'lastchange': // sort by change date, default: newest first $sort = " ORDER BY lastchange DESC, keyword ASC"; break; case 'lastchangedesc': // sort by change date, oldest first $sort = " ORDER BY lastchange, keyword ASC"; break; } $query = "SELECT keyword, MAX(chdate) AS lastchange, COUNT(*) AS versions FROM wiki WHERE range_id = ? GROUP BY keyword {$sort}"; $parameters = array($SessSemName[1]); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $document = new ExportPDF(); $document->SetTitle(_('Wiki: ').htmlReady($wikiData["keyword"])); $document->setHeaderTitle(sprintf(_("Wiki von \"%s\""), $SessSemName[0])); while ($wikiData = $statement->fetch(PDO::FETCH_ASSOC)) { $pagedata = getLatestVersion($wikiData["keyword"], $SessSemName[1]); $document->setHeaderSubtitle(sprintf(_("Seite: %s"), $wikiData["keyword"])); $document->addPage(); $document->addContent(deleteWikiLinks($pagedata["body"])); } $document->dispatch($SessSemName[header_line]." - ".$wikiData["keyword"]); }