Пример #1
0
 /**
  * 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;
 }
Пример #2
0
<?php

error_reporting(E_ALL ^ E_NOTICE);
include_once 'exportPDF.class.php';
$oPDF = new ExportPDF();
$arr = array(array('emp_id' => 1, 'emp_name' => 'Allyne', 'dept_name' => 'HumanResource'), array('emp_id' => 5, 'emp_name' => 'Philippes', 'dept_name' => 'HumanResource'), array('emp_id' => 9, 'emp_name' => 'Nicholas Swabber', 'dept_name' => 'HumanResource'), array('emp_id' => 2, 'emp_name' => 'Thomas Parre', 'dept_name' => 'Engineering'), array('emp_id' => 6, 'emp_name' => 'Iohn Brocke', 'dept_name' => 'Engineering'), array('emp_id' => 3, 'emp_name' => 'Michel Polyson', 'dept_name' => 'QualityAnalyst'), array('emp_id' => 7, 'emp_name' => 'Randall Mayne', 'dept_name' => 'QualityAnalyst'), array('emp_id' => 10, 'emp_name' => 'Haunce Walters', 'dept_name' => 'QualityAnalyst'), array('emp_id' => 4, 'emp_name' => 'William Farthowe', 'dept_name' => 'Database'), array('emp_id' => 8, 'emp_name' => 'Charles Stevenson', 'dept_name' => 'Database'), array('emp_id' => 11, 'emp_name' => 'John Arundell', 'dept_name' => 'Sales'));
//print_r($arr);
$labels = 'EmployeeID, EmployeeName';
$fields = array('emp_id', 'emp_name');
$title = 'Employees and Departments';
$glabel = array('Department');
$gfield = 'dept_name';
$oPDF->PDFExport($arr, $labels, $fields, $title, $glabel, $gfield);
 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&uumlr das Geb&auml;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);
     }
 }
Пример #4
0
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"]);
}