+ Arbeitsgruppen List,Edit; Korrekturen
authorBettina Schwarzer
Wed, 06 Aug 2014 09:42:40 +0200
changeset 43 70cea8f0e807
parent 42 cfc409017ba8
child 44 d652bbba2d43
+ Arbeitsgruppen List,Edit; Korrekturen
fhiiqm/css/db.css
fhiiqm/css/db_print.css
fhiiqm/deprecated/ap_massn_ed.php
fhiiqm/deprecated/ap_massn_flist.php
fhiiqm/deprecated/as_massn_ed.php
fhiiqm/deprecated/as_massn_flist.php
fhiiqm/deprecated/info_form.inc.php
fhiiqm/deprecated/info_ins.php
fhiiqm/deprecated/info_upd.php
fhiiqm/deprecated/vertrag_flist2.php
fhiiqm/deprecated/vertrag_ins.php
fhiiqm/form/info_form2.inc.php
fhiiqm/form/ma_fkt_form.inc.php
fhiiqm/form/recht_form.inc.php
fhiiqm/form/vertragmf_form.inc.php
fhiiqm/img/reseller_programm.png
fhiiqm/img/tel/tellist_kopf1n.jpg
fhiiqm/img/tel/tellist_kopf1no.jpg
fhiiqm/img/tel/tellist_kopf1ns.jpg
fhiiqm/inc/conf.inc.php
fhiiqm/inc/dbconnect.inc.php
fhiiqm/inc/file_upload.inc.php
fhiiqm/inc/func_lib.inc.php
fhiiqm/inc/ma_list_ac.inc.php
fhiiqm/inc/menu.inc.php
fhiiqm/inc/pdf_ma_tel.inc.php
fhiiqm/inc/vertragtab_ins.inc.php
fhiiqm/ma_tel_flist.php
fhiiqm/partner_upd.php
fhiiqm/pl/ma_search.pl
fhiiqm/rag_ed.php
fhiiqm/rag_flist.php
fhiiqm/raum_report.php
fhiiqm/recht_ed.php
fhiiqm/report/info_report_gvp.php
fhiiqm/report/raum_reinig_report.php
fhiiqm/vertrag_flist1.php
--- a/fhiiqm/css/db.css	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/css/db.css	Wed Aug 06 09:42:40 2014 +0200
@@ -138,6 +138,10 @@
   background-color:#FFCC88;
   color: #FFFFFF;
 }
+.bggast
+{
+  background-color:#C3DDDA;    
+}
 .bgmarkwe
 {
   background-color:#FFDFD1;
--- a/fhiiqm/css/db_print.css	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/css/db_print.css	Wed Aug 06 09:42:40 2014 +0200
@@ -77,6 +77,16 @@
     text-decoration: none;
     background-color: #DAFAFA}
 
+.bgmark
+{
+  background-color:#FFCC88;
+  color: #FFFFFF;
+}
+.bggast
+{
+  background-color:#C3DDDA;    
+}
+
 .red
 {
   color: #FF0000;
--- a/fhiiqm/deprecated/ap_massn_ed.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/ap_massn_ed.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,195 +1,195 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 06/2012
- * 
- * INSERT/UPDATE Arbeitsplatz - Massnahmen
- * 
- */
-
-
-    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("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-
-    $sub = $_POST["eintragen"];
-    $ap  = $_POST["ap"];
-    $ok  = $_POST["ok"];
-    $apid = $_GET["i"]; // arbeitsplatz_ID
-    
-
-
-?>
-<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-	<title>Arbeitsplatztyp - AS Ma&szlig;nahmen</title>
-
-    <script type="text/javascript">
-    <!--
-    var counter = 0;
-    var limit = 99;
-    var arr = new Array();
-    function addInput(divId){
-         if (counter == limit)  {
-              alert("Das Limit von " + counter + " zusätzlichen inputs ist erreicht");
-         }
-         else {
-              var newdiv = document.createElement('div');
-              var count;
-              var opt="<option value='-1'></option>";
-              for (var key in arr)  
-              {
-                opt = opt.concat("<option value='",key,"'>",arr[key],"</option>\n" );
-              }
-              opt += "</select>\n";
-              newdiv.innerHTML += "<select name='ap[asm][]'>"+opt;
-              document.getElementById(divId).appendChild(newdiv);
-              counter++;
-         }
-    }
-    function delInput(divId){
-            var kn = document.getElementById(divId); 
-            while (kn.childNodes.length>0 && kn.lastChild.nodeName != "SELECT" && kn.lastChild.nodeName != "A")
-            {
-//                alert ("vor "+kn.lastChild.nodeName+", nodetyp = "+ kn.lastChild.nodeType);
-                var knc = kn.lastChild;
-                    document.getElementById(divId).removeChild(knc);
-            }
-            if (kn.lastChild.nodeName == "SELECT") document.getElementById(divId).removeChild(kn.lastChild);
-    }
-    //-->
-    </script>
-
-</head>
-
-<body>
-
-<?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/role.png\" border=\"0\" alt=\"Arbeitsplatztyp - Massnahmen bearbeiten\" title=\"Arbeitsplatztyp - Massnahme bearbeiten\"/></div>\n";
-
-    if ($apid) $text = "editieren"; else $text = "erfassen";
-    echo "<div align=\"center\">";
-    echo "<h3>Arbeitsplatztyp - Arbeitssicherheit Ma&szlig;nahmen $text</h3>";
-    echo "</div>\n";
-    if (!$sub || !isset($ap) || !$ok) 
-    {
-        if ($apid && !$sub && !isset($ap))
-        {
-            $sql = "SELECT asm_ID, arbplatz_typ FROM AS_Massnahme_Arbplatz WHERE arbplatz_typ = '" . $apid . "'";
-            if ($res = $dbc -> queryObjectArray($sql))
-            {
-                foreach ($res as $row)
-                {
-                    $ap["aptyp"] = $row->arbplatz_typ;
-                    $ap["asm"][]  = $row->asm_ID;   
-                }
-            }
-            else $ap["aptyp"] = $apid;
-        }
-        include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/ap_massn_form.inc.php");
-        
-	  	if ($sub)
-        {
-            $frage = "Alle Angaben ok?";
-			echo "<tr>
-			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
-			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
-			        if ($ok)  echo "checked=\"checked\""; 
-			echo " /></td>\n</tr>\n";
-        }
-        if (!is_null($_SESSION["recht"]) && in_array("ase",$_SESSION["recht"]))
-        {
-            echo "
-           	<tr><td>&nbsp;</td>\n
-            	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
-           	echo "</td></tr>\n";
-        }
-        echo "</table>\n";
-        echo "</div>\n";
-    echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"ap_massn_flist.php\" target=\"_self\" title=\"Arbplatztyp-Massnahmenen-Liste\">&laquo; zur Arbeitsplatztyp-Massnahmenen-Liste</a></p>\n"; 
-    echo "</form>\n";
-    }
-    else
-    {
-        echo "<div align='center'>\n";
-
-        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-        
-        $stmt = $dbc -> stmtinit();
-        if (is_object($stmt))
-        {
-            $retd = 1;
-            if ($apid && is_array($ap['asm']))
-            {   //UPDATE
-                // Loeschen alte Arbeitsplatztypen
-                $retd = $dbc -> execute("DELETE FROM AS_Massnahme_Arbplatz WHERE arbplatz_typ = '". $ap["aptyp"] ."'");
-            }
-            
-            if ($retd && is_array($ap['asm']))
-            {
-                $rett = 1;
-                $stmt -> prepare("INSERT INTO AS_Massnahme_Arbplatz (asm_ID,arbplatz_typ) VALUES(?,?)");
-                for ($k=0; $k<count($ap["asm"]); $k++)
-                {
-                    if ($ap["asm"][$k] && $ap["asm"][$k] != -1) 
-                    {
-                        $stmt -> bind_param('is',$ap["asm"][$k], $ap["aptyp"]);
-                        $rett = $stmt -> execute();
-                        if (!$rett) $rett = false;
-                    }
-                }
-                if (!$rett) echo "error INSERT Massnahme: $stmt->error<br />\n";
-                
-            }
-        }
-            if ($rett)
-            {
-                echo "<p class='green'><b>AS Ma&szlig;nahmenen für Arbeitsplatztyp '".$ap["aptyp"]."' wurden erfolgreich gespeichert.</b></p>\n";
-                echo "<table>\n";
-                if (is_array($ap["asm"]))
-                {
-                    echo "<tr><td>AS Ma&szlig;nahmen: </td>";
-                    foreach ($ap["asm"] as $gf)
-                    { 
-                        $sql = "SELECT asm_bez FROM AS_Massnahme WHERE asm_ID=$gf";
-                        $asmbez = $dbc -> querySingleItem($sql);
-                        if ($next) $next ="<tr><td>&nbsp;</td>"; else $next =" ";
-                        if ($gf && $gf != -1) echo "$next<td>$asmbez</td></tr>\n";
-                    }
-                }
-                echo "</table>\n";
-            }   
-            else
-                echo "<p class='red'><b>AS Ma&szlig;nahmen für Arbeitsplatztyp '".$ap["aptyp"]."' wurden nicht oder nur teilweise gespeichert</b></p>\n";
-        
-        echo "</div>";
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"ap_massn_flist.php\" target=\"_self\" title=\"Arbplatztyp-Ma&szlig;nahmen-Liste\">&laquo; zur Arbeitsplatztyp-Ma&szlig;nahmen-Liste</a></p>\n"; 
-    }
-?>
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 06/2012
+ * 
+ * INSERT/UPDATE Arbeitsplatz - Massnahmen
+ * 
+ */
+
+
+    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("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+
+    $sub = $_POST["eintragen"];
+    $ap  = $_POST["ap"];
+    $ok  = $_POST["ok"];
+    $apid = $_GET["i"]; // arbeitsplatz_ID
+    
+
+
+?>
+<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+	<title>Arbeitsplatztyp - AS Ma&szlig;nahmen</title>
+
+    <script type="text/javascript">
+    <!--
+    var counter = 0;
+    var limit = 99;
+    var arr = new Array();
+    function addInput(divId){
+         if (counter == limit)  {
+              alert("Das Limit von " + counter + " zusätzlichen inputs ist erreicht");
+         }
+         else {
+              var newdiv = document.createElement('div');
+              var count;
+              var opt="<option value='-1'></option>";
+              for (var key in arr)  
+              {
+                opt = opt.concat("<option value='",key,"'>",arr[key],"</option>\n" );
+              }
+              opt += "</select>\n";
+              newdiv.innerHTML += "<select name='ap[asm][]'>"+opt;
+              document.getElementById(divId).appendChild(newdiv);
+              counter++;
+         }
+    }
+    function delInput(divId){
+            var kn = document.getElementById(divId); 
+            while (kn.childNodes.length>0 && kn.lastChild.nodeName != "SELECT" && kn.lastChild.nodeName != "A")
+            {
+//                alert ("vor "+kn.lastChild.nodeName+", nodetyp = "+ kn.lastChild.nodeType);
+                var knc = kn.lastChild;
+                    document.getElementById(divId).removeChild(knc);
+            }
+            if (kn.lastChild.nodeName == "SELECT") document.getElementById(divId).removeChild(kn.lastChild);
+    }
+    //-->
+    </script>
+
+</head>
+
+<body>
+
+<?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/role.png\" border=\"0\" alt=\"Arbeitsplatztyp - Massnahmen bearbeiten\" title=\"Arbeitsplatztyp - Massnahme bearbeiten\"/></div>\n";
+
+    if ($apid) $text = "editieren"; else $text = "erfassen";
+    echo "<div align=\"center\">";
+    echo "<h3>Arbeitsplatztyp - Arbeitssicherheit Ma&szlig;nahmen $text</h3>";
+    echo "</div>\n";
+    if (!$sub || !isset($ap) || !$ok) 
+    {
+        if ($apid && !$sub && !isset($ap))
+        {
+            $sql = "SELECT asm_ID, arbplatz_typ FROM AS_Massnahme_Arbplatz WHERE arbplatz_typ = '" . $apid . "'";
+            if ($res = $dbc -> queryObjectArray($sql))
+            {
+                foreach ($res as $row)
+                {
+                    $ap["aptyp"] = $row->arbplatz_typ;
+                    $ap["asm"][]  = $row->asm_ID;   
+                }
+            }
+            else $ap["aptyp"] = $apid;
+        }
+        include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/ap_massn_form.inc.php");
+        
+	  	if ($sub)
+        {
+            $frage = "Alle Angaben ok?";
+			echo "<tr>
+			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+			        if ($ok)  echo "checked=\"checked\""; 
+			echo " /></td>\n</tr>\n";
+        }
+        if (!is_null($_SESSION["recht"]) && in_array("ase",$_SESSION["recht"]))
+        {
+            echo "
+           	<tr><td>&nbsp;</td>\n
+            	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
+           	echo "</td></tr>\n";
+        }
+        echo "</table>\n";
+        echo "</div>\n";
+    echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"ap_massn_flist.php\" target=\"_self\" title=\"Arbplatztyp-Massnahmenen-Liste\">&laquo; zur Arbeitsplatztyp-Massnahmenen-Liste</a></p>\n"; 
+    echo "</form>\n";
+    }
+    else
+    {
+        echo "<div align='center'>\n";
+
+        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+        
+        $stmt = $dbc -> stmtinit();
+        if (is_object($stmt))
+        {
+            $retd = 1;
+            if ($apid && is_array($ap['asm']))
+            {   //UPDATE
+                // Loeschen alte Arbeitsplatztypen
+                $retd = $dbc -> execute("DELETE FROM AS_Massnahme_Arbplatz WHERE arbplatz_typ = '". $ap["aptyp"] ."'");
+            }
+            
+            if ($retd && is_array($ap['asm']))
+            {
+                $rett = 1;
+                $stmt -> prepare("INSERT INTO AS_Massnahme_Arbplatz (asm_ID,arbplatz_typ) VALUES(?,?)");
+                for ($k=0; $k<count($ap["asm"]); $k++)
+                {
+                    if ($ap["asm"][$k] && $ap["asm"][$k] != -1) 
+                    {
+                        $stmt -> bind_param('is',$ap["asm"][$k], $ap["aptyp"]);
+                        $rett = $stmt -> execute();
+                        if (!$rett) $rett = false;
+                    }
+                }
+                if (!$rett) echo "error INSERT Massnahme: $stmt->error<br />\n";
+                
+            }
+        }
+            if ($rett)
+            {
+                echo "<p class='green'><b>AS Ma&szlig;nahmenen für Arbeitsplatztyp '".$ap["aptyp"]."' wurden erfolgreich gespeichert.</b></p>\n";
+                echo "<table>\n";
+                if (is_array($ap["asm"]))
+                {
+                    echo "<tr><td>AS Ma&szlig;nahmen: </td>";
+                    foreach ($ap["asm"] as $gf)
+                    { 
+                        $sql = "SELECT asm_bez FROM AS_Massnahme WHERE asm_ID=$gf";
+                        $asmbez = $dbc -> querySingleItem($sql);
+                        if ($next) $next ="<tr><td>&nbsp;</td>"; else $next =" ";
+                        if ($gf && $gf != -1) echo "$next<td>$asmbez</td></tr>\n";
+                    }
+                }
+                echo "</table>\n";
+            }   
+            else
+                echo "<p class='red'><b>AS Ma&szlig;nahmen für Arbeitsplatztyp '".$ap["aptyp"]."' wurden nicht oder nur teilweise gespeichert</b></p>\n";
+        
+        echo "</div>";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"ap_massn_flist.php\" target=\"_self\" title=\"Arbplatztyp-Ma&szlig;nahmen-Liste\">&laquo; zur Arbeitsplatztyp-Ma&szlig;nahmen-Liste</a></p>\n"; 
+    }
+?>
+</body>
 </html>
\ No newline at end of file
--- a/fhiiqm/deprecated/ap_massn_flist.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/ap_massn_flist.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,187 +1,187 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 05/2012
- * 
- * Liste Arbeitsplatztyp - AS Massnahme 
- * Tabelle 'AS_Massnahme_Arbplatz' wird nicht mehr genutzt (19.06.2012, bs)
- * 
- */
-
-    error_reporting(E_ALL ^ E_NOTICE);
-    
-    session_start();
-    if (! isset($_SESSION["userid"]))
-    { 
-        include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");	
-        login($_SERVER["PHP_SELF"]);
-        exit;
-    }
-    
-    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-
-?>
-<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
-   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-
-    <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
-    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
-    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
-
-	<title>Arbplatztyp-AS-Ma&szlig;nahme-Liste</title>
-</head>
-
-<body onload="document.ffilter.filter.focus();">
-
-    <script>
-      $(document).ready(function() {
-        $("#dialog").dialog({
-            	bgiframe: true,
-            	autoOpen: false,
-            	height: 300,
-                width: 400,
-                resizable: true,
-            	modal: true
-                });
-        $('#open0').click(function() {
-    	       $('#dialog').dialog("open");
-                });
-        $('#open1').click(function() {
-    	       $('#dialog').dialog("open");
-                });
-        });
-    </script>
-    
-<?php
-    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-	$dbc = new dbconnection();
-
-    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/role.png\" border=\"0\" alt=\"Arbeitsplatztypen-AS Massnahmen\" title=\"Arbeitsplatztypen-AS Massnahmen\"/></div>\n";
-    
-    // Felder, nach denen gefiltert werden kann
-    $fields = array(2=>"Gefärdungs-Nr.");
-
-	$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 = 1;
-    if (!isset($dir) && !$dir)  $dir = "";
-
-
-    $sql = "SELECT ma.arbplatz_typ,arbplatz_typ_bez, ma.asm_ID, m.asm_bez, asm_bem 
-            FROM fhiiqm.AS_Massnahme_Arbplatz ma 
-            LEFT OUTER JOIN Arbplatz_Typ t ON ma.arbplatz_typ=t.arbplatz_typ
-            LEFT OUTER JOIN AS_Massnahme m ON ma.asm_ID=m.asm_ID ";
-    if ($fnum == 4 & $filter > " ")
-        $sql .= " WHERE asm_bez LIKE '%$filter%' ";
-    $sql .= " ORDER BY $sort $dir";
-    
-    $result = $dbc ->queryObjectArray($sql);
-    
-    echo "<div align='center'>\n";
-    echo "<p><b>Liste Arbeitsplatztypen - Ma&szlig;nahmen</b></p>\n";
-        
-    if ($result)
-    {
-		$bg1 = "#F8F8F8";
-		$bg2 = "#DEDFE1";
-		$bg = "#FFFFFF";
-     
-        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 jeder Spalte auf- bzw. absteigend sortieren</td></tr>
-            <td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' erm&ouml;glicht das Filtern nach Ma&szlig;nahmen</td></tr>\n
-                <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Arbeitsplatztyp - Ma&szlig;nahmen</td></tr>\n
-                <tr><td class='bigger'>&nbsp;</td></tr>";
-        echo "</table>\n";
-        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='f' value='$fnum'>";
-            echo "<table width=\"30%\" border=\"0\">\n";
-            echo "<tr><td>filtern nach $text: </td>";
-            echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" 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 border='0'>\n";
-        // Listenkopf generieren
-        echo "<tr bgcolor='#68ACBF'>";
-        tab_column(1,"Arbeitsplatz-Typ",$sort,$dir,0,$fnum,$filter,0,9999);
-        tab_column(4,"Ma&szlig;nahmen",$sort,$dir,4,$fnum,$filter,0,9999);
-        echo "<th>Bemerkung</th>";
-        echo "<th>&nbsp;</th></tr>";
-   
-        $vt = "?"; $i=0;
-        if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-        
-        foreach ($result as $row)
-        {
-            if ($row->arbplatz_typ != $vt)
-            {    
-                if ($vt != "?")
-                { 
-                    echo "</td><td><a href='/fhiiqm/ap_massn_ed.php?i=$vt'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
-                    if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-                }
-                echo "<tr bgcolor='" . $bg . "'>";
-                echo "<td>$row->arbplatz_typ - $row->arbplatz_typ_bez</td>";
-            }
-            else echo "<tr bgcolor='" . $bg . "'><td>&nbsp;</td>";
-                
-            echo "<td>$row->asm_bez</td>";
-            if (strlen($row->asm_bem) > 100) 
-            {   
-                $plus = "<a href='#' id='open$i'>...(weiter)</a>";
-                $bem[$i] = $row->asm_bem;
-                $i++;
-            }
-            else $plus = "";    
-            echo "<td>". nl2br(substr($row->asm_bem,0,100)). $plus;  
-            $vt = $row->arbplatz_typ;
-        }
-        echo "</td><td><a href='/fhiiqm/ap_massn_ed.php?i=$vt'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
-        echo "</table>\n</div>\n";
-    }
-    else
-    {
-            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider nichts gefunden f&uuml;r ". $fields["$fnum"] . " wie '$filter'!</p><br /></div>";
-            echo "&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Massnahmengen Arbeitsplatztyp\" class=\"sc\">Liste AS-Ma&szlig;nahmen Arbeitsplatztyp</a></p>\n";
-    }
-                echo "<div id='dialog' title='Erl&auml;uterung Ma&szlig;nahme' style='display:none'>";
-                echo nl2br($bem[$i]);
-                echo "</div>";
-?>
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 05/2012
+ * 
+ * Liste Arbeitsplatztyp - AS Massnahme 
+ * Tabelle 'AS_Massnahme_Arbplatz' wird nicht mehr genutzt (19.06.2012, bs)
+ * 
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");	
+        login($_SERVER["PHP_SELF"]);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+
+?>
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+    <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
+    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
+    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
+
+	<title>Arbplatztyp-AS-Ma&szlig;nahme-Liste</title>
+</head>
+
+<body onload="document.ffilter.filter.focus();">
+
+    <script>
+      $(document).ready(function() {
+        $("#dialog").dialog({
+            	bgiframe: true,
+            	autoOpen: false,
+            	height: 300,
+                width: 400,
+                resizable: true,
+            	modal: true
+                });
+        $('#open0').click(function() {
+    	       $('#dialog').dialog("open");
+                });
+        $('#open1').click(function() {
+    	       $('#dialog').dialog("open");
+                });
+        });
+    </script>
+    
+<?php
+    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+
+    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/role.png\" border=\"0\" alt=\"Arbeitsplatztypen-AS Massnahmen\" title=\"Arbeitsplatztypen-AS Massnahmen\"/></div>\n";
+    
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(2=>"Gefärdungs-Nr.");
+
+	$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 = 1;
+    if (!isset($dir) && !$dir)  $dir = "";
+
+
+    $sql = "SELECT ma.arbplatz_typ,arbplatz_typ_bez, ma.asm_ID, m.asm_bez, asm_bem 
+            FROM fhiiqm.AS_Massnahme_Arbplatz ma 
+            LEFT OUTER JOIN Arbplatz_Typ t ON ma.arbplatz_typ=t.arbplatz_typ
+            LEFT OUTER JOIN AS_Massnahme m ON ma.asm_ID=m.asm_ID ";
+    if ($fnum == 4 & $filter > " ")
+        $sql .= " WHERE asm_bez LIKE '%$filter%' ";
+    $sql .= " ORDER BY $sort $dir";
+    
+    $result = $dbc ->queryObjectArray($sql);
+    
+    echo "<div align='center'>\n";
+    echo "<p><b>Liste Arbeitsplatztypen - Ma&szlig;nahmen</b></p>\n";
+        
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+     
+        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 jeder Spalte auf- bzw. absteigend sortieren</td></tr>
+            <td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' erm&ouml;glicht das Filtern nach Ma&szlig;nahmen</td></tr>\n
+                <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Arbeitsplatztyp - Ma&szlig;nahmen</td></tr>\n
+                <tr><td class='bigger'>&nbsp;</td></tr>";
+        echo "</table>\n";
+        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='f' value='$fnum'>";
+            echo "<table width=\"30%\" border=\"0\">\n";
+            echo "<tr><td>filtern nach $text: </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" 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 border='0'>\n";
+        // Listenkopf generieren
+        echo "<tr bgcolor='#68ACBF'>";
+        tab_column(1,"Arbeitsplatz-Typ",$sort,$dir,0,$fnum,$filter,0,9999);
+        tab_column(4,"Ma&szlig;nahmen",$sort,$dir,4,$fnum,$filter,0,9999);
+        echo "<th>Bemerkung</th>";
+        echo "<th>&nbsp;</th></tr>";
+   
+        $vt = "?"; $i=0;
+        if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+        
+        foreach ($result as $row)
+        {
+            if ($row->arbplatz_typ != $vt)
+            {    
+                if ($vt != "?")
+                { 
+                    echo "</td><td><a href='/fhiiqm/ap_massn_ed.php?i=$vt'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+                    if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+                }
+                echo "<tr bgcolor='" . $bg . "'>";
+                echo "<td>$row->arbplatz_typ - $row->arbplatz_typ_bez</td>";
+            }
+            else echo "<tr bgcolor='" . $bg . "'><td>&nbsp;</td>";
+                
+            echo "<td>$row->asm_bez</td>";
+            if (strlen($row->asm_bem) > 100) 
+            {   
+                $plus = "<a href='#' id='open$i'>...(weiter)</a>";
+                $bem[$i] = $row->asm_bem;
+                $i++;
+            }
+            else $plus = "";    
+            echo "<td>". nl2br(substr($row->asm_bem,0,100)). $plus;  
+            $vt = $row->arbplatz_typ;
+        }
+        echo "</td><td><a href='/fhiiqm/ap_massn_ed.php?i=$vt'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+        echo "</table>\n</div>\n";
+    }
+    else
+    {
+            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider nichts gefunden f&uuml;r ". $fields["$fnum"] . " wie '$filter'!</p><br /></div>";
+            echo "&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Massnahmengen Arbeitsplatztyp\" class=\"sc\">Liste AS-Ma&szlig;nahmen Arbeitsplatztyp</a></p>\n";
+    }
+                echo "<div id='dialog' title='Erl&auml;uterung Ma&szlig;nahme' style='display:none'>";
+                echo nl2br($bem[$i]);
+                echo "</div>";
+?>
+</body>
 </html>
\ No newline at end of file
--- a/fhiiqm/deprecated/as_massn_ed.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/as_massn_ed.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,155 +1,155 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 06/2012
- * 
- * INSERT/UPDATE AS-Massnahme
- * 
- */
-
-
-    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("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-
-    $sub = $_POST["eintragen"];
-    $del    = $_POST["del"];
-    $asm  = $_POST["asm"];
-	$ok		= $_POST["ok"];
-    if (!$asm['okn']) $ok=false;
-    $asmid = $_GET["i"]; // asm_ID
-    
-
-
-?>
-<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-	<title>AS-Massnahme</title>
-</head>
-
-<body>
-
-<?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/role.png\" border=\"0\" alt=\"AS-Massnahme bearbeiten\" title=\"AS-Massnahme bearbeiten\"/></div>\n";
-
-    if ($ragid) $text = "editieren"; else $text = "erfassen";
-    echo "<div align=\"center\">";
-    echo "<h3>Arbeitssicherheit-Massnahme $text</h3>";
-    echo "</div>\n";
-    if ((!$sub && !$del) || !isset($asm) || !$ok) 
-    {
-        if ($asmid && !$sub && !isset($asm))
-        {
-            $sql = "SELECT asm_bez, asm_bem FROM AS_Massnahme WHERE asm_ID=$asmid";
-            $res = $dbc -> queryObjectArray($sql);
-            foreach ($res as $row)
-            {
-                $asm["bez"] = $row->asm_bez;
-                $asm["bem"] = $row->asm_bem;
-            }
-        }
-        include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/as_massn_form.inc.php");
-        
-        if ($sub || $del)
-		{
-		  	if ($sub)
-                $frage = "Alle Angaben ok?";
-            elseif ($del)
-                $frage = "AS Massnahme wirklich l&ouml;schen?";
-			echo "<tr>
-			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
-			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
-			        if ($ok)  echo "checked=\"checked\""; 
-			echo " /></td>\n</tr>\n"; 
-		}
-        if (!is_null($_SESSION["recht"]) && in_array("ase",$_SESSION["recht"]))
-        {
-            echo "
-           	<tr><td>&nbsp;</td>\n
-            	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
-            if ($asmid)
-            {
-                echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
-            }
-           	echo "</td></tr>\n";
-        }
-        echo "</table>\n";
-        echo "</div>\n";
-    echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"as_massn_flist.php\" target=\"_self\" title=\"AS-Massnahmen-Liste\">&laquo; zur AS-Massnahmen-Liste</a></p>\n"; 
-    echo "</form>\n";
-    }
-    else
-    {
-        echo "<div align='center'>\n";
-
-        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-        if ($del)
-        {
-            $sql = "DELETE FROM AS_Massnahme WHERE asm_ID = $asmid";
-            $retmd = $dbc -> execute($sql);
-            if ($retmd)
-            {
-                echo "<p class='green'><b>DELETE: Daten  zu '".$asm["bez"]."' wurden erfolgreich gel&ouml;scht.</b></p>\n";
-            }                
-            else
-            {
-                echo "<p class='red'><b>DELETE: Daten  zu '".$asm["bez"]."' konnten nicht gel&ouml;scht werden!</b></p>\n";
-                echo "sql = $sql<br />";
-                echo "error DELETE: " . $dbc->error . "<br />";
-            }
-        }
-        else
-        {
-            $stmt = $dbc -> stmtinit();
-            if (is_object($stmt))
-            {
-                $retm=1;
-                if ($asmid && is_array($asm)) // UPDATE
-                {
-                    $stmt -> prepare("UPDATE AS_Massnahme SET asm_bez=?, asm_bem=?");
-                    $stmt -> bind_param('ss',$asm['bez'], substr($asm["bem"],0,2000));
-                    $retm = $stmt -> execute();
-                    if (!$retm) echo "error UPDATE AS-Massnahme: $stmt->error<br />\n";
-                }
-                else //INSERT    
-                {
-                    $stmt -> prepare("INSERT INTO AS_Massnahme (asm_bez, asm_bem) VALUES(?,?)");
-                    $stmt -> bind_param('ss',$asm['bez'], substr($asm["bem"],0,2000));
-                    $retm = $stmt -> execute();
-                    if (!$retm) echo "error INSERT AS-Massnahme: $stmt->error<br />\n";
-                }
-            }
-            if ($retm)
-                echo "<p class='green'><b>AS-Massnahme '".$asm["bez"]."' wurde erfolgreich gespeichert.</b></p>\n";
-            else
-                 echo "<p class='red'><b>AS-Massnahme '".$asm["bez"]."' konnte nicht gespeichert werden.</b></p>\n";
-        }     
-        echo "</div>\n";
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"".$_SERVER['PHP_SELF']."\" target=\"_self\" title=\"AS-Massnahmen\"> weitere AS-Massnahmen erfassen</a></p>\n"; 
-   }
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 06/2012
+ * 
+ * INSERT/UPDATE AS-Massnahme
+ * 
+ */
+
+
+    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("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+
+    $sub = $_POST["eintragen"];
+    $del    = $_POST["del"];
+    $asm  = $_POST["asm"];
+	$ok		= $_POST["ok"];
+    if (!$asm['okn']) $ok=false;
+    $asmid = $_GET["i"]; // asm_ID
+    
+
+
+?>
+<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+	<title>AS-Massnahme</title>
+</head>
+
+<body>
+
+<?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/role.png\" border=\"0\" alt=\"AS-Massnahme bearbeiten\" title=\"AS-Massnahme bearbeiten\"/></div>\n";
+
+    if ($ragid) $text = "editieren"; else $text = "erfassen";
+    echo "<div align=\"center\">";
+    echo "<h3>Arbeitssicherheit-Massnahme $text</h3>";
+    echo "</div>\n";
+    if ((!$sub && !$del) || !isset($asm) || !$ok) 
+    {
+        if ($asmid && !$sub && !isset($asm))
+        {
+            $sql = "SELECT asm_bez, asm_bem FROM AS_Massnahme WHERE asm_ID=$asmid";
+            $res = $dbc -> queryObjectArray($sql);
+            foreach ($res as $row)
+            {
+                $asm["bez"] = $row->asm_bez;
+                $asm["bem"] = $row->asm_bem;
+            }
+        }
+        include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/as_massn_form.inc.php");
+        
+        if ($sub || $del)
+		{
+		  	if ($sub)
+                $frage = "Alle Angaben ok?";
+            elseif ($del)
+                $frage = "AS Massnahme wirklich l&ouml;schen?";
+			echo "<tr>
+			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+			        if ($ok)  echo "checked=\"checked\""; 
+			echo " /></td>\n</tr>\n"; 
+		}
+        if (!is_null($_SESSION["recht"]) && in_array("ase",$_SESSION["recht"]))
+        {
+            echo "
+           	<tr><td>&nbsp;</td>\n
+            	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
+            if ($asmid)
+            {
+                echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
+            }
+           	echo "</td></tr>\n";
+        }
+        echo "</table>\n";
+        echo "</div>\n";
+    echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"as_massn_flist.php\" target=\"_self\" title=\"AS-Massnahmen-Liste\">&laquo; zur AS-Massnahmen-Liste</a></p>\n"; 
+    echo "</form>\n";
+    }
+    else
+    {
+        echo "<div align='center'>\n";
+
+        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+        if ($del)
+        {
+            $sql = "DELETE FROM AS_Massnahme WHERE asm_ID = $asmid";
+            $retmd = $dbc -> execute($sql);
+            if ($retmd)
+            {
+                echo "<p class='green'><b>DELETE: Daten  zu '".$asm["bez"]."' wurden erfolgreich gel&ouml;scht.</b></p>\n";
+            }                
+            else
+            {
+                echo "<p class='red'><b>DELETE: Daten  zu '".$asm["bez"]."' konnten nicht gel&ouml;scht werden!</b></p>\n";
+                echo "sql = $sql<br />";
+                echo "error DELETE: " . $dbc->error . "<br />";
+            }
+        }
+        else
+        {
+            $stmt = $dbc -> stmtinit();
+            if (is_object($stmt))
+            {
+                $retm=1;
+                if ($asmid && is_array($asm)) // UPDATE
+                {
+                    $stmt -> prepare("UPDATE AS_Massnahme SET asm_bez=?, asm_bem=?");
+                    $stmt -> bind_param('ss',$asm['bez'], substr($asm["bem"],0,2000));
+                    $retm = $stmt -> execute();
+                    if (!$retm) echo "error UPDATE AS-Massnahme: $stmt->error<br />\n";
+                }
+                else //INSERT    
+                {
+                    $stmt -> prepare("INSERT INTO AS_Massnahme (asm_bez, asm_bem) VALUES(?,?)");
+                    $stmt -> bind_param('ss',$asm['bez'], substr($asm["bem"],0,2000));
+                    $retm = $stmt -> execute();
+                    if (!$retm) echo "error INSERT AS-Massnahme: $stmt->error<br />\n";
+                }
+            }
+            if ($retm)
+                echo "<p class='green'><b>AS-Massnahme '".$asm["bez"]."' wurde erfolgreich gespeichert.</b></p>\n";
+            else
+                 echo "<p class='red'><b>AS-Massnahme '".$asm["bez"]."' konnte nicht gespeichert werden.</b></p>\n";
+        }     
+        echo "</div>\n";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"".$_SERVER['PHP_SELF']."\" target=\"_self\" title=\"AS-Massnahmen\"> weitere AS-Massnahmen erfassen</a></p>\n"; 
+   }
 ?>
\ No newline at end of file
--- a/fhiiqm/deprecated/as_massn_flist.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/as_massn_flist.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,141 +1,141 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 06/2012
- * 
- * Liste Arbeitssicherheit - Massnahmen
- * 
- */
-
-    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("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
-	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 href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
-   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-
-	<title>Arbeitssicherheit-Ma&szlig;nahmen-Liste</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/role.png\" border=\"0\" alt=\"AS Massnahmen\" title=\"AS Massnahmen\"/></div>\n";
-    
-    // Felder, nach denen gefiltert werden kann
-    $fields = array(2=>"Ma&szlig;nahme-Bezeichnung");
-
-	$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 = 1;
-    if (!isset($dir) && !$dir)  $dir = "";
-
-    if ($fnum == 2 && $filter>" ") $where = " WHERE asm_bez LIKE '%" . $filter ."%'"; else $where = "";
-    $sql = "SELECT asm_ID,asm_bez,asm_bem FROM fhiiqm.AS_Massnahme $where ";
-    $sql .= " ORDER BY $sort $dir";
-
-    $result = $dbc ->queryObjectArray($sql);
-
-    echo "<div align='center'>\n";
-    echo "<p><b>Liste Arbeitssicherheit - Ma&szlig;nahmen</b></p>\n";
-    
-    if ($result)
-    {
-		$bg1 = "#F8F8F8";
-		$bg2 = "#DEDFE1";
-		$bg  = "#FFFFFF";
-     
-        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 Ma&szlig;nahmen 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 Ma&szlig;nahmen</td></tr>\n
-                <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Ma&szlig;nahme</td></tr>\n
-                <tr><td class='bigger'>&nbsp;</td></tr>";
-        echo "</table>\n";
-
-        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='f' value='$fnum'>";
-            echo "<table width=\"30%\" border=\"0\">\n";
-            echo "<tr><td>filtern nach $text: </td>";
-            echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" 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 border='0'>\n";
-        if ($fnum == 2) $filt = "filter_activ"; else $filt = "filter"; 
-        echo "<tr bgcolor='#68ACBF'>";
-//        <th>Massnahme&nbsp;&nbsp;&nbsp;<a href='".$_SERVER['PHP_SELF']."?f=2'><img src='/fhiiqm/img/$filt.gif' border='0' width='14' hight='11' alt='Filter Massnahme' title='Filter Massnahme'></a></th>";
-        tab_column(2,"Ma&szlig;nahme",$sort,$dir,2,$fnum,$filter,0,9999);
-        echo "<th>Bemerkung</th>";
-        echo "<th>&nbsp;</th></tr>";
-        
-        if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-        foreach ($result as $row)
-        {
-                echo "<tr bgcolor='" . $bg . "'>";
-                echo "<td>$row->asm_bez</td>";
-                echo "<td>".nl2br($row->asm_bem) ."</td>";  
-                echo "</td><td><a href='/fhiiqm/as_massn_ed.php?i=$row->asm_ID'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>
-                    </tr>\n";
-        }
-        echo "</table>\n";
-        echo "</div>\n";
-    }
-    else
-    {
-            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider nichts gefunden f&uuml;r ". $fields["$fnum"] . " wie '$filter'!</p><br /></div>";
-            echo "&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"AS Massnahme\" class=\"sc\">Liste AS Ma&szlig;nahmen</a></p>\n";
-    }
-    echo "&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/as_massn_ed.php\" target=\"_self\" title=\"AS Ma&szlig;nahme erfassen\" class=\"sc\">weitere AS Ma&szlig;nahme erfassen</a></p>\n";
-?>
-
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 06/2012
+ * 
+ * Liste Arbeitssicherheit - Massnahmen
+ * 
+ */
+
+    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("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	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 href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Arbeitssicherheit-Ma&szlig;nahmen-Liste</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/role.png\" border=\"0\" alt=\"AS Massnahmen\" title=\"AS Massnahmen\"/></div>\n";
+    
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(2=>"Ma&szlig;nahme-Bezeichnung");
+
+	$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 = 1;
+    if (!isset($dir) && !$dir)  $dir = "";
+
+    if ($fnum == 2 && $filter>" ") $where = " WHERE asm_bez LIKE '%" . $filter ."%'"; else $where = "";
+    $sql = "SELECT asm_ID,asm_bez,asm_bem FROM fhiiqm.AS_Massnahme $where ";
+    $sql .= " ORDER BY $sort $dir";
+
+    $result = $dbc ->queryObjectArray($sql);
+
+    echo "<div align='center'>\n";
+    echo "<p><b>Liste Arbeitssicherheit - Ma&szlig;nahmen</b></p>\n";
+    
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg  = "#FFFFFF";
+     
+        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 Ma&szlig;nahmen 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 Ma&szlig;nahmen</td></tr>\n
+                <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Ma&szlig;nahme</td></tr>\n
+                <tr><td class='bigger'>&nbsp;</td></tr>";
+        echo "</table>\n";
+
+        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='f' value='$fnum'>";
+            echo "<table width=\"30%\" border=\"0\">\n";
+            echo "<tr><td>filtern nach $text: </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" 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 border='0'>\n";
+        if ($fnum == 2) $filt = "filter_activ"; else $filt = "filter"; 
+        echo "<tr bgcolor='#68ACBF'>";
+//        <th>Massnahme&nbsp;&nbsp;&nbsp;<a href='".$_SERVER['PHP_SELF']."?f=2'><img src='/fhiiqm/img/$filt.gif' border='0' width='14' hight='11' alt='Filter Massnahme' title='Filter Massnahme'></a></th>";
+        tab_column(2,"Ma&szlig;nahme",$sort,$dir,2,$fnum,$filter,0,9999);
+        echo "<th>Bemerkung</th>";
+        echo "<th>&nbsp;</th></tr>";
+        
+        if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+        foreach ($result as $row)
+        {
+                echo "<tr bgcolor='" . $bg . "'>";
+                echo "<td>$row->asm_bez</td>";
+                echo "<td>".nl2br($row->asm_bem) ."</td>";  
+                echo "</td><td><a href='/fhiiqm/as_massn_ed.php?i=$row->asm_ID'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>
+                    </tr>\n";
+        }
+        echo "</table>\n";
+        echo "</div>\n";
+    }
+    else
+    {
+            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider nichts gefunden f&uuml;r ". $fields["$fnum"] . " wie '$filter'!</p><br /></div>";
+            echo "&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"AS Massnahme\" class=\"sc\">Liste AS Ma&szlig;nahmen</a></p>\n";
+    }
+    echo "&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/as_massn_ed.php\" target=\"_self\" title=\"AS Ma&szlig;nahme erfassen\" class=\"sc\">weitere AS Ma&szlig;nahme erfassen</a></p>\n";
+?>
+
+</body>
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/deprecated/info_form.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -0,0 +1,406 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 08/2011
+ *
+ * Form Info
+ */
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+    $okn = true;
+
+?>
+<div align="center">
+<?php
+    if (!is_null($_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"]))
+        $text = "";
+    else
+        if  (strpos($_SERVER['PHP_SELF'],"ins") > -1) $text = "Eingabe"; else $text="&Auml;ndern / L&ouml;schen";
+?>
+<h3><font face="Verdana, Arial, Helvetica, sans-serif"><?php echo $text;?> Informationen </font></h3>
+<h5>* - Felder sind erforderlich!</h5>
+</div>
+<!-- <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_svc"> -->	
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data" name="form_info" target="_self"> 	
+<div align="center">
+<table width="50%" border="0" cellspacing="3" cellpadding="3">
+    <tr>
+        <td>Titel *</td>
+        <td><textarea name="inf[iname]"  cols="50" rows="2"><?php echo $inf['iname']; ?></textarea>
+            <?php 
+			     if (isset($inf['iname']) && $inf['iname']<'!')
+				{
+					echo "<br><span class=\"red\">Titel ist erforderlich!</span>\n";
+					$okn = false;
+				}
+             ?> 
+		<div>max. 300 Zeichen sind m&ouml;glich</div></td>
+    </tr>
+    <tr>
+        <td>Kurzinformation</td>
+        <td><textarea name="inf[ilong]" cols="50" rows="10"><?php echo $inf['ilong']; ?></textarea>
+        </td>
+    </tr>
+    <tr>
+        <td>Info-Typ</td>
+        <td><select name="inf[ityp]">
+            <?php 
+                if ($inf['ityp'] == -1) $select = " selected "; else $select = "";
+                echo "<option $select value=\"-1\"></option>\n";
+                $sql = "SELECT infotyp_ID, infotyp_bez FROM Info_Typ ORDER BY 2";
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if ($row->infotyp_ID == $inf['ityp'])
+    					   echo "<option selected value=\"$row->infotyp_ID\">$row->infotyp_bez</option>\n";
+    				    else
+    					   echo "<option value=\"$row->infotyp_ID\">$row->infotyp_bez</option>\n";
+                    }
+            }
+            ?>
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td>Erstellungsdatum *</td>
+    	    <td align="left"><select name="inf[itag]" size="1">
+    		  <?php
+    		 if (!$inf['itag'] ) $ta1=date('d'); else $ta1 = $inf['itag'];
+    		 for ($i=1; $i<32; $i++)
+    		 {	if ($i==intval($ta1)) 
+    		 	{
+    				if ($i == 0)
+    					echo "<option selected></option>\n";
+    				else
+    					echo "<option selected>$ta1</option>\n";
+    			}
+    			else	{	
+    				if ($i<10)
+    				{				
+    					if ($i == 0)
+    						echo "<option></option>\n";
+    					else
+    						echo "<option>0$i</option>\n";
+    				} 
+    				else			
+    					echo "<option>$i</option>\n";
+    					}  
+    		  }
+    		 ?> 
+    		</select>.
+    		 <select name="inf[imon]" size="1">
+    		  <?php
+    		 if (!$inf['imon'] ) $mo1=date('m');  else $mo1 = $inf['imon'];
+    		 for ($i=1; $i<13; $i++)
+    		 {	if ($i==intval($mo1)) 
+    		 	{
+    				if ($i == 0)
+    					echo "<option selected></option>\n";
+    				else
+    					echo "<option selected>$mo1</option>\n";
+    			}
+    			else	{	
+    				if ($i<10)
+    				{
+    					if ($i == 0)
+    						echo "<option></option>\n";
+    					else
+    						echo "<option>0$i</option>\n";
+    				} 
+    				else			
+    					echo "<option>$i</option>\n";
+    					}  
+    		  }
+    		 ?> 
+    		 </select>.
+    		 <select name="inf[ijahr]" size="1">
+    		 <?php
+    		  
+    		if (!$inf['ijahr'] ) 
+    		 	$ja1 = date('Y') . "</option>\n";
+            else  
+    		  $ja1 = $inf['ijahr'];
+    		for ($i=2000; $i<2036; $i++)
+    		 {	if ($i==intval($ja1)) 
+    				echo "<option selected>$ja1</option>\n";
+    			else		
+    				echo "<option>$i</option>\n";
+    		  }
+    		 ?> 
+    		 </select>
+        </td>
+    </tr>
+    <tr>
+        <td>g&uuml;ltig ab</td>
+    	    <td align="left"><select name="inf[btag]" size="1">
+    		  <?php
+    		 if (!$inf['btag'] ) $ta1=0; else $ta1 = $inf['btag'];
+    		 for ($i=0; $i<32; $i++)
+    		 {	if ($i==intval($ta1)) 
+    		 	{
+    				if ($i == 0)
+    					echo "<option selected></option>\n";
+    				else
+    					echo "<option selected>$ta1</option>\n";
+    			}
+    			else	{	
+    				if ($i<10)
+    				{				
+    					if ($i == 0)
+    						echo "<option></option>\n";
+    					else
+    						echo "<option>0$i</option>\n";
+    				} 
+    				else			
+    					echo "<option>$i</option>\n";
+    					}  
+    		  }
+    		 ?> 
+    		</select>.
+    		 <select name="inf[bmon]" size="1">
+    		  <?php
+    		 if (!$inf['bmon'] ) $mo1=0;  else $mo1 = $inf['bmon'];
+    		 for ($i=0; $i<13; $i++)
+    		 {	if ($i==intval($mo1)) 
+    		 	{
+    				if ($i == 0)
+    					echo "<option selected></option>\n";
+    				else
+    					echo "<option selected>$mo1</option>\n";
+    			}
+    			else	{	
+    				if ($i<10)
+    				{
+    					if ($i == 0)
+    						echo "<option></option>\n";
+    					else
+    						echo "<option>0$i</option>\n";
+    				} 
+    				else			
+    					echo "<option>$i</option>\n";
+    					}  
+    		  }
+    		 ?> 
+    		 </select>.
+    		 <select name="inf[bjahr]" size="1">
+    		 <?php
+    		  
+    		if (!$inf['bjahr'] ) 
+    		 	echo "<option selected></option>\n";  
+    		else
+    		 	echo "<option></option>\n";  
+    		$ja1 = $inf['bjahr'];
+    		for ($i=2000; $i<2036; $i++)
+    		 {	if ($i==intval($ja1)) 
+    				echo "<option selected>$ja1</option>\n";
+    			else		
+    				echo "<option>$i</option>\n";
+    		  }
+    		 ?> 
+    		 </select>
+        </td>
+    </tr>
+     <tr>
+        <td>g&uuml;ltig bis</td>
+    	    <td align="left"><select name="inf[etag]" size="1">
+    		  <?php
+    		 if (!$inf['etag'] ) $ta1=0; else $ta1 = $inf['etag'];
+    		 for ($i=0; $i<32; $i++)
+    		 {	if ($i==intval($ta1)) 
+    		 	{
+    				if ($i == 0)
+    					echo "<option selected></option>\n";
+    				else
+    					echo "<option selected>$ta1</option>\n";
+    			}
+    			else	{	
+    				if ($i<10)
+    				{				
+    					if ($i == 0)
+    						echo "<option></option>\n";
+    					else
+    						echo "<option>0$i</option>\n";
+    				} 
+    				else			
+    					echo "<option>$i</option>\n";
+    					}  
+    		  }
+    		 ?> 
+    		</select>.
+    		 <select name="inf[emon]" size="1">
+    		  <?php
+    		 if (!$inf['emon'] ) $mo1=0;  else $mo1 = $inf['emon'];
+    		 for ($i=0; $i<13; $i++)
+    		 {	if ($i==intval($mo1)) 
+    		 	{
+    				if ($i == 0)
+    					echo "<option selected></option>\n";
+    				else
+    					echo "<option selected>$mo1</option>\n";
+    			}
+    			else	{	
+    				if ($i<10)
+    				{
+    					if ($i == 0)
+    						echo "<option></option>\n";
+    					else
+    						echo "<option>0$i</option>\n";
+    				} 
+    				else			
+    					echo "<option>$i</option>\n";
+    					}  
+    		  }
+    		 ?> 
+    		 </select>.
+    		 <select name="inf[ejahr]" size="1">
+    		 <?php
+    		  
+    		if (!$inf['ejahr'] ) 
+    		 	echo "<option selected></option>\n";  
+    		else
+    		 	echo "<option></option>\n";  
+    		$ja1 = $inf['ejahr'];
+    		for ($i=2000; $i<2036; $i++)
+    		 {	if ($i==intval($ja1)) 
+    				echo "<option selected>$ja1</option>\n";
+    			else		
+    				echo "<option>$i</option>\n";
+    		  }
+    		 ?> 
+    		 </select>
+        </td>
+    </tr>
+    <tr>
+        <td>Autor</td>
+        <td>
+            <select name="inf[pers]" size="1">
+                <?php
+                    $select = $inf['pers'] == "-1" ? ' selected' : null;
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            $select = $row->persknr == $inf['pers'] ? ' selected' : null;
+        					echo "<option $select value=\"$row->persknr\">$row->pname</option>\n";
+                        }
+                    }
+                ?>
+            </select>
+        </td>
+    </tr>
+   <tr>
+        <td>zugeordnet zu Produkt<br /><br />
+            &nbsp;&nbsp;&nbsp;Mehrfachauswahl m&ouml;glich:<br />
+            &nbsp;&nbsp;&nbsp;[Strg]-Taste + Anklicken der<br /> 
+            &nbsp;&nbsp;&nbsp;gewünschten Listeneinträge</td>
+        <td>
+            <select name="inf[prid][]" size="8" multiple="multiple">
+            <?php 
+                if (is_array($inf['prid'])) $select = in_array( "-1", $inf['prid'] ) ? ' selected' : null;
+                echo "<option $select value=\"-1\"></option>\n";
+//                $sql = "SELECT produkt_ID, LEFT(prod_name,70) AS prod, LENGTH(prod_name) AS lenp FROM Produkt ORDER BY 2";
+                $sql = "CALL prod_hiera_all(0,0)";  
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if (strlen($row->bez) > 70) 
+                            $prod=str_replace(" ","&nbsp;",htmlentities(substr($row->bez,0,70))) ."..."; 
+                        else 
+                            $prod=str_replace(" ","&nbsp;",htmlentities($row->bez));
+                        if ($row->prid >0) $color=" class='green'"; else $color="";
+                        if (is_array($inf['prid'])) $select = in_array($row->prid, $inf['prid']) ? ' selected' : null;
+                        echo "<option $color $select value=\"$row->prid\">$prod</option>\n";
+                    }
+                }
+                unset($result);
+            ?>
+            </select>
+            <br />bitte nur die <font color="green">gr&uuml;nen</font> Eintr&auml;ge w&auml;hlen
+        </td>
+    </tr>
+    <tr><td>Adressat<br /><br />
+            &nbsp;&nbsp;&nbsp;Mehrfachauswahl m&ouml;glich</td>
+        <td><select name="inf[adr][]" size="4" multiple="multiple">
+            <?php
+                if (is_array($inf['adr'])) $select = in_array( "-1", $inf['adr'] ) ? ' selected' : null;
+                echo "<option $select value=\"-1\"></option>\n";
+                $sql = "SELECT info_adr_ID, info_adr_name FROM Adressat ORDER BY 2";
+                if ($result = $dbc -> queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if (is_array($inf['adr'])) $select = in_array( $row->info_adr_ID, $inf['adr'] ) ? ' selected' : null;
+       					echo "<option $select value=\"$row->info_adr_ID\">$row->info_adr_name</option>\n";
+                    }
+                }
+            ?>
+        </select>
+        </td>
+    </tr>
+    <tr><td>geh&ouml;rt zu Info</td>
+        <td><select name="inf[infrel]">
+            <?php
+                if ($inf['adr'] == -1) $select = " selected "; else $select = "";
+                echo "<option $select value=\"-1\"></option>\n";
+                if (isset($inf["infid"]) && $inf["infid"]>0) $where = " WHERE info_ID != " . $inf["infid"]; else $where=""; 
+                $sql = "SELECT info_ID, LEFT(info_name_s,50) AS iname FROM Info $where ORDER BY 2";
+                if ($result = $dbc -> queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if ($row->info_ID == $inf['infrel'])
+    					   echo "<option selected value=\"$row->info_ID\">$row->iname</option>\n";
+    				    else
+    					   echo "<option value=\"$row->info_ID\">$row->iname</option>\n";
+                    }
+                }
+            ?>
+        </select>
+        </td>
+    </tr>
+    <tr><td>Sprache</td>
+        <td><select name="inf[lang]">
+        <?php
+                if ($inf['lang'] == -1) $select = " selected "; else $select = "";
+                echo "<option $select value=\"-1\"></option>\n";
+                $alang = array("de"=>"deutsch","en"=>"englisch");
+                foreach ($alang as $key=>$value)
+                {
+                    if ($inf['lang'] == $key) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"$key\">$value</option>\n";
+                }
+        ?>
+        </select></td>
+    </tr>
+	<tr>
+	   <td>Dateibezeichnung Dokument (*)</td>
+	   <td><input name="inf[ifname]" type="text" size="50" maxlength="50" value="<?php echo $inf['ifname']; ?>">
+	   <?php
+            echo "<br />bitte <u>keine</u> Umlaute im Dateinamen angeben!";   
+			if (isset($inf['ifname']) && $upd && is_uploaded_file($_FILES["ifile"]["tmp_name"]) && $inf['ifname']<'!')
+				{
+					echo "<br><span class=\"red\">Dateiname ist erforderlich!</span>\n";
+					$okn = false;
+				}
+				else
+				{
+                    if ($inf['ifname']>='!' && file_exists("infos/".$inf['ifname']))
+                        echo "<br />Dokument anschauen:&nbsp;<a href='infos/" . $inf['ifname'] ."'>" . $inf['ifname'] . "</a>";
+                    if ($okn) $okn = true; else $okn=false;
+                }
+		?>
+		</td>
+    </tr>
+
+    <input type="hidden" name="inf[infid]" value="<?php echo $inf['infoid']; ?>"/>
+    <input type="hidden" name="MAX_FILE_SIZE" value="6000000"/>    
+    <input type="hidden" name="inf[okn]" value="<?php echo $okn; ?>"/>
+<!--  </table>
+ </div>   
+</form> -->
\ No newline at end of file
--- a/fhiiqm/deprecated/info_ins.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/info_ins.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,185 +1,185 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 08/2011
- *
- * INSERT Informationen   
- */
-
-    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("ie",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-?>
-<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
-   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-
-	<title>Eingabe Informationen</title>
-</head>
-
-<body>
-
-<?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/document_image_ver.png\" border=\"0\" alt=\"Informationen eingeben\" title=\"Informationen eingeben\"/></div>\n";
-
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-	//$dbc = new dbconnection();
-    
-	$ok		= $_POST["ok"];
-    $inf    = $_POST["inf"];
-   	$submit	= $_POST["ins"];
-    if (!$inf["okn"]) $ok = false;
-    if (!$ok || !$submit)
-    {
-        include($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/info_form.inc.php");
-        if ($submit)
-		{
-            echo            
-            "<tr>
-        		<td>Upload Infodokument </td>
-        		<td><input type=\"file\" name=\"ifile\" size=\"50\" maxlength=\"50\" value=\"" .
-            $_FILES["ifile"]["name"] . "\"/></td>
-            </tr>";
-    
-		  	$frage = "Alle Angaben ok?<br>
-              erst wenn Haken gesetzt, Upload-File w&auml;hlen!";
-			echo "<tr>
-			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
-			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
-			        if ($ok)  echo "checked"; 
-			echo "></td>\n</tr>\n"; 
-		}
-		
-		echo "<tr>\n";
-		echo "
-		  <td>&nbsp;</td>
-		  <td><input class=\"button\" type=\"submit\" value=\"eingeben\" name=\"ins\" title=\"insert\" /></td>\n";
-		echo "</tr>\n";
-        echo "</table>\n";
-        echo "</div>\n";
-        echo "</form>\n";	
-
-    }
-    else
-    {
-        echo "<div align='center'>\n";
-        //daten speichern
-        $inf["iname"] = substr($inf["iname"],0,300);
-        $inf["ilong"] = substr($inf["ilong"],0,8000);
-        if ($inf["ityp"] == -1) $inf["ityp"] = null;
-        
-        if ($inf["ijahr"] && $inf["imon"] && $inf["itag"])
-        {
-            $idat = $inf["ijahr"]."-".$inf["imon"]."-".$inf["itag"];
-            // Datum valid?
-            if (!$idat = new DateTime_s($idat)) $idat = null;
-        }    
-        else
-            $idat = null;
-        if ($inf["bjahr"] && $inf["bmon"] && $inf["btag"])
-        {
-            $bdat = $inf["bjahr"]."-".$inf["bmon"]."-".$inf["btag"];
-            if (!$bdat = new DateTime_s($bdat)) $bdat = null;
-        }    
-        else
-            $bdat = null;
-        if ($inf["ejahr"] && $inf["emon"] && $inf["etag"])
-        {
-            $edat = $inf["ejahr"]."-".$inf["emon"]."-".$inf["etag"];
-            if (!$edat = new DateTime_s($edat)) $edat = null;
-        }    
-        else
-            $edat = null;
-
-        if ($inf["pers"] == -1) $inf["pers"] = null;
-        if ($inf["prid"] <1 ) $inf["prid"] = null;
-        if ($inf["infrel"] == -1) $inf["infrel"] = null;
-        if ($inf["lang"] == -1) $inf["lang"] = null;
-        //echo "datcreate: $idat, datevalidfrom: $bdat, datevalidto: $edat, author: " . $inf["pers"] . "<br />\n";        
-
-        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-        $stmt = $dbc -> stmtinit();
-        if (is_object($stmt))
-        {
-            $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,
-                        infotyp_ID,persknr,lang,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?)");
-            $stmt -> bind_param('sssssiisi', $inf["iname"],$inf["ilong"],$idat,$bdat,$edat,$inf["ityp"],$inf["pers"],$inf["lang"],$inf["infrel"]);
-            $result = $stmt -> execute();      
-        }
-        if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
-        if ($result)
-        { // INSERT o.k.
-          // info_ID ermitteln
-            $infid = $dbc -> insertId();
-            
-            // n:m Tabellen INSERT
-            include ("inc/info_tab_ins.inc.php");
-
-            // upload File
-            if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] )
-            {
-                include ("inc/file_upload.inc.php");
-                $fname = gen_filename($inf['ifname'],"ifile",$infid);
-                $retf   = upload("ifile", $fname, $infid, "infos");              // Datei prüfen und in Dokumentenverzeichnis verschieben
-                
-                if ($retf)
-                {   // upload o.k.
-                    //UPDATE des Filenamens
-                    $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid";
-                    $retv=$dbc->execute($sql);
-                    if (!$retv) 
-                        echo $dbc -> error . "<br>\n";
-                }
-               
-            }
-            else 
-            {
-                $retf=1; //kein Infodoc hochgeladen
-            }
-            if ($result && $retf && $reta && $retp) // INSERT Raum
-            {
-                //Eingabe Daten, Upload File erfolgreich 
-                    echo "<p class='green'><b>Infodaten zu ID '$infid' wurden erfolgreich gespeichert.</b></p>\n";
-                    echo "<br /><br />\n";
-
-                // Anzeigen gespeicherte Raumdaten
-                if ($fname)
-                    $ifile = $infid . "_" . $fname;
-                else
-                    $ifile = $inf['ifname'];
-                include ("inc/info_dat_show.inc.php");
-            }            
-        }
-        $dbc -> close();
-        echo "</div>\n";
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">Zur Infolisteliste</a></p>\n";    
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_ins.php\" target=\"_self\" title=\"Information erfassen\">Weitere Information erfassen</a></p>\n";    
-    }
-
-
-?>
-
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 08/2011
+ *
+ * INSERT Informationen   
+ */
+
+    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("ie",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Eingabe Informationen</title>
+</head>
+
+<body>
+
+<?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/document_image_ver.png\" border=\"0\" alt=\"Informationen eingeben\" title=\"Informationen eingeben\"/></div>\n";
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	//$dbc = new dbconnection();
+    
+	$ok		= $_POST["ok"];
+    $inf    = $_POST["inf"];
+   	$submit	= $_POST["ins"];
+    if (!$inf["okn"]) $ok = false;
+    if (!$ok || !$submit)
+    {
+        include($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/form/info_form.inc.php");
+        if ($submit)
+		{
+            echo            
+            "<tr>
+        		<td>Upload Infodokument </td>
+        		<td><input type=\"file\" name=\"ifile\" size=\"50\" maxlength=\"50\" value=\"" .
+            $_FILES["ifile"]["name"] . "\"/></td>
+            </tr>";
+    
+		  	$frage = "Alle Angaben ok?<br>
+              erst wenn Haken gesetzt, Upload-File w&auml;hlen!";
+			echo "<tr>
+			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+			        if ($ok)  echo "checked"; 
+			echo "></td>\n</tr>\n"; 
+		}
+		
+		echo "<tr>\n";
+		echo "
+		  <td>&nbsp;</td>
+		  <td><input class=\"button\" type=\"submit\" value=\"eingeben\" name=\"ins\" title=\"insert\" /></td>\n";
+		echo "</tr>\n";
+        echo "</table>\n";
+        echo "</div>\n";
+        echo "</form>\n";	
+
+    }
+    else
+    {
+        echo "<div align='center'>\n";
+        //daten speichern
+        $inf["iname"] = substr($inf["iname"],0,300);
+        $inf["ilong"] = substr($inf["ilong"],0,8000);
+        if ($inf["ityp"] == -1) $inf["ityp"] = null;
+        
+        if ($inf["ijahr"] && $inf["imon"] && $inf["itag"])
+        {
+            $idat = $inf["ijahr"]."-".$inf["imon"]."-".$inf["itag"];
+            // Datum valid?
+            if (!$idat = new DateTime_s($idat)) $idat = null;
+        }    
+        else
+            $idat = null;
+        if ($inf["bjahr"] && $inf["bmon"] && $inf["btag"])
+        {
+            $bdat = $inf["bjahr"]."-".$inf["bmon"]."-".$inf["btag"];
+            if (!$bdat = new DateTime_s($bdat)) $bdat = null;
+        }    
+        else
+            $bdat = null;
+        if ($inf["ejahr"] && $inf["emon"] && $inf["etag"])
+        {
+            $edat = $inf["ejahr"]."-".$inf["emon"]."-".$inf["etag"];
+            if (!$edat = new DateTime_s($edat)) $edat = null;
+        }    
+        else
+            $edat = null;
+
+        if ($inf["pers"] == -1) $inf["pers"] = null;
+        if ($inf["prid"] <1 ) $inf["prid"] = null;
+        if ($inf["infrel"] == -1) $inf["infrel"] = null;
+        if ($inf["lang"] == -1) $inf["lang"] = null;
+        //echo "datcreate: $idat, datevalidfrom: $bdat, datevalidto: $edat, author: " . $inf["pers"] . "<br />\n";        
+
+        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+        $stmt = $dbc -> stmtinit();
+        if (is_object($stmt))
+        {
+            $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,
+                        infotyp_ID,persknr,lang,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?)");
+            $stmt -> bind_param('sssssiisi', $inf["iname"],$inf["ilong"],$idat,$bdat,$edat,$inf["ityp"],$inf["pers"],$inf["lang"],$inf["infrel"]);
+            $result = $stmt -> execute();      
+        }
+        if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
+        if ($result)
+        { // INSERT o.k.
+          // info_ID ermitteln
+            $infid = $dbc -> insertId();
+            
+            // n:m Tabellen INSERT
+            include ("inc/info_tab_ins.inc.php");
+
+            // upload File
+            if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] )
+            {
+                include ("inc/file_upload.inc.php");
+                $fname = gen_filename($inf['ifname'],"ifile",$infid);
+                $retf   = upload("ifile", $fname, $infid, "infos");              // Datei prüfen und in Dokumentenverzeichnis verschieben
+                
+                if ($retf)
+                {   // upload o.k.
+                    //UPDATE des Filenamens
+                    $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid";
+                    $retv=$dbc->execute($sql);
+                    if (!$retv) 
+                        echo $dbc -> error . "<br>\n";
+                }
+               
+            }
+            else 
+            {
+                $retf=1; //kein Infodoc hochgeladen
+            }
+            if ($result && $retf && $reta && $retp) // INSERT Raum
+            {
+                //Eingabe Daten, Upload File erfolgreich 
+                    echo "<p class='green'><b>Infodaten zu ID '$infid' wurden erfolgreich gespeichert.</b></p>\n";
+                    echo "<br /><br />\n";
+
+                // Anzeigen gespeicherte Raumdaten
+                if ($fname)
+                    $ifile = $infid . "_" . $fname;
+                else
+                    $ifile = $inf['ifname'];
+                include ("inc/info_dat_show.inc.php");
+            }            
+        }
+        $dbc -> close();
+        echo "</div>\n";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">Zur Infolisteliste</a></p>\n";    
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_ins.php\" target=\"_self\" title=\"Information erfassen\">Weitere Information erfassen</a></p>\n";    
+    }
+
+
+?>
+
+</body>
 </html>
\ No newline at end of file
--- a/fhiiqm/deprecated/info_upd.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/info_upd.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,268 +1,268 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 08/2011
- *
- * INSERT Informationen   
- */
-
-    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("ir",$_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-?>
-<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
-   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-
-	<title>Eingabe Informationen</title>
-</head>
-
-<body>
-
-<?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/document_image_ver.png\" border=\"0\" alt=\"Infodaten &auml;ndern\" title=\"Infodaten &auml;ndern\"/></div>\n";
-
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
-	$dbc = new dbconnection();
-    
-    $infid    = $_GET["uid"];
-    if (!$inf) $inf=1;
-	$upd	= $_POST["upd"];
-    $del    = $_POST["del"];
-	$inf    = $_POST["inf"];
-    $ok		= $_POST["ok"];
-    if (!$inf["okn"]) $ok = false;
-
-    if (!$ok && ((!$upd && !$del) || $upd || $del))
-    {
-        if (!$upd && !$del)
-        {
-            $sql = "SELECT info_ID,info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,infotyp_ID,
-                    persknr,lang,info_file,info_rel_ID,info_freigabe FROM fhiiqm.Info WHERE info_ID = $infid";
-            if ($result = $dbc -> queryObjectArray($sql))
-            {
-                foreach ($result as $row)
-                {
-                    $inf["infid"]   = $infid;
-                    $inf["iname"]   = $row->info_name_s;
-                    $inf["ilong"]   = $row->info_name_l;
-                    $inf["ityp"]   = $row->infotyp_ID;
-                    $inf["ijahr"]   = substr($row->info_date,0,4);  
-                    $inf["imon"]    = substr($row->info_date,5,2);  
-                    $inf["itag"]    = substr($row->info_date,8,2);  
-                    $inf["bjahr"]   = substr($row->info_valid_from,0,4);  
-                    $inf["bmon"]    = substr($row->info_valid_from,5,2);  
-                    $inf["btag"]    = substr($row->info_valid_from,8,2);  
-                    $inf["ejahr"]   = substr($row->info_valid_to,0,4);  
-                    $inf["emon"]    = substr($row->info_valid_to,5,2);  
-                    $inf["etag"]    = substr($row->info_valid_to,8,2);
-                    $inf["pers"]    = $row->persknr;
-                    $inf["infrel"]  = $row->info_rel_ID;
-                    $inf["ifname"]   = $row->info_file;
-                    $inf["lang"]    = $row->lang;     
-                }
-            }
-            // Produkt
-            $sql = "SELECT produkt_ID FROM Info_Produkt WHERE info_ID = $infid";
-            if ($result = $dbc -> queryObjectArray($sql))
-            {
-                foreach ($result as $row)
-                {
-                    $inf['prid'][] = $row->produkt_ID;
-                }
-            }
-            // Adressat
-            $sql = "SELECT info_adr_ID FROM Info_Adressat WHERE info_id = $infid";
-            if ($result = $dbc->queryObjectArray($sql))
-            {
-                foreach ($result as $row)
-                $inf["adr"][] = $row->info_adr_ID;
-            }
-                
-        }
-        include_once("form/info_form.inc.php");
-        
-        if ($upd)
-		{
-            echo            
-            "<tr>
-        		<td>Upload Infodokument </td>
-        		<td><input type=\"file\" name=\"ifile\" size=\"50\" maxlength=\"50\" value=\"" .
-            $_FILES["ifile"]["name"] . "\"/></td>
-            </tr>";
-    
-		}
-	  	if ($upd || $del)
-        {
-            if ($upd)
-              $frage = "Alle Angaben ok?<br>
-              erst wenn Haken gesetzt, Upload-File w&auml;hlen!";
-            elseif ($del)
-                $frage = "Information wirklich l&ouml;schen?";
-    		echo "<tr>
-    		  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
-    		        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
-    		        if ($ok)  echo "checked"; 
-    		echo "></td>\n</tr>\n"; 
-        }
-		
-        if (!is_null($_SESSION["recht"]) && in_array("ie",$_SESSION["recht"]))
-        {
-    		echo "<tr>\n";
-    		echo "
-    		  <td>&nbsp;</td>
-    		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
-    		  &nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
-    		echo "</tr>\n";
-        }
-        echo "</table>\n";
-        echo "</div>\n";
-        if (!is_null($_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"]))
-            echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">&laquo; zur Infoliste</a></p>\n";    
-        echo "</form>\n";	
-
-        
-    }
-    elseif ($ok && $upd)
-    {
-        echo "<div align='center'>\n";
-        //daten speichern
-        $inf["iname"] = substr($inf["iname"],0,300);
-        $inf["ilong"] = substr($inf["ilong"],0,8000);
-        if ($inf["ityp"] == -1) $inf["ityp"] = null;
-        
-        //Datumswerte validieren
-        $idat = date_obj($inf["ijahr"], $inf["imon"], $inf["itag"]);
-        $bdat = date_obj($inf["bjahr"], $inf["bmon"], $inf["btag"]);
-        $edat = date_obj($inf["ejahr"], $inf["emon"], $inf["etag"]);
-
-        if ($inf["pers"] == -1) $inf["pers"] = null;
-        if ($inf["infrel"] == -1) $inf["infrel"] = null;
-        if ($inf["lang"] == -1) $inf["lang"] = null;
-        //echo "datcreate: $idat, datevalidfrom: $bdat, datevalidto: $edat, author: " . $inf["pers"] . "<br />\n";        
-
-        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-        $stmt = $dbc -> stmtinit();
-        if (is_object($stmt))
-        {
-            $stmt -> prepare("UPDATE fhiiqm.Info SET
-                        info_name_s = ?, 
-                        info_name_l = ?, 
-                        info_date = ?, 
-                        info_valid_from = ?, 
-                        info_valid_to = ?, 
-                        infotyp_ID = ?, 
-                        persknr = ?, 
-                        lang = ?, 
-                        info_rel_ID = ? WHERE info_ID = $infid");
-            $stmt -> bind_param('sssssiisi',$inf["iname"],$inf["ilong"],$idat,$bdat,$edat,$inf["ityp"],$inf["pers"],$inf["lang"],$inf["infrel"]);
-            $result = $stmt -> execute();
-//            print_r($stmt);
-        }
-        if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
-        if ($result)
-        { // UPDATE o.k.
-            
-            // n:m Tabellen INSERT
-            include ("inc/info_tab_ins.inc.php");
-
-            // upload File
-                // echo "upload-error: " . $_FILES["ifile"]["error"] .  "<br />\n";
-            if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] )
-            {
-//                echo "file hochgeladen: " . $_FILES["ifile"]["name"] ."<br />\n";
-                include ("inc/file_upload.inc.php");
-                $fname = gen_filename($inf['ifname'],"ifile",$infid);
-                $retdf  = mod_file("/var/www/fhiiqm/infos",$infid,"","del");  // Loeschen alte Datei
-                $retf   = upload("ifile", $fname, $infid, "infos");              // Datei prüfen und in Dokumentenverzeichnis verschieben
-                
-                if ($retf)
-                {   // upload o.k.
-                    //UPDATE des Filenamens
-                    $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid";
-                    $retv=$dbc->execute($sql);
-                    if (!$retv) 
-                        echo $dbc -> error . "<br>\n";
-                }
-               
-            }
-            else 
-            {
-                $retf=1; //kein Infodoc hochgeladen
-            }
-            if ($result && $retf && $reta && $retp) // INSERT Raum
-            {
-                //Eingabe Daten, Upload File erfolgreich 
-                    echo "<p class='green'><b>Infodaten zu ID '$infid' wurden erfolgreich gespeichert.</b></p>\n";
-                    echo "<br /><br />\n";
-
-                // Anzeigen gespeicherte Raumdaten
-                if ($fname)
-                    $ifile = $infid . "_" . $fname;
-                else
-                    $ifile = $inf['ifname'];
-                include ("inc/info_dat_show.inc.php");
-            }
-        }                      
-    }
-    elseif ($ok & $del)
-    {
-       // DELETE aus Tab Info und abhaengigen Tabellen
-        echo "<div align='center'>\n";
-
-        $idat = date_obj($inf["ijahr"], $inf["imon"], $inf["itag"]);
-        $bdat = date_obj($inf["bjahr"], $inf["bmon"], $inf["btag"]);
-        $edat = date_obj($inf["ejahr"], $inf["emon"], $inf["etag"]);
-        
-        $sql = "DELETE FROM Info WHERE info_ID = $infid";
-        $retid = $dbc -> execute($sql);
-        if ($retid)
-        {
-            include ("inc/file_upload.inc.php");
-            $retdf  = mod_file("/var/www/fhiiqm/infos",$infid,"","del");  // Loeschen Dokument
-            if ($retdf) echo "<p class='green'><b>Infodokument zu ID '$infid' wurde gel&ouml;scht.</b></p>\n";
-            echo "<p class='green'><b>Infodaten zu ID '$infid' wurden gel&ouml;scht.</b></p>\n";
-            echo "<br /><br />\n";
-
-            // Anzeigen geloeschter Vertragsdaten
-            if ($fname)
-                $ifile = $infid . "_" . $fname;
-            else
-                $ifile = $inf['ifname'];
-            include ("inc/info_dat_show.inc.php");
-        }
-         
-    }
-    if ($ok && ($upd || $del))
-    {
-        echo "</div><br /><br />\n";
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">Zur&uuml;ck zur Infoliste</a></p>\n";    
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_ins.php\" target=\"_self\" title=\"Info erfassen\">Weitere Info erfassen</a></p>\n";    
-    }
-
-?>
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 08/2011
+ *
+ * INSERT Informationen   
+ */
+
+    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("ir",$_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Eingabe Informationen</title>
+</head>
+
+<body>
+
+<?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/document_image_ver.png\" border=\"0\" alt=\"Infodaten &auml;ndern\" title=\"Infodaten &auml;ndern\"/></div>\n";
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	$dbc = new dbconnection();
+    
+    $infid    = $_GET["uid"];
+    if (!$inf) $inf=1;
+	$upd	= $_POST["upd"];
+    $del    = $_POST["del"];
+	$inf    = $_POST["inf"];
+    $ok		= $_POST["ok"];
+    if (!$inf["okn"]) $ok = false;
+
+    if (!$ok && ((!$upd && !$del) || $upd || $del))
+    {
+        if (!$upd && !$del)
+        {
+            $sql = "SELECT info_ID,info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,infotyp_ID,
+                    persknr,lang,info_file,info_rel_ID,info_freigabe FROM fhiiqm.Info WHERE info_ID = $infid";
+            if ($result = $dbc -> queryObjectArray($sql))
+            {
+                foreach ($result as $row)
+                {
+                    $inf["infid"]   = $infid;
+                    $inf["iname"]   = $row->info_name_s;
+                    $inf["ilong"]   = $row->info_name_l;
+                    $inf["ityp"]   = $row->infotyp_ID;
+                    $inf["ijahr"]   = substr($row->info_date,0,4);  
+                    $inf["imon"]    = substr($row->info_date,5,2);  
+                    $inf["itag"]    = substr($row->info_date,8,2);  
+                    $inf["bjahr"]   = substr($row->info_valid_from,0,4);  
+                    $inf["bmon"]    = substr($row->info_valid_from,5,2);  
+                    $inf["btag"]    = substr($row->info_valid_from,8,2);  
+                    $inf["ejahr"]   = substr($row->info_valid_to,0,4);  
+                    $inf["emon"]    = substr($row->info_valid_to,5,2);  
+                    $inf["etag"]    = substr($row->info_valid_to,8,2);
+                    $inf["pers"]    = $row->persknr;
+                    $inf["infrel"]  = $row->info_rel_ID;
+                    $inf["ifname"]   = $row->info_file;
+                    $inf["lang"]    = $row->lang;     
+                }
+            }
+            // Produkt
+            $sql = "SELECT produkt_ID FROM Info_Produkt WHERE info_ID = $infid";
+            if ($result = $dbc -> queryObjectArray($sql))
+            {
+                foreach ($result as $row)
+                {
+                    $inf['prid'][] = $row->produkt_ID;
+                }
+            }
+            // Adressat
+            $sql = "SELECT info_adr_ID FROM Info_Adressat WHERE info_id = $infid";
+            if ($result = $dbc->queryObjectArray($sql))
+            {
+                foreach ($result as $row)
+                $inf["adr"][] = $row->info_adr_ID;
+            }
+                
+        }
+        include_once("form/info_form.inc.php");
+        
+        if ($upd)
+		{
+            echo            
+            "<tr>
+        		<td>Upload Infodokument </td>
+        		<td><input type=\"file\" name=\"ifile\" size=\"50\" maxlength=\"50\" value=\"" .
+            $_FILES["ifile"]["name"] . "\"/></td>
+            </tr>";
+    
+		}
+	  	if ($upd || $del)
+        {
+            if ($upd)
+              $frage = "Alle Angaben ok?<br>
+              erst wenn Haken gesetzt, Upload-File w&auml;hlen!";
+            elseif ($del)
+                $frage = "Information wirklich l&ouml;schen?";
+    		echo "<tr>
+    		  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+    		        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+    		        if ($ok)  echo "checked"; 
+    		echo "></td>\n</tr>\n"; 
+        }
+		
+        if (!is_null($_SESSION["recht"]) && in_array("ie",$_SESSION["recht"]))
+        {
+    		echo "<tr>\n";
+    		echo "
+    		  <td>&nbsp;</td>
+    		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
+    		  &nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
+    		echo "</tr>\n";
+        }
+        echo "</table>\n";
+        echo "</div>\n";
+        if (!is_null($_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"]))
+            echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">&laquo; zur Infoliste</a></p>\n";    
+        echo "</form>\n";	
+
+        
+    }
+    elseif ($ok && $upd)
+    {
+        echo "<div align='center'>\n";
+        //daten speichern
+        $inf["iname"] = substr($inf["iname"],0,300);
+        $inf["ilong"] = substr($inf["ilong"],0,8000);
+        if ($inf["ityp"] == -1) $inf["ityp"] = null;
+        
+        //Datumswerte validieren
+        $idat = date_obj($inf["ijahr"], $inf["imon"], $inf["itag"]);
+        $bdat = date_obj($inf["bjahr"], $inf["bmon"], $inf["btag"]);
+        $edat = date_obj($inf["ejahr"], $inf["emon"], $inf["etag"]);
+
+        if ($inf["pers"] == -1) $inf["pers"] = null;
+        if ($inf["infrel"] == -1) $inf["infrel"] = null;
+        if ($inf["lang"] == -1) $inf["lang"] = null;
+        //echo "datcreate: $idat, datevalidfrom: $bdat, datevalidto: $edat, author: " . $inf["pers"] . "<br />\n";        
+
+        if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+        $stmt = $dbc -> stmtinit();
+        if (is_object($stmt))
+        {
+            $stmt -> prepare("UPDATE fhiiqm.Info SET
+                        info_name_s = ?, 
+                        info_name_l = ?, 
+                        info_date = ?, 
+                        info_valid_from = ?, 
+                        info_valid_to = ?, 
+                        infotyp_ID = ?, 
+                        persknr = ?, 
+                        lang = ?, 
+                        info_rel_ID = ? WHERE info_ID = $infid");
+            $stmt -> bind_param('sssssiisi',$inf["iname"],$inf["ilong"],$idat,$bdat,$edat,$inf["ityp"],$inf["pers"],$inf["lang"],$inf["infrel"]);
+            $result = $stmt -> execute();
+//            print_r($stmt);
+        }
+        if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
+        if ($result)
+        { // UPDATE o.k.
+            
+            // n:m Tabellen INSERT
+            include ("inc/info_tab_ins.inc.php");
+
+            // upload File
+                // echo "upload-error: " . $_FILES["ifile"]["error"] .  "<br />\n";
+            if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] )
+            {
+//                echo "file hochgeladen: " . $_FILES["ifile"]["name"] ."<br />\n";
+                include ("inc/file_upload.inc.php");
+                $fname = gen_filename($inf['ifname'],"ifile",$infid);
+                $retdf  = mod_file("/var/www/fhiiqm/infos",$infid,"","del");  // Loeschen alte Datei
+                $retf   = upload("ifile", $fname, $infid, "infos");              // Datei prüfen und in Dokumentenverzeichnis verschieben
+                
+                if ($retf)
+                {   // upload o.k.
+                    //UPDATE des Filenamens
+                    $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid";
+                    $retv=$dbc->execute($sql);
+                    if (!$retv) 
+                        echo $dbc -> error . "<br>\n";
+                }
+               
+            }
+            else 
+            {
+                $retf=1; //kein Infodoc hochgeladen
+            }
+            if ($result && $retf && $reta && $retp) // INSERT Raum
+            {
+                //Eingabe Daten, Upload File erfolgreich 
+                    echo "<p class='green'><b>Infodaten zu ID '$infid' wurden erfolgreich gespeichert.</b></p>\n";
+                    echo "<br /><br />\n";
+
+                // Anzeigen gespeicherte Raumdaten
+                if ($fname)
+                    $ifile = $infid . "_" . $fname;
+                else
+                    $ifile = $inf['ifname'];
+                include ("inc/info_dat_show.inc.php");
+            }
+        }                      
+    }
+    elseif ($ok & $del)
+    {
+       // DELETE aus Tab Info und abhaengigen Tabellen
+        echo "<div align='center'>\n";
+
+        $idat = date_obj($inf["ijahr"], $inf["imon"], $inf["itag"]);
+        $bdat = date_obj($inf["bjahr"], $inf["bmon"], $inf["btag"]);
+        $edat = date_obj($inf["ejahr"], $inf["emon"], $inf["etag"]);
+        
+        $sql = "DELETE FROM Info WHERE info_ID = $infid";
+        $retid = $dbc -> execute($sql);
+        if ($retid)
+        {
+            include ("inc/file_upload.inc.php");
+            $retdf  = mod_file("/var/www/fhiiqm/infos",$infid,"","del");  // Loeschen Dokument
+            if ($retdf) echo "<p class='green'><b>Infodokument zu ID '$infid' wurde gel&ouml;scht.</b></p>\n";
+            echo "<p class='green'><b>Infodaten zu ID '$infid' wurden gel&ouml;scht.</b></p>\n";
+            echo "<br /><br />\n";
+
+            // Anzeigen geloeschter Vertragsdaten
+            if ($fname)
+                $ifile = $infid . "_" . $fname;
+            else
+                $ifile = $inf['ifname'];
+            include ("inc/info_dat_show.inc.php");
+        }
+         
+    }
+    if ($ok && ($upd || $del))
+    {
+        echo "</div><br /><br />\n";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_flist.php\" target=\"_self\" title=\"Infoliste\">Zur&uuml;ck zur Infoliste</a></p>\n";    
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"info_ins.php\" target=\"_self\" title=\"Info erfassen\">Weitere Info erfassen</a></p>\n";    
+    }
+
+?>
+</body>
 </html>
\ No newline at end of file
--- a/fhiiqm/deprecated/vertrag_flist2.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/deprecated/vertrag_flist2.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,195 +1,195 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 7/2011
- * 
- * Liste Vertragsdaten mit Sortierung
- */
-
-    error_reporting(E_ALL ^ E_NOTICE);
-    
-    session_start();
-    if (! isset($_SESSION["userid"]))
-    { 
-        include_once ("inc/func_lib.inc.php");	
-        login("vertrag_flist2.php");
-        exit;
-    }
-    
-    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vr",$_SESSION["recht"]) && !in_array("ve",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-?>
-    
-<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen "/> 
-   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> 
-
-	<title>Liste Vertragsdaten, Teil 2</title>
-</head>
-
-<body>
-
-<?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\">&nbsp;&nbsp;&nbsp;<img src=\"img/document_mark_as_final.png\" border=\"0\" alt=\"Vertr&auml;ge\" title=\"Vertr&auml;ge\"/></div>\n";
-
-    $zeil = $_GET["z"];
-    if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen
-    $start = $_GET["st"];   // Start bei DS $start+1
-    if (!$start) $start=0;
-    
-    // Felder, nach denen gefiltert werden kann
-    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner");
-
-	$sort   = $_GET["s"];
-    $dir    = $_GET["d"];
-    if (!isset($sort) && !$sort) $sort = 2;
-    if (!isset($dir) && !$dir)  $dir = "";
-
-    $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
-    $filter = $_GET["b"];
-    if (!isset($fnum) && !$fnum) $fnum = 0;
-    
-    // Recht Produktgruppe beruecksichtigen
-    if (is_array($_SESSION["prodg"]))
-    {
-            foreach ($_SESSION["prodg"] as $val)
-                $listg .= "," .$val;
-            $listg = substr($listg,1);
-    }
-    else $listg = "";
-
-    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
-	$dbc = new dbconnection();
-
-    $sql = "CALL fhiiqm.vertrag_flist2(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "',$start,$zeil, @anz, @ganz)";
-    // Parameter: Nr. Sortfelf, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Start bei DS $start+1, Anzahl DS/Seite, Anzahl gefundener Vertraege, Anzahl DS gesamt
-    // liefert Felder: contract_ID,cname,clong,bearb,doc,typ,prod,cbegin,cend,kmon,partfirmar,kyear,kosten,bem
-    $result = $dbc -> queryObjectArray($sql);
-    if ($result)
-    {
-		$bg1 = "#F8F8F8";
-		$bg2 = "#DEDFE1";
-		$bg = "#FFFFFF";
-        
-        $heute = new DateTime();
-        
-        $vanz = $dbc -> querySingleItem("SELECT @anz");
-        $ganz = $dbc -> querySingleItem("SELECT @ganz");
-        
-        echo "<div align='center'>\n";
-        echo "<p><b>Vertr&auml;ge Teil 2</b></p>\n";
-        echo "<table border='0' cellspacing='0'>\n";
-        echo "<tr><td class='bigger'>Mittels '<img src='img/auf.gif' border='0' width='9' hight='9'>' / '<img src='img/ab.gif' border='0' width='9' hight='9'>' 
-            können Sie Spalten auf- bzw. absteigend sortieren</td></tr>
-            <tr><td class='bigger'>Klick auf '<img src='img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Vertragsdaten</td></tr>\n";
-        echo "</table>\n";
-        printf ("<p>Anzahl Vertr&auml;ge: %s </p>", $vanz);
-        echo "<table width='99%'>\n";
-
-        if ($filter>'!') echo "<tr><td class='bigger' colspan=7>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n";
-
-        echo "<tr bgcolor='#68ACBF'>";
-        tab_column(2,"Bezeichnung",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        tab_column(8,"Beginn",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        tab_column(9,"Ende",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        tab_column(10,"Verl&auml;ng.",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        tab_column(11,"K&uuml;nd.frist (mon)",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-//        tab_column(12,"Partner",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        echo "<th>Kosten/Jahr(&euro;)</th>";
-        echo "<th>Bemerkung</th>";
-        echo "<th>E-Mail</th>";
-
-        echo "<th>&nbsp;</th></tr>\n";
-        $cid=0;
-        foreach ($result as $row)
-        {
-            if ($row->contract_ID != $cid && $cid != 0)
-            {   // nicht beim 1. Datensatz
-                echo "</td>";
-                echo "<td width='27%'>$bem</td>";    
-                echo "<td>$mail</td>";
-                echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
-            }
-            if ($row->contract_ID != $cid)
-            {   // Anzeigen der nur einmal relevanten Daten
-    			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-                if ($row->cend)
-                {
-                    $ce = new DateTime($row->cend);
-                    if ((!$row->cautoend || is_null($row->cautoend)) && $heute > $ce) $class="class='red'"; else $class="";
-                }
-                else $class="";
-                echo "<tr bgcolor='" . $bg . "'><td $class><b>$row->cname</b></td>";    
-    //            echo "<td>$row->contract_s</td>";    
-                if ($row->cbegin)
-                {
-                    $cb = new DateTime($row->cbegin);    
-                    echo "<td>" . $cb->format('d.m.Y')."</td>";
-                }
-                else  echo "<td>&nbsp;</td>";       
-                if ($row->cend)
-                    echo "<td>" . $ce->format('d.m.Y')."</td>";    
-                else  echo "<td>&nbsp;</td>";       
-                if ($row->cautoend) echo "<td>automatisch</td>"; else echo "<td>&nbsp;</td>"; 
-                echo "<td class='center'>$row->kmon</td>";    
-//                echo "<td>$row->partfirma</td>";
-                echo "<td>"; 
-                $bem = nl2br($row->bem);
-                if ($row->email) $mail= "ja"; else $mail= "&nbsp;";   
-            }
-            // Anzeigen Kosten pro Jahr -> 1 Zeile des Resultsets (Kosten fast rechtsbuendig!))
-            if ($row->kosten)
-            { 
-                if ($row->contract_ID == $cid) echo "<br />";
-                echo "$row->kyear:&nbsp;&nbsp;&nbsp;" . str_replace(" ","&nbsp;",sprintf("%' 10s",number_format($row->kosten,2,",","."))) . "";
-            }    
-            $cid = $row->contract_ID;    
-       }
-        echo "</td>";
-        echo "<td>$bem</td>";    
-        echo "<td>$mail</td>";
-        echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
-        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,$ganz,$liste);
-    }
-    else
-    {
-        print_r ($dbc -> error);
-    }
-    $dbc -> close();
-    if (!is_null($_SESSION["recht"]) && in_array("ve",$_SESSION["recht"]))
-        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"vertrag_ins.php\" class=\"sc\" target=\"_self\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
-
-?>
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 7/2011
+ * 
+ * Liste Vertragsdaten mit Sortierung
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login("vertrag_flist2.php");
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vr",$_SESSION["recht"]) && !in_array("ve",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+    
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen "/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> 
+
+	<title>Liste Vertragsdaten, Teil 2</title>
+</head>
+
+<body>
+
+<?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\">&nbsp;&nbsp;&nbsp;<img src=\"img/document_mark_as_final.png\" border=\"0\" alt=\"Vertr&auml;ge\" title=\"Vertr&auml;ge\"/></div>\n";
+
+    $zeil = $_GET["z"];
+    if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen
+    $start = $_GET["st"];   // Start bei DS $start+1
+    if (!$start) $start=0;
+    
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner");
+
+	$sort   = $_GET["s"];
+    $dir    = $_GET["d"];
+    if (!isset($sort) && !$sort) $sort = 2;
+    if (!isset($dir) && !$dir)  $dir = "";
+
+    $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
+    $filter = $_GET["b"];
+    if (!isset($fnum) && !$fnum) $fnum = 0;
+    
+    // Recht Produktgruppe beruecksichtigen
+    if (is_array($_SESSION["prodg"]))
+    {
+            foreach ($_SESSION["prodg"] as $val)
+                $listg .= "," .$val;
+            $listg = substr($listg,1);
+    }
+    else $listg = "";
+
+    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	$dbc = new dbconnection();
+
+    $sql = "CALL fhiiqm.vertrag_flist2(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "',$start,$zeil, @anz, @ganz)";
+    // Parameter: Nr. Sortfelf, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Start bei DS $start+1, Anzahl DS/Seite, Anzahl gefundener Vertraege, Anzahl DS gesamt
+    // liefert Felder: contract_ID,cname,clong,bearb,doc,typ,prod,cbegin,cend,kmon,partfirmar,kyear,kosten,bem
+    $result = $dbc -> queryObjectArray($sql);
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+        
+        $heute = new DateTime();
+        
+        $vanz = $dbc -> querySingleItem("SELECT @anz");
+        $ganz = $dbc -> querySingleItem("SELECT @ganz");
+        
+        echo "<div align='center'>\n";
+        echo "<p><b>Vertr&auml;ge Teil 2</b></p>\n";
+        echo "<table border='0' cellspacing='0'>\n";
+        echo "<tr><td class='bigger'>Mittels '<img src='img/auf.gif' border='0' width='9' hight='9'>' / '<img src='img/ab.gif' border='0' width='9' hight='9'>' 
+            können Sie Spalten auf- bzw. absteigend sortieren</td></tr>
+            <tr><td class='bigger'>Klick auf '<img src='img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Vertragsdaten</td></tr>\n";
+        echo "</table>\n";
+        printf ("<p>Anzahl Vertr&auml;ge: %s </p>", $vanz);
+        echo "<table width='99%'>\n";
+
+        if ($filter>'!') echo "<tr><td class='bigger' colspan=7>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n";
+
+        echo "<tr bgcolor='#68ACBF'>";
+        tab_column(2,"Bezeichnung",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(8,"Beginn",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(9,"Ende",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(10,"Verl&auml;ng.",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(11,"K&uuml;nd.frist (mon)",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+//        tab_column(12,"Partner",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        echo "<th>Kosten/Jahr(&euro;)</th>";
+        echo "<th>Bemerkung</th>";
+        echo "<th>E-Mail</th>";
+
+        echo "<th>&nbsp;</th></tr>\n";
+        $cid=0;
+        foreach ($result as $row)
+        {
+            if ($row->contract_ID != $cid && $cid != 0)
+            {   // nicht beim 1. Datensatz
+                echo "</td>";
+                echo "<td width='27%'>$bem</td>";    
+                echo "<td>$mail</td>";
+                echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+            }
+            if ($row->contract_ID != $cid)
+            {   // Anzeigen der nur einmal relevanten Daten
+    			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+                if ($row->cend)
+                {
+                    $ce = new DateTime($row->cend);
+                    if ((!$row->cautoend || is_null($row->cautoend)) && $heute > $ce) $class="class='red'"; else $class="";
+                }
+                else $class="";
+                echo "<tr bgcolor='" . $bg . "'><td $class><b>$row->cname</b></td>";    
+    //            echo "<td>$row->contract_s</td>";    
+                if ($row->cbegin)
+                {
+                    $cb = new DateTime($row->cbegin);    
+                    echo "<td>" . $cb->format('d.m.Y')."</td>";
+                }
+                else  echo "<td>&nbsp;</td>";       
+                if ($row->cend)
+                    echo "<td>" . $ce->format('d.m.Y')."</td>";    
+                else  echo "<td>&nbsp;</td>";       
+                if ($row->cautoend) echo "<td>automatisch</td>"; else echo "<td>&nbsp;</td>"; 
+                echo "<td class='center'>$row->kmon</td>";    
+//                echo "<td>$row->partfirma</td>";
+                echo "<td>"; 
+                $bem = nl2br($row->bem);
+                if ($row->email) $mail= "ja"; else $mail= "&nbsp;";   
+            }
+            // Anzeigen Kosten pro Jahr -> 1 Zeile des Resultsets (Kosten fast rechtsbuendig!))
+            if ($row->kosten)
+            { 
+                if ($row->contract_ID == $cid) echo "<br />";
+                echo "$row->kyear:&nbsp;&nbsp;&nbsp;" . str_replace(" ","&nbsp;",sprintf("%' 10s",number_format($row->kosten,2,",","."))) . "";
+            }    
+            $cid = $row->contract_ID;    
+       }
+        echo "</td>";
+        echo "<td>$bem</td>";    
+        echo "<td>$mail</td>";
+        echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+        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,$ganz,$liste);
+    }
+    else
+    {
+        print_r ($dbc -> error);
+    }
+    $dbc -> close();
+    if (!is_null($_SESSION["recht"]) && in_array("ve",$_SESSION["recht"]))
+        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"vertrag_ins.php\" class=\"sc\" target=\"_self\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
+
+?>
+</body>
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/deprecated/vertrag_ins.php	Wed Aug 06 09:42:40 2014 +0200
@@ -0,0 +1,229 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 05/2011
+ *
+ * INSERT Vertragsdaten   
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login("vertrag_ins.php");
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ve",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+    
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Eingabe Vertragsdaten</title>
+</head>
+
+<body>
+    
+<?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/document_mark_as_final.png\" border=\"0\" alt=\"Vertragsdaten eingeben\" title=\"Vertragsdaten eingeben\"/></div>\n";
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	//$dbc = new dbconnection();
+    
+	$ok		= $_POST["ok"];
+	$submit	= $_POST["ins"];
+    $vtr    = $_POST["vertrag"];
+    if (!$vtr['okn']) $ok=false;
+    
+//    print_r($vtr);
+//    echo "<br><br>\n";
+//    echo "Vertragsbezeichnung: " . $vtr['cname'] ."<br><br>\n";
+
+    if ($_FILES["vfile"]["error"] == 1 || $_FILES["vfile"]["error"] == 2)
+    {
+        if ($_FILES["vfile"]["error"] == 2)
+            echo "<p class='red'><b>Uploadfile > 10 MByte!</b></p>\n";
+        $ok = 0;
+    }
+    
+    if (!$ok || !$submit)
+    {
+        include_once("form/vertrag_form.inc.php");
+        
+        if ($submit)
+		{
+            echo            
+            "<tr>
+        		<td>Upload Vertragsdokument </td>
+        		<td><input type=\"file\" name=\"vfile\" size=\"50\" maxlength=\"50\" value=\"" .
+            $_FILES["vfile"]["name"] . "\"/></td>
+            </tr>";
+    
+		  	$frage = "Alle Angaben ok?<br>
+              erst wenn Haken gesetzt, Upload-File w&auml;hlen!";
+			echo "<tr>
+			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+			        if ($ok)  echo "checked"; 
+			echo "></td>\n</tr>\n"; 
+		}
+		
+        if (!is_null($_SESSION["recht"]) && in_array("ve",$_SESSION["recht"]))
+        {
+    		echo "<tr>\n";
+    		echo "
+    		  <td>&nbsp;</td>
+    		  <td><input class=\"button\" type=\"submit\" value=\"eingeben\" name=\"ins\" title=\"insert\" /></td>\n";
+    		echo "</tr>\n";
+        }    
+        echo "</table>\n";
+        echo "</div>\n";
+        echo "</form>\n";	
+
+    }
+    else
+    {
+        echo "<div align='center'>\n";
+        //daten speichern
+//            echo "1realer filename: " . $_FILES["vfile"]["name"] . "<br><br>\n";
+        //INSERT Vertrag
+/*
+        if ($vtr['vtyp']== -1 || !(is_numeric($vtr['vtyp']))) $vtr['vtyp'] = "NULL";
+        if ($vtr['bjahr'] && $vtr['bmon'] && $vtr['btag'])
+        {
+            $vbegin = $vtr['bjahr'] . "-" . $vtr['bmon'] . "-" . $vtr['btag'];
+            $vbegin = "'$vbegin'";
+            $vbd = $vtr['btag'] . "." . $vtr['bmon'] . "." . $vtr['bjahr']; 
+        }    
+        else
+            $vbegin = "NULL";
+        if ($vtr['ejahr'] && $vtr['emon'] && $vtr['etag'])
+        {
+            $vend = $vtr['ejahr'] . "-" . $vtr['emon'] . "-" . $vtr['etag'];
+            $vend = "'$vend'";
+            $ved = $vtr['etag'] . "." . $vtr['emon'] . "." . $vtr['ejahr']; 
+        }   
+        else
+            $vend = "NULL";
+        if (!is_numeric($vtr['cnot'])) $vtr['cnot'] = "NULL";
+        if ($vtr['cbem']) $vtr['cbem'] = "'" . str_replace("'","\"",substr($vtr['cbem'],0,500)) . "'"; else $vtr['cbem']="NULL";
+*/
+        $vtr['cname'] = substr($vtr['cname'],0,50);
+//        $vtr['cshort'] = substr($vtr['cshort'],0,50);
+        $vtr['clong'] = substr($vtr['clong'],0,100);
+        if ($vtr['vtyp']== -1 || !(is_numeric($vtr['vtyp']))) $vtr['vtyp'] = null;
+        $vbegin = date_obj($vtr['bjahr'], $vtr['bmon'], $vtr['btag']);
+        $vend = date_obj($vtr['ejahr'], $vtr['emon'], $vtr['etag']);
+        if (!is_numeric($vtr['cnot'])) $vtr['cnot'] = null;
+        if ($vtr['cbem']) $vtr['cbem'] = substr($vtr['cbem'],0,500); else $vtr['cbem']=null;
+        // Filename Vertrag
+        $vtr['cfname'] = substr($vtr['cfname'],0,50);
+
+        if (!isset($dbc) || !$dbc) 
+            $dbc = new dbconnection();
+      
+/*        $sql = "INSERT INTO Vertrag (contract_name, contract_l,vtyp_ID,contract_begin, contract_end,contract_mon_notice,
+                    contract_file,bemerkung) 
+                    VALUES('" . $vtr['cname'] .
+                    "', '" . $vtr['clong'] .
+                    "', " . $vtr['vtyp'] .
+                    ", " . $vbegin .
+                    ", " . $vend .
+                    ", " . $vtr['cnot'] .
+                    ", '" . $vtr['cfname'] .
+                    "', " . $vtr['cbem'] .
+                    ")";
+                    
+//        echo "INSERT = $sql<br />\n";
+
+        $result=$dbc->execute($sql);
+*/
+        $stmt = $dbc -> stmtinit();
+        if (is_object($stmt))
+        {
+            $stmt -> prepare("INSERT INTO Vertrag (contract_name, contract_l,vtyp_ID,contract_begin, contract_end, contract_autoend, 
+                    contract_mon_notice, bemerkung,email_send) 
+                    VALUES(?,?,?,?,?,?,?,?,?)");
+            $stmt -> bind_param('ssissiisi',$vtr["cname"],$vtr["clong"],$vtr['vtyp'],$vbegin,$vend,$vtr['cautoend'],$vtr['cnot'],$vtr['cbem'],$vtr["email"]);
+            $result = $stmt -> execute();
+        }       
+        if ($stmt->error) echo "INSERT Vertrag, error: " . $stmt->errno . " - ". $stmt->error . "<br><br>\n";
+        if ($result)
+        { // INSERT o.k.
+          // contract_ID ermitteln
+            $cid = $dbc -> insertId();
+
+            // DELETE, INSERT n:m Tabellen
+            include ("inc/vertragtab_ins.inc.php");
+            
+            // upload File
+            if (is_uploaded_file($_FILES["vfile"]["tmp_name"]) && isset($_FILES["vfile"]["name"]) && $_FILES["vfile"]["name"] )
+            {
+                include ("inc/file_upload.inc.php");
+                $fname = gen_filename($vtr['cfname'],"vfile",$cid);
+                $ret = upload("vfile", $fname, $cid);
+                
+                if ($ret)
+                {   // upload o.k.
+                    //UPDATE des Filenamens
+                    $sql = "UPDATE Vertrag SET contract_file = '" . $cid . "_" . $fname ."' WHERE contract_ID=$cid";
+                    $retv=$dbc->execute($sql);
+                    if (!$retv) 
+                        echo $dbc -> error . "<br>\n";
+                }
+               
+            }
+            else
+            {   // upload failed
+                //UPDATE des Filenamens
+                echo "<p class='red'>Upload von '" . $vtr['cfname'] . "' ist fehlgeschlagen. (max. 6 MB)</p>";
+                $sql = "UPDATE Vertrag SET contract_file = NULL WHERE contract_ID=$cid";
+                $retv=$dbc->execute($sql);
+                if (!$retv) 
+                    echo $dbc -> error . "<br>\n";
+            }
+            
+            if ($retb && $retp && $retd && $retk) // INSERT n:m Tabellen zu Vertrag
+            {
+                    //Eingabe Daten, Upload File erfolgreich 
+                        echo "<p class='green'><b>Vertragsdaten zu ID '$cid' wurden erfolgreich gespeichert.</b></p>\n";
+                        echo "<br /><br />\n";
+    
+                        // Anzeigen gespeicherte Vertragsdaten
+                        if ($fname)
+                            $cfile = $cid . "_" . $fname;
+                        else
+                            $cfile = "";
+                        include ("inc/vertrag_dat_show.inc.php");
+            }            
+        }
+        $dbc -> close();
+        echo "</div>\n";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"vertrag_flist1.php\" target=\"_self\" title=\"Vertragsliste\">Zur Vertragsliste</a></p>\n";    
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"vertrag_ins.php\" target=\"_self\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
+
+    }
+
+?>
+
+</body>
+</html>
\ No newline at end of file
--- a/fhiiqm/form/info_form2.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/form/info_form2.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -171,7 +171,7 @@
                     }    
                     else */
                         $wherm = " WHERE aktiv < 2 "; // nur MA, keine Objekte, 02.11.2012, bs
-                    $sql = "SELECT persknr, CONCAT (nachname, ', ',IFNULL(vorname,''),' (',CASE aktiv WHEN 1 THEN 'aktiv' ELSE 'inaktiv' END, ')') as pname FROM fhiiqm.Mitarbeiter $wherm ORDER BY 2";
+                    $sql = "SELECT persknr, CONCAT (nachname, ', ',IFNULL(vorname,''),' (',CASE aktiv WHEN 1 THEN 'aktiv' ELSE (CASE aktiv WHEN -1 THEN 'Gast' ELSE 'inaktiv' END) END, ')') as pname FROM fhiiqm.Mitarbeiter $wherm ORDER BY 2";
                     if ($result = $dbc->queryObjectArray($sql))
                     {
                         foreach ($result as $row)
@@ -182,7 +182,8 @@
                                 if ($select)
                                     $inf["vma"][] = $row->persknr."|".$row->pname; // persknr als Index fuer bemerkung zu verantwortlichen-> $inf["prio"][persknr]
                             }                                    
-        					echo "<option $select value=\"$row->persknr\">$row->pname</option>\n";
+                            if (strpos($row->pname,"inaktiv") || strpos($row->pname,"Gast")) $class=" class='red'"; else $class="";
+                    		echo "<option$class $select value=\"$row->persknr\">$row->pname</option>\n";
                         }
                     }
                 ?>
--- a/fhiiqm/form/ma_fkt_form.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/form/ma_fkt_form.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,144 +1,144 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 09/2011
- */
-
-
-
-?>
-<div align="center">
-<table>
-<tr><td class="bigger">Die Auswahl eines Mitarbeiters geschieht durch<br />Eingeben von mindesten 2 Zeichen in das Mitarbeiter-Feld.
-</td></tr>
-<tr><td class="bigger">&nbsp;</td></tr>
-</table>
-</div>
-<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="fmafkt"> 
-<div align="center">
-    <table border="0" cellspacing="3" cellpadding="3">
-<!--        <div class="ui-widget"> -->
-        <tr><td>Mitarbeiter *</td>
-            <td valign="top"><input class="long20" type="text" name="fkt[persknr]" id="persknr" value="<?php echo $fkt['persknr']; ?>"/>
-            </td>
-        </tr>
-        <tr><td>Funktion *</td>
-            <td valign="top">
-                <!--<input class="long20" type="text" name="fkt[func]" id="func" value="<?php echo $fkt['func']; ?>"/> -->
-                <select name="fkt[func]" onchange="this.form.submit();">
-                <!--<select name="fkt[func]"> -->
-                <?php 
-                    $sql = "SELECT fkt_bez, fkt_ID FROM `fhiiqm`.`Funktion` ORDER BY 1";
-                    if ($result = $dbc->queryObjectArray($sql))
-                    {
-                        foreach ($result as $row)
-                        {
-                            if ($row->fkt_ID == $fkt['func'])
-        					   echo "<option selected value=\"$row->fkt_ID\">$row->fkt_bez</option>\n";
-        				    else
-        					   echo "<option value=\"$row->fkt_ID\">$row->fkt_bez</option>\n";
-                        }
-                }
-                ?>
-                </select>            
-            </td>
-        </tr>
-        <tr><td>Geltungsbereich
-        <?php if ($fkt["func"]=='KST') echo "<span> = Kostenstelle</span>"; ?>
-        </td>
-        <td valign="top">
-        <?php
-            if (isset($fkt['func']) && $fkt["func"]=='AL')
-            {
-                echo "<select name='fkt[ber]'>\n";
-                $sql = "SELECT  abt_ID,abt_name,abt_long FROM `fhiiqm`.`Abteilung`";
-                if ($result = $dbc->queryObjectArray($sql))
-                {
-                    foreach ($result as $row)
-                    {
-                        if ($row->abt_name == $fkt['ber'])
-    					   echo "<option selected value=\"$row->abt_name\">$row->abt_name</option>\n";
-    				    else
-    					   echo "<option value=\"$row->abt_name\">$row->abt_name</option>\n";
-                    }
-                }
-                echo "</select>";
-            }
-            elseif (isset($fkt['func']) && $fkt["func"]=='AGL')
-            {
-                echo "<select name='fkt[ber]'>\n";
-                $sql = "SELECT ag_name, abt_name FROM `fhiiqm`.`Arbeitsgruppe` ag INNER JOIN fhiiqm.Abteilung a
-                        ON ag.abt_ID=a.abt_ID ORDER BY ag.abt_ID, ag_ID";
-                if ($result = $dbc->queryObjectArray($sql))
-                {
-                    foreach ($result as $row)
-                    {
-                        if ($row->ag_name == $fkt['ber'])
-    					   echo "<option selected value=\"$row->ag_name\">$row->ag_name, $row->abt_name</option>\n";
-    				    else
-    					   echo "<option value=\"$row->ag_name\">$row->ag_name, $row->abt_name</option>\n";
-                    }
-                }
-                echo "</select>";
-            }
-            else
-            {
-        ?>
-            <input class="long20" type="text" name="fkt[ber]" id="ber" maxlength="50" value="<?php echo $fkt['ber']; ?>" onfocus="this.select();"/>
-        <?php } ?>   
-            </td>
-        </tr>
-        <tr><td>Beginn</td>
-            <td valign="top"><input class="long10" type="text" name="fkt[von]" id="von" value="<?php echo $fkt['von']; ?>"/>
-            </td>
-        </tr>
-        <tr><td>Ende</td>
-            <td valign="top"><input class="long10" type="text" name="fkt[bis]" id="bis" value="<?php echo $fkt['bis']; ?>"/>
-            </td>
-        </tr>
-        <tr><td>Bemerkung</td>
-            <td valign="top"><textarea name="fkt[bem]" id="bem" rows="3" cols="33"><?php echo $fkt['bem']; ?></textarea>
-            </td>
-        </tr>
-        <?php
-            if ($sub || $del)
-    		{
-    		  	if ($sub)
-                    $frage = "Alle Angaben ok?";
-                elseif ($del)
-                    $frage = "Beauftragung wirklich l&ouml;schen?";
-    			echo "<tr>
-    			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
-    			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
-    			        if ($ok)  echo "checked"; 
-    			echo "></td>\n</tr>\n"; 
-    		}
-        if (!is_null($_SESSION["recht"]) && in_array("fme",$_SESSION["recht"]))
-        {
-        ?>
-           	<tr><td>&nbsp;</td>
-            	<td><input  class="button" type="submit" name="eintragen" value="  eintragen  " />
-                <?php
-                if ($mfid)
-                { 
-                    echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
-                    echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"duplizieren\" name=\"dup\" title=\"delete\" />";
-                }
-                ?>
-                </td>
-           	</tr>
-        <?php
-        }
-        ?>
-<!--         </div> -->
-    </table>
-    <input type="hidden" name="fkt[pid]" id="pid" value="<?php echo $fkt['pid']; ?>"/>
-    <input type="hidden" name="fkt[fid]" id="fid" value="<?php echo $fkt['fid']; ?>"/>
-
-<?php
-    echo "</div>\n";
-//    if (!is_null($_SESSION["recht"]) && !in_array("fme", $_SESSION["recht"]))
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"ma_fkt_flist.php?$getp\" target=\"_self\" title=\"Funktionen\">&laquo; zur Funktionenliste</a></p>\n"; 
-    echo "</form>\n";   
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 09/2011
+ */
+
+
+
+?>
+<div align="center">
+<table>
+<tr><td class="bigger">Die Auswahl eines Mitarbeiters geschieht durch<br />Eingeben von mindesten 2 Zeichen in das Mitarbeiter-Feld.
+</td></tr>
+<tr><td class="bigger">&nbsp;</td></tr>
+</table>
+</div>
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="fmafkt"> 
+<div align="center">
+    <table border="0" cellspacing="3" cellpadding="3">
+<!--        <div class="ui-widget"> -->
+        <tr><td>Mitarbeiter *</td>
+            <td valign="top"><input class="long20" type="text" name="fkt[persknr]" id="persknr" value="<?php echo $fkt['persknr']; ?>"/>
+            </td>
+        </tr>
+        <tr><td>Funktion *</td>
+            <td valign="top">
+                <!--<input class="long20" type="text" name="fkt[func]" id="func" value="<?php echo $fkt['func']; ?>"/> -->
+                <select name="fkt[func]" onchange="this.form.submit();">
+                <!--<select name="fkt[func]"> -->
+                <?php 
+                    $sql = "SELECT fkt_bez, fkt_ID FROM `fhiiqm`.`Funktion` ORDER BY 1";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->fkt_ID == $fkt['func'])
+        					   echo "<option selected value=\"$row->fkt_ID\">$row->fkt_bez</option>\n";
+        				    else
+        					   echo "<option value=\"$row->fkt_ID\">$row->fkt_bez</option>\n";
+                        }
+                }
+                ?>
+                </select>            
+            </td>
+        </tr>
+        <tr><td>Geltungsbereich
+        <?php if ($fkt["func"]=='KST') echo "<span> = Kostenstelle</span>"; ?>
+        </td>
+        <td valign="top">
+        <?php
+            if (isset($fkt['func']) && $fkt["func"]=='AL')
+            {
+                echo "<select name='fkt[ber]'>\n";
+                $sql = "SELECT  abt_ID,abt_name,abt_long FROM `fhiiqm`.`Abteilung`";
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if ($row->abt_name == $fkt['ber'])
+    					   echo "<option selected value=\"$row->abt_name\">$row->abt_name</option>\n";
+    				    else
+    					   echo "<option value=\"$row->abt_name\">$row->abt_name</option>\n";
+                    }
+                }
+                echo "</select>";
+            }
+            elseif (isset($fkt['func']) && $fkt["func"]=='AGL')
+            {
+                echo "<select name='fkt[ber]'>\n";
+                $sql = "SELECT rag_bez, abt_name FROM `fhiiqm`.`RaumArb_Gruppe` rag INNER JOIN fhiiqm.Abteilung a
+                        ON rag.abt_ID=a.abt_ID ORDER BY rag.abt_ID, rag_ID";
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if ($row->rag_bez == $fkt['ber'])
+    					   echo "<option selected value=\"$row->rag_bez\">$row->rag_bez, $row->abt_name</option>\n";
+    				    else
+    					   echo "<option value=\"$row->rag_bez\">$row->rag_bez, $row->abt_name</option>\n";
+                    }
+                }
+                echo "</select>";
+            }
+            else
+            {
+        ?>
+            <input class="long20" type="text" name="fkt[ber]" id="ber" maxlength="50" value="<?php echo $fkt['ber']; ?>" onfocus="this.select();"/>
+        <?php } ?>   
+            </td>
+        </tr>
+        <tr><td>Beginn</td>
+            <td valign="top"><input class="long10" type="text" name="fkt[von]" id="von" value="<?php echo $fkt['von']; ?>"/>
+            </td>
+        </tr>
+        <tr><td>Ende</td>
+            <td valign="top"><input class="long10" type="text" name="fkt[bis]" id="bis" value="<?php echo $fkt['bis']; ?>"/>
+            </td>
+        </tr>
+        <tr><td>Bemerkung</td>
+            <td valign="top"><textarea name="fkt[bem]" id="bem" rows="3" cols="33"><?php echo $fkt['bem']; ?></textarea>
+            </td>
+        </tr>
+        <?php
+            if ($sub || $del)
+    		{
+    		  	if ($sub)
+                    $frage = "Alle Angaben ok?";
+                elseif ($del)
+                    $frage = "Beauftragung wirklich l&ouml;schen?";
+    			echo "<tr>
+    			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+    			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+    			        if ($ok)  echo "checked"; 
+    			echo "></td>\n</tr>\n"; 
+    		}
+        if (!is_null($_SESSION["recht"]) && in_array("fme",$_SESSION["recht"]))
+        {
+        ?>
+           	<tr><td>&nbsp;</td>
+            	<td><input  class="button" type="submit" name="eintragen" value="  eintragen  " />
+                <?php
+                if ($mfid)
+                { 
+                    echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
+                    echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"duplizieren\" name=\"dup\" title=\"delete\" />";
+                }
+                ?>
+                </td>
+           	</tr>
+        <?php
+        }
+        ?>
+<!--         </div> -->
+    </table>
+    <input type="hidden" name="fkt[pid]" id="pid" value="<?php echo $fkt['pid']; ?>"/>
+    <input type="hidden" name="fkt[fid]" id="fid" value="<?php echo $fkt['fid']; ?>"/>
+
+<?php
+    echo "</div>\n";
+//    if (!is_null($_SESSION["recht"]) && !in_array("fme", $_SESSION["recht"]))
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"ma_fkt_flist.php?$getp\" target=\"_self\" title=\"Funktionen\">&laquo; zur Funktionenliste</a></p>\n"; 
+    echo "</form>\n";   
 ?>
\ No newline at end of file
--- a/fhiiqm/form/recht_form.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/form/recht_form.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,164 +1,166 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 10/2011
- * 
- * Form Rechtezuordnung
- */
-
-
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
-    $okn = true;
-
-    if (!is_null($_SESSION["recht"]) && !in_array("rte",$_SESSION["recht"]))
-    {
-        $text = "";
-        $ro = " readonly='readonly'";
-        $da = " disabled='disabled'";
-    }    
-    else
-    {
-        if  (!$pget) $text = "Eingabe"; else $text="&Auml;ndern / L&ouml;schen";
-        $ro = "";
-        $da = "";
-    }    
-?>
-<div align="center">
-<h3><font face="Verdana, Arial, Helvetica, sans-serif"><?php echo $text;?> Nutzer &amp; Rechte fhiiqm</font></h3>
-<h5>* - Felder sind erforderlich!</h5>
-<table>
-<tr><td class="bigger">Die Auswahl eines Mitarbeiters geschieht durch Eingeben von mindesten 2 Zeichen in das Mitarbeiter-Feld.
-</td></tr>
-<tr><td class="bigger">&nbsp;</td></tr>
-</table>
-</div>
-<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_recht">	
-<div align="center">
-<table width="30%" border="0" cellspacing="3" cellpadding="3">
-    <tr><td>Mitarbeiter *</td>
-        <td valign="top"><input class="long20" type="text" name="rt[pers]" id="persknr" value="<?php echo $rt['pers'] . "\"" . $ro; ?>/>
-            <?php
-                if (isset($ins) && $rt['pid']<"1")
-                {
-    				echo "<br /><span class=\"red\">Mitarbeiter ist erforderlich!</span>\n";
-    				$okn = false;
-                }
-    			else
-    				if ($okn) $okn = true; else $okn=false; 
-            ?>
-        </td>
-    </tr>
-<!--
-    <tr>
-        <td>Mitarbeiter FHI *</td>
-        <td>
-            <select name="rt[pers]" size="10">
-                <?php
-/*                    $select = null;
-//                    $select = ("-1"==$rt['pers'] ) ? ' selected' : null;
-//                    echo "<option $select value=\"-1\"></option>\n";
-                    $sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter ORDER BY 2";
-                    if ($result = $dbc->queryObjectArray($sql))
-                    {
-                        foreach ($result as $row)
-                        {
-                            if (isset($rt['pers'])) $select = ($row->persknr==$rt['pers'] ) ? ' selected' : null;
-        					echo "<option $select value=\"$row->persknr\">$row->pname</option>\n";
-                        }
-                    }    */ 
-                ?>
-            </select>
-            <?php
-/*                if (isset($ins) && $rt['pers']<1)
-                {
-    				echo "<br /><span class=\"red\">Mitarbeiter ist erforderlich!</span>\n";
-    				$okn = false;
-                }
-    			else
-    				if ($okn) $okn = true; else $okn=false; */
-            ?>
-        </td>
-    </tr>
--->
-    <tr>
-        <td>Nutzername *</td>
-        <td><input name="rt[userid]" type="text" size="10" maxlength="10" value="<?php echo $rt['userid'] . "\"" . $ro; ?>/>
-            <?php 
-			     if (isset($rt['userid']) && $rt['userid']<'!')
-				{
-					echo "<br><span class=\"red\">Nutzername(userid) ist erforderlich!</span>\n";
-					$okn = false;
-				}
-				else
-					if ($okn) $okn = true; else $okn=false;
-             ?> 
-        </td>
-    </tr>
-    <tr>
-        <td>Rechte <br /><br />
-            &nbsp;&nbsp;&nbsp;<span class="green">Recht mu&szlig; explizit gew&auml;hlt werden</span><br /><br />
-            &nbsp;&nbsp;&nbsp;Mehrfachauswahl m&ouml;glich:<br />
-            &nbsp;&nbsp;&nbsp;[Strg]-Taste + Anklicken der<br /> 
-            &nbsp;&nbsp;&nbsp;gewünschten Listeneinträge
-        </td>
-        <td>
-            <select name="rt[recht][]" size="18" multiple="multiple"<?php echo $da; ?>>
-                <?php
-//                    $select = null;
-//                    if (is_array($rt['recht'])) $select = in_array( "-1", $rt['recht'] ) ? ' selected' : null;
-//                    echo "<option $select value=\"-1\"></option>\n";
-                    $sql = "SELECT recht_ID, thema FROM fhiiqm.recht ORDER BY 2";
-                    if ($result = $dbc->queryObjectArray($sql))
-                    {
-                        foreach ($result as $row)
-                        {
-                            if (is_array($rt['recht'])) $select = in_array( $row->recht_ID, $rt['recht'] ) ? ' selected' : null;
-        					echo "<option $select value=\"$row->recht_ID\">$row->thema</option>\n";
-                        }
-                    }
-                ?>
-            </select>
-            <?php
-/*                    if (isset($ins) && (count($rt["recht"])< 1) || (count($rt["recht"])==1 && $rt["recht"][0]== "-1"))
-                    {
-    					echo "<br><span class=\"red\">mindestens ein Recht ist erforderlich!</span>\n";
-    					$okn = false;
-                    }
-    				else
-    					if ($okn) $okn = true; else $okn=false;    
-*/
-            ?>
-        </td>
-    </tr>
-    <tr>
-        <td>Rechteinschr&auml;nkung Produktgruppe<br /><br />
-            &nbsp;&nbsp;&nbsp;<span class="green">nichts ausw&auml;hlen = alle Rechte</span><br /><br />
-            &nbsp;&nbsp;&nbsp;Mehrfachauswahl m&ouml;glich
-        </td>
-        <td>
-            <select name="rt[prodg][]" size="7" multiple="multiple"<?php echo $da; ?>>
-                <?php
-                    $select = null;
-//                    if (is_array($rt['prodg'])) $select = in_array( "-1", $rt['prodg'] ) ? ' selected' : null;
-//                    echo "<option $select value=\"-1\"></option>\n";
-                    $sql = "SELECT prod_group_ID, prod_group_name FROM fhiiqm.Produkt_Gruppe ORDER BY 2";
-                    if ($result = $dbc->queryObjectArray($sql))
-                    {
-                        foreach ($result as $row)
-                        {
-                            if (is_array($rt['prodg'])) $select = in_array( $row->prod_group_ID, $rt['prodg'] ) ? ' selected' : null;
-        					echo "<option $select value=\"$row->prod_group_ID\">$row->prod_group_name</option>\n";
-                        }
-                    }
-                ?>
-            </select>
-        </td>
-    </tr>
-    <input type="hidden" name="rt[pid]" id="pid" value="<?php echo $rt['pid']; ?>"/>
-<!--    <input type="hidden" name="rt[pget]" value="<?php echo $rt['pget']; ?>"/> -->
-    <input type="hidden" name="rt[okn]" value="<?php echo $okn; ?>"/>
-<!--  </table>
- </div>   
-</form> -->
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 10/2011
+ * 
+ * Form Rechtezuordnung
+ */
+
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+    $okn = true;
+
+    if (!is_null($_SESSION["recht"]) && !in_array("rte",$_SESSION["recht"]))
+    {
+        $text = "";
+        $ro = " readonly='readonly'";
+        $da = " disabled='disabled'";
+    }    
+    else
+    {
+        if  (!$pget) $text = "Eingabe"; else $text="&Auml;ndern / L&ouml;schen";
+        $ro = "";
+        $da = "";
+    }    
+?>
+<div align="center">
+<h3><font face="Verdana, Arial, Helvetica, sans-serif"><?php echo $text;?> Nutzer &amp; Rechte fhiiqm</font></h3>
+<h5>* - Felder sind erforderlich!</h5>
+<table>
+<tr><td class="bigger">Die Auswahl eines Mitarbeiters geschieht durch Eingeben von mindesten 2 Zeichen in das Mitarbeiter-Feld.
+</td></tr>
+<tr><td class="bigger">&nbsp;</td></tr>
+</table>
+</div>
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_recht">	
+<div align="center">
+<table width="30%" border="0" cellspacing="3" cellpadding="3">
+    <tr><td>Mitarbeiter *</td>
+        <td valign="top"><input class="long20" type="text" name="rt[pers]" id="persknr" value="<?php echo $rt['pers'] . "\"" . $ro; ?>/>
+            <?php
+                if (isset($ins) && $rt['pid']<"1")
+                {
+    				echo "<br /><span class=\"red\">Mitarbeiter ist erforderlich!</span>\n";
+    				$okn = false;
+                }
+    			else
+    				if ($okn) $okn = true; else $okn=false; 
+            ?>
+        </td>
+    </tr>
+<!--
+    <tr>
+        <td>Mitarbeiter FHI *</td>
+        <td>
+            <select name="rt[pers]" size="10">
+                <?php
+/*                    $select = null;
+//                    $select = ("-1"==$rt['pers'] ) ? ' selected' : null;
+//                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if (isset($rt['pers'])) $select = ($row->persknr==$rt['pers'] ) ? ' selected' : null;
+        					echo "<option $select value=\"$row->persknr\">$row->pname</option>\n";
+                        }
+                    }    */ 
+                ?>
+            </select>
+            <?php
+/*                if (isset($ins) && $rt['pers']<1)
+                {
+    				echo "<br /><span class=\"red\">Mitarbeiter ist erforderlich!</span>\n";
+    				$okn = false;
+                }
+    			else
+    				if ($okn) $okn = true; else $okn=false; */
+            ?>
+        </td>
+    </tr>
+-->
+    <tr>
+        <td>Nutzername *</td>
+        <td><input name="rt[userid]" type="text" size="10" maxlength="10" value="<?php echo $rt['userid'] . "\"" . $ro; ?>/>
+            <?php 
+			     if (isset($rt['userid']) && $rt['userid']<'!')
+				{
+					echo "<br><span class=\"red\">Nutzername(userid) ist erforderlich!</span>\n";
+					$okn = false;
+				}
+				else
+					if ($okn) $okn = true; else $okn=false;
+             ?> 
+        </td>
+    </tr>
+    <tr>
+        <td>Rechte <br /><br />
+            &nbsp;&nbsp;&nbsp;<span class="green">Recht mu&szlig; explizit gew&auml;hlt werden</span><br /><br />
+            &nbsp;&nbsp;&nbsp;Mehrfachauswahl m&ouml;glich:<br />
+            &nbsp;&nbsp;&nbsp;[Strg]-Taste + Anklicken der<br /> 
+            &nbsp;&nbsp;&nbsp;gewünschten Listeneinträge
+        </td>
+        <td>
+            <select name="rt[recht][]" size="18" multiple="multiple"<?php echo $da; ?>>
+                <?php
+//                    $select = null;
+//                    if (is_array($rt['recht'])) $select = in_array( "-1", $rt['recht'] ) ? ' selected' : null;
+//                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT recht_ID, thema FROM fhiiqm.recht ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if (is_array($rt['recht'])) $select = in_array( $row->recht_ID, $rt['recht'] ) ? ' selected' : null;
+        					echo "<option $select value=\"$row->recht_ID\">$row->thema</option>\n";
+                        }
+                    }
+                ?>
+            </select>
+            <?php
+/*                    if (isset($ins) && (count($rt["recht"])< 1) || (count($rt["recht"])==1 && $rt["recht"][0]== "-1"))
+                    {
+    					echo "<br><span class=\"red\">mindestens ein Recht ist erforderlich!</span>\n";
+    					$okn = false;
+                    }
+    				else
+    					if ($okn) $okn = true; else $okn=false;    
+*/
+            ?>
+        </td>
+    </tr>
+    <tr>
+        <td>Rechteinschr&auml;nkung Produktgruppe<br /><br />
+            &nbsp;&nbsp;&nbsp;<span class="green">nichts ausw&auml;hlen = alle Rechte</span><br /><br />
+            &nbsp;&nbsp;&nbsp;Mehrfachauswahl m&ouml;glich
+        </td>
+        <td>
+            <select name="rt[prodg][]" size="7" multiple="multiple"<?php echo $da; ?>>
+                <?php
+                    $select = null;
+//                    if (is_array($rt['prodg'])) $select = in_array( "-1", $rt['prodg'] ) ? ' selected' : null;
+//                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT prod_group_ID, prod_group_name FROM fhiiqm.Produkt_Gruppe ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if (is_array($rt['prodg'])) $select = in_array( $row->prod_group_ID, $rt['prodg'] ) ? ' selected' : null;
+        					echo "<option $select value=\"$row->prod_group_ID\">$row->prod_group_name</option>\n";
+                        }
+                    }
+                ?>
+            </select>
+        </td>
+    </tr>
+    <input type="hidden" name="rt[pid]" id="pid" value="<?php echo $rt['pid']; ?>"/>
+    <input type="hidden" name="rt[sn]" id="sn" value="<?php echo $rt['sn']; ?>"/>
+    <input type="hidden" name="rt[gn]" id="gn" value="<?php echo $rt['gn']; ?>"/>
+<!--    <input type="hidden" name="rt[pget]" value="<?php echo $rt['pget']; ?>"/> -->
+    <input type="hidden" name="rt[okn]" value="<?php echo $okn; ?>"/>
+<!--  </table>
+ </div>   
+</form> -->
--- a/fhiiqm/form/vertragmf_form.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/form/vertragmf_form.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -95,13 +95,21 @@
              <?php
                 if ($vtr['bdat'] && $vtr['edat'])
                 {
-                    $dat = $vtr['edat'];
-                    $edate = new DateTime("$dat");
-                    $edate = $edate->add(new DateInterval('P1D'));
-                    $dat = $vtr['bdat'];
-                    $bdate = new DateTime("$dat");
-                    $diff = $edate->diff($bdate);
-                    echo "<br />Vertragsdauer: ".$diff->format('%y Jahr(e), %m Monat(e), %d Tag(e)');
+                    if ($vtr['bdat'] > $vtr['edat'])
+                    {
+    					echo "<br><span class=\"red\">Datum Vertragsende < Datum Vertragsbeginn</span>\n";
+    					$okn = false;
+                    }
+                    else
+                    {
+                        $dat = $vtr['edat'];
+                        $edate = new DateTime("$dat");
+                        $edate = $edate->add(new DateInterval('P1D'));
+                        $dat = $vtr['bdat'];
+                        $bdate = new DateTime("$dat");
+                        $diff = $edate->diff($bdate);
+                        echo "<br />Vertragsdauer: ".$diff->format('%y Jahr(e), %m Monat(e), %d Tag(e)');
+                    }
                 }
              ?>
         </td>
Binary file fhiiqm/img/reseller_programm.png has changed
Binary file fhiiqm/img/tel/tellist_kopf1n.jpg has changed
Binary file fhiiqm/img/tel/tellist_kopf1no.jpg has changed
Binary file fhiiqm/img/tel/tellist_kopf1ns.jpg has changed
--- a/fhiiqm/inc/conf.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/conf.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -22,6 +22,12 @@
         "user" => "telefon",
         "passwort" => "telefon",
         "dbname" => "fhi");
+
+$confa = array(
+        "server" => "aeos",
+        "user" => "www",
+        "passwort" => "grolle",
+        "dbname" => "aeos31");
                 
         $ldaprdn = "cn=admin,dc=rz-berlin,dc=mpg,dc=de";
         $ldappwd = 'ooboot';
--- a/fhiiqm/inc/dbconnect.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/dbconnect.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -26,6 +26,7 @@
 	function __construct($dbname='')
 	{
 		include_once("conf.inc.php");
+//		include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/conf.inc.php");
 //		global $config;
 
         if ($dbname == "fhi")
@@ -35,6 +36,13 @@
             $this->_passwort =  ( isset($passwort) && $passwort ) ? $passwort : $confr["passwort"];
             $this->_dbname   =  ( isset($dbname)   && $dbname   ) ? $dbname   : $confr["dbname"];
         }
+        elseif ($dbname == "aeos31")
+        {
+            $this->_server   =  ( isset($server)   && $server   ) ? $server   : $confa["server"];
+            $this->_user     =  ( isset($user)     && $user     ) ? $user     : $confa["user"];
+            $this->_passwort =  ( isset($passwort) && $passwort ) ? $passwort : $confa["passwort"];
+            $this->_dbname   =  ( isset($dbname)   && $dbname   ) ? $dbname   : $confa["dbname"];
+        }
         else
         {
             $this->_server   =  ( isset($server)   && $server   ) ? $server   : $config["server"];
--- a/fhiiqm/inc/file_upload.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/file_upload.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,239 +1,239 @@
-<?php
-
-/**
- * @author B.Schwarzer, Fritz-Haber-Institut
- * @copyright 05/2011
- */
-
-function upload($ufile, $fname, $id, $dir="documents")
-{
-   /**
-    * prueft Uploadfile und verschiebt es in gewaehltes Verzeichnis
-    *  Parameter
-    *   $ufile = upload-File: name <input>-Feld 
-    * 	$fname = gewaehlter filename
-    *   $id    = ID
-    *   $dir   = Verzeichnisname der Upload-Files
-    */
-
-        $errupl1 = null;
-        $errupl2 = null;
-        $errupl3 = null;
-		// Test filesize, filetyp	
-		if ($_FILES[$ufile]["size"] < 1) $errupl1 .= "$ufile: File ist leer! ";
-		if ($_FILES[$ufile]["size"] > 32000000) $errupl1 .= "$ufile: File > 32MByte! ";
-//		list($first,$rest) = explode(".",$_FILES[$ufile]["name"]);
-		$filep = explode(".",$_FILES[$ufile]["name"]);
-		$anz    = count($filep);
-      	$typ   = $filep[$anz-1];
-		if (substr($typ,0,2)=="ph" || substr($typ,0,2)=="pl" || substr($typ,0,2)=="cg" || substr($typ,0,2)=="ex") $errupl2 .="$ufile: falscher Filetyp! ";
-//echo "filesize=" . $_FILES[$ufile]["size"] . "<br>\n";
-		if ($_FILES[$ufile]["error"] > 0) $errupl3 = "Fehler upload: ".$_FILES[$ufile]["error"];
-		if (!$errupl1 && !$errupl2 && !$errupl3)
-		{
-			// File laden
-			$filetyp = $_FILES[$ufile]['type'];
-			$filesize = $_FILES[$ufile]['size'];
-			$filename = basename(addslashes($_FILES[$ufile]["name"]));				
-			$tempname = $_FILES[$ufile]['tmp_name'];
-			if ($fname)
-            {
-                  $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$fname);
-            }
-            else    
-                $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$filename);
-
-			if ($ret)
-			{		
-	//				echo "Error upload: ". $_FILES['pfile']['error'] .", $tempname<br>\n";
-                if ($fname) $fname=$id."_".$fname; else $fname = $id."_".$filename;
-   				echo "<p class=\"green\">Upload von '" . $_FILES[$ufile]["name"]."' erfolgreich.<br>
-                    gespeicherter Dateiname: '". $fname ."'</p>\n";
-				return true;
-			}
-			else
-			{
-				echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"]."' fehlgeschlagen.</p>\n";
-				return false;
-			}	
-		}
-		else
-		{
-			echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"]."' nicht m&ouml;glich!<br>$errupl1<br>$errupl2<br>$errupl3</p>\n";			
-			echo "<p>Upload bitte wiederholen</p>\n";
-			return false;
-		}	
-}
-
-function upload_multif($ufile, $fname, $id, $dir="documents")
-{
-   /**
-    * prueft Uploadfile und verschiebt es in gewaehltes Verzeichnis
-    *  Parameter
-    *   $ufile = upload-File-Array: name <input>-Felder 
-    * 	$fname = gewaehltes filenamen-Array
-    *   $id    = ID
-    *   $dir   = Verzeichnisname der Upload-Files
-    */
-
-        $errupl1 = null;
-        $errupl2 = null;
-        $errupl3 = null;
-        $ret = true;
-		// Test filesize, filetyp	
-        foreach ($_FILES[$ufile]['error'] as $key => $error) 
-        {
-            if ($error == UPLOAD_ERR_OK)
-            {
-                if ($_FILES[$ufile]['size'][$key] < 1) $errupl1 .= $_FILES[$ufile]['name'][$key].": File ist leer! ";
-        		if ($_FILES[$ufile]['size'][$key] > 32000000) $errupl1 .= $_FILES[$ufile]['name'][$key].": File > 32MByte! ";
-        //		list($first,$rest) = explode(".",$_FILES[$ufile]["name"]);
-        		$filep = explode(".",$_FILES[$ufile]['name'][$key]);
-        		$anz    = count($filep);
-              	$typ   = $filep[$anz-1];
-        		if (substr($typ,0,2)=="ph" || substr($typ,0,2)=="pl" || substr($typ,0,2)=="cg" || substr($typ,0,2)=="ex") $errupl2 .="$ufile: falscher Filetyp! ";
-        //echo "filesize=" . $_FILES[$ufile]["size"] . "<br>\n";
-        		if (!$errupl1 && !$errupl2)
-        		{
-        			// File laden
-        			$filename = basename(addslashes($_FILES[$ufile]['name'][$key]));				
-        			$tempname = $_FILES[$ufile]['tmp_name'][$key];
-//echo "key = $key, fname = ".$fname[$key].", filename = $filename, uploadname = " . $_FILES[$ufile]['name'][$key] ."<br />";
-        			if ($fname[$key])
-                    {
-                          $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$fname[$key]);
-                    }
-                    else    
-                        $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$filename);
-        
-        			if ($ret)
-        			{		
-                        if ($fname[$key]) $fnam=$id."_".$fname[$key]; else $fnam = $id."_".$filename;
-           				echo "<p class=\"green\">Upload von '$filename' erfolgreich.<br>
-                            gespeicherter Dateiname: '". $fnam ."'</p>\n";
-        				$ret = $ret && true;
-        			}
-        			else
-        			{
-        				echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"][$key]."' fehlgeschlagen.</p>\n";
-        				$ret = $ret && false;
-        			}	
-        		}
-        		else
-        		{
-                    $errupl3 = "Fehler upload: ".$_FILES[$ufile]["error"][$key];
-        			echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"][$key]."' nicht m&ouml;glich!<br>$errupl1<br>$errupl2<br>$errupl3</p>\n";			
-        			echo "<p>Upload bitte wiederholen</p>\n";
-        			$ret = $ret && false;
-        		}
-            }
-        $errupl1 = null;
-        $errupl2 = null;
-        $errupl3 = null;
-        }
-        return $ret;	
-}
-
-function gen_filename($nfile, $ufile, $id, $upload=1)
-{
-   /** generiert Filenamen aus Eingabefilenamen und Uploadfilenamen
-    *  wenn upload<>1, dann aus neuem Dateinamen+alten (wenn nicht angegeben:Typ)
-    * Parameter
-    *    $nfile  -   vorgegebener Name durch Nutzer
-    *    $ufile  -   Name aus Upload-Feld Formular, bzw. alter Filename
-    *    $id     -   ID
-    */
-
-    if ($nfile > '!')
-    {
-        $su = array("ä","ö","ü","ß","Ä","Ö","Ü");
-        $er = array("ae","oe","ue","ss","Ae","Oe","Ue");
-    
-        switch ($id) 
-        {
-            case ($id < 10):
-                $len = 2;
-                break;
-            case ($id < 100):
-                $len = 3;
-                break;
-            case ($id < 1000):
-                $len = 4;
-                break;
-        }
-//            echo "cid, len : $cid, $len<br><br>\n";          
-		// Dokument-Typ aus Dateibezeichnung bzw. Uploadfile, wenn nicht angegeben
-		$filea = explode(".",$nfile);
-		$anz    = count($filea);
-      	if ($anz>1) // File-Typ im Eingabenamen angegeben
-        {   
-            $typ = $filea[$anz-1]; 
-            for ($i=0; $i<$anz-1; $i++)
-            {
-                $fname .= "." . $filea[$i];
-            }
-        }
-        else // File-Typ aus Uploadfile
-        {
-            if ($upload)
-                $filep = explode(".",$_FILES[$ufile]['name']);
-            else
-                $filep = explode(".",$ufile);
-            $anz    = count($filep);
-            if ($anz>1) $typ = $filep[$anz-1]; else $typ = "pdf";
-            $fname = $nfile;
-        }
-        // ev. vorhandene gaengige Umlaute ersetzen
-        $fname = str_replace($su,$er,$fname);
-        
-        if (strlen($typ) < 3) $typ="pdf";
-        if (substr($fname,0,1) == ".")
-            $fname = substr($fname,1,50-(4+$len)) . "." .$typ;
-        else
-            $fname = substr($fname,0,50-(4+$len)) . "." .$typ;
-        if (substr($fname,0,$len) == "$id" . "_") $fname = substr($fname,$len,50);
-     }
-     else $fname = "";       
-     return $fname;
-}
-
-function mod_file($path,$id,$fname_new,$mod,$fname_old="")
-{
-   /** Loeschen, Aendern des Namens von Vetragsdokumenten
-    * Parameter 
-    *    $path       -   Pfad zur Datei
-    *    $id         -   ID des zu bearbeiteten Files, beginnt mit 'ID_'
-    *    $fname_new  -   neuer Filename
-    *    $mod        -   del = Loeschen
-    *                    upd = Umbenennen
-    *    $fname_old  -   alter Filename
-    */
-    
-    if ($fname_old == "") $fname_old = exec("ls ".$path." | grep '". $id . "_'");
-    if ($fname_old)
-    {
-        if (file_exists($path."/".$fname_old))
-        {
-            chmod($path."/".$fname_old,0644);
-            if ($mod == "del")
-            {
-                return unlink($path."/".$fname_old);
-            }
-            elseif ($mod == "upd" && $fname_new>"!")
-            {
-                return rename($path."/".$fname_old, $path."/".$fname_new);           
-            }
-        }
-        else return true;
-    }
-    else return false;    
-}
-// Test Aufruf
-/*
-    if (mod_file("/var/www/fhiiqm/documents","20","","del"))
-        echo "Erfolg!\n";
-    else
-        echo "Misserfolg\n";
-*/
-
+<?php
+
+/**
+ * @author B.Schwarzer, Fritz-Haber-Institut
+ * @copyright 05/2011
+ */
+
+function upload($ufile, $fname, $id, $dir="documents")
+{
+   /**
+    * prueft Uploadfile und verschiebt es in gewaehltes Verzeichnis
+    *  Parameter
+    *   $ufile = upload-File: name <input>-Feld 
+    * 	$fname = gewaehlter filename
+    *   $id    = ID
+    *   $dir   = Verzeichnisname der Upload-Files
+    */
+
+        $errupl1 = null;
+        $errupl2 = null;
+        $errupl3 = null;
+		// Test filesize, filetyp	
+		if ($_FILES[$ufile]["size"] < 1) $errupl1 .= "$ufile: File ist leer! ";
+		if ($_FILES[$ufile]["size"] > 32000000) $errupl1 .= "$ufile: File > 32MByte! ";
+//		list($first,$rest) = explode(".",$_FILES[$ufile]["name"]);
+		$filep = explode(".",$_FILES[$ufile]["name"]);
+		$anz    = count($filep);
+      	$typ   = $filep[$anz-1];
+		if (substr($typ,0,2)=="ph" || substr($typ,0,2)=="pl" || substr($typ,0,2)=="cg" || substr($typ,0,2)=="ex") $errupl2 .="$ufile: falscher Filetyp! ";
+//echo "filesize=" . $_FILES[$ufile]["size"] . "<br>\n";
+		if ($_FILES[$ufile]["error"] > 0) $errupl3 = "Fehler upload: ".$_FILES[$ufile]["error"];
+		if (!$errupl1 && !$errupl2 && !$errupl3)
+		{
+			// File laden
+			$filetyp = $_FILES[$ufile]['type'];
+			$filesize = $_FILES[$ufile]['size'];
+			$filename = basename(addslashes($_FILES[$ufile]["name"]));				
+			$tempname = $_FILES[$ufile]['tmp_name'];
+			if ($fname)
+            {
+                  $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$fname);
+            }
+            else    
+                $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$filename);
+
+			if ($ret)
+			{		
+	//				echo "Error upload: ". $_FILES['pfile']['error'] .", $tempname<br>\n";
+                if ($fname) $fname=$id."_".$fname; else $fname = $id."_".$filename;
+   				echo "<p class=\"green\">Upload von '" . $_FILES[$ufile]["name"]."' erfolgreich.<br>
+                    gespeicherter Dateiname: '". $fname ."'</p>\n";
+				return true;
+			}
+			else
+			{
+				echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"]."' fehlgeschlagen.</p>\n";
+				return false;
+			}	
+		}
+		else
+		{
+			echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"]."' nicht m&ouml;glich!<br>$errupl1<br>$errupl2<br>$errupl3</p>\n";			
+			echo "<p>Upload bitte wiederholen</p>\n";
+			return false;
+		}	
+}
+
+function upload_multif($ufile, $fname, $id, $dir="documents")
+{
+   /**
+    * prueft Uploadfile und verschiebt es in gewaehltes Verzeichnis
+    *  Parameter
+    *   $ufile = upload-File-Array: name <input>-Felder 
+    * 	$fname = gewaehltes filenamen-Array
+    *   $id    = ID
+    *   $dir   = Verzeichnisname der Upload-Files
+    */
+
+        $errupl1 = null;
+        $errupl2 = null;
+        $errupl3 = null;
+        $ret = true;
+		// Test filesize, filetyp	
+        foreach ($_FILES[$ufile]['error'] as $key => $error) 
+        {
+            if ($error == UPLOAD_ERR_OK)
+            {
+                if ($_FILES[$ufile]['size'][$key] < 1) $errupl1 .= $_FILES[$ufile]['name'][$key].": File ist leer! ";
+        		if ($_FILES[$ufile]['size'][$key] > 32000000) $errupl1 .= $_FILES[$ufile]['name'][$key].": File > 32MByte! ";
+        //		list($first,$rest) = explode(".",$_FILES[$ufile]["name"]);
+        		$filep = explode(".",$_FILES[$ufile]['name'][$key]);
+        		$anz    = count($filep);
+              	$typ   = $filep[$anz-1];
+        		if (substr($typ,0,2)=="ph" || substr($typ,0,2)=="pl" || substr($typ,0,2)=="cg" || substr($typ,0,2)=="ex") $errupl2 .="$ufile: falscher Filetyp! ";
+        //echo "filesize=" . $_FILES[$ufile]["size"] . "<br>\n";
+        		if (!$errupl1 && !$errupl2)
+        		{
+        			// File laden
+        			$filename = basename(addslashes($_FILES[$ufile]['name'][$key]));				
+        			$tempname = $_FILES[$ufile]['tmp_name'][$key];
+//echo "key = $key, fname = ".$fname[$key].", filename = $filename, uploadname = " . $_FILES[$ufile]['name'][$key] ."<br />";
+        			if ($fname[$key])
+                    {
+                          $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$fname[$key]);
+                    }
+                    else    
+                        $ret = move_uploaded_file ( $tempname, $dir."/".$id."_".$filename);
+        
+        			if ($ret)
+        			{		
+                        if ($fname[$key]) $fnam=$id."_".$fname[$key]; else $fnam = $id."_".$filename;
+           				echo "<p class=\"green\">Upload von '$filename' erfolgreich.<br>
+                            gespeicherter Dateiname: '". $fnam ."'</p>\n";
+        				$ret = $ret && true;
+        			}
+        			else
+        			{
+        				echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"][$key]."' fehlgeschlagen.</p>\n";
+        				$ret = $ret && false;
+        			}	
+        		}
+        		else
+        		{
+                    $errupl3 = "Fehler upload: ".$_FILES[$ufile]["error"][$key];
+        			echo "<p class=\"red\">Upload von '" . $_FILES[$ufile]["name"][$key]."' nicht m&ouml;glich!<br>$errupl1<br>$errupl2<br>$errupl3</p>\n";			
+        			echo "<p>Upload bitte wiederholen</p>\n";
+        			$ret = $ret && false;
+        		}
+            }
+        $errupl1 = null;
+        $errupl2 = null;
+        $errupl3 = null;
+        }
+        return $ret;	
+}
+
+function gen_filename($nfile, $ufile, $id, $upload=1)
+{
+   /** generiert Filenamen aus Eingabefilenamen und Uploadfilenamen
+    *  wenn upload<>1, dann aus neuem Dateinamen+alten (wenn nicht angegeben:Typ)
+    * Parameter
+    *    $nfile  -   vorgegebener Name durch Nutzer
+    *    $ufile  -   Name aus Upload-Feld Formular, bzw. alter Filename
+    *    $id     -   ID
+    */
+
+    if ($nfile > '!')
+    {
+        $su = array("ä","ö","ü","ß","Ä","Ö","Ü");
+        $er = array("ae","oe","ue","ss","Ae","Oe","Ue");
+    
+        switch ($id) 
+        {
+            case ($id < 10):
+                $len = 2;
+                break;
+            case ($id < 100):
+                $len = 3;
+                break;
+            case ($id < 1000):
+                $len = 4;
+                break;
+        }
+//            echo "cid, len : $cid, $len<br><br>\n";          
+		// Dokument-Typ aus Dateibezeichnung bzw. Uploadfile, wenn nicht angegeben
+		$filea = explode(".",$nfile);
+		$anz    = count($filea);
+      	if ($anz>1) // File-Typ im Eingabenamen angegeben
+        {   
+            $typ = $filea[$anz-1]; 
+            for ($i=0; $i<$anz-1; $i++)
+            {
+                $fname .= "." . $filea[$i];
+            }
+        }
+        else // File-Typ aus Uploadfile
+        {
+            if ($upload)
+                $filep = explode(".",$_FILES[$ufile]['name']);
+            else
+                $filep = explode(".",$ufile);
+            $anz    = count($filep);
+            if ($anz>1) $typ = $filep[$anz-1]; else $typ = "pdf";
+            $fname = $nfile;
+        }
+        // ev. vorhandene gaengige Umlaute ersetzen
+        $fname = str_replace($su,$er,$fname);
+        
+        if (strlen($typ) < 3) $typ="pdf";
+        if (substr($fname,0,1) == ".")
+            $fname = substr($fname,1,50-(4+$len)) . "." .$typ;
+        else
+            $fname = substr($fname,0,50-(4+$len)) . "." .$typ;
+        if (substr($fname,0,$len) == "$id" . "_") $fname = substr($fname,$len,50);
+     }
+     else $fname = "";       
+     return $fname;
+}
+
+function mod_file($path,$id,$fname_new,$mod,$fname_old="")
+{
+   /** Loeschen, Aendern des Namens von Vetragsdokumenten
+    * Parameter 
+    *    $path       -   Pfad zur Datei
+    *    $id         -   ID des zu bearbeiteten Files, beginnt mit 'ID_'
+    *    $fname_new  -   neuer Filename
+    *    $mod        -   del = Loeschen
+    *                    upd = Umbenennen
+    *    $fname_old  -   alter Filename
+    */
+    
+    if ($fname_old == "") $fname_old = exec("ls ".$path." | grep '". $id . "_'");
+    if ($fname_old)
+    {
+        if (file_exists($path."/".$fname_old))
+        {
+            chmod($path."/".$fname_old,0644);
+            if ($mod == "del")
+            {
+                return unlink($path."/".$fname_old);
+            }
+            elseif ($mod == "upd" && $fname_new>"!")
+            {
+                return rename($path."/".$fname_old, $path."/".$fname_new);           
+            }
+        }
+        else return true;
+    }
+    else return true;    
+}
+// Test Aufruf
+/*
+    if (mod_file("/var/www/fhiiqm/documents","20","","del"))
+        echo "Erfolg!\n";
+    else
+        echo "Misserfolg\n";
+*/
+
 ?>
\ No newline at end of file
--- a/fhiiqm/inc/func_lib.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/func_lib.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -600,7 +600,7 @@
             $base="ou=people,dc=ppb,dc=rz-berlin,dc=mpg,dc=de";
             $su = array("ä","ö","ü","ß","Ä","Ö","Ü");
             $rp = array("ae","oe","ue","ss","Ae","Oe","Ue");
-            $afields = array ("uid","cn","mail");
+            $afields = array ("uid","cn","mail","sn");
             $gnr = str_replace($su,$rp,$gn);
             $snr = str_replace($su,$rp,$sn); 
             $gnu = utf8_encode($gn);
@@ -643,6 +643,7 @@
                     $inf[$i][0] = $info[$i]["uid"][0];
                     $inf[$i][1] = $info[$i]["cn"][0];
                     $inf[$i][2] = $info[$i]["mail"][0];
+                    $inf[$i][3] = $info[$i]["sn"][0];
                 }    
             }
 //            echo "&nbsp;&nbsp;&nbsp;$filter<br />";
--- a/fhiiqm/inc/ma_list_ac.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/ma_list_ac.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -33,7 +33,8 @@
     if (isset($abt) && $abt == "a") $ord = "abt_ID, "; else $ord = "";
     if (isset($gast) && $gast) $aktiv = ""; else $aktiv = "aktiv>=0 AND ";    
     $sql = "SELECT CONCAT (nachname, IF (vorname>'',CONCAT(', ',vorname), ''), ', ' , IFNULL(abt_name,''),' (',CASE aktiv WHEN 1 THEN 'aktiv' ELSE (CASE aktiv WHEN -1 THEN 'Gast' ELSE 'inaktiv' END) END, ')') as label, 
-            CONCAT (nachname, IF (vorname>'',CONCAT(', ',vorname), ''), ', ' , IFNULL(abt_name,''), ' (',CASE aktiv WHEN 1 THEN 'aktiv' ELSE (CASE aktiv WHEN -1 THEN 'Gast' ELSE 'inaktiv' END) END, ')') as val,persknr as id 
+            CONCAT (nachname, IF (vorname>'',CONCAT(', ',vorname), ''), ', ' , IFNULL(abt_name,''), ' (',CASE aktiv WHEN 1 THEN 'aktiv' ELSE (CASE aktiv WHEN -1 THEN 'Gast' ELSE 'inaktiv' END) END, ')') as val,
+            persknr as id, nachname as sn, vorname as gn 
             FROM fhiiqm.Mitarbeiter m LEFT OUTER JOIN fhiiqm.Abteilung a ON m.abt_tel=a.abt_ID
             WHERE $aktiv aktiv<2 AND nachname LIKE '%".$q."%' COLLATE latin1_general_ci 
             ORDER BY ". $ord ."1";
@@ -42,7 +43,7 @@
     {
         foreach ($result as $row)
         {
- 			$clist[] = "{\"label\": \"" . $row->label . "\",\"value\": \"" . $row->val . "\",\"id\": " . $row->id . "}";
+ 			$clist[] = "{\"label\": \"" . $row->label . "\",\"value\": \"" . $row->val . "\",\"id\": " . $row->id . ",\"sn\": \"" . $row->sn . "\",\"gn\": \"" . $row->gn ."\"}";
 		}
         echo "[" . implode(", ", $clist) . "]"; // Format, das jquery source erwartet
     }
--- a/fhiiqm/inc/menu.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/menu.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -237,6 +237,10 @@
           if (in_array("pe",$_SESSION["recht"]))
             		echo "<li><a href=\"/fhiiqm/produkt_ins.php\" target=\"_blank\" title=\"Produkt erfassen\">Produkt erfassen</a></li>\n";
           if (in_array("rtr",$_SESSION["recht"]) || in_array("rte",$_SESSION["recht"]))
+            		echo "<li><a href=\"/fhiiqm/rag_flist.php\" target=\"_blank\" title=\"AGListe\">Arbeitsgruppen sortieren, filtern, bearbeiten</a></li>\n";
+          if (in_array("rte",$_SESSION["recht"]))
+            		echo "<li><a href=\"/fhiiqm/rag_ed.php\" target=\"_blank\" title=\"Rechte\">Arbeitsgruppe erfassen</a></li>\n";
+          if (in_array("rtr",$_SESSION["recht"]) || in_array("rte",$_SESSION["recht"]))
             		echo "<li><a href=\"/fhiiqm/recht_list.php\" target=\"_blank\" title=\"Nutzerliste\">Nutzer - Rechte bearbeiten</a></li>\n";
           if (in_array("rte",$_SESSION["recht"]))
             		echo "<li><a href=\"/fhiiqm/recht_ed.php\" target=\"_blank\" title=\"Rechte\">Rechteverwaltung neuer Nutzer</a></li>\n";
--- a/fhiiqm/inc/pdf_ma_tel.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/pdf_ma_tel.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,453 +1,455 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 11/2012
- * 
- * Klasse PDF zur Telefonliste
- */
-
-    include ($_SERVER['DOCUMENT_ROOT']."/fhiiqm/tool/fpdf.php");
-    class PDF extends FPDF
-    {
-        var $y0, $y, $xa, $width, $height;
-//        var $wid = array(55,25,40,15,40); // Breite: Spalten 'new'
-        var $wid = array(65,15,40,15,40); // Breite: Spalten 'new'
-        var $fancy = 1;
-        var $anzcol = 2;
-        var $col = 0;
-        //Author Patrick Benny: Fit text to cell (http://www.fpdf.org)
-        //*********************************************************************
-        //Cell with horizontal scaling if text is too wide
-        function CellFit($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $scale=false, $force=true)
-        {
-            //Get string width
-            $str_width=$this->GetStringWidth($txt);
-            // Division by 0 avoid, 21.11.2012, bs
-            if ($str_width == 0) $str_width = 0.1;
-    
-            //Calculate ratio to fit cell
-            if($w==0)
-                $w = $this->w-$this->rMargin-$this->x;
-            $ratio = ($w-$this->cMargin*2)/$str_width;
-    
-            $fit = ($ratio < 1 || ($ratio > 1 && $force));
-            if ($fit)
-            {
-                if ($scale)
-                {
-                    //Calculate horizontal scaling
-                    $horiz_scale=$ratio*100.0;
-                    //Set horizontal scaling
-                    $this->_out(sprintf('BT %.2F Tz ET',$horiz_scale));
-                }
-                else
-                {
-                    //Calculate character spacing in points
-                    $char_space=($w-$this->cMargin*2-$str_width)/max($this->MBGetStringLength($txt)-1,1)*$this->k;
-                    //Set character spacing
-                    $this->_out(sprintf('BT %.2F Tc ET',$char_space));
-                }
-                //Override user alignment (since text will fill up cell)
-                $align='';
-            }
-    
-            //Pass on to Cell method
-            $this->Cell($w,$h,$txt,$border,$ln,$align,$fill,$link);
-    
-            //Reset character spacing/horizontal scaling
-            if ($fit)
-                $this->_out('BT '.($scale ? '100 Tz' : '0 Tc').' ET');
-        }
-    
-        //Cell with horizontal scaling only if necessary
-        function CellFitScale($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
-        {
-            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,true,false);
-        }
-    
-        //Cell with horizontal scaling always
-        function CellFitScaleForce($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
-        {
-            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,true,true);
-        }
-    
-        //Cell with character spacing only if necessary
-        function CellFitSpace($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
-        {
-            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,false,false);
-        }
-    
-        //Cell with character spacing always
-        function CellFitSpaceForce($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
-        {
-            //Same as calling CellFit directly
-            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,false,true);
-        }
-    
-        //Patch to also work with CJK double-byte text
-        function MBGetStringLength($s)
-        {
-            if($this->CurrentFont['type']=='Type0')
-            {
-                $len = 0;
-                $nbbytes = strlen($s);
-                for ($i = 0; $i < $nbbytes; $i++)
-                {
-                    if (ord($s[$i])<128)
-                        $len++;
-                    else
-                    {
-                        $len++;
-                        $i++;
-                    }
-                }
-                return $len;
-            }
-            else
-                return strlen($s);
-        }
-        //*********************************************************************
-        
-        //Kopfzeile
-        function Header()
-        {
-            global $header;
-            //$this->Cell(20);
-            //Titel
-            //Arial fett 15
-            $this->SetFont('helvetica','BI',11);
-            $this->Cell(55,10,'Fritz-Haber-Institut',0,0,'L');
-            $this->SetFont('helvetica','B',11);
-            $this->Cell(40,10,'Telefonverzeichnis',0,0,'L');
-            if ($this->fancy && !$this->anzcol)
-            {
-                $this->SetTextColor(255,0,0);
-                $this->Cell(0,10,'(intern)',0,0,'L');
-            }
-            else
-                $this->Cell(0,10,' ',0,0,'L');
-            //Logo
-            $this->Image($_SERVER['DOCUMENT_ROOT']."/fhiiqm/img/fhilogotransp.png",170,8,25);
-            //Zeilenumbruch
-            $this->Ln(16);
-            if ($this->fancy)
-            {
-                //Colors, line width and bold font
-                $this->SetFont('helvetica','',8);
-                $this->SetFillColor(104,172,191);
-                $this->SetTextColor(0,0,102);
-                $this->SetDrawColor(255,255,255);
-                $this->SetLineWidth(.0);
-                $this->SetFont('','B');
-                //Tabellen-Header immer im Kopf
-//                $w=array(55,40,30,15,40);
-                for($i=0;$i<count($header);$i++)
-                    $this->Cell($this->wid[$i],5,$header[$i],1,0,'L',1);
-                $this->Ln();
-            }
-        }
-        
-        //Fusszeile
-        function Footer()
-        {
-            //Position 1,5 cm von unten
-            $this->SetY(-15);
-            //Arial kursiv 8
-            $this->SetFont('Arial','I',8);
-            //Datum der Liste
-            $heute = new DateTime();
-            $this->Cell(0,10,$heute->format('d.m.Y H:i:s'),0,0,'L');
-            //Seitenzahl
-            $this->Cell(0,10,'Seite '.$this->PageNo().'/{nb}',0,0,'R');
-        }
-        //Colored table
-        function FancyTable($header,$data)
-        {
-
-            //Colors, line width and bold font
-            $this->SetFillColor(104,172,191);
-            $this->SetTextColor(0,0,102);
-            $this->SetDrawColor(255,255,255);
-            $this->SetLineWidth(.0);
-            $this->SetFont('','B');
-
-            //Header notwendig fuer Tabelle, Hoehe = 0!
-//            $w=array(55,40,30,15,40); // Breite der Zellen
-            for($i=0;$i<count($header);$i++)
-                $this->Cell($this->wid[$i],0,'',1,0,'L',1);
-            $this->Ln();
-            //Color and font restoration
-//            $this->SetFillColor(222,222,222);
-            $this->SetFillColor(249,249,249);
-            $this->SetTextColor(0);
-            $this->SetFont('');
-            //Data
-            $fill=0;
-            $height = 4;
-            $fill = !$fill;
-//            $breite = ($pdf->w - $pdf->lMargin - $pdf->rMargin) / 3;
-            foreach($data as $row)
-            {
-    			if ($row->persknr != $vpnr)
-                {
-                    $fill=!$fill;
-                    if (substr($row->name,0,1) != $vfirst)
-                    { 
-                        $this->SetFont('','B',9);
-                        $kap = strtoupper(substr($row->name,0,1));
-//                        $this->Ln(5); //$this->AddPage();
-                        $this->CellFitScale(175,$height,$kap,0,0,'L',$fill);                    
-                        $this->Ln();
-                        $this->SetFont('','',8);
-                    }
-                    $titel = ($row->titel)? ", $row->titel" : "" ;
-                    $vname = ($row->vorname)? ", $row->vorname" : "";
-                    $name = $row->name . $titel . $vname;
-                    $this->CellFitScale($this->wid[0],$height,$name,0,0,'L',$fill);
-                    $this->CellFitScale($this->wid[1],$height,$row->abt_name,'LR',0,'L',$fill);
-                    if ($row->telefon_typ == "fax") $typ = " FAX"; else $typ = "";
-                    if (!$row->public) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
-                    $this->CellFitScale($this->wid[2],$height,$row->telefon_nr.$typ,'LR',0,'L',$fill);
-                    $this->SetTextColor(0);
-                    $this->CellFitScale($this->wid[3],$height,$row->geb_ID . " " . $row->raum_nr,'LR',0,'L',$fill);
-                    $this->CellFitScale($this->wid[4],$height,$row->email,'LR',0,'L',$fill);
-                    $this->Ln();
-                }
-                else
-                {
-                    $this->Cell($this->wid[0],$height,'','LR',0,'L',$fill);
-                    if ($vabt != $row->abt_name) $abt = $row->abt_name;
-                    else $abt = '';    
-                    $this->CellFitScale($this->wid[1],$height,$abt,'LR',0,'L',$fill);
-                    if ($row->telefon_typ == "fax") $typ = " FAX"; else $typ = "";
-                    if (!$row->public) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
-                    $this->CellFitScale($this->wid[2],$height,$row->telefon_nr.$typ,'LR',0,'L',$fill);
-                    $this->SetTextColor(0);
-                    $this->CellFitScale($this->wid[3],$height,'','LR',0,'L',$fill);
-                    $this->Cell($this->wid[4],$height,'','LR',0,'L',$fill);
-                    $this->Ln();
-                    
-                }
-                $vpnr = $row->persknr;
-                $vabt = $row->abt_name;
-                $vfirst = substr($row->name,0,1);
-            }
-        }
-        function FancyTableOldMySQL($header,$data)
-        {
-
-            //Colors, line width and bold font
-            $this->SetFillColor(104,172,191);
-            $this->SetTextColor(0,0,102);
-            $this->SetDrawColor(255,255,255);
-            $this->SetLineWidth(.0);
-            $this->SetFont('','B');
-
-            //Header notwendig fuer Tabelle, Hoehe = 0!
-            $w=array(55,40,30,15,40);
-            for($i=0;$i<count($header);$i++)
-                $this->Cell($w[$i],0,'',1,0,'L',1);
-            $this->Ln();
-            //Color and font restoration
-//            $this->SetFillColor(222,222,222);
-            $this->SetFillColor(238,238,238);
-            $this->SetTextColor(0);
-            $this->SetFont('');
-            //Data
-            $fill=0;
-            $fill = !$fill;
-            while ($row = mysql_fetch_assoc($data)) 
-            {
-    			if ($row["persknr"] != $vpnr)
-                {
-                    $fill=!$fill;
-                    $titel = ($row["titel"])? ", ".$row["titel"]  : "" ;
-                    $vname = ($row["vorname"])? ",". $row["vorname"] : "";
-                    $name = $row["name"] . $titel . $vname;
-                    $this->CellFitScale($w[0],4.5,$name,0,0,'L',$fill);
-                    $this->CellFitScale($w[1],4.5,$row["abt_name"],'LR',0,'L',$fill);
-                    if ($row["telefon_typ"] == "fax") $typ = " FAX"; else $typ = "";
-                    if (!$row["public"]) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
-                    $this->CellFitScale($w[2],4.5,$row["telefon_nr"].$typ,'LR',0,'L',$fill);
-                    $this->SetTextColor(0);
-                    $this->CellFitScale($w[3],4.5,$row["geb_ID"] . " " . $row["raum_nr"],'LR',0,'L',$fill);
-                    $this->CellFitScale($w[4],4.5,$row["email"],'LR',0,'L',$fill);
-                    $this->Ln();
-                }
-                else
-                {
-                    $newline = 0;
-                    $this->Cell($w[0],4.5,'','LR',0,'L',$fill);
-                    if ($vabt != $row["abt_name"]) $abt = $row["abt_name"];
-                    else $abt = '';    
-                    $this->CellFitScale($w[1],4.5,$abt,'LR',0,'L',$fill);
-                    if ($row["telefon_typ"] == "fax") $typ = " FAX"; else $typ = "";
-                    if (!$row["public"]) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
-                    $this->CellFitScale($w[2],4.5,$row["telefon_nr"].$typ,'LR',0,'L',$fill);
-                    $this->SetTextColor(0);
-                    $this->CellFitScale($w[3],4.5,$row["geb_ID"] . " " . $row["raum_nr"],'LR',0,'L',$fill);
-                    $this->Cell($w[4],4.5,'','LR',0,'L',$fill);
-                    $this->Ln();
-                    
-                }
-                $vpnr = $row["persknr"];
-                $vabt = $row["abt_name"];
-            }
-        }
-        function Normal($data)
-        {
-            $this->fancy = 1;
-            $w = array(55,40,35,40);
-            $this->SetFillColor(249,249,249);
-            $fill = 0;
-            $fill = !$fill;
-            foreach ($data as $row)
-            { 
-    			if ($row->persknr != $vpnr)
-                {
-                    if ($vpnr)
-                    {
-                        // ausgeben vorheriges Objekt
-                        $tel = implode(", ",$atel); 
-                        $this->SetFont('times','',9);
-                        $this->CellFitScale($w[0],$this->height,$name,0,0,'L',$fill);                    
-                        $this->CellFitScale($w[1],$this->height,$tel,0,0,'L',$fill);                    
-                        $this->CellFitScale($w[2],$this->height,$abtort,0,0,'L',$fill);                    
-                        $this->CellFitScale($w[3],$this->height,$mail,0,0,'L',$fill);
-                        $this->Ln();
-                    }                    
-
-                    $fill=!$fill;
-                    if (substr($row->name,0,1) != $vfirst)
-                    { 
-                        $this->SetFont('','B',11);
-                        $kap = strtoupper(substr($row->name,0,1));
-                        $this->CellFitScale(170,$this->height,$kap,0,0,'L',$fill);                    
-                        $this->Ln();
-                        $this->SetFont('','',9);
-                    }
-                    $atel = array();
-                    $titel = ($row->titel)? ", ".$row->titel  : "" ;
-                    $vname = ($row->vorname)? " ". $row->vorname : "";
-                    $name = $row->name . $titel . $vname;
-                    $raum = ($row->raum_nr)? ", ".$row->raum_nr : "";
-                    $abtort = $row->abt_name . "   " . $row->geb_ID . $raum;
-                    $mail = $row->email;
-                    $fax =($row->telefon_typ == 'fax')? " FAX" : "";
-                    $atel[] = $row->telefon_nr . $fax;
-                }
-                else
-                {            
-                    $fax =($row->telefon_typ == 'fax')? " FAX" : "";
-                    $atel[] = $row->telefon_nr . $fax;
-                }
-                $vfirst = substr($row->name,0,1);
-                $vpnr = $row->persknr;
-            }
-            // ausgeben letztes Objekt
-            $tel = implode(";",$atel); 
-            $this->SetFont('times','',9);
-            $this->CellFitScale($w[0],$this->height,$name,0,0,'L',$fill);                    
-            $this->CellFitScale($w[1],$this->height,$tel,0,0,'L',$fill);                    
-            $this->CellFitScale($w[2],$this->height,$abtort,0,0,'L',$fill);                    
-            $this->CellFitScale($w[3],$this->height,$mail,0,0,'L',$fill);                    
-       }
-
-// mehrere Spalten        
-        function SetCol($col,$width)
-        {
-            // Move position to a column
-            $this->col = $col;
-            $this->width = $width;
-//                echo "1x = " . $this->GetX() . ", col = $this->col" . ", width = $this->width<br />\n";
-            if ($this->xa <= $this->lMargin || ($this->anzcol == 3 && $this->xa <= $this->lMargin + $this->width + 5*$this->col))
-                $this->xa = $this->lMargin + 5*$this->col + ($this->col*$this->width);
-            else $this->xa = $this->lMargin;
-//            $this->SetLeftMargin(25);
-            $this->SetX($this->xa);
-//                echo "2x = " . $this->GetX() . ", col = $this->col" . ", width = $this->width<br />\n";
-        }
-        
-        function AcceptPageBreak()
-        {
-            if (!$this->fancy) // nur bei mehrspaltiger Darstellung
-            {
-                if ($this->GetY()+$this->height > $this->PageBreakTrigger)
-                    if($this->col < $this->anzcol-1)
-                    {
-                        // Go to next column
-                        $this->SetCol($this->col+1,$this->width);
-                        $this->SetY($this->y0);
-                        $this->y = $this->y0;
-    //                echo "apb_x = " . $this->GetX() . ", col = $this->col" . ", width = $this->width<br />\n";
-                        return false;
-                    }
-                    else
-                    {
-                        // Go back to first column and issue page break
-                        $this->AddPage($this->CurOrientation);
-                        $this->SetCol(0,$this->width);
-                        $this->SetY($this->y0);
-                        $this->y = $this->y0;
-                        return true;
-                    }
-                else
-                    return false;
-            }
-            else
-	           return $this->AutoPageBreak;
-        }
-
-        function Small($data,$colwidth,$height)
-        {
-            $this->fancy = 0;
-            $this->y0 = $this->GetY();
-            $this->y = $this->y0;
-            $this->width = $colwidth;
-            $this->height = $height;
-            $this->SetFillColor(249,249,249);
-            $fill = 0;
-            $fill = !$fill;
-            foreach ($data as $row)
-            { 
-//                echo "3x = " . $this->GetX() . ", y = " . $this->GetY() . ", width = $colwidth<br />\n";
-                $fill=!$fill;
-                if (substr($row->name,0,1) != $vfirst)
-                { 
-                    $this->SetFont('','B',11);
-                    $kap = strtoupper(substr($row->name,0,1));
-                    $this->SetX($this->xa);
-                    $this->CellFitScale($colwidth,$height,$kap,0,0,'L',$fill);                    
-                    $this->y = $this->y+$height;
-                    $this->SetY($this->y);                    
-                    $this->AcceptPageBreak();
-                }
-                $zeil1 = $row->name . ", " . $row->titel . " " . $row->vorname . " ";
-                $zeil2 = $row->abt_name . "   " . $row->geb_ID. " ". $row->raum_nr;
-                $zeil3 = $row->telefon_nr;
-                $this->SetFont('times','',9);
-                $this->SetX($this->xa);
-                if ($this->anzcol == 2)
-                    $this->CellFitScale($colwidth/2,$height,$zeil1,0,0,'L',$fill);
-                else                    
-                    $this->CellFitScale($colwidth*0.75,$height,$zeil1,0,0,'L',$fill);
-                if ($this->anzcol == 2)
-                {
-                    $this->SetFont('','',8);
-                    $this->CellFitScale($colwidth/4,$height,$zeil2,0,0,'L',$fill); 
-                }                   
-                $this->SetFont('','',9);
-                $this->CellFitScale($colwidth/4,$height,$zeil3,0,0,'R',$fill);
-                $this->y = $this->y+$height;
-                $this->SetY($this->y);                    
-            
-                $vfirst = substr($row->name,0,1);
-                $this->AcceptPageBreak();
-//                echo "4x = " . $this->GetX() . ", y = " . $this->GetY() . ", width = $colwidth<br />\n";
-            }
-        }
-    }
-
-
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 11/2012
+ * 
+ * Klasse PDF zur Telefonliste
+ */
+
+    include ($_SERVER['DOCUMENT_ROOT']."/fhiiqm/tool/fpdf.php");
+    class PDF extends FPDF
+    {
+        var $y0, $y, $xa, $width, $height;
+//        var $wid = array(55,25,40,15,40); // Breite: Spalten 'new'
+        var $wid = array(65,15,40,15,40); // Breite: Spalten 'new'
+        var $fancy = 1;
+        var $anzcol = 2;
+        var $col = 0;
+        //Author Patrick Benny: Fit text to cell (http://www.fpdf.org)
+        //*********************************************************************
+        //Cell with horizontal scaling if text is too wide
+        function CellFit($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $scale=false, $force=true)
+        {
+            //Get string width
+            $str_width=$this->GetStringWidth($txt);
+            // Division by 0 avoid, 21.11.2012, bs
+            if ($str_width == 0) $str_width = 0.1;
+    
+            //Calculate ratio to fit cell
+            if($w==0)
+                $w = $this->w-$this->rMargin-$this->x;
+            $ratio = ($w-$this->cMargin*2)/$str_width;
+    
+            $fit = ($ratio < 1 || ($ratio > 1 && $force));
+            if ($fit)
+            {
+                if ($scale)
+                {
+                    //Calculate horizontal scaling
+                    $horiz_scale=$ratio*100.0;
+                    //Set horizontal scaling
+                    $this->_out(sprintf('BT %.2F Tz ET',$horiz_scale));
+                }
+                else
+                {
+                    //Calculate character spacing in points
+                    $char_space=($w-$this->cMargin*2-$str_width)/max($this->MBGetStringLength($txt)-1,1)*$this->k;
+                    //Set character spacing
+                    $this->_out(sprintf('BT %.2F Tc ET',$char_space));
+                }
+                //Override user alignment (since text will fill up cell)
+                $align='';
+            }
+    
+            //Pass on to Cell method
+            $this->Cell($w,$h,$txt,$border,$ln,$align,$fill,$link);
+    
+            //Reset character spacing/horizontal scaling
+            if ($fit)
+                $this->_out('BT '.($scale ? '100 Tz' : '0 Tc').' ET');
+        }
+    
+        //Cell with horizontal scaling only if necessary
+        function CellFitScale($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
+        {
+            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,true,false);
+        }
+    
+        //Cell with horizontal scaling always
+        function CellFitScaleForce($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
+        {
+            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,true,true);
+        }
+    
+        //Cell with character spacing only if necessary
+        function CellFitSpace($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
+        {
+            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,false,false);
+        }
+    
+        //Cell with character spacing always
+        function CellFitSpaceForce($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
+        {
+            //Same as calling CellFit directly
+            $this->CellFit($w,$h,$txt,$border,$ln,$align,$fill,$link,false,true);
+        }
+    
+        //Patch to also work with CJK double-byte text
+        function MBGetStringLength($s)
+        {
+            if($this->CurrentFont['type']=='Type0')
+            {
+                $len = 0;
+                $nbbytes = strlen($s);
+                for ($i = 0; $i < $nbbytes; $i++)
+                {
+                    if (ord($s[$i])<128)
+                        $len++;
+                    else
+                    {
+                        $len++;
+                        $i++;
+                    }
+                }
+                return $len;
+            }
+            else
+                return strlen($s);
+        }
+        //*********************************************************************
+        
+        //Kopfzeile
+        function Header()
+        {
+            global $header;
+            //$this->Cell(20);
+            //Titel
+            //Arial fett 15
+            $this->SetFont('helvetica','BI',11);
+            $this->Cell(55,10,'Fritz-Haber-Institut',0,0,'L');
+            $this->SetFont('helvetica','B',11);
+            $this->Cell(40,10,'Telefonverzeichnis',0,0,'L');
+            if ($this->fancy && !$this->anzcol)
+            {
+                $this->SetTextColor(255,0,0);
+                $this->Cell(0,10,'(intern)',0,0,'L');
+            }
+            else
+                $this->Cell(0,10,' ',0,0,'L');
+            //Logo
+            $this->Image($_SERVER['DOCUMENT_ROOT']."/fhiiqm/img/fhilogotransp.png",170,8,25);
+            //Zeilenumbruch
+            $this->Ln(16);
+            if ($this->fancy)
+            {
+                //Colors, line width and bold font
+                $this->SetFont('helvetica','',8);
+                $this->SetFillColor(104,172,191);
+                $this->SetTextColor(0,0,102);
+                $this->SetDrawColor(255,255,255);
+                $this->SetLineWidth(.0);
+                $this->SetFont('','B');
+                //Tabellen-Header immer im Kopf
+//                $w=array(55,40,30,15,40);
+                for($i=0;$i<count($header);$i++)
+                    $this->Cell($this->wid[$i],5,$header[$i],1,0,'L',1);
+                $this->Ln();
+            }
+        }
+        
+        //Fusszeile
+        function Footer()
+        {
+            //Position 1,5 cm von unten
+            $this->SetY(-15);
+            //Arial kursiv 8
+            $this->SetFont('Arial','I',8);
+            //Datum der Liste
+            $heute = new DateTime();
+            $this->Cell(0,10,$heute->format('d.m.Y H:i:s'),0,0,'L');
+            //Seitenzahl
+            $this->Cell(0,10,'Seite '.$this->PageNo().'/{nb}',0,0,'R');
+        }
+        //Colored table
+        function FancyTable($header,$data)
+        {
+
+            //Colors, line width and bold font
+            $this->SetFillColor(104,172,191);
+            $this->SetTextColor(0,0,102);
+            $this->SetDrawColor(255,255,255);
+            $this->SetLineWidth(.0);
+            $this->SetFont('','B');
+
+            //Header notwendig fuer Tabelle, Hoehe = 0!
+//            $w=array(55,40,30,15,40); // Breite der Zellen
+            for($i=0;$i<count($header);$i++)
+                $this->Cell($this->wid[$i],0,'',1,0,'L',1);
+            $this->Ln();
+            //Color and font restoration
+//            $this->SetFillColor(222,222,222);
+            $this->SetFillColor(249,249,249);
+            $this->SetTextColor(0);
+            $this->SetFont('');
+            //Data
+            $fill=0;
+            $height = 4;
+            $fill = !$fill;
+//            $breite = ($pdf->w - $pdf->lMargin - $pdf->rMargin) / 3;
+            foreach($data as $row)
+            {
+    			if ($row->persknr != $vpnr)
+                {
+                    $fill=!$fill;
+                    if (substr($row->name,0,1) != $vfirst)
+                    { 
+                        $this->SetFont('','B',9);
+                        $kap = strtoupper(substr($row->name,0,1));
+//                        $this->Ln(5); //$this->AddPage();
+                        $this->CellFitScale(175,$height,$kap,0,0,'L',$fill);                    
+                        $this->Ln();
+                        $this->SetFont('','',8);
+                    }
+                    $titel = ($row->titel)? ", $row->titel" : "" ;
+                    $vname = ($row->vorname)? ", $row->vorname" : "";
+                    $name = $row->name . $titel . $vname;
+                    $this->CellFitScale($this->wid[0],$height,$name,0,0,'L',$fill);
+                    $this->CellFitScale($this->wid[1],$height,$row->abt_name,'LR',0,'L',$fill);
+                    if ($row->telefon_typ == "fax") $typ = " FAX"; else $typ = "";
+                    if (!$row->public) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
+                    $this->CellFitScale($this->wid[2],$height,$row->telefon_nr.$typ,'LR',0,'L',$fill);
+                    $this->SetTextColor(0);
+                    $this->CellFitScale($this->wid[3],$height,$row->geb_ID . " " . $row->raum_nr,'LR',0,'L',$fill);
+                    $this->CellFitScale($this->wid[4],$height,$row->email,'LR',0,'L',$fill);
+                    $this->Ln();
+                }
+                else
+                {
+                    $this->Cell($this->wid[0],$height,'','LR',0,'L',$fill);
+                    if ($vabt != $row->abt_name) $abt = $row->abt_name;
+                    else $abt = '';    
+                    $this->CellFitScale($this->wid[1],$height,$abt,'LR',0,'L',$fill);
+                    if ($row->telefon_typ == "fax") $typ = " FAX"; else $typ = "";
+                    if (!$row->public) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
+                    $this->CellFitScale($this->wid[2],$height,$row->telefon_nr.$typ,'LR',0,'L',$fill);
+                    $this->SetTextColor(0);
+                    $this->CellFitScale($this->wid[3],$height,'','LR',0,'L',$fill);
+                    $this->Cell($this->wid[4],$height,'','LR',0,'L',$fill);
+                    $this->Ln();
+                    
+                }
+                $vpnr = $row->persknr;
+                $vabt = $row->abt_name;
+                $vfirst = substr($row->name,0,1);
+            }
+        }
+        function FancyTableOldMySQL($header,$data)
+        {
+
+            //Colors, line width and bold font
+            $this->SetFillColor(104,172,191);
+            $this->SetTextColor(0,0,102);
+            $this->SetDrawColor(255,255,255);
+            $this->SetLineWidth(.0);
+            $this->SetFont('','B');
+
+            //Header notwendig fuer Tabelle, Hoehe = 0!
+            $w=array(55,40,30,15,40);
+            for($i=0;$i<count($header);$i++)
+                $this->Cell($w[$i],0,'',1,0,'L',1);
+            $this->Ln();
+            //Color and font restoration
+//            $this->SetFillColor(222,222,222);
+            $this->SetFillColor(238,238,238);
+            $this->SetTextColor(0);
+            $this->SetFont('');
+            //Data
+            $fill=0;
+            $fill = !$fill;
+            while ($row = mysql_fetch_assoc($data)) 
+            {
+    			if ($row["persknr"] != $vpnr)
+                {
+                    $fill=!$fill;
+                    $titel = ($row["titel"])? ", ".$row["titel"]  : "" ;
+                    $vname = ($row["vorname"])? ",". $row["vorname"] : "";
+                    $name = $row["name"] . $titel . $vname;
+                    $this->CellFitScale($w[0],4.5,$name,0,0,'L',$fill);
+                    $this->CellFitScale($w[1],4.5,$row["abt_name"],'LR',0,'L',$fill);
+                    if ($row["telefon_typ"] == "fax") $typ = " FAX"; else $typ = "";
+                    if (!$row["public"]) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
+                    $this->CellFitScale($w[2],4.5,$row["telefon_nr"].$typ,'LR',0,'L',$fill);
+                    $this->SetTextColor(0);
+                    $this->CellFitScale($w[3],4.5,$row["geb_ID"] . " " . $row["raum_nr"],'LR',0,'L',$fill);
+                    $this->CellFitScale($w[4],4.5,$row["email"],'LR',0,'L',$fill);
+                    $this->Ln();
+                }
+                else
+                {
+                    $newline = 0;
+                    $this->Cell($w[0],4.5,'','LR',0,'L',$fill);
+                    if ($vabt != $row["abt_name"]) $abt = $row["abt_name"];
+                    else $abt = '';    
+                    $this->CellFitScale($w[1],4.5,$abt,'LR',0,'L',$fill);
+                    if ($row["telefon_typ"] == "fax") $typ = " FAX"; else $typ = "";
+                    if (!$row["public"]) $this->SetTextColor(255,0,0); else $this->SetTextColor(0,0,136); 
+                    $this->CellFitScale($w[2],4.5,$row["telefon_nr"].$typ,'LR',0,'L',$fill);
+                    $this->SetTextColor(0);
+                    $this->CellFitScale($w[3],4.5,$row["geb_ID"] . " " . $row["raum_nr"],'LR',0,'L',$fill);
+                    $this->Cell($w[4],4.5,'','LR',0,'L',$fill);
+                    $this->Ln();
+                    
+                }
+                $vpnr = $row["persknr"];
+                $vabt = $row["abt_name"];
+            }
+        }
+        function Normal($data)
+        {
+            $this->fancy = 1;
+            $w = array(55,40,35,40);
+            $this->SetFillColor(249,249,249);
+            $fill = 0;
+            $fill = !$fill;
+            foreach ($data as $row)
+            { 
+    			if ($row->persknr != $vpnr)
+                {
+                    if ($vpnr)
+                    {
+                        // ausgeben vorheriges Objekt
+                        $tel = implode(", ",$atel); 
+                        $this->SetFont('times','',9);
+                        $this->CellFitScale($w[0],$this->height,$name,0,0,'L',$fill);                    
+                        $this->CellFitScale($w[1],$this->height,$tel,0,0,'L',$fill);                    
+                        $this->CellFitScale($w[2],$this->height,$abtort,0,0,'L',$fill);                    
+                        $this->CellFitScale($w[3],$this->height,$mail,0,0,'L',$fill);
+                        $this->Ln();
+                    }                    
+
+                    $fill=!$fill;
+                    if (substr($row->name,0,1) != $vfirst)
+                    { 
+                        $this->SetFont('','B',11);
+                        $kap = strtoupper(substr($row->name,0,1));
+                        $this->CellFitScale(170,$this->height,$kap,0,0,'L',$fill);                    
+                        $this->Ln();
+                        $this->SetFont('','',9);
+                    }
+                    $atel = array();
+                    $titel = ($row->titel)? ", ".$row->titel  : "" ;
+                    $vname = ($row->vorname)? ", ". $row->vorname : "";
+                    $name = $row->name . $titel . $vname;
+                    $raum = ($row->raum_nr)? ", ".$row->raum_nr : "";
+                    $abtort = $row->abt_name . "   " . $row->geb_ID . $raum;
+                    $mail = $row->email;
+                    $fax =($row->telefon_typ == 'fax')? " FAX" : "";
+                    $atel[] = $row->telefon_nr . $fax;
+                }
+                else
+                {            
+                    $fax =($row->telefon_typ == 'fax')? " FAX" : "";
+                    $atel[] = $row->telefon_nr . $fax;
+                }
+                $vfirst = substr($row->name,0,1);
+                $vpnr = $row->persknr;
+            }
+            // ausgeben letztes Objekt
+            $tel = implode(";",$atel); 
+            $this->SetFont('times','',9);
+            $this->CellFitScale($w[0],$this->height,$name,0,0,'L',$fill);                    
+            $this->CellFitScale($w[1],$this->height,$tel,0,0,'L',$fill);                    
+            $this->CellFitScale($w[2],$this->height,$abtort,0,0,'L',$fill);                    
+            $this->CellFitScale($w[3],$this->height,$mail,0,0,'L',$fill);                    
+       }
+
+// mehrere Spalten        
+        function SetCol($col,$width)
+        {
+            // Move position to a column
+            $this->col = $col;
+            $this->width = $width;
+//                echo "1x = " . $this->GetX() . ", col = $this->col" . ", width = $this->width<br />\n";
+            if ($this->xa <= $this->lMargin || ($this->anzcol == 3 && $this->xa <= $this->lMargin + $this->width + 5*$this->col))
+                $this->xa = $this->lMargin + 5*$this->col + ($this->col*$this->width);
+            else $this->xa = $this->lMargin;
+//            $this->SetLeftMargin(25);
+            $this->SetX($this->xa);
+//                echo "2x = " . $this->GetX() . ", col = $this->col" . ", width = $this->width<br />\n";
+        }
+        
+        function AcceptPageBreak()
+        {
+            if (!$this->fancy) // nur bei mehrspaltiger Darstellung
+            {
+                if ($this->GetY()+$this->height > $this->PageBreakTrigger)
+                    if($this->col < $this->anzcol-1)
+                    {
+                        // Go to next column
+                        $this->SetCol($this->col+1,$this->width);
+                        $this->SetY($this->y0);
+                        $this->y = $this->y0;
+    //                echo "apb_x = " . $this->GetX() . ", col = $this->col" . ", width = $this->width<br />\n";
+                        return false;
+                    }
+                    else
+                    {
+                        // Go back to first column and issue page break
+                        $this->AddPage($this->CurOrientation);
+                        $this->SetCol(0,$this->width);
+                        $this->SetY($this->y0);
+                        $this->y = $this->y0;
+                        return true;
+                    }
+                else
+                    return false;
+            }
+            else
+	           return $this->AutoPageBreak;
+        }
+
+        function Small($data,$colwidth,$height)
+        {
+            $this->fancy = 0;
+            $this->y0 = $this->GetY();
+            $this->y = $this->y0;
+            $this->width = $colwidth;
+            $this->height = $height;
+            $this->SetFillColor(249,249,249);
+            $fill = 0;
+            $fill = !$fill;
+            foreach ($data as $row)
+            { 
+//                echo "3x = " . $this->GetX() . ", y = " . $this->GetY() . ", width = $colwidth<br />\n";
+                $fill=!$fill;
+                if (substr($row->name,0,1) != $vfirst)
+                { 
+                    $this->SetFont('','B',11);
+                    $kap = strtoupper(substr($row->name,0,1));
+                    $this->SetX($this->xa);
+                    $this->CellFitScale($colwidth,$height,$kap,0,0,'L',$fill);                    
+                    $this->y = $this->y+$height;
+                    $this->SetY($this->y);                    
+                    $this->AcceptPageBreak();
+                }
+                $titel = ($row->titel)? ", ".$row->titel  : "" ;
+                $vname = ($row->vorname)? ", ". $row->vorname : "";
+                $zeil1 = $row->name . $titel . $vname . " ";
+                $zeil2 = $row->abt_name . "   " . $row->geb_ID. " ". $row->raum_nr;
+                $zeil3 = $row->telefon_nr;
+                $this->SetFont('times','',9);
+                $this->SetX($this->xa);
+                if ($this->anzcol == 2)
+                    $this->CellFitScale($colwidth/2,$height,$zeil1,0,0,'L',$fill);
+                else                    
+                    $this->CellFitScale($colwidth*0.75,$height,$zeil1,0,0,'L',$fill);
+                if ($this->anzcol == 2)
+                {
+                    $this->SetFont('','',8);
+                    $this->CellFitScale($colwidth/4,$height,$zeil2,0,0,'L',$fill); 
+                }                   
+                $this->SetFont('','',9);
+                $this->CellFitScale($colwidth/4,$height,$zeil3,0,0,'R',$fill);
+                $this->y = $this->y+$height;
+                $this->SetY($this->y);                    
+            
+                $vfirst = substr($row->name,0,1);
+                $this->AcceptPageBreak();
+//                echo "4x = " . $this->GetX() . ", y = " . $this->GetY() . ", width = $colwidth<br />\n";
+            }
+        }
+    }
+
+
 ?>
\ No newline at end of file
--- a/fhiiqm/inc/vertragtab_ins.inc.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/inc/vertragtab_ins.inc.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,175 +1,182 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 06/2011
- *   
- * INSERT Vertragsdaten in n:m-Tabellen fuer INSERT und UPDATE Vertragsdaten 
- */
-
-            // Loeschen der alten Bearbeiter, Hinzufuegen der neuen
-            $retb = true;
-            $sql = "DELETE FROM Vertrag_Bearbeiter WHERE contract_ID = $cid";
-            $retd = $dbc -> execute($sql);
-            if ($retd)
-            {
-                if (is_array($vtr['cpers']))
-                {
-                    foreach ($vtr['cpers'] as $pers)
-                    {
-                        if ($pers != -1)
-                        { 
-                            $sql = "INSERT INTO Vertrag_Bearbeiter VALUES($cid, $pers)";
-                //                        echo "INSERT Bearbeiter: $sql<br><br>\n";
-                            $retb = $dbc -> execute($sql);
-                        }
-                    }
-                }
-
-            }
-
-             // Partner
-            $retp = true;
-            if ($vtr['partid'] != -1)
-            {
-                // Loeschen alter Partner, INSERT neuer
-                $sql = "DELETE FROM Vertrag_Partner WHERE contract_ID = $cid";
-                $retdp = $dbc -> execute($sql);
-                if ($retdp)
-                {
-                    $sql = "INSERT INTO Vertrag_Partner VALUES($cid," . $vtr['partid'] .")";
-                    $retp = $dbc -> execute($sql);
-                    if (!$retp) echo "error INSERT Vertrag_Partner: " . $dbc -> error . " <br />\n";
-                }
-                $pid = $vtr['partid'];
-            }
-            if ($vtr['partner'])
-            {
-                // Test, ob Eintrag schon vorhanden
-                $sql = "SELECT part_ID, part_firma FROM Partner WHERE part_firma = '" . ltrim($vtr['partner']) . "'";
-                if ($res = $dbc -> queryObjectArray($sql))
-                {
-                    foreach ($res as $row)
-                        $pid = $row->part_ID;
-                }        
-                else
-                {
-                    // INSERT in Partner, ID INSERT in Vertrag_Partner
-                    $sql = "INSERT INTO Partner (part_firma) VALUES (LEFT(TRIM('" . $vtr['partner'] . "'),50))";
-                    $retp = $dbc -> execute($sql); 
-    //                    echo "Partner INSERT: $sql<br />\n";           
-                    if ($retp) $pid = $dbc -> insertId();
-                }
-                if ($pid)
-                { 
-                    // Loeschen alter Partner, INSERT neuer
-                    $sql = "DELETE FROM Vertrag_Partner WHERE contract_ID = $cid";
-                    $retdp = $dbc -> execute($sql);
-                    if ($retdp)
-                    {
-                            $sql = "INSERT INTO Vertrag_Partner VALUES($cid,$pid)";
-                            $retp = $dbc -> execute($sql);
-                            if (!$retp) echo "error INSERT Vertrag_Partner: " . $dbc -> error . " <br />\n";
-                    }
-                }
-            }
-            
-            // Produkt
-            $retd = true;
-            if ($vtr['prodid'] > 0 || $vtr['prodid'] = -1) // nur Produkte, keine Gruppen, Bereiche
-            {
-                // Loeschen altes Produkt, INSERT neues
-                $sql = "DELETE FROM Produkt_Vertrag WHERE contract_ID = $cid";
-                $retdd = $dbc -> execute($sql);
-                if ($retdd && $vtr['prodid'] > 0)
-                {
-                    //INSERT in Produkt_Vertrag
-                    $sql = "INSERT INTO Produkt_Vertrag VALUES(".$vtr['prodid'].",$cid)";
-                    $retd = $dbc -> execute($sql); 
-                    if (!$retd) echo "error INSERT Produkt_Vertrag: " . $dbc -> error . " <br />\n";
-                }
-                
-            }
-            
-            // Kosten
-            $retk = true;
-            if ($vtr['kost'] && ($vtr['bjahr'] || $vtr['bdat'])) // Kosten fuer mindestens Startjahr
-            {
-                if ($vtr['bdat'])
-                {
-                    $jahr = new DateTime($vtr['bdat']);
-                    $bjahr = $jahr->format('Y');
-                }
-                else $bjahr = $vtr['bjahr'];              
-
-                // alle bisherigen Angaben loeschen
-                $sql = "DELETE FROM Vertrag_Kosten WHERE contract_ID = $cid";
-                $retdk = $dbc -> execute($sql);   
-                if ($retdk)
-                {
-                    $j=0;
-                    if ($vtr['ejahr'] || $vtr['edat'])
-                    { 
-                        if ($vtr['ejahr']) $ejahr = $vtr['ejahr'];
-                        else
-                        {
-                            $jahr = new DateTime($vtr['edat']);
-                            $ejahr = $jahr->format('Y');   
-                        }
-                    }    
-                    elseif ($vtr["cautoend"] && !$vtr['ejahr'] && !$vtr['edat']) // automatische Vertragsverlaengerung und kein Endjahr angegeben
-                        $ejahr = date("Y");
-                    else 
-                        $ejahr = null;
-//                    if ($vtr['ejahr']) // Endjahr angegeben
-                    if ($ejahr) // Endjahr angegeben
-                    {
-                        for ($i=(int)$bjahr; $i< (int)$ejahr +1; $i++)
-                        {
-                            if ($vtr['kost'][$j])
-                            {
-//                                $kost = str_replace(',','.',$vtr['kost'][$j]);
-                                $kost = dbformat_wert($vtr['kost'][$j]);
-                                $sql = "INSERT INTO Vertrag_Kosten (contract_ID,k_year,kosten) VALUES($cid,$i,$kost)";
-                                $retk = $dbc -> execute($sql);
-                            }
-                            $j++;   
-                        }
-                    }
-                    else // nur fuer Startjahr
-                    {
-                        if ($vtr['kost'][0])
-                        {
-//                            $kost = str_replace(',','.',$vtr['kost'][0]);
-                            $kost = dbformat_wert($vtr['kost'][0]);
-                            $sql = "INSERT INTO Vertrag_Kosten (contract_ID,k_year,kosten) VALUES($cid,".(int)$bjahr.",$kost)";
-                            $retk = $dbc -> execute($sql);
-                        }   
-                    }
-                    if (!$retk) echo "error INSERT Vertrag_Kosten: " . $dbc -> error . "<br />$sql<br />\n";
-                }
-            }
-
-            // Vertragfile und Schlagwort
-            $retl = true;
-            if (is_array($vtr['cfname']) && count($vtr['cfname']) > 0)
-            {
-                // alle bisherigen Dokumente loeschen
-                $sql = "DELETE FROM Vertrag_File WHERE contract_ID = $cid";
-                $retdl = $dbc -> execute($sql);   
-                if ($retdl)
-                {
-                    foreach ($vtr['cfname'] as $key => $value)
-                    {
-                        if ($value)
-                        {
-                            if (!$vtr['swort'][$key] || $vtr['swort'][$key]<"!") $sw = "NULL"; else $sw = "'".$vtr['swort'][$key]."'";
-                            if (substr($value,0,$len) != $cid . "_") $file = $cid . "_".$value; else $file = $value;
-                            $sql = "INSERT INTO Vertrag_File (contract_ID,cf_filename,cf_schlagwort) VALUES ($cid,'$file',$sw)";
-                            $retl = $retl && $dbc -> execute($sql);
-                        }
-                    }    
-                    if (!$retl) echo "error INSERT Vertrag_File: " . $dbc -> error . "<br />$sql<br />\n";
-                }
-            }
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 06/2011
+ *   
+ * INSERT Vertragsdaten in n:m-Tabellen fuer INSERT und UPDATE Vertragsdaten 
+ */
+
+            // Loeschen der alten Bearbeiter, Hinzufuegen der neuen
+            $retb = true;
+            $sql = "DELETE FROM Vertrag_Bearbeiter WHERE contract_ID = $cid";
+            $retd = $dbc -> execute($sql);
+            if ($retd)
+            {
+                if (is_array($vtr['cpers']))
+                {
+                    foreach ($vtr['cpers'] as $pers)
+                    {
+                        if ($pers != -1)
+                        { 
+                            $sql = "INSERT INTO Vertrag_Bearbeiter VALUES($cid, $pers)";
+                //                        echo "INSERT Bearbeiter: $sql<br><br>\n";
+                            $retb = $dbc -> execute($sql);
+                        }
+                    }
+                }
+
+            }
+
+             // Partner
+            $retp = true;
+            if ($vtr['partid'] != -1)
+            {
+                // Loeschen alter Partner, INSERT neuer
+                $sql = "DELETE FROM Vertrag_Partner WHERE contract_ID = $cid";
+                $retdp = $dbc -> execute($sql);
+                if ($retdp)
+                {
+                    $sql = "INSERT INTO Vertrag_Partner VALUES($cid," . $vtr['partid'] .")";
+                    $retp = $dbc -> execute($sql);
+                    if (!$retp) echo "error INSERT Vertrag_Partner: " . $dbc -> error . " <br />\n";
+                }
+                $pid = $vtr['partid'];
+            }
+            else
+            {
+                // Loeschen alter Partner, INSERT neuer
+                $sql = "DELETE FROM Vertrag_Partner WHERE contract_ID = $cid";
+                $retdp = $dbc -> execute($sql);
+                if ($retdp) $retp=1;
+            }
+            if ($vtr['partner'])
+            {
+                // Test, ob Eintrag schon vorhanden
+                $sql = "SELECT part_ID, part_firma FROM Partner WHERE part_firma = '" . ltrim($vtr['partner']) . "'";
+                if ($res = $dbc -> queryObjectArray($sql))
+                {
+                    foreach ($res as $row)
+                        $pid = $row->part_ID;
+                }        
+                else
+                {
+                    // INSERT in Partner, ID INSERT in Vertrag_Partner
+                    $sql = "INSERT INTO Partner (part_firma) VALUES (LEFT(TRIM('" . $vtr['partner'] . "'),50))";
+                    $retp = $dbc -> execute($sql); 
+    //                    echo "Partner INSERT: $sql<br />\n";           
+                    if ($retp) $pid = $dbc -> insertId();
+                }
+                if ($pid)
+                { 
+                    // Loeschen alter Partner, INSERT neuer
+                    $sql = "DELETE FROM Vertrag_Partner WHERE contract_ID = $cid";
+                    $retdp = $dbc -> execute($sql);
+                    if ($retdp)
+                    {
+                            $sql = "INSERT INTO Vertrag_Partner VALUES($cid,$pid)";
+                            $retp = $dbc -> execute($sql);
+                            if (!$retp) echo "error INSERT Vertrag_Partner: " . $dbc -> error . " <br />\n";
+                    }
+                }
+            }
+            
+            // Produkt
+            $retd = true;
+            if ($vtr['prodid'] > 0 || $vtr['prodid'] = -1) // nur Produkte, keine Gruppen, Bereiche
+            {
+                // Loeschen altes Produkt, INSERT neues
+                $sql = "DELETE FROM Produkt_Vertrag WHERE contract_ID = $cid";
+                $retdd = $dbc -> execute($sql);
+                if ($retdd && $vtr['prodid'] > 0)
+                {
+                    //INSERT in Produkt_Vertrag
+                    $sql = "INSERT INTO Produkt_Vertrag VALUES(".$vtr['prodid'].",$cid)";
+                    $retd = $dbc -> execute($sql); 
+                    if (!$retd) echo "error INSERT Produkt_Vertrag: " . $dbc -> error . " <br />\n";
+                }
+                
+            }
+            
+            // Kosten
+            $retk = true;
+            if ($vtr['kost'] && ($vtr['bjahr'] || $vtr['bdat'])) // Kosten fuer mindestens Startjahr
+            {
+                if ($vtr['bdat'])
+                {
+                    $jahr = new DateTime($vtr['bdat']);
+                    $bjahr = $jahr->format('Y');
+                }
+                else $bjahr = $vtr['bjahr'];              
+
+                // alle bisherigen Angaben loeschen
+                $sql = "DELETE FROM Vertrag_Kosten WHERE contract_ID = $cid";
+                $retdk = $dbc -> execute($sql);   
+                if ($retdk)
+                {
+                    $j=0;
+                    if ($vtr['ejahr'] || $vtr['edat'])
+                    { 
+                        if ($vtr['ejahr']) $ejahr = $vtr['ejahr'];
+                        else
+                        {
+                            $jahr = new DateTime($vtr['edat']);
+                            $ejahr = $jahr->format('Y');   
+                        }
+                    }    
+                    elseif ($vtr["cautoend"] && !$vtr['ejahr'] && !$vtr['edat']) // automatische Vertragsverlaengerung und kein Endjahr angegeben
+                        $ejahr = date("Y");
+                    else 
+                        $ejahr = null;
+//                    if ($vtr['ejahr']) // Endjahr angegeben
+                    if ($ejahr) // Endjahr angegeben
+                    {
+                        for ($i=(int)$bjahr; $i< (int)$ejahr +1; $i++)
+                        {
+                            if ($vtr['kost'][$j])
+                            {
+//                                $kost = str_replace(',','.',$vtr['kost'][$j]);
+                                $kost = dbformat_wert($vtr['kost'][$j]);
+                                $sql = "INSERT INTO Vertrag_Kosten (contract_ID,k_year,kosten) VALUES($cid,$i,$kost)";
+                                $retk = $dbc -> execute($sql);
+                            }
+                            $j++;   
+                        }
+                    }
+                    else // nur fuer Startjahr
+                    {
+                        if ($vtr['kost'][0])
+                        {
+//                            $kost = str_replace(',','.',$vtr['kost'][0]);
+                            $kost = dbformat_wert($vtr['kost'][0]);
+                            $sql = "INSERT INTO Vertrag_Kosten (contract_ID,k_year,kosten) VALUES($cid,".(int)$bjahr.",$kost)";
+                            $retk = $dbc -> execute($sql);
+                        }   
+                    }
+                    if (!$retk) echo "error INSERT Vertrag_Kosten: " . $dbc -> error . "<br />$sql<br />\n";
+                }
+            }
+
+            // Vertragfile und Schlagwort
+            $retl = true;
+            if (is_array($vtr['cfname']) && count($vtr['cfname']) > 0)
+            {
+                // alle bisherigen Dokumente loeschen
+                $sql = "DELETE FROM Vertrag_File WHERE contract_ID = $cid";
+                $retdl = $dbc -> execute($sql);   
+                if ($retdl)
+                {
+                    foreach ($vtr['cfname'] as $key => $value)
+                    {
+                        if ($value)
+                        {
+                            if (!$vtr['swort'][$key] || $vtr['swort'][$key]<"!") $sw = "NULL"; else $sw = "'".$vtr['swort'][$key]."'";
+                            if (substr($value,0,$len) != $cid . "_") $file = $cid . "_".$value; else $file = $value;
+                            $sql = "INSERT INTO Vertrag_File (contract_ID,cf_filename,cf_schlagwort) VALUES ($cid,'$file',$sw)";
+                            $retl = $retl && $dbc -> execute($sql);
+                        }
+                    }    
+                    if (!$retl) echo "error INSERT Vertrag_File: " . $dbc -> error . "<br />$sql<br />\n";
+                }
+            }
 ?>
\ No newline at end of file
--- a/fhiiqm/ma_tel_flist.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/ma_tel_flist.php	Wed Aug 06 09:42:40 2014 +0200
@@ -219,7 +219,9 @@
                 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
                 $titel = ($row->titel)? ", $row->titel" : "" ;
                 $email = ($row->email)? "<a href='mailto:$row->email'>$row->name$titel</a>" : "$row->name$titel";
-                if ($row->aktiv == 0) $class = " class='bgmark'"; else $class="";
+                if ($row->aktiv == 0) $class = " class='bgmark'";
+                elseif ($row->aktiv == -1) $class = " class='bggast'"; 
+                else $class="";
                 echo "<tr$class bgcolor='" . $bg . "'><td>$email</td>";    
                 echo "<td>$row->vorname</td>";
                 echo "<td>$row->abt_name</td>";
--- a/fhiiqm/partner_upd.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/partner_upd.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,202 +1,202 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 08/2011
- *
- * UPDATE/DELETE Partnerdaten   
- */
-
-    error_reporting(E_ALL ^ E_NOTICE);
-    
-    session_start();
-    if (! isset($_SESSION["userid"]))
-    { 
-        include_once ("inc/func_lib.inc.php");	
-        login("partner_upd.php");
-        exit;
-    }
-    
-    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vpr",$_SESSION["recht"]) && !in_array("vpe",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-?>
-<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
-   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-
-	<title>Aktualisieren Partnerdaten</title>
-</head>
-
-<body> 
-    
-
-<?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/group_gear.png\" border=\"0\" alt=\"Partnerdaten bearbeiten\" title=\"Partnerdaten bearbeiten\"/></div>\n";
-
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-	$dbc = new dbconnection();
-    
-    $pid    = $_GET["uid"];
-    if (!$rid) $rid=1;
-	$ok		= $_POST["ok"];
-	$upd	= $_POST["upd"];
-    $del    = $_POST["del"];
-    $part    = $_POST["part"];
-    if (!$part['okn']) $ok=false;
-    
-//    print_r($raum);
-//    echo "<br><br>\n";
-//    echo "Vertragsbezeichnung: " . $raum['cname'] ."<br><br>\n";
-    
-    if ((!$ok && !$upd && !$del) || (!$ok && ($upd || $del)))
-    {
-        if (!$upd && !$del)
-        {
-            $sql = "SELECT part_ID,part_firma,part_nachname,part_vorname,part_titel,part_anrede,part_strasse,
-                    part_ort,part_plz,part_tel,part_fax,part_mobil,part_email,part_bemerkung
-                    FROM fhiiqm.Partner WHERE part_ID=$pid";
-            if ($result = $dbc ->queryObjectArray($sql))
-            {
-                foreach ($result as $row)
-                {
-                    $part['firma'] = $row->part_firma;
-                    $part['str'] = $row->part_strasse;
-                    $part['ort'] = $row->part_ort;
-                    $part['plz'] = $row->part_plz;
-                    $part['nname'] = $row->part_nachname;
-                    $part['vname'] = $row->part_vorname;
-                    $part['titel'] = $row->part_titel;
-                    $part['anr'] = $row->part_anrede;
-                    $part['tel'] = $row->part_tel;
-                    $part['motel'] = $row->part_mobil;
-                    $part['fax'] = $row->part_fax;
-                    $part['email'] = $row->part_email;
-                    $part['bem'] = $row->part_bemerkung;
-                }
-            }
-        }
-        include ("form/partner_form.inc.php");
-        
-	  	if ($upd || $del)
-        {
-            if ($upd)
-              $frage = "Alle Angaben ok?";
-            elseif ($del)
-                $frage = "Partner wirklich l&ouml;schen?";
-    		echo "<tr>
-    		  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
-    		        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
-    		        if ($ok)  echo "checked"; 
-    		echo "></td>\n</tr>\n"; 
-        }
-		
-        if (!is_null($_SESSION["recht"]) && in_array("vpe",$_SESSION["recht"]))
-        {
-    		echo "<tr>\n";
-    		echo "
-    		  <td>&nbsp;</td>
-    		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
-    		  &nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
-    		echo "</tr>\n";
-        }
-        echo "</table>\n";
-        echo "</div>\n";
-        if (!is_null($_SESSION["recht"]) && !in_array("vpe",$_SESSION["recht"]))
-            echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"partner_flist.php\" target=\"_self\" title=\"Partnerliste\">&laquo; zur Partnerliste</a></p>\n";    
-        echo "</form>\n";	
-
-    }
-    elseif ($ok && $del)
-    {
-        echo "<div align='center'>\n";
-        //daten loeschen
-        
-        $sql = "DELETE FROM Partner WHERE part_ID=pid";
-        $retd = $dbc -> execute($sql);
-        if ($retd)
-        {
-            echo "<p class='green'><b>Partner '" . $part['firma'] . "' wurde gelöscht!</b></p>";
-            include ($_SERVER["DOCUMENT_ROOT"] ."/fhiiqm/inc/partner_show.inc.php");
-        }
-    }
-    elseif ($ok && $upd)
-    {
-        echo "<div align='center'>\n";
-        //daten speichern
-        $part["firma"] = substr($part["firma"],0,50);
-        $part["nname"] = substr($part["nname"],0,30);
-        $part["vname"] = substr($part["vname"],0,30);
-        if ($part['anr']== -1) $part['anr']=null; 
-        $part["titel"] = substr($part["titel"],0,10);
-        $part["tel"] = substr($part["tel"],0,20);
-        $part["mobil"] = substr($part["motel"],0,20);
-        $part["fax"] = substr($part["fax"],0,20);
-        $part["email"] = substr($part["email"],0,20);
-        $part["ort"] = substr($part["ort"],0,50);
-        $part["str"] = substr($part["str"],0,50);
-        $part["plz"] = substr($part["plz"],0,10);
-        $part["bem"] = substr($part["bem"],0,500);
-        foreach ($part as $key=>$value)
-        {
-			if (is_null($value) || $value < "!") $part["$key"] = null;
-        }    
-        
-        // vermeiden von SQL-Injection
-        $stmt = $dbc -> stmtinit();
-        if (is_object($stmt))
-        {
-            $stmt -> prepare("UPDATE fhiiqm.Partner SET 
-                part_firma = ?,
-                part_nachname = ?,
-                part_vorname = ?,
-                part_titel = ?,
-                part_anrede = ?,
-                part_strasse = ?,
-                part_ort = ?,
-                part_plz = ?,
-                part_tel = ?,
-                part_fax = ?,
-                part_mobil = ?,
-                part_email = ?,
-                part_bemerkung = ?
-                WHERE part_ID = $pid");
-            $stmt -> bind_param('sssssssssssss',$part["firma"],$part["nname"],$part["vname"],$part["titel"],$part['anr'],
-                            $part["str"],$part["ort"],$part["plz"],$part["tel"],$part["fax"],$part["motel"],$part["email"],$part["bem"]);
-            $result = $stmt -> execute();      
-            if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
-            if ($result)
-            {
-                // UPDATE o.k.
-                echo "<p class='green'><b>Partnerdaten zu ID '$pid' wurden erfolgreich gespeichert.</b></p>\n";
-                echo "<br /><br />\n";
-                
-                // Anzeigen gespeicherte Partnerdaten
-                include ("inc/partner_dat_show.inc.php");
-            }
-            else
-                echo "<p class='red'>&Auml;ndern der Partnerdaten ist fehlgeschlagen!</p>\n";
-        }
-    }
-    if ($ok && ($upd || $del))
-    {
-        echo "</div><br /><br />\n";
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"partner_flist.php\" target=\"_self\" title=\"Partnerliste\">Zur&uuml;ck zur Partnerliste</a></p>\n";    
-        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"partner_ins.php\" target=\"_self\" title=\"Partner erfassen\">Weiteren Partner erfassen</a></p>\n";    
-    }
-    
-?>
-
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 08/2011
+ *
+ * UPDATE/DELETE Partnerdaten   
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login("partner_upd.php");
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vpr",$_SESSION["recht"]) && !in_array("vpe",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Aktualisieren Partnerdaten</title>
+</head>
+
+<body> 
+    
+
+<?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/group_gear.png\" border=\"0\" alt=\"Partnerdaten bearbeiten\" title=\"Partnerdaten bearbeiten\"/></div>\n";
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+    
+    $pid    = $_GET["uid"];
+    if (!$rid) $rid=1;
+	$ok		= $_POST["ok"];
+	$upd	= $_POST["upd"];
+    $del    = $_POST["del"];
+    $part    = $_POST["part"];
+    if (!$part['okn']) $ok=false;
+    
+//    print_r($raum);
+//    echo "<br><br>\n";
+//    echo "Vertragsbezeichnung: " . $raum['cname'] ."<br><br>\n";
+    
+    if ((!$ok && !$upd && !$del) || (!$ok && ($upd || $del)))
+    {
+        if (!$upd && !$del)
+        {
+            $sql = "SELECT part_ID,part_firma,part_nachname,part_vorname,part_titel,part_anrede,part_strasse,
+                    part_ort,part_plz,part_tel,part_fax,part_mobil,part_email,part_bemerkung
+                    FROM fhiiqm.Partner WHERE part_ID=$pid";
+            if ($result = $dbc ->queryObjectArray($sql))
+            {
+                foreach ($result as $row)
+                {
+                    $part['firma'] = $row->part_firma;
+                    $part['str'] = $row->part_strasse;
+                    $part['ort'] = $row->part_ort;
+                    $part['plz'] = $row->part_plz;
+                    $part['nname'] = $row->part_nachname;
+                    $part['vname'] = $row->part_vorname;
+                    $part['titel'] = $row->part_titel;
+                    $part['anr'] = $row->part_anrede;
+                    $part['tel'] = $row->part_tel;
+                    $part['motel'] = $row->part_mobil;
+                    $part['fax'] = $row->part_fax;
+                    $part['email'] = $row->part_email;
+                    $part['bem'] = $row->part_bemerkung;
+                }
+            }
+        }
+        include ("form/partner_form.inc.php");
+        
+	  	if ($upd || $del)
+        {
+            if ($upd)
+              $frage = "Alle Angaben ok?";
+            elseif ($del)
+                $frage = "Partner wirklich l&ouml;schen?";
+    		echo "<tr>
+    		  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+    		        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+    		        if ($ok)  echo "checked"; 
+    		echo "></td>\n</tr>\n"; 
+        }
+		
+        if (!is_null($_SESSION["recht"]) && in_array("vpe",$_SESSION["recht"]))
+        {
+    		echo "<tr>\n";
+    		echo "
+    		  <td>&nbsp;</td>
+    		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
+    		  &nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
+    		echo "</tr>\n";
+        }
+        echo "</table>\n";
+        echo "</div>\n";
+        if (!is_null($_SESSION["recht"]) && !in_array("vpe",$_SESSION["recht"]))
+            echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"partner_flist.php\" target=\"_self\" title=\"Partnerliste\">&laquo; zur Partnerliste</a></p>\n";    
+        echo "</form>\n";	
+
+    }
+    elseif ($ok && $del)
+    {
+        echo "<div align='center'>\n";
+        //daten loeschen
+        
+        $sql = "DELETE FROM Partner WHERE part_ID=$pid";
+        $retd = $dbc -> execute($sql);
+        if ($retd)
+        {
+            echo "<p class='green'><b>Partner '" . $part['firma'] . "' wurde gelöscht!</b></p>";
+            include ($_SERVER["DOCUMENT_ROOT"] ."/fhiiqm/inc/partner_dat_show.inc.php");
+        }
+    }
+    elseif ($ok && $upd)
+    {
+        echo "<div align='center'>\n";
+        //daten speichern
+        $part["firma"] = substr($part["firma"],0,50);
+        $part["nname"] = substr($part["nname"],0,30);
+        $part["vname"] = substr($part["vname"],0,30);
+        if ($part['anr']== -1) $part['anr']=null; 
+        $part["titel"] = substr($part["titel"],0,10);
+        $part["tel"] = substr($part["tel"],0,20);
+        $part["mobil"] = substr($part["motel"],0,20);
+        $part["fax"] = substr($part["fax"],0,20);
+        $part["email"] = substr($part["email"],0,20);
+        $part["ort"] = substr($part["ort"],0,50);
+        $part["str"] = substr($part["str"],0,50);
+        $part["plz"] = substr($part["plz"],0,10);
+        $part["bem"] = substr($part["bem"],0,500);
+        foreach ($part as $key=>$value)
+        {
+			if (is_null($value) || $value < "!") $part["$key"] = null;
+        }    
+        
+        // vermeiden von SQL-Injection
+        $stmt = $dbc -> stmtinit();
+        if (is_object($stmt))
+        {
+            $stmt -> prepare("UPDATE fhiiqm.Partner SET 
+                part_firma = ?,
+                part_nachname = ?,
+                part_vorname = ?,
+                part_titel = ?,
+                part_anrede = ?,
+                part_strasse = ?,
+                part_ort = ?,
+                part_plz = ?,
+                part_tel = ?,
+                part_fax = ?,
+                part_mobil = ?,
+                part_email = ?,
+                part_bemerkung = ?
+                WHERE part_ID = $pid");
+            $stmt -> bind_param('sssssssssssss',$part["firma"],$part["nname"],$part["vname"],$part["titel"],$part['anr'],
+                            $part["str"],$part["ort"],$part["plz"],$part["tel"],$part["fax"],$part["motel"],$part["email"],$part["bem"]);
+            $result = $stmt -> execute();      
+            if ($dbc->error) echo "error: " . $dbc->error . "<br><br>\n";
+            if ($result)
+            {
+                // UPDATE o.k.
+                echo "<p class='green'><b>Partnerdaten zu ID '$pid' wurden erfolgreich gespeichert.</b></p>\n";
+                echo "<br /><br />\n";
+                
+                // Anzeigen gespeicherte Partnerdaten
+                include ("inc/partner_dat_show.inc.php");
+            }
+            else
+                echo "<p class='red'>&Auml;ndern der Partnerdaten ist fehlgeschlagen!</p>\n";
+        }
+    }
+    if ($ok && ($upd || $del))
+    {
+        echo "</div><br /><br />\n";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"partner_flist.php\" target=\"_self\" title=\"Partnerliste\">Zur&uuml;ck zur Partnerliste</a></p>\n";    
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"partner_ins.php\" target=\"_self\" title=\"Partner erfassen\">Weiteren Partner erfassen</a></p>\n";    
+    }
+    
+?>
+
+</body>
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/pl/ma_search.pl	Wed Aug 06 09:42:40 2014 +0200
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+### Mitarbeitersuche aus fhiiqm-DB ###
+### 11.07.2014, bs ###
+
+use Getopt::Std;getopts('s:n:a:t:h');
+
+if ($opt_h gt "" || (!$opt_s && !$opt_n && !$opt_a && !$opt_t))
+{
+    print <<"ENDOFTXT";
+
+ma_search - Mitarbeitersuche
+Parameter:
+    -s  Status: -1 - Gast, 0 - ausgeschieden, 1 - aktiv, 2 - Objekt, sonst - alles
+    -n  Name oder Vorname
+    -a  Abteilung
+    -t  TelefonNr.
+    
+Beispiel: ma_search -nmeier -s1
+  
+ENDOFTXT
+
+}
+else
+{
+    use DBI;
+    
+    $dbh=DBI->connect("DBI:mysql:fhiiqm:achilleus.rz-berlin.mpg.de:","www","fhiiqm",
+                  {PrintError=>1,RaiseError=>1});
+
+    $wher = "";
+    if ($opt_s gt "") { $wher .= "'".$opt_s."'"; }
+    else { $wher .= "''";}
+    if ($opt_n gt "") { $wher .= ",'".$opt_n."'"; }
+    else { $wher .= ",''";}
+    if ($opt_a gt "") { $wher .= ",'".$opt_a."'"; }
+    else { $wher .= ",''";}
+    if ($opt_t gt "") { $wher .= ",'".$opt_t."'"; }
+    else { $wher .= ",''";}
+    $wher .= ",\@anz";
+    $sql = "CALL tel_list_comp(".$wher.")";
+#    print "sql = ".$sql . "\n";
+    
+    $sth=$dbh->prepare($sql);
+    $sth->execute();
+    if ($sth)
+    {
+        $dbh->do($sql);
+        $anz = $dbh->selectrow_array('SELECT @anz');
+        if ($anz > 0)
+        { 
+            print "\nAnzahl = ".$anz . "\n\n";
+            print "----------+----------+------+--------------------+----------+------------\n";
+            print "Name      | Vorname  | Abt. | E-Mail             | Tel.     | Geb., Raum \n";
+            print "----------+----------+------+--------------------+----------+------------\n";
+            while ($dat = $sth->fetchrow_hashref) 
+            {
+              print "$$dat{name} | $$dat{vorname} | $$dat{abt_name} | $$dat{email} | $$dat{tel} | $$dat{geb_ID}, $$dat{raum_nr}\n";
+            }
+            print "\n";
+         }
+        else {print "- kein Ergebnis -\n";}    
+    }
+ }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/rag_ed.php	Wed Aug 06 09:42:40 2014 +0200
@@ -0,0 +1,256 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 07/2014
+ * 
+ * Arbeitsgruppe INSERT/UPDATE DELETE COPY
+ */
+
+
+    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("pr",$_SESSION["recht"]) && !in_array("pe",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+    include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php");
+    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+    if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+
+    $ragid = $_GET["i"];
+
+    $zeil = $_GET["z"];
+    if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen
+    $start = $_GET["st"];   // Start bei DS $start+1
+    if (!$start) $start=0;
+	$sort   = $_GET["s"];   // Sortierung nach Spalte
+    $dir    = $_GET["d"];   // Sortierrichtung
+    $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
+    $filter = $_GET["b"];   // Filterbegriff
+    // $_GET-Parameter zurück zur Infoliste mit den selben Einstellungen wie zuvor
+    $getp = "s=$sort&d=$dir&f=$fnum&b=$filter&st=$start&z=$zeil";
+    
+    $del    = $_POST["del"];
+    $sub    = $_POST["eintragen"];
+    $dup    = $_POST["dup"];
+    if (!$dup) $dup = $_GET["dp"];
+    $copy   = $_GET["c"];
+	$rag    = $_POST["rag"];
+    $ok		= $_POST["ok"];
+    if (!$rag["okn"]) $ok = false;
+    $duptext="";
+    if ($dup)
+    {   // Info duplizieren
+        $tab = "RaumArb_Gruppe";
+        $key = "rag_ID";
+        $val =  $ragid;
+//        $ret=1;
+        $ret = duplicate_record ($tab, $key, $val);
+        if ($ret)
+        { 
+            $ragid_new = $ret;
+            $addr = $_SERVER["PHP_SELF"] . "?i=$ragid_new&c=1&$getp";
+            header("Location: $addr");
+            exit;
+        }
+        else $duptext = " - Fehler beim Duplizieren von ". $rag["rbez"];    
+    }
+?>
+<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Edit Arbeitsgruppe</title>
+</head>
+
+<body>
+
+<?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=\"/fhiiqm/img/reseller_programm.png\" border=\"0\" alt=\"Arbeitsgruppe &auml;ndern\" title=\"Arbeitsgruppe &auml;ndern\"/></div>\n";
+
+
+    echo "<div align='center'>";
+    if ($ragid) $text = "editieren"; else $text = "erfassen";
+    if ($copy) $duptext = " (Kopie)";
+    echo "<h3>Arbeitsgruppe $text$duptext<h3>";
+    
+    echo "</div>\n";
+    if (!$ok || (!$sub && !$del && !$dup))
+    {
+        if ($ragid && (!$sub || !$del) && !isset($rag))
+        { // update
+            $sql = "SELECT rag_bez, rag_bezk, abt_ID FROM RaumArb_Gruppe WHERE rag_ID = $ragid";
+            if ($result = $dbc -> queryObjectArray($sql))
+            {
+                foreach ($result as $row)
+                {
+                   $rag["ragid"]    = $ragid;
+                   $rag["ragbez"]   = $row->rag_bez;
+                   $rag["ragbezk"]  = $row->rag_bezk;
+                   $rag["abt"]      = $row->abt_ID;
+                }
+            }
+        }
+?>
+<div align="center">
+<h5>* - Felder sind erforderlich!</h5>
+</div>
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_ma">
+<div align="center"> 
+<table width="65%" border="0" cellspacing="3" cellpadding="3">
+    <tr><td>Abteilung *</td>
+        <td valign="top">
+             <select name="rag[abt]" onchange="this.form.submit();">
+            <?php 
+                $okn = true;
+                $sql = "SELECT abt_ID, abt_name, abt_long FROM `fhiiqm`.`Abteilung` ORDER BY abt_ID+0";
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        if ($row->abt_ID == $rag['abt'])
+    					   echo "<option selected='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";
+                    }
+                }
+            ?>
+            </select>
+         </td>
+    </tr>          
+    <tr><td>Arbeitsgruppe *</td>;
+           <td><input name="rag[ragbez]" type="text" size="50" maxlength="100"  value="<?php echo $rag['ragbez']; ?>" />
+           <?php 
+            if (isset($rag["ragbez"]) && $rag["ragbez"] < "!") 
+            {
+                echo "<br><span class=\"red\">AG-Bezeichnung ist erforderlich!</span>\n";
+                $okn = false; 
+            }
+           ?>
+         </td>
+    </tr>          
+    <tr><td>Arbeitsgruppe kurz</td>;
+           <td><input name="rag[ragbezk]" type="text" size="10" maxlength="10" value="<?php echo $rag['ragbezk']; ?>" />
+         </td>
+    </tr>          
+    <input type="hidden" name="rag[okn]" value="<?php echo $okn; ?>" />
+    <input type="hidden" name="rag[ragid]" value="<?php echo $ragid; ?>" />
+<?php
+        if ($sub || $del)
+		{
+		  	if ($sub)
+                $frage = "Alle Angaben ok?";
+            elseif ($del)
+                $frage = "Arbeitsgruppe wirklich l&ouml;schen?";
+			echo "<tr>
+			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+			        if ($ok)  echo "checked=\"checked\""; 
+			echo " /></td>\n</tr>\n"; 
+		}
+        if (!is_null($_SESSION["recht"]) && in_array("pe",$_SESSION["recht"]))
+        {
+            echo "
+           	<tr><td>&nbsp;</td>\n
+            	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
+            if ($ragid)
+            {
+                echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
+                echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"duplizieren\" name=\"dup\" title=\"delete\" />";
+            }    
+           	echo "</td></tr>\n";
+        }
+        echo "</table>\n";
+        echo "</div>\n";
+            echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"rag_flist.php?$getp\" target=\"_self\" title=\"AG-Liste\">&laquo; zur AG-Liste</a></p>\n"; 
+        echo "</form>\n";   
+    }
+    else
+    {
+        echo "<div align='center'>\n";
+        
+        if ($del)
+        {   // loeschn
+            $sql = "DELETE FROM RaumArb_Gruppe WHERE rag_ID = '$ragid'";
+            $retdi = $dbc -> execute($sql);
+            if ($retdi)
+            {
+                // Anzeigen geloeschter Infodaten
+                echo "<p class='green'><b>DELETE: Daten  zu '".$rag["ragbez"]."' wurden erfolgreich gel&ouml;scht.</b></p>\n";
+            }                
+            else
+            {
+                echo "<p class='red'><b>DELETE: Daten  zu '".$rag["ragbez"]."' konnten nicht gel&ouml;scht werden!</b></p>\n";
+                echo "sql = $sql<br />";
+                echo "error DELETE: " . $dbc->error . "<br />";
+            }
+        }
+        else //INSERT oder UPDATE
+        {
+            //daten speichern
+            $rag["ragbez"] = substr($rag["ragbez"],0,100);
+            $rag["ragbezk"] = substr($rag["ragbezk"],0,10);
+            if ($rag["ragbezk"] < "!") $rag["ragbezk"] = null;
+            if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+            
+            $stmt = $dbc -> stmtinit();
+            if (is_object($stmt))
+            {
+                if ($ragid)
+                {   //UPDATE
+                    
+                    $stmt -> prepare("UPDATE fhiiqm.RaumArb_Gruppe SET
+                                rag_bez = ?,
+                                rag_bezk = ?,
+                                abt_ID = ?
+                                WHERE rag_ID = ?");
+                    $stmt -> bind_param('ssii',$rag["ragbez"],$rag["ragbezk"],$rag["abt"],$ragid);
+                    $result = $stmt -> execute();
+                    if ($stmt->error) echo "error UPDATE AG: " . $stmt->error . "<br><br>\n";
+                }
+                else
+                {   //INSERT
+                    $stmt -> prepare ("INSERT INTO RaumArb_Gruppe (rag_bez,rag_bezk,abt_ID) VALUES(?,?,?)"); 
+                    $stmt -> bind_param('ssi',$rag["ragbez"],$rag["ragbezk"],$rag["abt"]);        
+                    $result = $stmt -> execute();      
+                    if ($stmt->error) echo "error INSERT AG: " . $stmt->error . "<br><br>\n";
+                    else
+                    {// rag_ID ermitteln
+                        $ragid = $dbc -> insertId();
+                    }
+                }
+            }
+            if ($result) // INSERT/UPDATE Info
+            {
+                //Eingabe Daten erfolgreich 
+                    echo "<p class='green'><b>AG '".$rag["ragbez"]."' wurde erfolgreich gespeichert.</b></p>\n";
+                    echo "<br /><br />\n";
+            }
+        }
+        echo "</div>";
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"rag_flist.php?$getp\" target=\"_self\" title=\"AG-Liste\">AG-Liste</a></p>\n"; 
+        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"".$_SERVER["PHP_SELF"]."\" target=\"_self\" title=\"AG erfassen\">Weitere AG erfassen</a></p>\n";    
+    }
+    
+?>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/rag_flist.php	Wed Aug 06 09:42:40 2014 +0200
@@ -0,0 +1,189 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 07/2014
+ * 
+ * Liste (Raum-)Arbeitsgruppen
+ */
+    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("pr",$_SESSION["recht"]) && !in_array("pe",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+<!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="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen" /> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> 
+
+	<title>Liste Arbeitsgruppen</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/reseller_programm.png\" border=\"0\" alt=\"Arbeitsgruppen\" title=\"Arbeitsgruppen\"/></div>\n";
+
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(4=>"Abteilung");
+
+    $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 = "";
+    if ($sort == 4) $sort = "4 $dir, 2";
+    $getp = "&st=$start&z=$zeil&s=$sort&d=$dir&f=$fnum&b=$filter"; //Link fuer Beauftragungenliste zurueck
+
+    include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+
+    $sql = "SELECT rag_ID,rag_bez,rag_bezk,abt_name, abt_long 
+            FROM RaumArb_Gruppe rag LEFT JOIN Abteilung a ON rag.abt_ID=a.abt_ID";
+    if ($filter) $wher .= " WHERE abt_name LIKE '$filter%' "; else $wher = "";
+    $sql .= "$wher ORDER BY $sort $dir LIMIT $start, $zeil";
+//    echo "sql = $sql<br />";
+    $result = $dbc ->queryObjectArray($sql);
+    
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+     
+        echo "<div align='center'>\n";
+        echo "<p><b>Liste Arbeitsgruppen</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,  
+            '<img src='/fhiiqm/img/duplicate.gif' border='0' hight='11'>' - Duplizieren der Arbeitsgruppe</td></tr>\n";
+        echo "</table>\n";
+
+        $panz = $dbc -> querySingleItem("SELECT COUNT(*) FROM RaumArb_Gruppe rag LEFT JOIN Abteilung a ON rag.abt_ID=a.abt_ID $wher");
+        printf ("<p>Anzahl Arbeitsgruppen: %s</p>", $panz);
+        
+        if (isset($fnum) && $fnum>1 && !$filter && !$subf)
+        {
+            // Formular anzeigen fuer Filterbegriff
+            $text = $fields[$fnum];
+            $azeil = array(10=>'10',25=>'25',50=>'50',100=>'100',1000=>'alle');
+            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: </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"10\" maxlength=\"30\" value=\"$filter\"/></td>";
+            echo "<td>Zeilen/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>\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,"AG",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(3,"AG kurz.",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(4,"Abt",$sort,$dir,4,$fnum,$filter,$start,$zeil);
+        tab_column(5,"Abt. lang",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        echo "<th>&nbsp;</th>";
+        echo "<th>&nbsp;</th></tr>\n";
+        
+        foreach ($result as $row)
+        {
+			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+            echo "<tr bgcolor='" . $bg . "'><td>$row->rag_bez</td>";
+            echo "<td>$row->rag_bezk</td>";
+            echo "<td>$row->abt_name</td>";
+            echo "<td>$row->abt_long</td>";
+            echo "<td><a href='/fhiiqm/rag_ed.php?i=$row->rag_ID&$getp'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>";
+            echo "<td><a href='/fhiiqm/rag_ed.php?i=$row->rag_ID&dp=1$getp'><img src=\"/fhiiqm/img/duplicate.gif\" alt='duplizieren' title='duplizieren' border='0'/></a></td></tr>\n";
+       }       
+        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";
+        else
+        {
+            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=\"Arbeitsgruppen\" class=\"sc\">Arbeitsgruppen</a></p>\n";
+        }
+        
+    }
+    $dbc -> close();
+    if (!is_null($_SESSION["recht"]) && in_array("pe",$_SESSION["recht"]))
+        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/rag_ed.php\" target=\"_self\" title=\"Arbeitsgruppe erfassen\" class=\"sc\">Weitere Arbeitsgruppe erfassen</a></p>\n";    
+
+?>
+</body>
+</html>  
\ No newline at end of file
--- a/fhiiqm/raum_report.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/raum_report.php	Wed Aug 06 09:42:40 2014 +0200
@@ -86,6 +86,13 @@
                 <br />&nbsp;&nbsp;&nbsp;Ansicht: Datenblatt 'Dauerbetrieb' (Haus, Raum-Nr., Raum-Bezeichnung, Raum-Typ, Geräte-Anzahl, Gefährdungen, Verantwortliche, Raum-Nutzer)
             </td>
         </tr>
+        <tr>
+            <td class="bigger">
+                <a href="/fhiiqm/report/raum_reinig_report.php" title="Raum-Reinigung">Raum - Reinigung</a>
+                <br />&nbsp;&nbsp;&nbsp;Auswahl: Haus, Raum
+                <br />&nbsp;&nbsp;&nbsp;Ansicht: Haus, Raum-Nr., Raum-Bezeichnung, Reinigungs-Typ, Reinigungs-Turnus, Boden-Typ, Reinigungs-Fl&auml;che
+            </td>
+        </tr>
     </table>
     </div>    
 
--- a/fhiiqm/recht_ed.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/recht_ed.php	Wed Aug 06 09:42:40 2014 +0200
@@ -50,7 +50,11 @@
         $("#persknr").autocomplete({
                 source: "/fhiiqm/inc/ma_list_ac.inc.php",
     			minLength: 2,
-                select: function(event,ui){$("#pid").val(ui.item.id);}
+                select: function(event,ui){
+                    $("#pid").val(ui.item.id);
+                    $("#sn").val(ui.item.sn);
+                    $("#gn").val(ui.item.gn);
+                    }
     		});
         $("input").filter("long20").addClass("long20");
         });
@@ -64,6 +68,7 @@
     echo "<div class=\"float-r\"><img src=\"img/user_go.png\" border=\"0\" alt=\"User, Rechte eingeben\" title=\"User, Rechte eingeben\"/></div>\n";
 
 	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
 	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
     
 	$pget   = $_GET["pid"];
@@ -97,6 +102,18 @@
                         $rt["prodg"][] = $row->prod_group_ID;
             }
         }
+        if (isset($rt["sn"]) && $rt["sn"]>"!") // nachname
+        {
+            $sn = substr($rt["sn"],0, strpos($rt["sn"],","));
+            $info = ldap_search_uid($sn,$rt["gn"]);
+            if (isset($info) && count($info))
+            {
+                for ($i=0; $i<count($info); $i++)
+                { 
+                    $rt["userid"] = $info[$i][0];
+                }
+            }
+        }
         
         include_once("form/recht_form.inc.php");
 
--- a/fhiiqm/report/info_report_gvp.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/report/info_report_gvp.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,369 +1,369 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 02/2012
- * 
- * Report Info (GVP)
- * 
- */
-
-    error_reporting(E_ALL ^ E_NOTICE);
-    
-    session_start();
-    if (! isset($_SESSION["userid"]))
-    { 
-        include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");	
-        login($_SERVER["PHP_SELF"]);
-        exit;
-    }
-    
-    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ir",$_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-?>
-<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
-
-	<title>Gesch&auml;ftsverteilungsplan</title>
-</head>
-
-<body >
-
-<?php
-	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
-
-	$dbc = new dbconnection();
-
-    $report = $_GET["r"]; // Berichtstyp: 'p' -> Produkte, 'k' -> Kennzahlen 
-    $create = $_POST["create"];
-    $inf    = $_POST["inf"];
-//    $sort = array("-1"=>"","15"=>"Kennzeichen","2"=>"Teilgebiet");
-
-    echo "&nbsp;";  
-    echo "<div class=\"float-br smaller sc\" 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 sc\"><img src=\"/fhiiqm/img/document_image_ver.png\" border=\"0\" alt=\"Infodaten\" title=\"Infodaten\"/></div>\n";
-
-    if (!isset($create) || !$create)
-    {   // Form Kriterien
-        echo "<div align=\"center\">";
-        echo "<h3>Gesch&auml;ftsverteilungsplan</h3>\n";
-
-        echo "<p>Bitte die Kriterien für den Bericht wählen</p>\n";
-        
-        echo "<form action=\"". $_SERVER['PHP_SELF'] ."?r=$report\" method=\"post\" enctype=\"application/x-www-form-urlencoded\" name=\"form_inf\">\n";
-        echo "<table width=\"30%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
-        echo "<tr>";
-//        echo "<tr><td>Infotyp wie</td><td><input name='inf[ityp]' type='text' size='10' maxlength='50' value='". $inf['ityp'] ."' /></td>";
-        if ($report == 'k')
-        {
-           echo "<td>Kennzeichen wie</td><td><input name='inf[kz]' type='text' size='10' maxlength='10' value='". $inf['kz'] ."' /></td>"; 
-        }
-        else
-        {
-            echo "<td>Produktbereich</td>";
-            echo "<td><select name='inf[prodb]'>";
-                    if (is_array($inf['prodb'])) $select = in_array( "-1", $inf['prodb'] ) ? ' selected' : null;
-                    echo "<option $select value=\"-1\"></option>\n";
-                    $sql = "SELECT prod_ber_ID,prod_ber_name FROM Produkt_Bereich ORDER BY 1";  
-                    if ($result = $dbc->queryObjectArray($sql))
-                    {
-                        foreach ($result as $row)
-                        {
-                            $prod=str_replace(" ","&nbsp;",htmlentities($row->prod_ber_name));
-                            if (is_array($inf['prodb'])) $select = in_array($row->prod_ber_ID, $inf['prodb']) ? ' selected' : null;
-                            echo "<option  $select value=\"|$row->prod_ber_ID|\">$row->prod_ber_ID $prod</option>\n";
-                        }
-                    }
-            echo "</select></td></tr>";
-            echo "<tr><td>Produktgruppe</td>";
-            echo "<td><select name='inf[prodg]'>";
-                if ($inf["prodg"] == -1) $select = " selected "; else $select = "";
-                echo "<option $select value=\"-1\"></option>\n";
-                $sql = "SELECT prod_group_ID, prod_group_name, prod_group_hier FROM Produkt_Gruppe ORDER BY 3";
-                if ($result = $dbc->queryObjectArray($sql))
-                {
-                    $select = "";
-                    foreach ($result as $row)
-                    {
-                        if (isset($inf["prodg"])) $select = ($row->prod_group_ID == $inf["prodg"] ) ? ' selected' : null;
-            			   echo "<option $select value=\"|$row->prod_group_ID|\">$row->prod_group_hier $row->prod_group_name</option>\n";
-                    }
-                }
-            echo "</select></td>";
-            echo 
-            "</tr>\n";
-        }
-            echo "<tr><td>Status Freigabe</td>";
-            echo "<td><select name='inf[stat]'>";
-                if ($inf["stat"] == -1) $select = " selected "; else $select = "";
-                echo "<option $select value=\"-1\"></option>\n";
-                $sql = "SELECT info_freigabe_ID, info_freigabe_bez FROM Info_Freigabe ORDER BY 2";
-                if ($result = $dbc->queryObjectArray($sql))
-                {
-                    $select = "";
-                    foreach ($result as $row)
-                    {
-                        if (isset($inf["stat"])) $select = ($row->info_freigabe_ID == $inf["stat"] ) ? ' selected' : null;
-            			   echo "<option $select value=\"$row->info_freigabe_ID\">$row->info_freigabe_ID - $row->info_freigabe_bez</option>\n";
-                    }
-                }
-            echo "</select></td></tr>\n";
-
-/*        echo "<tr><td>Sortierung nach</td>";
-        echo "<td><select name='inf[sort]'>";
-        foreach ($sort as $key=>$val)
-        { 
-            if ($inf["sort"] == $key) $select= " selected"; else $select = "";
-            echo "<option$select value='$key'>$val</option>\n";
-        }
-        echo "</select></td></tr>";
-*/    
-        echo "    <tr> 
-                <td>&nbsp;</td>
-                <td colspan='3'><input class=\"button\" type=\"submit\" name=\"create\" value=\"Bericht erstellen\"></td>
-            </tr>
-            </table>\n
-            </form>\n
-            </div>\n";
-        
-//        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a></p>\n";    
-    }    
-    else
-    {
-        // Auswertung Kriterien
-//        if ($inf["ityp"]) $ityp = "'" . $inf["ityp"] . "'"; else $ityp = "''";
-        echo "<span  class=\"sc\">";
-        echo "<br />&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/info_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a>";
-        echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "?r=$report\" target=\"_self\" title=\"Report Info GVP\">neuer Bericht GVP </a></span>\n";
-        if ($inf['stat'] > -1) // Status Freigabe
-        {
-            $stat = $inf['stat'];
-            $statb = $dbc -> querySingleItem("SELECT info_freigabe_bez FROM Info_Freigabe WHERE info_freigabe_ID=$stat");
-        }
-        else $stat = "''";
-        if ($report == 'k')
-        {
-            if ($inf["kz"] && $inf["kz"] > "!") $kz = "'".$inf["kz"]."'";
-            else $kz = "''";
-            // Parameter: 4:ifotyp=6, 15:Kz, 16:freigabe
-            $sql = "CALL info_report(15,'',4,6,15,$kz,16,$stat,0,100,@anz)";
-    
-            $result = $dbc ->queryObjectArray($sql);
-            if ($dbc -> error) echo "$sql<br />".$dbc -> error."<br />";
-    
-            if ($kz > "''") $filter = "Filter: [Kennzeichen wie $kz]"; else $filter = "Filter: []";
-            $kz =" nach Kennzeichen";
-        }
-        else
-        {
-            if ($inf["prodb"] && $inf["prodb"] != '-1')
-            {  
-                $prodb = $inf["prodb"];
-                $sql = "SELECT prod_ber_name FROM Produkt_Bereich WHERE prod_ber_ID = REPLACE('" .$inf["prodb"] ."','|','')";
-                $prodbb = $dbc -> querySingleItem($sql);
-            }    
-            else $prodb = "''";
-            if ($inf["prodg"] && $inf["prodg"] != '-1')
-            {  
-                $prodg = $inf["prodg"];
-                $sql = "SELECT prod_group_name FROM Produkt_Gruppe WHERE prod_group_ID = REPLACE('" .$inf["prodg"] ."','|','')";
-                $prodgb = $dbc -> querySingleItem($sql);
-            }    
-            else $prodg = "''";
-            if ($prodb > "''" && $prodg > "''") $prod = "'" . $prodg . substr($prodb,1) . "'";
-            elseif ($prodb > "''" && $prodg == "''") $prod = "'" . $prodb . "'";
-            elseif ($prodb == "''" && $prodg > "''") $prod = "'" . $prodg . "'";
-            else $prod = "''";
-    
-            if ($inf["sort"] && $inf["sort"] != '-1') $sor = $inf["sort"]; else $sor=15;
-            // Parameter: 4:ifotyp=6, 5:produkt, 16:freigabe
-            // es wird immer nach Kennzeichen Info sortiert
-            $sql = "CALL info_report($sor,'',4,6,5,$prod,16,$stat,0,500,@anz)";
-    
-            $result = $dbc ->queryObjectArray($sql);
-            if ($dbc -> error) echo "$sql<br />".$dbc -> error."<br />";
-            //Filteranzeige
-            if ($prodbb && $prodgb)
-                $filter = "[Produktbereich = $prodbb] UND [Produktgruppe = $prodgb]";
-            elseif ($prodbb && !$prodgb)
-                $filter = "[Produktbereich = $prodbb]";
-            elseif (!$prodbb && $prodgb)
-                $filter = "[Produktgruppe = $prodgb]";
-            else $filter = "[]";
-            $filter = "Filter: $filter";
-        }
-        if ($statb) $filter = ($filter > " ") ? "$filter UND [Status Freigabe = $statb]" : "[Status Freigabe = $statb]";
-        
-        echo "<div class='sc' align='center'><h3>Gesch&auml;ftsverteilungsplan$kz</h3></div>\n"; // Anzeige nur Screen
-        echo "<div align='center'>\n";
-        
-//        echo "<p>Kriterien: Infotyp wie $ityp, Produktbereich = '" .$prodbb. "', Produktgruppe = '" .$prodgb. "'; Sortierung nach ".$sort[$sor] . " </p>";
-        
-        if ($result)
-        {
-            echo "<p class='sc'>$filter</p>";
-            $ianz = $dbc -> querySingleItem("SELECT @anz");
-            echo "<p class='sc'>Anzahl Aufgaben:&nbsp;&nbsp;&nbsp;$ianz</p>";
-         
-            if ($report == 'k')
-            {
-                $start = true;
-                if (!$start) echo "</table>\n<p style=\"page-break-after:always\">&nbsp;</p>";
-                echo "<div class='pr' align='center'><h3>Gesch&auml;ftsverteilungsplan nach Kennzeichen</h3></div>\n"; // Anzeige nur im Ausdruck
-                echo "<table border='1' cellspacing='0' cellpadding='2' width=99%>\n";
-                // Listenkopf
-                echo "<tr bgcolor='#68ACBF'>";
-                echo "<th width='5%'>Kennzeichen</th>";
-//                echo "<th width='10%'>Produktgruppe</th>";
-                echo "<th width='25%'>Aufgabe (prod)</th>";
-                echo "<th width='35%'>Teilgebiet (kurzinfo)</th>";
-                echo "<th colspan='2'>Zust&auml;ndigkeit</th>";
-                if ($stat == "''") echo "<th>Status</th>";
-
-        		$bg1 = "#F8F8F8";
-        		$bg2 = "#DEDFE1";
-        		$bg = "#FFFFFF";
-                foreach ($result as $row)
-                {
-                    //nur jeweils eine Produktzuordnung zu Info
-                    list($prod,$pg,$pb) = explode ('|',$row->prod); // prodgroup, prodbereich stehen innerhalb von |-Zeichen in prod
-                    if ($pg != $pgv)
-                    {
-                        // Produktgruppenname
-                        $sql = "SELECT prod_group_name FROM Produkt_Gruppe WHERE prod_group_ID IN ($pg)";
-                        $pgb = $dbc -> querySingleItem($sql);
-                        //$start = false;
-                    }
-         			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-                    echo "<tr bgcolor='" . $bg . "'>";
-                    echo "<td>$row->infsort</td>";
-//                    echo "<td>$pgb</td>";
-                    echo "<td>$prod</td>";
-//                    echo "<td>$row->iname</td>";
-                    echo "<td>".nl2br($row->ilong)."</td>";
-                    if (strtoupper(substr($row->infsort,0,2)) == 'BK' && $row->betrag)
-                    {
-                        $colsp="";
-                        $betr = "<td class='right'>max. ".number_format($row->betrag,2,",",".")." &euro;</td>";
-                    }
-                    else {$colsp = " colspan='2'"; $betr="";}
-                    echo "<td$colsp>".str_replace(";","<br />",$row->verantw)."</td>";
-                    echo $betr;
-                    if ($stat == "''") echo "<td>$row->freigabe</td>";
-                    echo "</tr>\n";
-                    $pgv = $pg;
-                }
-            }
-            else
-            {
-//                if ($prodgb) echo "<p><b>$prodgb<b></p>";
-                $i=0;
-                foreach ($result as $row)
-                {
-                    if ($i==0)
-                    { 
-                         $vprodid = $row->prodid;
-                    }
-                    $aprod = explode('; ',$row->prod);
-                    $prod=null; 
-                    $pg=null; 
-                    $pb=null;  
-                    foreach ($aprod as $eprod)
-                    { 
-                        list($pro,$prg,$prb) = explode ('|',$eprod); // prodgroup, prodbereich stehen innerhalb von |-Zeichen in prod
-                        $prod .= $pro . "; ";
-                        $pg .=  $prg . ",";
-                        $pb .= $prb . ",";
-                    }
-                    // es wird angenommen, dass jeweils nur 1 Produkt/Info zugeordnet ist
-                    $prod = substr($prod,0,strlen($prod)-2);
-                    $pg   = substr($pg,0,strlen($pg)-1);
-                    $pb   = substr($pb,0,strlen($pb)-1);
-//echo "prod = $prod, pg = $pg, pb = $pb <br />";
-                    if ($pb != $vpb)
-                    {
-                        $sql = "SELECT prod_ber_name FROM Produkt_Bereich WHERE prod_ber_ID IN ($pb)";
-                        $pberbez = $dbc -> querySingleItem($sql);
-                    }    
-                    if ($pg != $vpg)
-                    {
-                        if ($i!=0) echo "</table>\n<p style=\"page-break-after:always\">&nbsp;</p>";
-                        echo "<div class='pr' align='center'><h3>Gesch&auml;ftsverteilungsplan</h3></div>\n"; // Anzeige nur im Ausdruck
-                        // Produktbereich immer anzeigen
-                        echo "<p><b>$pberbez</b></p>";
-                        // Produktgruppe fuer Teiliste + Bemerkung
-                        $sql = "SELECT prod_group_name,IFNULL(prod_group_bem,'&nbsp;') AS bem FROM Produkt_Gruppe WHERE prod_group_ID IN ($pg)";
-                        $res = $dbc -> queryObjectArray($sql);
-                        if ($res)
-                        foreach ($res as $ro)
-                            echo "<p><b>".$ro->prod_group_name."</b></p><p>".$ro->bem."</p>";
-
-                        echo "<table border='1' cellspacing='0' cellpadding='2' width=99%>\n";
-                        // Listenkopf
-                        echo "<tr bgcolor='#68ACBF'>";
-                        echo "<th width='5%'>Kennzeichen</th>";
-//                        echo "<th>Infotyp</th>";
-                        echo "<th width='30%'>Aufgabe (prod)</th>";
-                        echo "<th width='30%'>Teilgebiet (kurzinfo)</th>";
-//                        echo "<th width='40%'>Kurzinfo</th>";
-                        echo "<th colspan='2'>Zust&auml;ndigkeit</th>";
-                        if ($stat == "''") echo "<th>Status</th>";
-                		$bg1 = "#F8F8F8";
-                		$bg2 = "#DEDFE1";
-                		$bg = "#FFFFFF";
-                    }
-                    if ($row->prodid != $vprodid && $pg == $vpg) echo "<tr><td colspan='5'>&nbsp;</td></tr>\n";  // Leerzeile  
-        			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-                    echo "<tr bgcolor='" . $bg . "'>";
-                    echo "<td>$row->infsort</td>";
-//                    echo "<td>$row->ityp</td>";
-                    echo "<td>".$prod."</td>";
-//                    echo "<td>$row->iname</td>";
-                    echo "<td>".nl2br($row->ilong)."</td>";
-                    if (strtoupper(substr($row->infsort,0,2)) == 'BK' && $row->betrag)
-                    {
-                        $colsp="";
-                        $betr = "<td class='right'>max. ".number_format($row->betrag,2,",",".")." &euro;</td>";
-                    }
-                    else {$colsp = " colspan='2'"; $betr="";}
-                    echo "<td$colsp>".str_replace(";","<br />",$row->verantw)."</td>";
-                    echo $betr;
-                    if ($stat == "''") echo "<td>$row->freigabe</td>";
-                    echo "</tr>\n";
-                    $vprodid = $row->prodid;
-                    $vpg = $pg;
-                    $vpb = $pb;
-                    $i++;
-                }
-            }
-
-            echo "</table>\n";
-
-            echo "<p></p><table width=99%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'>
-                <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>";
-            
-        }
-        else echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>";
-        
-        echo "</div>\n";
-        echo "<span  class=\"sc\">";
-        echo "<br />&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/info_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a>";
-        echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "?r=$report\" target=\"_self\" title=\"Report Info GVP\">neuer Bericht GVP </a></span>\n";
-    }
-
-?>
-
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 02/2012
+ * 
+ * Report Info (GVP)
+ * 
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");	
+        login($_SERVER["PHP_SELF"]);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ir",$_SESSION["recht"]) && !in_array("ie",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/> 
+
+	<title>Gesch&auml;ftsverteilungsplan</title>
+</head>
+
+<body >
+
+<?php
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+
+	$dbc = new dbconnection();
+
+    $report = $_GET["r"]; // Berichtstyp: 'p' -> Produkte, 'k' -> Kennzahlen 
+    $create = $_POST["create"];
+    $inf    = $_POST["inf"];
+//    $sort = array("-1"=>"","15"=>"Kennzeichen","2"=>"Teilgebiet");
+
+    echo "&nbsp;";  
+    echo "<div class=\"float-br smaller sc\" 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 sc\"><img src=\"/fhiiqm/img/document_image_ver.png\" border=\"0\" alt=\"Infodaten\" title=\"Infodaten\"/></div>\n";
+
+    if (!isset($create) || !$create)
+    {   // Form Kriterien
+        echo "<div align=\"center\">";
+        echo "<h3>Gesch&auml;ftsverteilungsplan</h3>\n";
+
+        echo "<p>Bitte die Kriterien für den Bericht wählen</p>\n";
+        
+        echo "<form action=\"". $_SERVER['PHP_SELF'] ."?r=$report\" method=\"post\" enctype=\"application/x-www-form-urlencoded\" name=\"form_inf\">\n";
+        echo "<table width=\"30%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
+        echo "<tr>";
+//        echo "<tr><td>Infotyp wie</td><td><input name='inf[ityp]' type='text' size='10' maxlength='50' value='". $inf['ityp'] ."' /></td>";
+        if ($report == 'k')
+        {
+           echo "<td>Kennzeichen wie</td><td><input name='inf[kz]' type='text' size='10' maxlength='10' value='". $inf['kz'] ."' /></td>"; 
+        }
+        else
+        {
+            echo "<td>Produktbereich</td>";
+            echo "<td><select name='inf[prodb]'>";
+                    if (is_array($inf['prodb'])) $select = in_array( "-1", $inf['prodb'] ) ? ' selected' : null;
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT prod_ber_ID,prod_ber_name FROM Produkt_Bereich ORDER BY 1";  
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            $prod=str_replace(" ","&nbsp;",htmlentities($row->prod_ber_name));
+                            if (is_array($inf['prodb'])) $select = in_array($row->prod_ber_ID, $inf['prodb']) ? ' selected' : null;
+                            echo "<option  $select value=\"|$row->prod_ber_ID|\">$row->prod_ber_ID $prod</option>\n";
+                        }
+                    }
+            echo "</select></td></tr>";
+            echo "<tr><td>Produktgruppe</td>";
+            echo "<td><select name='inf[prodg]'>";
+                if ($inf["prodg"] == -1) $select = " selected "; else $select = "";
+                echo "<option $select value=\"-1\"></option>\n";
+                $sql = "SELECT prod_group_ID, prod_group_name, prod_group_hier FROM Produkt_Gruppe ORDER BY 3";
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    $select = "";
+                    foreach ($result as $row)
+                    {
+                        if (isset($inf["prodg"])) $select = ($row->prod_group_ID == $inf["prodg"] ) ? ' selected' : null;
+            			   echo "<option $select value=\"|$row->prod_group_ID|\">$row->prod_group_hier $row->prod_group_name</option>\n";
+                    }
+                }
+            echo "</select></td>";
+            echo 
+            "</tr>\n";
+        }
+            echo "<tr><td>Status Freigabe</td>";
+            echo "<td><select name='inf[stat]'>";
+                if ($inf["stat"] == -1) $select = " selected "; else $select = "";
+                echo "<option $select value=\"-1\"></option>\n";
+                $sql = "SELECT info_freigabe_ID, info_freigabe_bez FROM Info_Freigabe ORDER BY 2";
+                if ($result = $dbc->queryObjectArray($sql))
+                {
+                    $select = "";
+                    foreach ($result as $row)
+                    {
+                        if (isset($inf["stat"])) $select = ($row->info_freigabe_ID == $inf["stat"] ) ? ' selected' : null;
+            			   echo "<option $select value=\"$row->info_freigabe_ID\">$row->info_freigabe_ID - $row->info_freigabe_bez</option>\n";
+                    }
+                }
+            echo "</select></td></tr>\n";
+
+/*        echo "<tr><td>Sortierung nach</td>";
+        echo "<td><select name='inf[sort]'>";
+        foreach ($sort as $key=>$val)
+        { 
+            if ($inf["sort"] == $key) $select= " selected"; else $select = "";
+            echo "<option$select value='$key'>$val</option>\n";
+        }
+        echo "</select></td></tr>";
+*/    
+        echo "    <tr> 
+                <td>&nbsp;</td>
+                <td colspan='3'><input class=\"button\" type=\"submit\" name=\"create\" value=\"Bericht erstellen\"></td>
+            </tr>
+            </table>\n
+            </form>\n
+            </div>\n";
+        
+//        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a></p>\n";    
+    }    
+    else
+    {
+        // Auswertung Kriterien
+//        if ($inf["ityp"]) $ityp = "'" . $inf["ityp"] . "'"; else $ityp = "''";
+        echo "<span  class=\"sc\">";
+        echo "<br />&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/info_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a>";
+        echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "?r=$report\" target=\"_self\" title=\"Report Info GVP\">neuer Bericht GVP </a></span>\n";
+        if ($inf['stat'] > -1) // Status Freigabe
+        {
+            $stat = $inf['stat'];
+            $statb = $dbc -> querySingleItem("SELECT info_freigabe_bez FROM Info_Freigabe WHERE info_freigabe_ID=$stat");
+        }
+        else $stat = "''";
+        if ($report == 'k')
+        {
+            if ($inf["kz"] && $inf["kz"] > "!") $kz = "'".$inf["kz"]."'";
+            else $kz = "''";
+            // Parameter: 4:ifotyp=6, 15:Kz, 16:freigabe
+            $sql = "CALL info_report(15,'',4,6,15,$kz,16,$stat,0,100,@anz)";
+    
+            $result = $dbc ->queryObjectArray($sql);
+            if ($dbc -> error) echo "$sql<br />".$dbc -> error."<br />";
+    
+            if ($kz > "''") $filter = "Filter: [Kennzeichen wie $kz]"; else $filter = "";
+            $kz =" nach Kennzeichen";
+        }
+        else
+        {
+            if ($inf["prodb"] && $inf["prodb"] != '-1')
+            {  
+                $prodb = $inf["prodb"];
+                $sql = "SELECT prod_ber_name FROM Produkt_Bereich WHERE prod_ber_ID = REPLACE('" .$inf["prodb"] ."','|','')";
+                $prodbb = $dbc -> querySingleItem($sql);
+            }    
+            else $prodb = "''";
+            if ($inf["prodg"] && $inf["prodg"] != '-1')
+            {  
+                $prodg = $inf["prodg"];
+                $sql = "SELECT prod_group_name FROM Produkt_Gruppe WHERE prod_group_ID = REPLACE('" .$inf["prodg"] ."','|','')";
+                $prodgb = $dbc -> querySingleItem($sql);
+            }    
+            else $prodg = "''";
+            if ($prodb > "''" && $prodg > "''") $prod = "'" . $prodg . substr($prodb,1) . "'";
+            elseif ($prodb > "''" && $prodg == "''") $prod = "'" . $prodb . "'";
+            elseif ($prodb == "''" && $prodg > "''") $prod = "'" . $prodg . "'";
+            else $prod = "''";
+    
+            if ($inf["sort"] && $inf["sort"] != '-1') $sor = $inf["sort"]; else $sor=15;
+            // Parameter: 4:ifotyp=6, 5:produkt, 16:freigabe
+            // es wird immer nach Kennzeichen Info sortiert
+            $sql = "CALL info_report($sor,'',4,6,5,$prod,16,$stat,0,500,@anz)";
+    
+            $result = $dbc ->queryObjectArray($sql);
+            if ($dbc -> error) echo "$sql<br />".$dbc -> error."<br />";
+            //Filteranzeige
+            if ($prodbb && $prodgb)
+                $filter = "[Produktbereich = $prodbb] UND [Produktgruppe = $prodgb]";
+            elseif ($prodbb && !$prodgb)
+                $filter = "[Produktbereich = $prodbb]";
+            elseif (!$prodbb && $prodgb)
+                $filter = "[Produktgruppe = $prodgb]";
+            else $filter = "[]";
+            $filter = "Filter: $filter";
+        }
+        if ($statb) $filter = ($filter > " ") ? "$filter UND [Status Freigabe = $statb]" : "Filter: [Status Freigabe = $statb]";
+        
+        echo "<div class='sc' align='center'><h3>Gesch&auml;ftsverteilungsplan$kz</h3></div>\n"; // Anzeige nur Screen
+        echo "<div align='center'>\n";
+        
+//        echo "<p>Kriterien: Infotyp wie $ityp, Produktbereich = '" .$prodbb. "', Produktgruppe = '" .$prodgb. "'; Sortierung nach ".$sort[$sor] . " </p>";
+        
+        if ($result)
+        {
+            echo "<p class='sc'>$filter</p>";
+            $ianz = $dbc -> querySingleItem("SELECT @anz");
+            echo "<p class='sc'>Anzahl Aufgaben:&nbsp;&nbsp;&nbsp;$ianz</p>";
+         
+            if ($report == 'k')
+            {
+                $start = true;
+                if (!$start) echo "</table>\n<p style=\"page-break-after:always\">&nbsp;</p>";
+                echo "<div class='pr' align='center'><h3>Gesch&auml;ftsverteilungsplan nach Kennzeichen</h3></div>\n"; // Anzeige nur im Ausdruck
+                echo "<table border='1' cellspacing='0' cellpadding='2' width=99%>\n";
+                // Listenkopf
+                echo "<tr bgcolor='#68ACBF'>";
+                echo "<th width='5%'>Kennzeichen</th>";
+//                echo "<th width='10%'>Produktgruppe</th>";
+                echo "<th width='25%'>Aufgabe (prod)</th>";
+                echo "<th width='35%'>Teilgebiet (kurzinfo)</th>";
+                echo "<th colspan='2'>Zust&auml;ndigkeit</th>";
+                if ($stat == "''") echo "<th>Status</th>";
+
+        		$bg1 = "#F8F8F8";
+        		$bg2 = "#DEDFE1";
+        		$bg = "#FFFFFF";
+                foreach ($result as $row)
+                {
+                    //nur jeweils eine Produktzuordnung zu Info
+                    list($prod,$pg,$pb) = explode ('|',$row->prod); // prodgroup, prodbereich stehen innerhalb von |-Zeichen in prod
+                    if ($pg != $pgv)
+                    {
+                        // Produktgruppenname
+                        $sql = "SELECT prod_group_name FROM Produkt_Gruppe WHERE prod_group_ID IN ($pg)";
+                        $pgb = $dbc -> querySingleItem($sql);
+                        //$start = false;
+                    }
+         			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+                    echo "<tr bgcolor='" . $bg . "'>";
+                    echo "<td>$row->infsort</td>";
+//                    echo "<td>$pgb</td>";
+                    echo "<td>$prod</td>";
+//                    echo "<td>$row->iname</td>";
+                    echo "<td>".nl2br($row->ilong)."</td>";
+                    if (strtoupper(substr($row->infsort,0,2)) == 'BK' && $row->betrag)
+                    {
+                        $colsp="";
+                        $betr = "<td class='right'>max. ".number_format($row->betrag,2,",",".")." &euro;</td>";
+                    }
+                    else {$colsp = " colspan='2'"; $betr="";}
+                    echo "<td$colsp>".str_replace(";","<br />",$row->verantw)."</td>";
+                    echo $betr;
+                    if ($stat == "''") echo "<td>$row->freigabe</td>";
+                    echo "</tr>\n";
+                    $pgv = $pg;
+                }
+            }
+            else
+            {
+//                if ($prodgb) echo "<p><b>$prodgb<b></p>";
+                $i=0;
+                foreach ($result as $row)
+                {
+                    if ($i==0)
+                    { 
+                         $vprodid = $row->prodid;
+                    }
+                    $aprod = explode('; ',$row->prod);
+                    $prod=null; 
+                    $pg=null; 
+                    $pb=null;  
+                    foreach ($aprod as $eprod)
+                    { 
+                        list($pro,$prg,$prb) = explode ('|',$eprod); // prodgroup, prodbereich stehen innerhalb von |-Zeichen in prod
+                        $prod .= $pro . "; ";
+                        $pg .=  $prg . ",";
+                        $pb .= $prb . ",";
+                    }
+                    // es wird angenommen, dass jeweils nur 1 Produkt/Info zugeordnet ist
+                    $prod = substr($prod,0,strlen($prod)-2);
+                    $pg   = substr($pg,0,strlen($pg)-1);
+                    $pb   = substr($pb,0,strlen($pb)-1);
+//echo "prod = $prod, pg = $pg, pb = $pb <br />";
+                    if ($pb != $vpb)
+                    {
+                        $sql = "SELECT prod_ber_name FROM Produkt_Bereich WHERE prod_ber_ID IN ($pb)";
+                        $pberbez = $dbc -> querySingleItem($sql);
+                    }    
+                    if ($pg != $vpg)
+                    {
+                        if ($i!=0) echo "</table>\n<p style=\"page-break-after:always\">&nbsp;</p>";
+                        echo "<div class='pr' align='center'><h3>Gesch&auml;ftsverteilungsplan</h3></div>\n"; // Anzeige nur im Ausdruck
+                        // Produktbereich immer anzeigen
+                        echo "<p><b>$pberbez</b></p>";
+                        // Produktgruppe fuer Teiliste + Bemerkung
+                        $sql = "SELECT prod_group_name,IFNULL(prod_group_bem,'&nbsp;') AS bem FROM Produkt_Gruppe WHERE prod_group_ID IN ($pg)";
+                        $res = $dbc -> queryObjectArray($sql);
+                        if ($res)
+                        foreach ($res as $ro)
+                            echo "<p><b>".$ro->prod_group_name."</b></p><p>".$ro->bem."</p>";
+
+                        echo "<table border='1' cellspacing='0' cellpadding='2' width=99%>\n";
+                        // Listenkopf
+                        echo "<tr bgcolor='#68ACBF'>";
+                        echo "<th width='5%'>Kennzeichen</th>";
+//                        echo "<th>Infotyp</th>";
+                        echo "<th width='30%'>Aufgabe (prod)</th>";
+                        echo "<th width='30%'>Teilgebiet (kurzinfo)</th>";
+//                        echo "<th width='40%'>Kurzinfo</th>";
+                        echo "<th colspan='2'>Zust&auml;ndigkeit</th>";
+                        if ($stat == "''") echo "<th>Status</th>";
+                		$bg1 = "#F8F8F8";
+                		$bg2 = "#DEDFE1";
+                		$bg = "#FFFFFF";
+                    }
+                    if ($row->prodid != $vprodid && $pg == $vpg) echo "<tr><td colspan='5'>&nbsp;</td></tr>\n";  // Leerzeile  
+        			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+                    echo "<tr bgcolor='" . $bg . "'>";
+                    echo "<td>$row->infsort</td>";
+//                    echo "<td>$row->ityp</td>";
+                    echo "<td>".$prod."</td>";
+//                    echo "<td>$row->iname</td>";
+                    echo "<td>".nl2br($row->ilong)."</td>";
+                    if (strtoupper(substr($row->infsort,0,2)) == 'BK' && $row->betrag)
+                    {
+                        $colsp="";
+                        $betr = "<td class='right'>max. ".number_format($row->betrag,2,",",".")." &euro;</td>";
+                    }
+                    else {$colsp = " colspan='2'"; $betr="";}
+                    echo "<td$colsp>".str_replace(";","<br />",$row->verantw)."</td>";
+                    echo $betr;
+                    if ($stat == "''") echo "<td>$row->freigabe</td>";
+                    echo "</tr>\n";
+                    $vprodid = $row->prodid;
+                    $vpg = $pg;
+                    $vpb = $pb;
+                    $i++;
+                }
+            }
+
+            echo "</table>\n";
+
+            echo "<p></p><table width=99%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'>
+                <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>";
+            
+        }
+        else echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>";
+        
+        echo "</div>\n";
+        echo "<span  class=\"sc\">";
+        echo "<br />&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/info_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a>";
+        echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "?r=$report\" target=\"_self\" title=\"Report Info GVP\">neuer Bericht GVP </a></span>\n";
+    }
+
+?>
+
+</body>
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/report/raum_reinig_report.php	Wed Aug 06 09:42:40 2014 +0200
@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 02/2014
+ * 
+ * Report Raeume, Reinigung
+ * $_GET['s']=2 - Aufruf aus adm-fhi-Seite ohne Anmeldung
+ * 
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    if (!isset($_GET['s']) || $_GET['s'] != 2 )
+    {
+        session_start();
+        if (! isset($_SESSION["userid"]))
+        { 
+            include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");	
+            login($_SERVER["PHP_SELF"]);
+            exit;
+        }
+        
+        if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("rr",$_SESSION["recht"]) && !in_array("re",$_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 href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS"  media="screen"/> 
+   	<link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS"  media="print"/> 
+	<title>Report Raum - Reinigung</title>
+</head>
+
+<body>
+
+<?php    
+    echo "&nbsp;";  
+    if (!isset($_GET['s']) || $_GET['s'] != 2 )
+    {
+        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";
+    }
+    else
+        echo "<br />&nbsp;&nbsp;&nbsp;<a href='javascript:history.back();' onMouseOver=\"{window.status='Zur&uuml;ck'; return true;}\">&laquo; Zur&uuml;ck</a>";
+    echo "<div class=\"float-r\"><img src=\"/fhiiqm/img/house.png\" border=\"0\" alt=\"Raum\" title=\"Raum\"/></div>\n";
+
+    $rag    = $_POST["rag"];    // Parameter aus Form
+    $search = $_POST["search"];
+    if (!$search) $search =  $_GET["s"];
+
+    $zeil = $rag["z"];
+    if (!$zeil) $zeil = $_GET["z"];
+    if (!$zeil) $zeil = 9999; // Anzahl der gezeigten Zeilen
+    $start = $_GET["st"];   // Start bei DS $start+1
+    if (!$start) $start=0;
+    
+
+    if (!is_array($rag))
+    {
+        $rag["geb"]     = $_GET["g"];
+        $rag["rnum"]    = $_GET["r"];
+        $rag["rtyp"]    = $_GET["t"];
+        $rag["bind"]    = $_GET["b"];
+        $rag["sort1"]   = $_GET["s1"];
+        $rag["sort2"]   = $_GET["s2"];
+        $rag["sort3"]   = $_GET["s3"];
+    }
+    $_GET["g"] = $rag["geb"];
+    $_GET["r"] = $rag["rnum"];
+    $_GET["t"] = $rag["rtyp"];
+    $_GET["b"] = $rag["bind"];
+    $_GET["s1"] = $rag["sort1"];
+    $_GET["s2"] = $rag["sort2"];
+    $_GET["s3"] = $rag["sort3"];
+    $_GET["z"]  = $zeil;
+   
+    if ($search && $_GET['s'] != 2)
+    {    
+        echo "<span class='sc'>";
+        echo "<br />&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/raum_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a>";
+        echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Raum-Reinigung\" class=\"sc\">neuer Raum - Reinigung Bericht</a>\n";    
+        echo "</span>";
+    }
+    echo "<div align='center'>\n";
+    echo "<p><b>Bericht Raum - Reinigung</b></p>\n";
+    echo "</div>\n";
+    
+
+    if (!$search)
+    {
+?>
+        <div align="center">
+        <p>Bitte Kriterien f&uuml;r die Suche w&auml;hlen</p>
+        <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="form_raum" target="_self">	
+        <table width="50%" border="0" cellspacing="3" cellpadding="3">
+            <tr>
+                <td>Haus</td>
+                <td>
+                    <select name="rag[geb]" size="1" onchange="this.form.submit();">
+                    <?php 
+                        if ($rag["geb"] == -1) $select = " selected "; else $select = "";
+                        echo "<option $select value=\"-1\"></option>\n";
+                        $sql = "SELECT geb_ID, geb_name FROM Haus ORDER BY 1";
+                        if ($result = $dbc->queryObjectArray($sql))
+                        {
+                            foreach ($result as $row)
+                            {
+                                if ($row->geb_ID == $rag['geb'])
+            					   echo "<option selected value=\"$row->geb_ID\">$row->geb_ID - $row->geb_name</option>\n";
+            				    else
+            					   echo "<option value=\"$row->geb_ID\">$row->geb_ID - $row->geb_name</option>\n";
+                            }
+                        }
+                    ?>
+                    </select>
+                </td>
+            </tr>
+            <tr><td>&nbsp;</td><td>oder</td></tr>
+            <tr>
+                <td>Raum-Nummer</td>
+                <td><select name="rag[rnum]">
+                    <?php 
+                        if ($rag["rnum"] == -1) $select = " selected "; else $select = "";
+                        echo "<option $select value=\"-1\"></option>\n";
+                        if (isset($rag["geb"]) && $rag["geb"] > -1) $where = " WHERE geb_ID = '".$rag["geb"]."'"; else $where = "";
+                        echo "Gebaeude: ".$rag["geb"]."<br />\n";
+                        $sql = "SELECT geb_ID, raum_ID,raum_nr,raum_name FROM fhiiqm.Raum $where ORDER BY 1,3";
+                        if ($result = $dbc->queryObjectArray($sql))
+                        {
+                            foreach ($result as $row)
+                            {
+                                if ($row->raum_ID == $rag['rnum'])
+            					   echo "<option selected value=\"$row->raum_ID\">$row->geb_ID - $row->raum_nr, $row->raum_name</option>\n";
+            				    else
+            					   echo "<option value=\"$row->raum_ID\">$row->geb_ID - $row->raum_nr, $row->raum_name</option>\n";
+                            }
+                        }
+                    ?>
+                    </select>
+                </td>
+            </tr>
+<!--            <tr> 
+                  <td>Verkn&uuml;pfung</td>
+                  <td>UND&nbsp;&nbsp;&nbsp;
+                    <input type="radio" name="rag[bind]" value="AND" <?php //if (isset($rag["bind"]) && $rag["bind"]=="AND") echo "checked"; else  echo "checked";?>>
+                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ODER&nbsp;&nbsp;&nbsp;
+                    <input type="radio" name="rag[bind]" value="OR" <?php //if (isset($rag["bind"]) && $rag["bind"]=="OR") echo "checked"; ?>></td>
+            </tr> -->
+            <tr>
+                <td>Sortierung nach<br />(in dieser Reihenfolge)</td><td>
+            <?php
+                $sort = array("-1"=>"","4"=>"Geb&auml;ude","2"=>"Raum-Nr.");
+                for ($i=1; $i<3; $i++)
+                { 
+                  echo "$i.&nbsp;&nbsp;<select name='rag[sort$i]'>\n";
+                  foreach ($sort as $key=>$val)
+                  {
+                    $rsort = "sort" . $i;
+                    if ($rag[$rsort] == $val) $select= " selected"; else $select = "";
+                    echo "<option$select value='$key'>$val</option>\n";
+                  }
+                  echo "</select>&nbsp;&nbsp;&nbsp;&nbsp;\n";
+                } 
+                echo "</td></tr>\n";
+        
+                $azeil = array(10=>'10',20=>'20',25=>'25',50=>'50',100=>'100',9999=>'alle'); // Anzahl gezeigter rows
+                echo "<tr><td>Zeilen/Seite?</td><td><select name='rag[z]'>\n";
+                if (!$rag['z']) $rag['z'] = 9999;
+                foreach ($azeil as $key=>$val)
+                {
+                    if ($key == $rag['z']) $select = "selected"; else $select = "";
+                    echo "<option $select value='$key'>$val</option>\n";
+                }
+                echo "</select></td></tr>\n";
+        
+            ?>
+            <tr> 
+                <td>&nbsp;</td>
+                <td><input class="button" type="submit" name="search" value="Bericht erstellen"/></td>
+            </tr> 
+        </table>
+        </div>
+        </form>
+<?php
+    }
+    else
+    {
+        echo "<div align='center'>\n";
+        
+        if (!$rag["bind"]) $bind = " AND "; else $bind = $rag["bind"];
+        
+        $fnum = 0; $filter = "''";
+        if ($rag["geb"]> -1) {$fnum = 4; $filter = "'$rag[geb]'";}
+        if ($rag["rnum"]> -1)
+        {
+            $fnum = 1; $filter = $rag["rnum"];
+        }
+        if ($rag["sort1"]>0 || $rag["sort2"]>0)
+        {
+            if ($rag["sort1"]>0) $ord = $rag["sort1"];
+            if ($rag["sort2"]>0) $ord = $rag["sort2"];
+        }
+        else $ord = 2;
+        
+        $sql = "CALL raum_flist($ord,'',$fnum,$filter,$start,$zeil,@anz)";
+        
+//        echo "sql = $sql<br />\n";
+        $result = $dbc ->queryObjectArray($sql);
+        
+        if ($rag["geb"] > -1) $krit = " [Geb&auml;ude = '" . $rag["geb"] ."']";
+        if ($rag["rnum"] > -1)
+        { 
+            if ($krit) $bd = " ".$bind; else $bd = "";
+            $rn = $dbc -> querySingleItem("SELECT raum_nr FROM Raum WHERE raum_ID=".$rag["rnum"]);
+            $krit .= $bd." [Raum-Nr = '$rn']";
+        }
+        if ($krit )echo "Suchergebnis f&uuml;r $krit"; else echo "Suchergebnis\n";
+        $ranz = $dbc -> querySingleItem("SELECT @anz");
+        printf ("<p>Anzahl gefundener R&auml;ume: %s</p>", $ranz);
+
+        if ($result)
+        {
+            include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+            
+    		$bg1 = "#F8F8F8";
+    		$bg2 = "#DEDFE1";
+    		$bg = "#FFFFFF";
+            echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
+            // Listenkopf
+            echo "<tr bgcolor='#68ACBF'>";
+            if (!$rag["geb"] || $rag['geb'] == -1) echo "<th>Geb&auml;ude</th>";
+            echo "<th>Raum-Nr.</th>";
+            echo "<th>Raum-Bezeichnung</th>";
+            echo "<th>Reinig.-Typ</th>";
+            echo "<th>Reinig.-Turnus</th>";
+            echo "<th>Boden-Typ</th>";
+            echo "<th>Reinig.-Fl.(m<sup>2</sup>)</th>";
+            echo "</tr>\n";
+
+            foreach ($result as $row)
+            {
+        			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+                    echo "<tr bgcolor='" . $bg . "'>"; 
+                    if (!$rag["geb"] || $rag['geb'] == -1) echo "<td>$row->geb_ID</td>";
+                    echo "<td>$row->raum_nr</td>";
+                    echo "<td>$row->raum_name</td>";
+                    echo "<td>$row->reinigung_typ_ID</td>";
+                    echo "<td>$row->reinigung_turnus_bez</td>";
+                    echo "<td>$row->boden_typ_bez</td>";
+                    echo "<td class='right'>".number_format($row->reinigung_flaeche,2,',','') . "</td></tr>";
+            }
+            echo "</table>\n";
+            echo "<p></p><table width=60%><tr><td class='right'><a href=\"javascript:window.print()\" class='sc'>
+                <img src=\"/fhiiqm/img/printer.png\" alt=\"Bericht drucken\" border=\"0\" align=\"right\" title=\"Bericht drucken\"></a></td></tr></table>";
+            echo "</div>\n";
+        
+            echo "<br />&nbsp;&nbsp;&nbsp;";
+            if ($search != 2) // Aufruf aus fhiiqm
+            {    
+                // Parameter aus $_GET fuer weitere Seiten
+                $_GET["s"] = 1; // bewirkt weitere Suche
+                foreach ($_GET as $key=>$val)
+                {
+                    if ($key != "st") $liste .= "&" . $key ."=".$val;
+                }    
+                // Links auf andere Seiten generieren
+                liste_links($start,$zeil,$ianz,$liste);
+            }
+        }
+        else
+        {
+            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider gibt es kein Ergebnis für die von Ihnen gewählten Kriterien!</p>";
+            echo "</div>\n";
+            echo "<br />&nbsp;&nbsp;&nbsp;";
+        }
+        if ($search != 2)
+        {    
+            echo "<span class='sc'>";
+            echo "<br /><br />&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/raum_report.php\" target=\"_self\" title=\"Berichte\" class='sc'>&laquo; zur Berichts&uuml;bersicht</a>";
+            echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Raum-Reinigung\" class=\"sc\">neuer Raum - Reinigung Bericht</a>\n";    
+            echo "</span>";
+        }
+        else
+            echo "<a href='javascript:history.back();' onMouseOver=\"{window.status='Zur&uuml;ck'; return true;}\">&laquo; Zur&uuml;ck</a>";
+    }
+
+?>
+
+</body>
+</html>
--- a/fhiiqm/vertrag_flist1.php	Fri Jan 17 08:50:55 2014 +0100
+++ b/fhiiqm/vertrag_flist1.php	Wed Aug 06 09:42:40 2014 +0200
@@ -1,287 +1,287 @@
-<?php
-
-/**
- * @author Bettina Schwarzer, Fritz-Haber-Institut
- * @copyright 7/2011
- * 
- * Liste Vertragsdaten mit Sortierung und Filter
- */
-
-    error_reporting(E_ALL ^ E_NOTICE);
-    
-    session_start();
-    if (! isset($_SESSION["userid"]))
-    { 
-        include_once ("inc/func_lib.inc.php");	
-        login("vertrag_flist1.php");
-        exit;
-    }
-    
-    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vr",$_SESSION["recht"]) && !in_array("ve",$_SESSION["recht"])))
-    {
-        header("Location: start.php");
-        exit;
-    }    
-    
-?>
-
-<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> 
-
-	<title>Liste Vertragsdaten</title>
-    <script type="text/javascript">
-        function winopen (addr,title) 
-        {
-          mywin = window.open(addr,title, "width=1400,height=700,left=400,top=300,menubar=yes,status=yes,scrollbars=yes,resizable=yes,toolbar=yes");
-          mywin.focus();
-        }
-    </script>
-</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\">&nbsp;&nbsp;&nbsp;<img src=\"img/document_mark_as_final.png\" border=\"0\" alt=\"Vertr&auml;ge\" title=\"Vertr&auml;ge\"/></div>\n";
-
-    $mfile = $_GET['g']; // Multifile = mehrere Vertragsdokumente moeglich
-    if (!$mfile) $mfile = $_POST['g']; 
-    $zeil = $_GET["z"];
-    if (!$zeil) $zeil = $_POST["z"];
-    if (!$zeil) $zeil = 20; // Anzahl der gezeigten Zeilen
-    $start = $_GET["st"];   // Start bei DS $start+1
-    if (!$start) $start=0;
-    
-    // Felder, nach denen gefiltert werden kann
-    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner");
-    
-	$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($sort) || !$sort) $sort = 2;
-    if (!isset($dir) || !$dir)  $dir = "";
-    // $_GET-Parameter zurueck zur Vertragliste mit den selben Einstellungen wie zuvor fuer Update
-    $getp = "s=$sort&d=$dir&f=$fnum&b=$filter&st=$start&z=$zeil&g=$mfile";
-    
-    // Recht Produktgruppe beruecksichtigen
-    if (is_array($_SESSION["prodg"]))
-    {
-            foreach ($_SESSION["prodg"] as $val)
-                $listg .= "," .$val;
-            $listg = substr($listg,1);
-    }
-    else $listg = "";
-
-//    echo "sort=$sort, fnum=$fnum, filter=$filter <br />";
-    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
-    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
-	$dbc = new dbconnection();
-    
-    echo "<div align='center'>\n";
-//echo "$sort, $dir, $fnum, $filter<br><br>\n";    
-//    $sql = "CALL fhiiqm.vertrag_flist1(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "',$start,$zeil, @anz)";
-    if ($mfile)
-        $sql = "CALL fhiiqm.vertrag_flist1_mf(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "', $start,$zeil, @anz)";
-    else
-        $sql = "CALL fhiiqm.vertrag_flist1_1(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "', $start,$zeil, @anz)";
-    // Parameter: Nr. Sortfelf, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Liste der berechtigten prodgroup, Start bei DS $start+1, Anzahl DS/Seite, Anzahl gefundener Vertraege
-    // liefert Felder: contract_ID,cname,clong,bearb,doc,typ,prod
-    $result = $dbc -> queryObjectArray($sql);
-    if ($result)
-    {
-		$bg1 = "#F8F8F8";
-		$bg2 = "#DEDFE1";
-		$bg = "#FFFFFF";
-        
-        $heute = new DateTime();
-        
-        $vanz = $dbc -> querySingleItem("SELECT @anz");
-        
-        echo "<p><b>Vertr&auml;ge - &Uuml;bersicht</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 jeder Spalte 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' hight='11'>' - Bearbeiten der Vertragsdaten, 
-            '<img src='/fhiiqm/img/file_extension_xls.png' border='0' hight='11'>' - Excel-Export</td></tr>\n";
-        echo "</table>\n";
-        printf ("<p>Anzahl Vertr&auml;ge: %s </p>", $vanz);
-        echo "</div>\n";
-        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_flist12.php?$getp\" class=\"sc\" title=\"Vertragliste 2\" onclick=\"winopen(this.href,'Vertragsliste 2'); return false\">Vertr&auml;ge Teil 2</a></p>\n";
-        echo "<div align='center'>\n";
-        
-
-        if (isset($fnum) && $fnum>1 && !$filter && !$subf)
-        {
-            // Formular anzeigen fuer Filterbegriff
-            $text = $fields[$fnum];
-            $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 "<input type='hidden' name='g' value='$mfile'>";
-            echo "<table width=\"40%\" border=\"0\">\n";
-            echo "<tr><td>filtern nach $text: </td>";
-            echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\"";
-            if ($fnum == 6)
-            {
-                $sql = "SELECT vtyp_kurz, vtyp_bezeichnung FROM Vertrag_Typ ORDER BY 1";
-                if ($res = $dbc->queryObjectArray($sql))
-                {
-                    foreach ($res as $row)
-                       $title .= ", " . $row->vtyp_kurz." - ".$row->vtyp_bezeichnung; 
-                    echo "title='".substr($title,2)."' ";            
-                }
-            }
-            echo "/></td>";
-            echo "<td>Zeilen/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";
-//        echo "<tr bgcolor='#CFDEF0'><th>Bezeichnung</th><th>Titel</th><th>Beschreibung</th><th>Typ</th><th>Beginn</th><th>Ende</th><th>K&uuml;nd.frist(mon)</th>
-//                <th>Dokument</th><th>Bemerkung</th><th>&nbsp;</th></tr>\n";
-
-        echo "<tr bgcolor='#68ACBF'>";
-        tab_column(8,"Partner",$sort,$dir,8,$fnum,$filter,$start,$zeil,"",$mfile);
-        tab_column(2,"Bezeichnung",$sort,$dir,2,$fnum,$filter,$start,$zeil,"",$mfile);
-        tab_column(3,"Beschreibung",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",$mfile);
-        tab_column(6,"Typ",$sort,$dir,6,$fnum,$filter,$start,$zeil,"",$mfile);
-        tab_column(7,"zu Produkt",$sort,$dir,7,$fnum,$filter,$start,$zeil,"",$mfile);
-        tab_column(4,"Bearbeiter",$sort,$dir,4,$fnum,$filter,$start,$zeil,"",$mfile);
-        if ($mfile)
-            tab_column(5,"Dokument, Schlagwort",$sort,$dir,5,$fnum,$filter,$start,$zeil,"",$mfile);
-        else
-            tab_column(5,"Dokument",$sort,$dir,0,$fnum,$filter,$start,$zeil);
-        echo "<th>&nbsp;</th></tr>\n";
-        foreach ($result as $row)
-        {
-			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
-            echo "<tr bgcolor='" . $bg . "'>";
-            echo "<td>$row->partfirma</td>";
-            if ($row->cend)
-            {
-                $ce = new DateTime($row->cend);
-                if ((!$row->cauto || is_null($row->cauto)) && $heute > $ce) $class="class='red'"; else $class="";
-            }
-            else $class="";
-            echo "<td width='17%' $class><b>$row->cname<br /></b></td>";    
-//            echo "<td>$row->contract_s</td>";    
-            echo "<td width='22%'>" . nl2br($row->clong) . "</td>";    
-            echo "<td>$row->typ</td>";    
-            echo "<td>$row->prod</td>";
-            echo "<td>$row->bearb</td>";
-            if ($mfile)
-            {
-                $docsw = explode("; ", $row->doc);
-                if (isset($docsw) && is_array($docsw))
-                {
-                    echo "<td>";
-                    foreach ($docsw as $val)
-                    {
-                        $file = substr($val,0,strpos($val,'|'));
-                        $sw   = substr($val,strpos($val,'|')+1);
-                        if ($fnum == 5 && $filter > '!') // Filterbegriff in Schlagwort hervorheben
-                        { 
-                            $sw = str_replace(lcfirst($filter),"<b>".lcfirst($filter)."</b>",$sw);
-                            $sw = str_replace(ucfirst($filter),"<b>".ucfirst($filter)."</b>",$sw);
-                        } 
-                        if ($sw) $sw =  " &rarr; <em>$sw</em>"; else $sw = "";
-                        if (file_exists("documents/$file"))
-                        {
-                            $doc = substr($file,strpos($file,"_")+1);
-                            echo "<a href='documents/$file'>$doc</a>$sw<br />";
-                        }    
-                        else 
-                            echo "$file$sw<br />";   
-                    }
-                    echo "</td>";
-                }       
-            }
-            else
-            {
-                if (file_exists("documents/".$row->doc))
-                {
-                    $doc = substr($row->doc,strpos($row->doc,"_")+1); 
-                    echo "<td><a href='documents/$row->doc'>$doc</a></td>";
-                }    
-                else    
-                    echo "<td>$row->doc</td>";
-            }
-            if ($mfile) $part = "ed"; else $part = "upd";
-            echo "<td><a href='/fhiiqm/vertrag_$part.php?uid=$row->contract_ID&$getp'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
-       }
-        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,$vanz,$liste);
-
-        // Export csv-Datei
-        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class='sc'><a href='/fhiiqm/vertrag_list12_csv.php?$getp'>
-            <img src='/fhiiqm/img/file_extension_xls.png' border='0' title='Export dieser Auswahl nach Excel(csv)' /></a></span>";
-    }
-    else
-    {
-        echo "<p class='red'>Leider wurde nichts gefunden mit Ihrem Suchbegriff '$filter'!</p>\n";
-        echo "<p><a href=\"vertrag_flist1.php\" title=\"Vertragliste 1\" >Vertragsliste zeigen</a></p>\n";
-        echo "</div>\n";
-    }
-    
-    $dbc -> close();
-    
-    echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_flist12.php?$getp\" class=\"sc\" title=\"Vertragliste 2\" onclick=\"winopen(this.href,'Vertragsliste 2'); return false\">Vertr&auml;ge Teil 2</a></p>\n";
-    if (!is_null($_SESSION["recht"]) && in_array("ve",$_SESSION["recht"]))
-    {
-        if ($mfile)
-            echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_ed.php?$getp\" target=\"_self\" class=\"sc\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
-        else
-            echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_ins.php\" target=\"_self\" class=\"sc\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
-    }
-?>
-
-</body>
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 7/2011
+ * 
+ * Liste Vertragsdaten mit Sortierung und Filter
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login("vertrag_flist1.php?g=1");
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("vr",$_SESSION["recht"]) && !in_array("ve",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+
+<!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="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> 
+
+	<title>Liste Vertragsdaten</title>
+    <script type="text/javascript">
+        function winopen (addr,title) 
+        {
+          mywin = window.open(addr,title, "width=1400,height=700,left=400,top=300,menubar=yes,status=yes,scrollbars=yes,resizable=yes,toolbar=yes");
+          mywin.focus();
+        }
+    </script>
+</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\">&nbsp;&nbsp;&nbsp;<img src=\"img/document_mark_as_final.png\" border=\"0\" alt=\"Vertr&auml;ge\" title=\"Vertr&auml;ge\"/></div>\n";
+
+    $mfile = $_GET['g']; // Multifile = mehrere Vertragsdokumente moeglich
+    if (!$mfile) $mfile = $_POST['g']; 
+    $zeil = $_GET["z"];
+    if (!$zeil) $zeil = $_POST["z"];
+    if (!$zeil) $zeil = 20; // Anzahl der gezeigten Zeilen
+    $start = $_GET["st"];   // Start bei DS $start+1
+    if (!$start) $start=0;
+    
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner");
+    
+	$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($sort) || !$sort) $sort = 2;
+    if (!isset($dir) || !$dir)  $dir = "";
+    // $_GET-Parameter zurueck zur Vertragliste mit den selben Einstellungen wie zuvor fuer Update
+    $getp = "s=$sort&d=$dir&f=$fnum&b=$filter&st=$start&z=$zeil&g=$mfile";
+    
+    // Recht Produktgruppe beruecksichtigen
+    if (is_array($_SESSION["prodg"]))
+    {
+            foreach ($_SESSION["prodg"] as $val)
+                $listg .= "," .$val;
+            $listg = substr($listg,1);
+    }
+    else $listg = "";
+
+//    echo "sort=$sort, fnum=$fnum, filter=$filter <br />";
+    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+    include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	$dbc = new dbconnection();
+    
+    echo "<div align='center'>\n";
+//echo "$sort, $dir, $fnum, $filter<br><br>\n";    
+//    $sql = "CALL fhiiqm.vertrag_flist1(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "',$start,$zeil, @anz)";
+    if ($mfile)
+        $sql = "CALL fhiiqm.vertrag_flist1_mf(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "', $start,$zeil, @anz)";
+    else
+        $sql = "CALL fhiiqm.vertrag_flist1_1(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "', '" . $listg . "', $start,$zeil, @anz)";
+    // Parameter: Nr. Sortfelf, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Liste der berechtigten prodgroup, Start bei DS $start+1, Anzahl DS/Seite, Anzahl gefundener Vertraege
+    // liefert Felder: contract_ID,cname,clong,bearb,doc,typ,prod
+    $result = $dbc -> queryObjectArray($sql);
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+        
+        $heute = new DateTime();
+        
+        $vanz = $dbc -> querySingleItem("SELECT @anz");
+        
+        echo "<p><b>Vertr&auml;ge - &Uuml;bersicht</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 jeder Spalte 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' hight='11'>' - Bearbeiten der Vertragsdaten, 
+            '<img src='/fhiiqm/img/file_extension_xls.png' border='0' hight='11'>' - Excel-Export</td></tr>\n";
+        echo "</table>\n";
+        printf ("<p>Anzahl Vertr&auml;ge: %s </p>", $vanz);
+        echo "</div>\n";
+        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_flist12.php?$getp\" class=\"sc\" title=\"Vertragliste 2\" onclick=\"winopen(this.href,'Vertragsliste 2'); return false\">Vertr&auml;ge Teil 2</a></p>\n";
+        echo "<div align='center'>\n";
+        
+
+        if (isset($fnum) && $fnum>1 && !$filter && !$subf)
+        {
+            // Formular anzeigen fuer Filterbegriff
+            $text = $fields[$fnum];
+            $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 "<input type='hidden' name='g' value='$mfile'>";
+            echo "<table width=\"40%\" border=\"0\">\n";
+            echo "<tr><td>filtern nach $text: </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\"";
+            if ($fnum == 6)
+            {
+                $sql = "SELECT vtyp_kurz, vtyp_bezeichnung FROM Vertrag_Typ ORDER BY 1";
+                if ($res = $dbc->queryObjectArray($sql))
+                {
+                    foreach ($res as $row)
+                       $title .= ", " . $row->vtyp_kurz." - ".$row->vtyp_bezeichnung; 
+                    echo "title='".substr($title,2)."' ";            
+                }
+            }
+            echo "/></td>";
+            echo "<td>Zeilen/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";
+//        echo "<tr bgcolor='#CFDEF0'><th>Bezeichnung</th><th>Titel</th><th>Beschreibung</th><th>Typ</th><th>Beginn</th><th>Ende</th><th>K&uuml;nd.frist(mon)</th>
+//                <th>Dokument</th><th>Bemerkung</th><th>&nbsp;</th></tr>\n";
+
+        echo "<tr bgcolor='#68ACBF'>";
+        tab_column(8,"Partner",$sort,$dir,8,$fnum,$filter,$start,$zeil,"",$mfile);
+        tab_column(2,"Bezeichnung",$sort,$dir,2,$fnum,$filter,$start,$zeil,"",$mfile);
+        tab_column(3,"Beschreibung",$sort,$dir,0,$fnum,$filter,$start,$zeil,"",$mfile);
+        tab_column(6,"Typ",$sort,$dir,6,$fnum,$filter,$start,$zeil,"",$mfile);
+        tab_column(7,"zu Produkt",$sort,$dir,7,$fnum,$filter,$start,$zeil,"",$mfile);
+        tab_column(4,"Bearbeiter",$sort,$dir,4,$fnum,$filter,$start,$zeil,"",$mfile);
+        if ($mfile)
+            tab_column(5,"Dokument, Schlagwort",$sort,$dir,5,$fnum,$filter,$start,$zeil,"",$mfile);
+        else
+            tab_column(5,"Dokument",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        echo "<th>&nbsp;</th></tr>\n";
+        foreach ($result as $row)
+        {
+			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+            echo "<tr bgcolor='" . $bg . "'>";
+            echo "<td>$row->partfirma</td>";
+            if ($row->cend)
+            {
+                $ce = new DateTime($row->cend);
+                if ((!$row->cauto || is_null($row->cauto)) && $heute > $ce) $class="class='red'"; else $class="";
+            }
+            else $class="";
+            echo "<td width='17%' $class><b>$row->cname<br /></b></td>";    
+//            echo "<td>$row->contract_s</td>";    
+            echo "<td width='22%'>" . nl2br($row->clong) . "</td>";    
+            echo "<td>$row->typ</td>";    
+            echo "<td>$row->prod</td>";
+            echo "<td>$row->bearb</td>";
+            if ($mfile)
+            {
+                $docsw = explode("; ", $row->doc);
+                if (isset($docsw) && is_array($docsw))
+                {
+                    echo "<td>";
+                    foreach ($docsw as $val)
+                    {
+                        $file = substr($val,0,strpos($val,'|'));
+                        $sw   = substr($val,strpos($val,'|')+1);
+                        if ($fnum == 5 && $filter > '!') // Filterbegriff in Schlagwort hervorheben
+                        { 
+                            $sw = str_replace(lcfirst($filter),"<b>".lcfirst($filter)."</b>",$sw);
+                            $sw = str_replace(ucfirst($filter),"<b>".ucfirst($filter)."</b>",$sw);
+                        } 
+                        if ($sw) $sw =  " &rarr; <em>$sw</em>"; else $sw = "";
+                        if (file_exists("documents/$file"))
+                        {
+                            $doc = substr($file,strpos($file,"_")+1);
+                            echo "<a href='documents/$file'>$doc</a>$sw<br />";
+                        }    
+                        else 
+                            echo "$file$sw<br />";   
+                    }
+                    echo "</td>";
+                }       
+            }
+            else
+            {
+                if (file_exists("documents/".$row->doc))
+                {
+                    $doc = substr($row->doc,strpos($row->doc,"_")+1); 
+                    echo "<td><a href='documents/$row->doc'>$doc</a></td>";
+                }    
+                else    
+                    echo "<td>$row->doc</td>";
+            }
+            if ($mfile) $part = "ed"; else $part = "upd";
+            echo "<td><a href='/fhiiqm/vertrag_$part.php?uid=$row->contract_ID&$getp'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+       }
+        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,$vanz,$liste);
+
+        // Export csv-Datei
+        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class='sc'><a href='/fhiiqm/vertrag_list12_csv.php?$getp'>
+            <img src='/fhiiqm/img/file_extension_xls.png' border='0' title='Export dieser Auswahl nach Excel(csv)' /></a></span>";
+    }
+    else
+    {
+        echo "<p class='red'>Leider wurde nichts gefunden mit Ihrem Suchbegriff '$filter'!</p>\n";
+        echo "<p><a href=\"vertrag_flist1.php?g=1\" title=\"Vertragliste 1\" >Vertragsliste zeigen</a></p>\n";
+        echo "</div>\n";
+    }
+    
+    $dbc -> close();
+    
+    echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_flist12.php?$getp\" class=\"sc\" title=\"Vertragliste 2\" onclick=\"winopen(this.href,'Vertragsliste 2'); return false\">Vertr&auml;ge Teil 2</a></p>\n";
+    if (!is_null($_SESSION["recht"]) && in_array("ve",$_SESSION["recht"]))
+    {
+        if ($mfile)
+            echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_ed.php?$getp\" target=\"_self\" class=\"sc\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
+        else
+            echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_ins.php\" target=\"_self\" class=\"sc\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
+    }
+?>
+
+</body>
 </html>
\ No newline at end of file