Gruppe_kurzbz als Autocomplete-Feld hinzugefügt

This commit is contained in:
Martin Tatzber
2013-12-23 12:38:51 +00:00
parent ded206a6e0
commit 1bbccbebc3
2 changed files with 82 additions and 2 deletions
+27 -2
View File
@@ -110,7 +110,7 @@
$lvangebot->lehrveranstaltung_id=$_POST['lehrveranstaltung_id'];
$lvangebot->studiensemester_kurzbz=$_POST['studiensemester_kurzbz'];
//$lvangebot->gruppe_kurzbz=$_POST['gruppe_kurzbz'];
$lvangebot->gruppe_kurzbz=$_POST['gruppe_kurzbz'];
$lvangebot->incomingplaetze=$_POST['incomingplaetze'];
$lvangebot->gesamtplaetze=$_POST['gesamtplaetze'];
$lvangebot->anmeldefenster_start=$datum_obj->formatDatum($_POST['anmeldefenster_start'], 'Y-m-d');
@@ -135,6 +135,7 @@
<thead>
<tr>
<th>Studiensemester</th>
<th>Gruppe</th>
<th title="Incomingplätze">Inc</th>
<th title="Gesamtplätze">Ges</th>
<th>Anmeldefenster Start</th>
@@ -158,6 +159,7 @@
} */
$htmlstr .= '<tr>
<td>'.$lvang->studiensemester_kurzbz.'</td>
<td>'.$lvang->gruppe_kurzbz.'</td>
<td>'.$lvang->incomingplaetze.'</td>
<td>'.$lvang->gesamtplaetze.'</td>
<td>'.$datum_obj->formatDatum($lvang->anmeldefenster_start,'d.m.Y').'</td>
@@ -195,6 +197,10 @@
$htmlstr .= '<input type="hidden" name="studiensemester_kurzbz" value="'.$lvangebot->studiensemester_kurzbz.'" />';
$htmlstr .= ' </td>
</tr>
<tr><td>Gruppe</td>
<td>
<input type="text" name="gruppe_kurzbz" id="gruppe_kurzbz" onchange="submitable()" value="'.$lvangebot->gruppe_kurzbz.'"/>
</td></tr>
<tr><td>Incomingplätze</td>
<td>
<input type="text" name="incomingplaetze" onchange="submitable()" value="'.$lvangebot->incomingplaetze.'"/>
@@ -245,7 +251,26 @@
$("#t1").tablesorter(
{
widgets: ["zebra"]
});
});
$('#gruppe_kurzbz').autocomplete({
source: "lvangebot_autocomplete.php",
minLength:1,
response: function(event, ui)
{
//Value und Label fuer die Anzeige setzen
for(i in ui.content)
{
ui.content[i].value=ui.content[i].gruppe_kurzbz;
ui.content[i].label=ui.content[i].gruppe_kurzbz;
}
},
select: function(event, ui)
{
ui.item.value=ui.item.gruppe_kurzbz;
}
});
});
function submitable()
+55
View File
@@ -0,0 +1,55 @@
<?php
/* Copyright (C) 2013 fhcomplete.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Martin Tatzber < tatzberm@technikum-wien.at >
*/
require_once('../../config/vilesci.config.inc.php');
// require_once('../../include/functions.inc.php');
// require_once('../../include/benutzerberechtigung.class.php');
require_once('../../include/gruppe.class.php');
/* if (!$uid = get_uid())
die('Keine UID gefunden ! <a href="javascript:history.back()">Zur&uuml;ck</a>');
$rechte = new benutzerberechtigung();
if(!$rechte->getBerechtigungen($uid))
die('Sie haben keine Berechtigung fuer diese Seite');
if(!$rechte->isBerechtigt('...', null, 's'))
die('Sie haben keine Berechtigung fuer diese Seite'); */
if (!$db = new basis_db())
die('Datenbank kann nicht geoeffnet werden. <a href="javascript:history.back()">Zur&uuml;ck</a>');
$gruppe_kurzbz=trim((isset($_REQUEST['term']) ? $_REQUEST['term']:''));
$json=array();
$qry="SELECT gruppe_kurzbz FROM public.tbl_gruppe
WHERE lower(gruppe_kurzbz) LIKE lower('%$gruppe_kurzbz%')
AND aktiv=true";
if($result=$db->db_query($qry))
{
while($row=$db->db_fetch_object($result))
{
$item['gruppe_kurzbz']=html_entity_decode($row->gruppe_kurzbz);
$json[]=$item;
}
}
echo json_encode($json);
// exit();
?>