|
1 <?php |
|
2 |
|
3 /** |
|
4 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
5 * @copyright 09/2011 |
|
6 * |
|
7 * Autocomplete Vertragssuche |
|
8 */ |
|
9 |
|
10 header('Content-type: text/html; charset="iso-8859-1',true); //wg. jquery ui autocomplete |
|
11 error_reporting(E_ALL ^ E_NOTICE); |
|
12 |
|
13 $q = strtolower($_GET["term"]); // wird in jquery in 'term' uebergeben |
|
14 |
|
15 $su = array("ä","ö","ü","ß","Ä","Ö","Ü"); |
|
16 $er = array("ä","ö","ü","ß","Ä","Ö","Ü"); |
|
17 // $er = array("ae","oe","ue","ss","Ae;","Oe","Ue"); |
|
18 |
|
19 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
20 $dbc = new dbconnection(); |
|
21 |
|
22 $sql = "SELECT contract_ID,contract_name,t.vtyp_bezeichnung,contract_begin |
|
23 FROM fhiiqm.Vertrag v LEFT OUTER JOIN fhiiqm.Vertrag_Typ t ON v.vtyp_ID=t.vtyp_ID |
|
24 WHERE contract_name LIKE '%".$q."%' COLLATE latin1_general_ci |
|
25 ORDER BY contract_name"; |
|
26 $result = $dbc ->queryObjectArray($sql); |
|
27 if ($result) |
|
28 { |
|
29 foreach ($result as $row) |
|
30 { |
|
31 $cb = new DateTime($row->contract_begin); |
|
32 // $clist[] = "\"" . $row->contract_ID . " - " . str_replace($su,$er,$row->contract_name) . " | " . |
|
33 // str_replace($su,$er,$row->vtyp_bezeichnung) . " | VBeginn: " . $cb->format('d.m.Y') . "\""; |
|
34 $clist[] = "\"" . $row->contract_ID . " - " . $row->contract_name . " | " . |
|
35 $row->vtyp_bezeichnung . " | VBeginn: " . $cb->format('d.m.Y') . "\""; |
|
36 } |
|
37 echo "[" . implode(", ", $clist) . "]"; // Format, das jquery source erwartet |
|
38 } |
|
39 $dbc -> close(); |
|
40 ?> |