<?php
/**
* @author Bettina Schwarzer, Fritz-Haber-Institut
* @copyright 06/2011
*
* Suche Vertraege und Anzeige Updateformular
*/
error_reporting(E_ALL ^ E_NOTICE);
session_start();
if (! isset($_SESSION["userid"]))
{
include_once ("inc/func_lib.inc.php");
login("vertrag_search.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;
}
include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
$dbc = new dbconnection();
// $cid = $_POST["con_id"];
if (isset($_POST["conbez"]) && $_POST["conbez"])
$cname = $_POST["conbez"];
if (!$cname) $cname = $_POST["conprod"];
if (!$cname) $cname = $_POST["conpart"];
$cid = trim(substr($cname,0,strpos($cname,"-")));
// echo "cname = $cname, cid = $cid<br />\n";
if (isset($cid) && $cid)
// header("Location: vertrag_upd.php?uid=$cid"); // bis 25.03.2013
header("Location: vertrag_ed.php?uid=$cid&g=1");
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" />
<!--
<link type="text/css" href="/fhiiqm/css/jquery/ui-lightness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
-->
<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>Suche Vertrag</title>
</head>
<body>
<?php
echo " ";
echo "<div class=\"float-br smaller\" valign='top'>";
echo " user: " . $_SESSION["userid"];
echo " <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=\"Vertragssuche\" title=\"Vertragssuche\"/></div>\n";
?>
<script>
$(document).ready(function() {
$("#conbez").focus();
$("#conbez").autocomplete({
minLength: 2,
source: "/fhiiqm/inc/vertrag_list_ac.inc.php",
/* select:(function(event,ui){
if(ui.item)
{
$('#conbez').val(ui.item.value);
$(this).parents('form').submit();
return false; // Liste wird ausgeblendet
}
// $("#fcontract").submit();
}),
*/
close: (function(event,ui){
$("#fcontract").submit();})
});
$("#conprod").autocomplete({
minLength: 2,
source: "/fhiiqm/inc/vertrag_prod_list_ac.inc.php",
close: (function(event,ui){
$("#fcontractpr").submit();})
});
$("#conpart").autocomplete({
minLength: 2,
source: "/fhiiqm/inc/vertrag_list_ac.inc.php?part=1",
close: (function(event,ui){
$("#fcontractpa").submit();})
});
$("input[id='conbez']").addClass("long50");
});
</script>
<div align="center">
<h3>Vertragssuche</h3>
<table>
<tr><td class="bigger">Bitte <i>Vertragsbezeichnung</i> bzw. Teil davon eingeben</td></tr>
<form name="fcontract" id="fcontract" action="<?php $_SERVER['PHP_SELF']?>" method="post" enctype="application/x-www-form-urlencoded">
<tr><td><div class="ui-widget">
<input class="long50" id="conbez" name="conbez" type="text" value=""/>
</div></td></tr>
</form>
<tr><td class="bigger">oder <i>Vertragspartner</i> bzw. Teil davon eingeben</td></tr>
<form name="fcontractpa" id="fcontractpa" action="<?php $_SERVER['PHP_SELF']?>" method="post" enctype="application/x-www-form-urlencoded">
<tr><td><div class="ui-widget">
<input class="long50" id="conpart" name="conpart" type="text" value=""/>
</div></td></tr>
</form>
<tr><td class="bigger">oder <i>Produkt</i> bzw. Teil davon eingeben</td></tr>
<form name="fcontractpr" id="fcontractpr" action="<?php $_SERVER['PHP_SELF']?>" method="post" enctype="application/x-www-form-urlencoded">
<tr><td><div class="ui-widget">
<input class="long50" id="conprod" name="conprod" type="text" value=""/>
</div></td></tr>
</form>
<tr><td class="bigger">dann Vertrag aus angebotener Liste durch Anklicken wählen</td></tr>
<tr><td>Falls keine Liste angezeigt wird, existiert kein Vertrag mit den eingegebenen Zeichen!</td></tr>
</table>
</div>
</body>
</html>
<?php
}
?>