fhiiqm/laser_flist.php
changeset 22 aae5b0ecc47b
child 23 a382de56a8e4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/laser_flist.php	Thu Jan 12 11:41:22 2012 +0100
@@ -0,0 +1,213 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 01/2012
+ * 
+ * Laser-Liste
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login($_SERVER["PHP_SELF"]);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("lr",$_SESSION["recht"]) && !in_array("le",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+    include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php");
+    if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+
+?>
+
+<!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 type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" media="screen"/>	
+    <link type="text/css" href="/fhiiqm/css/db_print.css" rel="Stylesheet" media="print"/>	
+    <title>Liste Laser</title>
+ </head>
+ 
+ <body onload="document.ffilter.filter.focus();">
+
+<?php
+    echo "&nbsp;";  
+    echo "<div class=\"float-br smaller\" valign='top'>";
+    echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
+    echo "&nbsp;&nbsp;&nbsp;<a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
+    echo "<div class=\"float-r\"><img src=\"img/laser.png\" border=\"0\" alt=\"Laser\" title=\"Laser\"/></div>\n";
+
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(2=>"ID",3=>"Bezeichnung",4=>"Art",5=>"Klasse",6=>"Typ",7=>"Schutzstufe",8=>"Hersteller",9=>"'in Betrieb'",
+                    10=>"Haus",11=>"Raum-Nr.",12=>"Verantwortlicher",13=>"Referenz-ID");
+
+    $zeil = $_GET["z"];
+    if (!$zeil) $zeil = $_POST["z"];
+    if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen
+    $start = $_GET["st"];
+    if (!$start) $start=0;
+    
+	$sort   = $_GET["s"];   // Sortierung nach Spalte
+    if (!isset($sort) && !$sort) $sort = $_POST["s"];      
+
+    $dir    = $_GET["d"];   // Sortierrichtung
+    if (!isset($dir) && !$dir) $dir = $_POST["d"];
+
+    $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
+    if (!isset($fnum) && !$fnum) $fnum = $_POST["f"];
+
+    $filter = $_POST["filter"];
+    if (!isset($filter) && !$filter) $filter = $_GET["b"];   
+
+    $subf   = $_POST["subf"]; // submit
+    
+    if (!isset($fnum) && !$fnum) $fnum = 1;
+    if (!isset($filter) && !$filter) $filter = "";
+    if (!isset($sort) && !$sort) $sort = 2;
+    if (!isset($dir) && !$dir)  $dir = "";
+
+    include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+    
+    // Filter 'aktiv'
+    if ($fnum == 9)
+    { 
+        if ($filter == "ja") $filter = "1";
+        elseif  ($filter == "nein") $filter = "0";
+        else $filter = "";
+    }
+    $sql = "CALL laser_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz,@anzpl);"; 
+    // Parameter: Nr. Sortfeld, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Startsatz(0), Anzahl zu liefernde DS, Anzahl gefundener Laser
+    $result = $dbc ->queryObjectArray($sql);
+
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+     
+        echo "<div align='center'>\n";
+        echo "<p><b>Laser</b></p>\n";
+        
+        echo "<table border='0' cellspacing='0'>\n";
+        echo "<tr><td class='bigger'>Mittels '<img src='/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />' 
+            können Sie nach relevanten Spalten auf- bzw. absteigend sortieren</td></tr>
+            <tr><td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' erm&ouml;glicht das Filtern nach ausgew&auml;hlten Spalten der Liste</td></tr>
+            <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten "; 
+        if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"]))
+            echo ", '<img src='/fhiiqm/img/duplicate.gif' border='0' hight='11'>' - Duplizieren";
+        echo "    des Lasers</td></tr>\n";
+        echo "</table>\n";
+
+        $anz = $dbc -> querySingleItem("SELECT @anz");
+        $anzpl = $dbc -> querySingleItem("SELECT @anzpl");
+        
+        printf ("<p>Anzahl Laser: %s, Anzahl physischer Laser: %s </p>", $anz, $anzpl);
+        
+        if (isset($fnum) && $fnum>1 && !$filter && !$subf)
+        {
+            // Formular anzeigen fuer Filterbegriff
+            $text = $fields[$fnum];
+            echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n";
+            echo "<input type='hidden' name='s' value='$sort'>";
+            echo "<input type='hidden' name='d' value='$dir'>";
+            echo "<input type='hidden' name='f' value='$fnum'>";
+            echo "<table width=\"25%\" border=\"0\">\n";
+            echo "<tr><td>filtern nach $text: </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"10\" maxlength=\"30\" value=\"$filter\"/></td>";
+            
+            echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n";
+            echo "</form>\n";
+            echo "<p>&nbsp;&nbsp;&nbsp;</p>\n";
+        }
+        echo "<table width='99%'>\n";
+        
+        if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n";
+
+        // Listenkopf generieren
+        echo "<tr bgcolor='#68ACBF'>";
+        tab_column(2,"ID",$sort,$dir,2,$fnum,$filter,$start,$zeil);
+        tab_column(13,"ref-ID",$sort,$dir,13,$fnum,$filter,$start,$zeil);
+        tab_column(3,"Bezeichnung",$sort,$dir,3,$fnum,$filter,$start,$zeil);
+        echo "<th>Welle</th>";
+        tab_column(4,"Art",$sort,$dir,4,$fnum,$filter,$start,$zeil);
+        tab_column(6,"Typ",$sort,$dir,6,$fnum,$filter,$start,$zeil);
+        tab_column(5,"Klasse",$sort,$dir,5,$fnum,$filter,$start,$zeil);
+        tab_column(7,"Schutzst.",$sort,$dir,7,$fnum,$filter,$start,$zeil);
+        tab_column(8,"Hersteller",$sort,$dir,8,$fnum,$filter,$start,$zeil);
+        tab_column(9,"Betrieb",$sort,$dir,9,$fnum,$filter,$start,$zeil);
+        tab_column(10,"Haus",$sort,$dir,10,$fnum,$filter,$start,$zeil);
+        tab_column(11,"Raum",$sort,$dir,11,$fnum,$filter,$start,$zeil);
+        tab_column(12,"Verantw.",$sort,$dir,12,$fnum,$filter,$start,$zeil);
+
+        echo "<th>&nbsp;</th>";
+        if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"]))
+            echo "<th>&nbsp;</th></tr>\n";
+        
+        foreach ($result as $row)
+        {
+			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+            echo "<tr bgcolor='" . $bg . "'><td>$row->las_ID</td>";
+            echo "<td>$row->las_ref_ID</td>";
+            echo "<td>$row->las_bez</td>";
+            echo "<td>" .str_replace(".",",",str_replace(".00","",$row->las_welle_von))." - ".str_replace(".",",",str_replace(".00","",$row->las_welle_bis))."</td>";
+            echo "<td>$row->las_art_bez</td>";
+            echo "<td>$row->las_typ_bez</td>";
+            echo "<td>$row->las_klasse_bez</td>";
+            echo "<td>$row->schutzst_bez</td>";
+            echo "<td>$row->las_hersteller_bez</td>";
+            echo "<td>"; echo ($row->aktiv) ? "ja" : "nein"; echo "</td>";
+            echo "<td>$row->geb_ID</td>";
+            echo "<td>$row->raum_nr</td>";
+            echo "<td>$row->vma</td>";
+            echo "<td><a href='/fhiiqm/laser_ed.php?i=$row->las_ID'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>";
+            if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"]))
+                echo "<td><a href='/fhiiqm/laser_ed.php?i=$row->las_ID&d=1&c=1'><img src=\"/fhiiqm/img/duplicate.gif\" alt='duplizieren' title='duplizieren' border='0'/></a></td>";
+        }
+        echo "</table></div>\n";
+
+        echo "<br />&nbsp;&nbsp;&nbsp;";
+        
+        // Sortierung und Filter aus $_GET fuer weitere Seiten
+        foreach ($_GET as $key=>$val)
+        {
+            if ($key != "st") $liste .= "&" . $key ."=".$val;
+        }    
+        // Sortierung und Filter aus $_POST fuer weitere Seiten
+        if ($subf)
+        foreach ($_POST as $key=>$val)
+        {
+            if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val;
+            if ($key == "filter") $liste .= "&b=" . $val;
+        }    
+        
+        // Links auf andere Seiten generieren
+        liste_links($start,$zeil,$panz,$liste);
+
+    }
+    else
+    {
+        if ($dbc -> error)  
+            echo "error: " . $dbc -> error . "<br />\n";
+        {
+            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider nichts gefunden f&uuml;r ". $fields["$fnum"] . " wie '$filter'!</p><br />";
+            echo "&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Laserliste\" class=\"sc\">Laserliste</a></p>\n";
+        }
+        
+    }
+    $dbc -> close();
+    if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"]))
+        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/laser_ed.php\" target=\"_self\" title=\"Laser erfassen\" class=\"sc\">Weiteren Laser erfassen</a></p>\n";    
+
+?>
+</body>
+</html>
\ No newline at end of file