fhiiqm/info_flist.php
changeset 29 72f79dab938e
parent 25 482252ff12fd
child 31 0a1eb975fbd9
--- a/fhiiqm/info_flist.php	Thu Jul 12 13:29:11 2012 +0200
+++ b/fhiiqm/info_flist.php	Thu Aug 23 10:17:50 2012 +0200
@@ -67,11 +67,11 @@
 
     $subf   = $_POST["subf"]; // submit
     
-    if (!isset($fnum) && !$fnum) $fnum = 1;
-    if (!isset($filter) && !$filter) $filter = "";
-    if (!isset($sort) && !$sort) $sort = 15; // Kennzeichen
-    if (!isset($dir) && !$dir)  $dir = "";
-
+    if (!isset($fnum) || !$fnum) $fnum = 1;
+    if (!isset($filter) || !$filter) $filter = "";
+    if (!isset($sort) || !$sort) $sort = 15; // Kennzeichen
+    if (!$dir || $dir < "!")  $dir = "";
+//    print_r ($_GET); echo "<br /><br />";
 	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
     include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
 
@@ -79,7 +79,7 @@
 
     $sql = "CALL info_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz);"; 
     // Parameter: Nr. Sortfeld, Sortierrichtung, Nr. Filterfeld, Filterbegriff, (StartNr DS) -1, Anzahl Zeilen=DS, Anzahl gefundener Raeume
-    // liefert: info_ID, iname, ilong, ityp, prod, adressat, author, idate, bdate, edate, lang, doc, infrel
+    // liefert: info_ID, iname, ilong, ityp, prod, adressat, author, idate, bdate, edate, lang, doc, infrel, infsort, ityp_ID, raum_ID, geb_ID, al_bez
 //    echo "sql = $sql<br />";  
     $result = $dbc ->queryObjectArray($sql);
     
@@ -141,11 +141,13 @@
         tab_column(5,"Produkt",$sort,$dir,5,$fnum,$filter,$start,$zeil);
         tab_column(6,"Adressat",$sort,$dir,6,$fnum,$filter,$start,$zeil);
         tab_column(7,"Verantw.",$sort,$dir,7,$fnum,$filter,$start,$zeil);
+        echo "<th>Ort</th>";
         tab_column(8,"Autor",$sort,$dir,0,$fnum,$filter,$start,$zeil);
         tab_column(9,"erst. am",$sort,$dir,0,$fnum,$filter,$start,$zeil);
         tab_column(10,"gilt ab",$sort,$dir,0,$fnum,$filter,$start,$zeil);
         tab_column(11,"gilt bis",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        echo "<th>Sprache</th>";
+//        echo "<th>Sprache</th>";
+        tab_column(12,"Status",$sort,$dir,12,$fnum,$filter,$start,$zeil);
         echo "<th>Dokument</th>";
         echo "<th>zu ID</th>";
         echo "<th>&nbsp;</th>";
@@ -153,6 +155,7 @@
         
 //        echo "<tr bgcolor='#68ACBF'><th>Raum-Nr.</th><th>Bezeichnung</th><th>Haus</th><th>Typ</th><th>Fl&auml;che (m<sup>2</sup>)</th><th>Raumplan</th><th>&nbsp;</th>
 //                </tr>\n";
+//      Format $row->prod: 'prod_name | prod_hier; prod_name | prod_hier; prod_name | prod_hier'
         foreach ($result as $row)
         {
 			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
@@ -160,11 +163,31 @@
             echo "<td class=\"left\">$row->infsort</td>";
             echo "<td class=\"left\">$row->iname</td>";
 //            if (strlen($row->ilong)>60) $row->ilong = substr($row->ilong,0,60)."...";
-            echo "<td class=\"left\">" . nl2br($row->ilong) . "</td>";
+            if ($row->ityp_ID == 81) $anl = " <b>&rarr; '" . $row->al_bez . "'</b>"; else $anl="";
+            echo "<td class=\"left\">" . nl2br($row->ilong).$anl . "</td>";
             echo "<td class=\"left\">$row->ityp</td>";
-            echo "<td class=\"left\">" . str_replace(";",";<br />",$row->prod) . "</td>";
+            $prod = explode("; ",$row->prod);
+            $prods = "";
+            foreach ($prod as $val)
+                $prods .= "; " . substr($val,0,strpos($val,"|")-1);
+            $prods = substr($prods,2);
+//            echo "<td class=\"left\">" . str_replace(";",";<br />",$row->prod) . "</td>";
+            echo "<td class=\"left\">" . str_replace(";",";<br />",$prods) . "</td>";
             echo "<td class=\"left\">" . str_replace(";","<br />",$row->adressat) . "</td>";
             echo "<td class=\"left\">" . str_replace(";","<br />",$row->verantw) . "</td>";
+            if ($row->ityp_ID == 7 || substr($row->ityp_ID,0,1) == 8)   // 7 = Betriebsstörung, 8 = Betriebsanweisung
+            {    if ($row->raum_ID)
+                {
+                    $sql = "SELECT geb_ID, raum_nr FROM Raum WHERE raum_ID = $row->raum_ID";
+                    $res = $dbc -> queryObjectArray($sql);
+                    foreach ($res as $ro)
+                        echo "<td>$ro->geb_ID, $ro->raum_nr</td>";
+                }
+                elseif ($row->geb_ID && !$row->raum_ID)
+                    echo "<td>$row->geb_ID</td>";
+                else echo "<td>&nbsp;</td>";
+            }
+            else echo "<td>&nbsp;</td>";
             echo "<td class=\"left\">$row->author</td>";
             if ($row->idate)
             {
@@ -184,7 +207,8 @@
                 echo "<td class=\"left\">" . $dat->format('d.m.Y')."</td>";
             }
             else  echo "<td>&nbsp;</td>";       
-            echo "<td class=\"left\">$row->lang</td>";
+//            echo "<td class=\"left\">$row->lang</td>";
+            echo "<td class=\"left\">$row->freigabe</td>";
             if (file_exists("infos/".$row->doc))
             {
                 $doc = substr($row->doc,strpos($row->doc,"_")+1); 
@@ -193,8 +217,10 @@
             else    
                 echo "<td class=\"left\">$row->doc</td>";
             echo "<td class=\"left\">$row->infrel</td>";
-            echo "<td><a href='/fhiiqm/info_ed.php?i=$row->info_ID'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>";
-            echo "<td><a href='/fhiiqm/info_ed.php?i=$row->info_ID&d=1'><img src=\"/fhiiqm/img/duplicate.gif\" alt='duplizieren' title='duplizieren' border='0'/></a></td></tr>\n";
+            $getp = "&s=$sort&d=$dir&f=$fnum&b=$filter&st=$start&z=$zeil";
+            if ($row->ityp_ID == 7 || substr($row->ityp_ID,0,1) == 8) $ref = "/fhiiqm/info_betrst_ed.php?i=$row->info_ID&t=$row->ityp_ID$getp"; else $ref="/fhiiqm/info_ed.php?i=$row->info_ID$getp";
+            echo "<td><a href='$ref'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>";
+            echo "<td><a href='$ref&dp=1'><img src=\"/fhiiqm/img/duplicate.gif\" alt='duplizieren' title='duplizieren' border='0'/></a></td></tr>\n";
         }
         echo "</table></div>\n";