fhiiqm/prozess_flist.php
changeset 25 482252ff12fd
child 27 d92bbe898f32
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/prozess_flist.php	Thu Apr 05 15:35:43 2012 +0200
@@ -0,0 +1,252 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 04/2012
+ * 
+ * Liste der Prozesse
+ * 
+ */
+
+
+    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("pzr",$_SESSION["recht"]) && !in_array("pze",$_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 Prozesse</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/sheduled_task.png\" border=\"0\" alt=\"Prozessliste\" title=\"Prozesslisze\"/></div>\n";
+
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(1=>"ID",2=>"Bezeichnung",4=>"Produkt",5=>"'bezieht sich auf ID'",6=>"Anforderer",7=>"Verantwortlicher",8=>"'Plan Start'",9=>"'Plan Ende'",
+                    11=>"Start",12=>"Ende",14=>"Wichtigkeit",15=>"Status");
+
+    $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");
+    
+    $sql = "CALL prozess_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz);"; 
+    // 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>Prozesse</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 Prozesses</td></tr>\n";
+        echo "</table>\n";
+
+        $anz = $dbc -> querySingleItem("SELECT @anz");
+        
+        printf ("<p>Anzahl Prozesse: %s</p>", $anz);
+        
+        if (isset($fnum) && $fnum>1 && !$filter && !$subf)
+        {
+            // Formular anzeigen fuer Filterbegriff
+            $text = $fields[$fnum];
+            if ($fnum > 7 && $fnum < 13) $textd = "<br />Format 'jjjj-mm-tt' oder Teil davon"; else $textd = "";
+            $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows
+            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=\"40%\" border=\"0\">\n";
+            echo "<tr><td>filtern nach $text:$textd </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"10\" maxlength=\"30\" value=\"$filter\"/></td>";
+            echo "<td>Prozesse/Seite?   <select name='z'>\n";
+            foreach ($azeil as $key=>$val)
+            {
+                if ($key == $zeil) $select = "selected"; else $select = "";
+                echo "<option $select value='$key'>$val</option>\n";
+            }
+            echo "</select></td>\n";
+            
+            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(1,"ID",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(5,"zu ID",$sort,$dir,5,$fnum,$filter,$start,$zeil);
+        tab_column(2,"Bezeichnung",$sort,$dir,2,$fnum,$filter,$start,$zeil);
+/*        tab_column(3,"Beschreibung",$sort,$dir,0,$fnum,$filter,$start,$zeil); */
+        tab_column(4,"Produkt",$sort,$dir,4,$fnum,$filter,$start,$zeil);
+        tab_column(6,"Auftragg.",$sort,$dir,6,$fnum,$filter,$start,$zeil);
+        tab_column(7,"Verantw.",$sort,$dir,7,$fnum,$filter,$start,$zeil);
+        echo "<th>Schritte</th>";
+/*        tab_column(8,"Start Pl.",$sort,$dir,8,$fnum,$filter,$start,$zeil);
+        tab_column(9,"Ende Pl.",$sort,$dir,9,$fnum,$filter,$start,$zeil);
+        tab_column(10,"Kosten Pl.",$sort,$dir,0,$fnum,$filter,$start,$zeil);    */
+        tab_column(11,"Start",$sort,$dir,11,$fnum,$filter,$start,$zeil);
+        tab_column(12,"Ende",$sort,$dir,12,$fnum,$filter,$start,$zeil);
+        tab_column(13,"Kosten",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(14,"Wichtigk.",$sort,$dir,14,$fnum,$filter,$start,$zeil);
+        tab_column(15,"Status",$sort,$dir,15,$fnum,$filter,$start,$zeil);
+        echo "<th>Bemerkung</th>";
+
+        echo "<th>&nbsp;</th>";
+        if (!is_null($_SESSION["recht"]) && in_array("pe",$_SESSION["recht"]))
+            echo "<th>&nbsp;</th>";
+        echo "</tr>\n";
+       
+        foreach ($result as $row)
+        {
+			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+            echo "<tr bgcolor='" . $bg . "'><td>$row->proz_ID</td>";
+            if ($row->proz_ref_ID) echo "<td>$row->proz_ref_ID</td>"; else echo "<td>&nbsp;</td>";
+            echo "<td>$row->bez</td>";
+/*            echo "<td>" .nl2br($row->proz_bez_l)."</td>"; */
+            echo "<td>$row->prod_name</td>";
+            echo "<td>$row->ama</td>";
+            echo "<td>$row->vma</td>";
+            $steps = explode(";",$row->steps);
+            if (is_array($steps))
+            {
+                echo "<td>";
+                foreach ($steps as $step)
+                {
+                    list($id,$ste) = explode("|",$step);
+                    echo $ste . "<br />";
+                }    
+                echo "</td>";
+            }    
+/*            if ($row->start_pl)
+            {
+                $dat = new DateTime($row->start_pl);    
+                echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>";
+            }
+            else  echo "<td>&nbsp;</td>";       
+            if ($row->end_pl)
+            {
+                $dat = new DateTime($row->end_pl);    
+                echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>";
+            }
+            else  echo "<td>&nbsp;</td>";
+            echo "<td>".number_format($row->kost_pl,2,",","."); */       
+            if ($row->start)
+            {
+                $dat = new DateTime($row->start);    
+                echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>";
+            }
+            else  echo "<td>&nbsp;</td>";       
+            if ($row->end)
+            {
+                $dat = new DateTime($row->end);    
+                echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>";
+            }
+            else  echo "<td>&nbsp;</td>";
+            echo "<td>".number_format($row->kost,2,",",".");       
+            echo "<td>$row->urg_bez</td>";
+            echo "<td>$row->stat_bez</td>";
+            echo "<td>".nl2br($row->bem)."</td>";
+            echo "<td><a href='/fhiiqm/prozess_ed.php?i=$row->proz_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/prozess_ed.php?i=$row->proz_ID&d=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,$anz,$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=\"Prozessliste\" class=\"sc\">Prozessliste</a></p>\n";
+        
+    }
+    $dbc -> close();
+    if (!is_null($_SESSION["recht"]) && in_array("pze",$_SESSION["recht"]))
+        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/prozess_ed.php\" target=\"_self\" title=\"Prozess erfassen\" class=\"sc\">Weiteren Prozess erfassen</a></p>\n";    
+
+?>
+</body>
+</html>
\ No newline at end of file