fhiiqm/form/info_form2.inc.php
changeset 24 15f33315f045
child 25 482252ff12fd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/form/info_form2.inc.php	Fri Mar 02 13:54:32 2012 +0100
@@ -0,0 +1,277 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 02/2012
+ *
+ * Form Info Geschaeftsverteilungsplan
+ */
+
+	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";
+?>
+<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="60%" border="0" cellspacing="3" cellpadding="3">
+    <tr>
+        <td>Titel *<br/><br />
+            &nbsp;&nbsp;&nbsp;max. 300 Zeichen m&ouml;glich</td>
+        <td><textarea name="inf[iname]" id="titel" 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;
+				}
+                if ($infid)
+                { 
+                    echo "&nbsp;&nbsp;&nbsp;Info-ID";
+                    echo "&nbsp;&nbsp;&nbsp;<input class='read right' name='inf[infid]' type='text' size='5' value='" .$inf['infid']."' readonly='readonly' />"; 
+                }
+             ?>
+        </td>
+    </tr>
+    <tr>
+        <td>Kurzinformation<br/><br />
+            &nbsp;&nbsp;&nbsp;max. 8000 Zeichen m&ouml;glich
+        </td>
+        <td><textarea name="inf[ilong]" cols="80" rows="6"><?php echo $inf['ilong']; ?></textarea>
+        </td>
+    </tr>
+	<tr>
+	   <td>Kennzeichen(Sort.)</td>
+	   <td><input name="inf[sort]" type="text" size="5" maxlength="5" value="<?php echo $inf['sort']; ?>" /></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->info_ID - $row->iname</option>\n";
+    				    else
+    					   echo "<option value=\"$row->info_ID\">$row->info_ID - $row->iname</option>\n";
+                    }
+                }
+            ?>
+        </select>
+        </td>
+    </tr>
+    <tr>
+        <td>Info-Typ</td>
+        <td><select name="inf[ityp]">
+            <?php 
+                if (!$ityp)
+                { 
+                    $wher = "";
+                    if ($inf['ityp'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                }
+                else $wher = " WHERE infotyp_ID = $ityp";
+                $sql = "SELECT infotyp_ID, infotyp_bez FROM Info_Typ $wher 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><input class="long10" name="inf[cdat]" id="cdat"  value="<?php echo $inf['cdat']; ?>">
+            <?php
+                if (isset($inf['cdat']) && $inf['cdat']< "!")
+                { 
+                    echo "<br><span class=\"red\">Erstellungsdatum ist erforderlich!</span>\n";
+                    $okn = false;
+                }    
+            ?>
+        </td>
+    </tr>
+    <tr>
+        <td>g&uuml;ltig ab</td>
+        <td><input class="long10" name="inf[vdat]" id="vdat"  value="<?php echo $inf['vdat']; ?>"></td>
+    </tr>
+     <tr>
+        <td>g&uuml;ltig bis</td>
+        <td><input class="long10" name="inf[bdat]" id="bdat"  value="<?php echo $inf['bdat']; ?>"></td>
+    </tr>
+    <tr>
+        <td>Autor</td>
+        <td><input class="long20" type="text" name="inf[persknr]" id="persknr" value="<?php echo $inf['persknr']; ?>"/>
+        &nbsp;&nbsp;&nbsp;Eingabe von mind. 2 Zeichen -&gt; Namensliste
+        </td>
+    </tr>
+    <tr>
+        <td>Verantwortliche(r) FHI <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><table cellspacing="0"><tr><td>
+            <select name="inf[vpers][]" size="5" multiple="multiple" onblur="this.form.submit();">
+                <?php
+                    $select = null;
+                    if (is_array($inf['vpers'])) $select = in_array( "-1", $inf['vpers'] ) ? ' selected' : null;
+                    echo "<option $select value=\"-1\"></option>\n";
+/*                    if ((isset($ityp) && $ityp==6) || (isset($inf["ityp"]) && $inf["ityp"]==6)) 
+                    {    // nur fuer Infotyp 'Geschaeftsverteilungsplan'
+                        $wherm = " WHERE abt_tel=6 OR persknr IN (122,390,414,418,1339,2450,2452) ";
+                    }    
+                    else */
+                        $wherm = "";
+                    $sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter $wherm ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if (is_array($inf['vpers']))
+                            { 
+                                $select = in_array( $row->persknr, $inf['vpers'] ) ? ' selected' : null;
+                                if ($select) $inf["vma"][] = $row->pname;
+                            }                                    
+        					echo "<option $select value=\"$row->persknr\">$row->pname</option>\n";
+                        }
+                    }
+                ?>
+            </select></td>
+            <?php
+            if (isset($inf["vma"]) && is_array($inf["vma"]))
+            {
+                $i=0;
+               echo "<td><table cellspacing='0' cellpadding='0'>";
+                foreach ($inf["vma"] as $vma)
+                {
+                    echo "<tr><td class='valignb'>&nbsp;&nbsp;&nbsp;$vma:&nbsp;&nbsp;&nbsp;</td>";
+//                        <td class='valignb'>Priorit&auml;t <select name=' inf[prio][$i]'>";
+                    echo "<td class='valignb'> <input name='inf[prio][$i]' type='text' size='50' maxlength='50' value='". $inf["prio"][$i] . "' />";
+/*                    for ($j=1; $j<4; $j++)
+                    {
+                        $select =  ($j == $inf["prio"][$i] ) ? ' selected' : null;
+                        echo "<option$select value='$j'>$j</option>";                    
+                    }
+                    echo "</select></td></tr>";
+*/
+                    echo "</td></tr>";
+                    $i++; 
+                }
+                echo "</table></td>\n";    
+            }
+            ?>
+        </tr></table></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>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="6" 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>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[pers]" id="pid" value="<?php echo $inf['pers']; ?>"/> // Author
+    <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