--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/ma_tel_pdf.php Fri Dec 21 15:31:50 2012 +0100
@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 11/2012
+ *
+ * Telefonliste als pdf erstellen
+ *
+ */
+
+ error_reporting(E_ALL ^ E_NOTICE);
+ include ($_SERVER['DOCUMENT_ROOT']."/fhiiqm/inc/pdf_ma_tel.inc.php");
+ include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+ $dbc = new dbconnection();
+ $sub = $_POST['sub'];
+ $sortp = $_POST['sortp'];
+ if (!$sortp) $sortp = $_GET['sp'];
+ $abt = $_POST['abt'];
+ if (!$abt) $abt = $_GET['a'];
+
+ $sort = $_GET["s"]; // Sortierung nach Spalte
+ $dir = $_GET["d"]; // Sortierrichtung
+ $fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird
+ $filter = $_GET["b"]; // Filterbegriff
+ $edit = $_GET["e"]; // Telefonliste editierbar
+ $getp = "e=$edit&s=$sort&d=$dir&f=$fnum&b=$filter"; // Parameter Listenanzeige Mitarbeiter/Objekte-Telefonliste
+
+ if (!$sub)
+ {
+ ?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+ <link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/>
+ <link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/>
+ <title>MA/O-Telefonliste -> PDF</title>
+ </head>
+ <body>
+ <div align="center">
+ <p><b>PDF: Mitarbeiter/Objekte - Telefonliste</b></p>
+ <?php
+ echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n";
+ echo "<table width=\"30%\" border=\"0\">\n";
+ echo "<tr><td>filtern nach Abteilung</td>";
+ echo " <td valign=\"top\">
+ <select name=\"abt\">";
+ echo "<option value=\"-1\"></option>\n";
+ $sql = "SELECT abt_ID, abt_name, abt_long FROM `fhiiqm`.`Abteilung` ORDER BY abt_ID+0";
+ if ($result = $dbc->queryObjectArray($sql))
+ {
+ foreach ($result as $row)
+ {
+ if ($row->abt_ID == $ma['abt'])
+ echo "<option selected value=\"$row->abt_ID\">$row->abt_name: $row->abt_long</option>\n";
+ else
+ echo "<option value=\"$row->abt_ID\">$row->abt_name: $row->abt_long</option>\n";
+ }
+ }
+ echo " </select></td></tr>\n";
+ echo "<tr><td>sortieren nach</td>";
+ echo " <td><select name='sortp'>";
+ echo " <option value=\"-1\"></option>\n";
+ echo " <option value='2'>Name</option>\n";
+ echo " <option value='12'>Abteilung</option>\n";
+ echo " </select></td></tr>\n";
+ echo "<tr><td> </td><td><input class=\"button\" type=\"submit\" name=\"sub\" value=\" pdf erstellen \" /></td></tr>\n";
+ echo "</table>\n";
+ echo "</form>\n";
+ echo "</div>\n";
+ echo "<p><br /><br /> <a href=/fhiiqm/ma_tel_flist.php?$getp>« zur Telefon-Liste</a></p>\n";
+ echo "</body></html>\n";
+ }
+ else
+ {
+ $sql = "SELECT persknr, name, vorname, titel, abt_name, telefon_nr, telefon_typ, public, geb_ID, raum_nr, email, abt_tel+0 FROM v_tel_list_ma_raum ";
+
+ if ($sortp == '2') $sortp = "name COLLATE latin1_general_ci,3,12,5,6"; // Name
+ elseif ($sortp == '12') $sortp = "12,5,name COLLATE latin1_general_ci,3,6"; // abt_ID
+ else $sortp = "name COLLATE latin1_general_ci,3,12,5,6";
+
+ if ($abt > '-1') $wher = " WHERE abt_tel = $abt "; else $wher = "";
+
+ $sql .= $wher . " ORDER BY $sortp";
+ if ($result = $dbc ->queryObjectArray($sql))
+ {
+ $header=array('Name','Abteilung','Tel/Fax','Raum','E-Mail');
+ $pdf = new PDF();
+ $pdf->SetLeftMargin(25);
+ $pdf->AddPage();
+ $pdf->AliasNbPages();
+ $pdf->SetFont('helvetica','',9);
+
+ $pdf->FancyTable($header,$result);
+ $pdf->SetDisplayMode('real');
+ $pdf->Output();
+ // als Download
+// $pdf->Output('ma_tel_list.pdf','D');
+ }
+ }
+?>
\ No newline at end of file