--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/test/ma_tel_pdf_mysql.php Fri Dec 21 15:31:50 2012 +0100
@@ -0,0 +1,103 @@
+<?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/conf.inc.php");
+// include_once ("../../../../home/schwarzer/Daten/php/fhiiqm_achilleus/inc/config.inc.php");
+ $conn=mysql_connect($config["server"],$config["user"],$config["passwort"]) or die("Keine Verbindung zum SQL Server");
+
+ $db=mysql_select_db($config["dbname"],$conn); // or die("Keine Verbindung zur DB fhiiqm");
+
+ if (mysql_errno())
+ echo "error after connect und db select: " . mysql_errno() . ": " . mysql_error() . "<br>\n";
+
+ $sub = $_POST['sub'];
+ $sort = $_POST['sort'];
+ if (!$sort) $sort = $_GET['s'];
+ $abt = $_POST['abt'];
+ if (!$abt) $abt = $_GET['a'];
+
+ 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="http://www.fhi-berlin.mpg.de/fhi.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/>
+ <title>MA-Telefonliste -> PDF</title>
+ </head>
+ <body>
+ <div align="center">
+ <p><b>PDF: Mitarbeiter - 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 = mysql_query($sql,$conn))
+ {
+ while ($row = mysql_fetch_assoc($result))
+ {
+ 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='sort'>";
+ 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/test/ma_tel_flist_mysql.php>« 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 ";
+
+ if ($sort == '2') $sort = "2,3,12,5,6";
+ elseif ($sort == '12') $sort = "12,5,2,3,6";
+ else $sort = "2,3,12,5,6";
+
+ if ($abt > '-1') $wher = " WHERE abt_tel = $abt "; else $wher = "";
+
+ $sql .= $wher . " ORDER BY $sort";
+ $result=mysql_query($sql,$conn);
+ if ($result && mysql_num_rows($result))
+ {
+ $header=array('Name','Abteilung','Tel/Fax','Raum','E-Mail');
+ $pdf = new PDF();
+ $pdf->SetLeftMargin(25);
+ $pdf->AddPage();
+ $pdf->AliasNbPages();
+ $pdf->SetFont('helvetica','',9);
+
+ $pdf->FancyTableOldMySQL($header,$result);
+ $pdf->SetDisplayMode('real');
+ $pdf->Output();
+ // als Download
+// $pdf->Output('ma_tel_list.pdf','D');
+ }
+ }
+?>
\ No newline at end of file