fhiiqm/ma_tel_pdf.php
changeset 33 f1a8785434e4
child 34 fc60ef80a7ad
equal deleted inserted replaced
32:c2d325791e24 33:f1a8785434e4
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * @author Bettina Schwarzer, Fritz-Haber-Institut
       
     5  * @copyright 11/2012
       
     6  * 
       
     7  * Telefonliste als pdf erstellen
       
     8  * 
       
     9  */
       
    10 
       
    11     error_reporting(E_ALL ^ E_NOTICE);
       
    12     include ($_SERVER['DOCUMENT_ROOT']."/fhiiqm/inc/pdf_ma_tel.inc.php");
       
    13 	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
       
    14     $dbc = new dbconnection();
       
    15     $sub = $_POST['sub'];
       
    16     $sortp = $_POST['sortp'];
       
    17     if (!$sortp) $sortp = $_GET['sp'];
       
    18     $abt = $_POST['abt'];
       
    19     if (!$abt) $abt  = $_GET['a'];
       
    20 
       
    21 	$sort   = $_GET["s"];   // Sortierung nach Spalte
       
    22     $dir    = $_GET["d"];   // Sortierrichtung
       
    23     $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
       
    24     $filter = $_GET["b"];  // Filterbegriff
       
    25     $edit   = $_GET["e"];   // Telefonliste editierbar 
       
    26     $getp = "e=$edit&s=$sort&d=$dir&f=$fnum&b=$filter"; // Parameter Listenanzeige Mitarbeiter/Objekte-Telefonliste
       
    27       
       
    28     if (!$sub)
       
    29     {
       
    30     ?>
       
    31         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
    32         <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
       
    33         
       
    34         <head>
       
    35         	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
       
    36            	<link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
       
    37            	<link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
       
    38         	<title>MA/O-Telefonliste -&gt; PDF</title>
       
    39          </head>
       
    40          <body>
       
    41          <div align="center">
       
    42          <p><b>PDF: Mitarbeiter/Objekte - Telefonliste</b></p>
       
    43     <?php
       
    44         echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n";
       
    45         echo "<table width=\"30%\" border=\"0\">\n";
       
    46         echo "<tr><td>filtern nach Abteilung</td>";
       
    47         echo "   <td valign=\"top\">
       
    48                  <select name=\"abt\">";
       
    49                     echo "<option value=\"-1\"></option>\n";
       
    50                     $sql = "SELECT abt_ID, abt_name, abt_long FROM `fhiiqm`.`Abteilung` ORDER BY abt_ID+0";
       
    51                     if ($result = $dbc->queryObjectArray($sql))
       
    52                     {
       
    53                         foreach ($result as $row)
       
    54                         {
       
    55                             if ($row->abt_ID == $ma['abt'])
       
    56         					   echo "<option selected value=\"$row->abt_ID\">$row->abt_name: $row->abt_long</option>\n";
       
    57         				    else
       
    58         					   echo "<option value=\"$row->abt_ID\">$row->abt_name: $row->abt_long</option>\n";
       
    59                         }
       
    60                 }
       
    61         echo "       </select></td></tr>\n";
       
    62         echo "<tr><td>sortieren nach</td>";
       
    63         echo "  <td><select name='sortp'>";
       
    64         echo "      <option value=\"-1\"></option>\n";
       
    65         echo "      <option value='2'>Name</option>\n";    
       
    66         echo "      <option value='12'>Abteilung</option>\n";    
       
    67         echo "       </select></td></tr>\n";
       
    68         echo "<tr><td>&nbsp;</td><td><input  class=\"button\" type=\"submit\" name=\"sub\" value=\"  pdf erstellen  \" /></td></tr>\n";
       
    69         echo "</table>\n";
       
    70         echo "</form>\n";
       
    71         echo "</div>\n";
       
    72         echo "<p><br /><br />&nbsp;&nbsp;&nbsp;<a href=/fhiiqm/ma_tel_flist.php?$getp>&laquo; zur Telefon-Liste</a></p>\n";
       
    73         echo "</body></html>\n";
       
    74     }
       
    75     else
       
    76     {
       
    77         $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 "; 
       
    78     
       
    79         if ($sortp == '2') $sortp = "name COLLATE latin1_general_ci,3,12,5,6"; // Name
       
    80         elseif ($sortp == '12') $sortp = "12,5,name COLLATE latin1_general_ci,3,6"; // abt_ID
       
    81         else $sortp = "name COLLATE latin1_general_ci,3,12,5,6";
       
    82         
       
    83         if ($abt > '-1') $wher = " WHERE abt_tel = $abt "; else $wher = "";
       
    84         
       
    85         $sql .= $wher . " ORDER BY $sortp";
       
    86         if ($result = $dbc ->queryObjectArray($sql))
       
    87         { 
       
    88             $header=array('Name','Abteilung','Tel/Fax','Raum','E-Mail');
       
    89             $pdf = new PDF();
       
    90             $pdf->SetLeftMargin(25);
       
    91             $pdf->AddPage();
       
    92             $pdf->AliasNbPages();
       
    93             $pdf->SetFont('helvetica','',9);
       
    94         
       
    95             $pdf->FancyTable($header,$result);
       
    96             $pdf->SetDisplayMode('real');
       
    97             $pdf->Output();
       
    98             // als Download
       
    99 //            $pdf->Output('ma_tel_list.pdf','D');
       
   100         }
       
   101     }
       
   102 ?>