--- a/fhiiqm/test/partner_list_autocomplete.php Wed Aug 31 14:33:47 2011 +0200
+++ b/fhiiqm/test/partner_list_autocomplete.php Fri Sep 02 12:52:50 2011 +0200
@@ -10,9 +10,11 @@
error_reporting(E_ALL ^ E_NOTICE);
$su = array("ä","ö","ü","ß","Ä","Ö","Ü");
- $er = array("ä","ö","ü","ß","Ä","Ö","Ü");
+// $er = array("ä","ö","ü","ß","Ä","Ö","Ü");
+ $er = array("ae","oe","ue","ss","Ae;","Oe","Ue");
- $q = strtolower($_GET["term"]);
+ $q = strtolower($_GET["term"]); // wird in jquery in 'term' uebergeben
+// $q = strtolower($_GET["q"]);
include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
$dbc = new dbconnection();
@@ -25,11 +27,12 @@
{
foreach ($result as $row)
{
- echo $row->part_ID . " - " . str_replace($su,$er,$row->part_firma) . "\n";
+ $plist[] = "\"" . $row->part_ID . " - " . html_entity_decode( str_replace($su,$er,$row->part_firma)) ."\"";
}
}
$dbc -> close();
-
+
+ echo "[" . implode(", ", $plist) . "]"; // Format, das jquery source erwartet
?>
\ No newline at end of file
--- a/fhiiqm/test/partner_select1.php Wed Aug 31 14:33:47 2011 +0200
+++ b/fhiiqm/test/partner_select1.php Fri Sep 02 12:52:50 2011 +0200
@@ -6,7 +6,9 @@
*/
-
+ error_reporting(E_ALL ^ E_NOTICE);
+
+ include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -22,10 +24,7 @@
</head>
<body>
- <script>
- $('#date').datepicker();
- </script>
- <script>
+<!-- <script>
$(function() {
/*
function log( message ) {
@@ -45,22 +44,75 @@
*/
});
});
+ </script>
+-->
+ <script>
$(document).ready(function() {
- $("input#partner").autocomplete({
- source: ["FU Berlin", "TU Berlin", "HU Berlin"],
- minLength: 2
+ $("#partner").autocomplete({
+ source: "partner_list_autocomplete.php",
+ minLength: 2,
+ autofocus: true
});
- });
-
+ $('#date').datepicker();
+ $( "#format" ).change(function() {
+ $( "#date" ).datepicker( "option", "dateFormat", $( this ).val() );
+ });
+ $("a").click(function(){
+ alert("das wird nicht funktionieren!");
+ $(this).hide("slow");
+ return false;});
+ $("input").filter("long20").addClass("long20");
+ $("input").filter("long30").addClass("long30");
+ $("input").filter("long50").addClass("long50");
+ });
</script>
- <h3>Versuch autocomplete ui widget</h3>
- <div class="ui-widget">
- <label for="partner">Partner: </label>
- <input id="partner" /> <br /><br />
- <label>Datum waehlen:</label>
- <input type="text" name="date" id="date" />
- </div>
+ <?php
+ $part = $_POST["partner"];
+ $dat = $_POST["date"];
+ if ($part || $dat)
+ {
+ $partid = trim(substr($part,0,strpos($part,"-")));
+ $datef = new DateTime_s($dat);
+ }
+ ?>
+
+ <form action="<?php $_SERVER["PHP_SELF"] ?>" method="post" enctype="application/x-www-form-urlencoded" id="form_part" target="_self">
+ <table cellpadding="10">
+ <tr><td>
+ <h3>Versuch autocomplete ui widget</h3>
+ <div class="ui-widget">
+ <label for="partner">Partner: </label>
+ <input class="long30" id="partner" name="partner" value="<?php echo $part; ?>"/> <br />
+ <?php echo "partner-ID = $partid<br />\n"; ?>
+ <br />
+
+ <label>Datum waehlen:</label>
+ <input class="long20" type="text" name="date" id="date" value="<?php echo $dat; ?>" /><br />
+ <?php echo "Datum = $datef<br />\n"; ?>
+ </div>
+ <div class="ui-widget">
+ <br />
+ <label>Format options: </label>
+ <br />
+ <select id="format">
+ <option value="mm/dd/yy">Default - mm/dd/yy</option>
+ <option value="dd.mm.yy">German - dd.mm.yy</option>
+ <option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
+ <!--
+ <option value="d M, y">Short - d M, y</option>
+ <option value="d MM, y">Medium - d MM, y</option>
+ <option value="DD, d MM, yy">Full - DD, d MM, yy</option>
+ <option value="'day' d 'of' MM 'in the year' yy">With text - 'day' d 'of' MM 'in the year' yy</option>
+ -->
+ </select>
+ <br /><br />
+ <button type="submit" id="ab" name="ab" onclick="$this.form.submit;">und ab</button>
+ </div>
+ <p><a href="/gallerie.html">zur Gallerie</a></p>
+ </td></tr>
+ </table>
+ </form>
</body>
</html>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/test/vertrag_list_autocomplete1.php Fri Sep 02 12:52:50 2011 +0200
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 09/2011
+ *
+ * Autocomplete Vertragssuche
+ */
+
+ header('Content-type: text/html; charset="iso-8859-1',true); //wg. jquery ui autocomplete
+ error_reporting(E_ALL ^ E_NOTICE);
+
+ $q = strtolower($_GET["term"]); // wird in jquery in 'term' uebergeben
+
+ $su = array("ä","ö","ü","ß","Ä","Ö","Ü");
+ $er = array("ä","ö","ü","ß","Ä","Ö","Ü");
+// $er = array("ae","oe","ue","ss","Ae;","Oe","Ue");
+
+ include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+ $dbc = new dbconnection();
+
+ $sql = "SELECT contract_ID,contract_name,t.vtyp_bezeichnung,contract_begin
+ FROM fhiiqm.Vertrag v LEFT OUTER JOIN fhiiqm.Vertrag_Typ t ON v.vtyp_ID=t.vtyp_ID
+ WHERE contract_name LIKE '%".$q."%' COLLATE latin1_general_ci
+ ORDER BY contract_name";
+ $result = $dbc ->queryObjectArray($sql);
+ if ($result)
+ {
+ foreach ($result as $row)
+ {
+ $cb = new DateTime($row->contract_begin);
+// $clist[] = "\"" . $row->contract_ID . " - " . str_replace($su,$er,$row->contract_name) . " | " .
+// str_replace($su,$er,$row->vtyp_bezeichnung) . " | VBeginn: " . $cb->format('d.m.Y') . "\"";
+ $clist[] = "\"" . $row->contract_ID . " - " . $row->contract_name . " | " .
+ $row->vtyp_bezeichnung . " | VBeginn: " . $cb->format('d.m.Y') . "\"";
+ }
+ }
+ $dbc -> close();
+ echo "[" . implode(", ", $clist) . "]"; // Format, das jquery source erwartet
+?>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/test/vertrag_search1.php Fri Sep 02 12:52:50 2011 +0200
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 06/2011
+ *
+ * Suche Vertraege und Anzeige Updateformular
+ */
+
+ error_reporting(E_ALL ^ E_NOTICE);
+
+ include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+ $dbc = new dbconnection();
+
+// $cid = $_POST["con_id"];
+ $cname = $_POST["conbez"];
+ $cid = trim(substr($cname,0,strpos($cname,"-")));
+// echo "cname = $cname, cid = $cid<br />\n";
+ if (isset($cid) && $cid)
+ header("Location: http://achilleus/fhiiqm/vertrag_upd.php?uid=$cid");
+ 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>
+ <title>Suche Vertrag</title>
+
+ </head>
+
+ <body>
+ <div class="float-r"><img src="/fhiiqm/img/document_mark_as_final.png" border="0" alt="Vertragssuche" title="Vertragssuche"/></div>
+ <script>
+ $(document).ready(function() {
+ $("#conbez").autocomplete({
+ minLength: 2,
+ source: "vertrag_list_autocomplete1.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();})
+ });
+ $("input").filter("long20").addClass("long20");
+ $("input").filter("long30").addClass("long30");
+ $("input").filter("long50").addClass("long50");
+ });
+ </script>
+ <div align="center">
+ <h3>Vertragssuche</h3>
+ <table>
+ <tr><td class="bigger">Bitte Vertragsbezeichnung oder Teil davon eingeben und dann Vertrag</td></tr>
+ <tr><td class="bigger">aus angebotener Liste durch Anklicken wählen:</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="<?php echo $cname; ?>"/>
+ </div></td></tr>
+
+ </form>
+ <tr><td>Falls keine Liste angezeigt wird, existiert kein Vertrag mit den eingegebenen Zeichen!</td></tr>
+ </table>
+ </div>
+ </body>
+ </html>
+<?php
+ }
+?>
\ No newline at end of file