mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Ort-Verwaltung mit neuem Tablesorter.
Ändern von Lehre,Reservieren oder Aktiv erfolgt jetzt mittels Ajax-Request und Javascript (Kein neu laden und herumspringen der Seite mehr nach Aktualisierung)
This commit is contained in:
+13
-3
@@ -45,6 +45,10 @@ class ort extends basis_db
|
||||
public $stockwerk; // integer
|
||||
public $standort_id; // varchar(16)
|
||||
public $telefonklappe; // varchar(8)
|
||||
public $updateamum; // timestamp without timezone
|
||||
public $updatevon; // varchar(32)
|
||||
public $insertamum; // timestamp without timezone
|
||||
public $insertvon; // varchar(32)
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
@@ -200,7 +204,7 @@ class ort extends basis_db
|
||||
{
|
||||
//Neuen Datensatz anlegen
|
||||
$qry = 'INSERT INTO public.tbl_ort (ort_kurzbz, bezeichnung, planbezeichnung, max_person, aktiv, lehre, reservieren, lageplan,
|
||||
dislozierung, kosten, stockwerk, standort_id, telefonklappe) VALUES ('.
|
||||
dislozierung, kosten, stockwerk, standort_id, telefonklappe, insertamum, insertvon, updateamum, updatevon) VALUES ('.
|
||||
$this->db_add_param($this->ort_kurzbz).', '.
|
||||
$this->db_add_param($this->bezeichnung).', '.
|
||||
$this->db_add_param($this->planbezeichnung).', '.
|
||||
@@ -213,7 +217,11 @@ class ort extends basis_db
|
||||
$this->db_add_param(str_replace(",",".",$this->kosten)).', '.
|
||||
$this->db_add_param($this->stockwerk).','.
|
||||
$this->db_add_param($this->standort_id).','.
|
||||
$this->db_add_param($this->telefonklappe).');';
|
||||
$this->db_add_param($this->telefonklappe).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->updateamum).','.
|
||||
$this->db_add_param($this->updatevon).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,7 +239,9 @@ class ort extends basis_db
|
||||
'kosten='.$this->db_add_param(str_replace(",",".",$this->kosten)).', '.
|
||||
'standort_id='.$this->db_add_param($this->standort_id).', '.
|
||||
'telefonklappe='.$this->db_add_param($this->telefonklappe).', '.
|
||||
'stockwerk='.$this->db_add_param($this->stockwerk).' '.
|
||||
'stockwerk='.$this->db_add_param($this->stockwerk).', '.
|
||||
'updateamum='.$this->db_add_param($this->updateamum).', '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||
'WHERE ort_kurzbz = '.$this->db_add_param($this->ort_kurzbz).';';
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,72 @@ $rechte->getBerechtigungen($user);
|
||||
if(!$rechte->isBerechtigt('basis/ort'))
|
||||
die('Sie haben keine Rechte fuer diese Seite');
|
||||
|
||||
if($rechte->isBerechtigt('basis/ort', 'suid'))
|
||||
$write_admin=true;
|
||||
|
||||
// Speichern der Daten
|
||||
if(isset($_POST['ort_kurzbz']))
|
||||
{
|
||||
// Die Aenderungen werden per Ajax Request durchgefuehrt,
|
||||
// daher wird nach dem Speichern mittels exit beendet
|
||||
if($write_admin)
|
||||
{
|
||||
//Lehre Feld setzen
|
||||
if(isset($_POST['lehre']))
|
||||
{
|
||||
$lv_obj = new ort();
|
||||
if($lv_obj->load($_POST['ort_kurzbz']))
|
||||
{
|
||||
$lv_obj->lehre=($_POST['lehre']=='true'?false:true);
|
||||
$lv_obj->updateamum = date('Y-m-d H:i:s');
|
||||
$lv_obj->updatevon = $user;
|
||||
if($lv_obj->save(false))
|
||||
exit('true');
|
||||
else
|
||||
exit('Fehler beim Speichern:'.$lv_obj->errormsg);
|
||||
}
|
||||
else
|
||||
exit('Fehler beim Laden der LV:'.$lv_obj->errormsg);
|
||||
}
|
||||
|
||||
//Reservieren Feld setzen
|
||||
if(isset($_POST['reservieren']))
|
||||
{
|
||||
$lv_obj = new ort();
|
||||
if($lv_obj->load($_POST['ort_kurzbz']))
|
||||
{
|
||||
$lv_obj->reservieren=($_POST['reservieren']=='true'?false:true);
|
||||
$lv_obj->updateamum = date('Y-m-d H:i:s');
|
||||
$lv_obj->updatevon = $user;
|
||||
if($lv_obj->save(false))
|
||||
exit('true');
|
||||
else
|
||||
exit('Fehler beim Speichern:'.$lv_obj->errormsg);
|
||||
}
|
||||
else
|
||||
exit('Fehler beim Laden der LV:'.$lv_obj->errormsg);
|
||||
}
|
||||
|
||||
//Aktiv Feld setzen
|
||||
if(isset($_POST['aktiv']))
|
||||
{
|
||||
$lv_obj = new ort();
|
||||
if($lv_obj->load($_POST['ort_kurzbz']))
|
||||
{
|
||||
$lv_obj->aktiv=($_POST['aktiv']=='true'?false:true);
|
||||
$lv_obj->updateamum = date('Y-m-d H:i:s');
|
||||
$lv_obj->updatevon = $user;
|
||||
if($lv_obj->save(false))
|
||||
exit('true');
|
||||
else
|
||||
exit('Fehler beim Speichern:'.$lv_obj->errormsg);
|
||||
}
|
||||
else
|
||||
exit('Fehler beim Laden der LV:'.$lv_obj->errormsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET["toggle"]))
|
||||
{
|
||||
if(!$rechte->isBerechtigt('basis/ort', null, 'suid'))
|
||||
@@ -78,17 +144,17 @@ if (!$sg->getAll())
|
||||
die($sg->errormsg);
|
||||
|
||||
//$htmlstr = "<table class='liste sortable'>\n";
|
||||
$htmlstr = "<form name='formular'><input type='hidden' name='check' value=''></form><table id='t1' class='liste table-autosort:0 table-stripeclass:alternate table-autostripe'>\n";
|
||||
$htmlstr .= " <thead><tr class='liste'>\n";
|
||||
$htmlstr .= " <th class='table-sortable:default' onmouseup='document.formular.check.value=0'>Kurzbezeichnung</th>
|
||||
<th class='table-sortable:default'>Bezeichnung</th>
|
||||
<th class='table-sortable:default'>Planbezeichnung</th>
|
||||
<th class='table-sortable:numeric'>Max. Person</th>
|
||||
$htmlstr = "<form name='formular'><input type='hidden' name='check' value=''></form><table class='tablesorter' id='t1'>\n";
|
||||
$htmlstr .= " <thead><tr>\n";
|
||||
$htmlstr .= " <th onmouseup='document.formular.check.value=0'>Kurzbezeichnung</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Planbezeichnung</th>
|
||||
<th>Max. Person</th>
|
||||
<th>Lehre</th>
|
||||
<th>Reservieren</th>
|
||||
<th>Aktiv</th>
|
||||
<th class='table-sortable:numeric'>Kosten</th>
|
||||
<th class='table-sortable:numeric'>Stockwerk</th>";
|
||||
<th>Kosten</th>
|
||||
<th>Stockwerk</th>";
|
||||
$htmlstr .= " </tr></thead><tbody>\n";
|
||||
$i = 0;
|
||||
foreach ($sg->result as $twraum)
|
||||
@@ -99,36 +165,28 @@ foreach ($sg->result as $twraum)
|
||||
$htmlstr .= " <td>".$twraum->bezeichnung."</td>\n";
|
||||
$htmlstr .= " <td>".$twraum->planbezeichnung."</td>\n";
|
||||
$htmlstr .= " <td>".$twraum->max_person."</td>\n";
|
||||
if($twraum->lehre=='t')
|
||||
{
|
||||
$lehrebild = "true.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
$lehrebild = "false.png";
|
||||
}
|
||||
$lehrelink = "?toggle=true&rlehre=".$twraum->ort_kurzbz."&rres=NULL&raktiv=NULL";
|
||||
$htmlstr .= " <td align='center'><a href='".$lehrelink."'><img src='../../skin/images/".$lehrebild."' height='20'></a></td>\n";
|
||||
if($twraum->reservieren=='t')
|
||||
{
|
||||
$resbild = "true.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
$resbild = "false.png";
|
||||
}
|
||||
$reslink = "?toggle=true&rres=".$twraum->ort_kurzbz."&rlehre=NULL&raktiv=NULL";
|
||||
$htmlstr .= " <td align='center'><a href='".$reslink."'><img src='../../skin/images/".$resbild."' height='20'></a></td>\n";
|
||||
if($twraum->aktiv)
|
||||
{
|
||||
$aktivbild = "true.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
$aktivbild = "false.png";
|
||||
}
|
||||
$aktivlink = "?toggle=true&raktiv=".$twraum->ort_kurzbz."&rres=NULL&rlehre=NULL";
|
||||
$htmlstr .= " <td align='center'><a href='".$aktivlink."'><img src='../../skin/images/".$aktivbild."' height='20'></a></td>\n";
|
||||
|
||||
// Lehre bollean setzen
|
||||
|
||||
$htmlstr .= " <div style='display: none'>".$db->convert_html_chars($twraum->lehre)."</div> <td align='center'><a href='#Lehre' onclick='changeboolean(\"".$twraum->ort_kurzbz."\",\"lehre\"); return false'>";
|
||||
$htmlstr .= " <input type='hidden' id='lehre".$twraum->ort_kurzbz."' value='".($twraum->lehre=="t"?"true":"false")."'>";
|
||||
$htmlstr .= " <img id='lehreimg".$twraum->ort_kurzbz."' src='../../skin/images/".($twraum->lehre=="t"?"true.png":"false.png")."' height='20'>";
|
||||
$htmlstr .= " </a></td>";
|
||||
|
||||
// Reservieren boolean setzen
|
||||
|
||||
$htmlstr .= " <div style='display: none'>".$db->convert_html_chars($twraum->reservieren)."</div> <td align='center'><a href='#Reservieren' onclick='changeboolean(\"".$twraum->ort_kurzbz."\",\"reservieren\"); return false'>";
|
||||
$htmlstr .= " <input type='hidden' id='reservieren".$twraum->ort_kurzbz."' value='".($twraum->reservieren=="t"?"true":"false")."'>";
|
||||
$htmlstr .= " <img id='reservierenimg".$twraum->ort_kurzbz."' src='../../skin/images/".($twraum->reservieren=="t"?"true.png":"false.png")."' style='margin:0;' height='20'>";
|
||||
$htmlstr .= " </a></td>";
|
||||
|
||||
// Aktiv boolean setzen
|
||||
|
||||
$htmlstr .= " <div style='display: none'>".$db->convert_html_chars($twraum->aktiv)."</div> <td align='center'><a href='#Aktiv' onclick='changeboolean(\"".$twraum->ort_kurzbz."\",\"aktiv\"); return false'>";
|
||||
$htmlstr .= " <input type='hidden' id='aktiv".$twraum->ort_kurzbz."' value='".($twraum->aktiv=="t"?"true":"false")."'>";
|
||||
$htmlstr .= " <img id='aktivimg".$twraum->ort_kurzbz."' src='../../skin/images/".($twraum->aktiv=="t"?"true.png":"false.png")."' style='margin:0;' height='20'>";
|
||||
$htmlstr .= " </a></td>";
|
||||
|
||||
$htmlstr .= " <td>".$twraum->kosten."</td>\n";
|
||||
$htmlstr .= " <td>".$twraum->stockwerk."</td>\n";
|
||||
$htmlstr .= " </tr>\n";
|
||||
@@ -143,9 +201,28 @@ $htmlstr .= "</tbody></table>\n";
|
||||
<title>Räume Übersicht</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
|
||||
<link rel="stylesheet" href="../../include/js/tablesort/table.css" type="text/css">
|
||||
<script src="../../include/js/tablesort/table.js" type="text/javascript"></script>
|
||||
<!--<link rel="stylesheet" href="../../include/js/tablesort/table.css" type="text/css">
|
||||
<script src="../../include/js/tablesort/table.js" type="text/javascript"></script>-->
|
||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
|
||||
<style>
|
||||
table.tablesorter tbody td
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#t1").tablesorter(
|
||||
{
|
||||
sortList: [[2,0]],
|
||||
widgets: ["zebra"]
|
||||
});
|
||||
});
|
||||
|
||||
function confdel()
|
||||
{
|
||||
if(confirm("Diesen Datensatz wirklick loeschen?"))
|
||||
@@ -153,6 +230,36 @@ function confdel()
|
||||
return false;
|
||||
}
|
||||
|
||||
function changeboolean(ort_kurzbz, name)
|
||||
{
|
||||
value=document.getElementById(name+ort_kurzbz).value;
|
||||
|
||||
var dataObj = {};
|
||||
dataObj["ort_kurzbz"]=ort_kurzbz;
|
||||
dataObj[name]=value;
|
||||
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"raum_uebersicht.php",
|
||||
data:dataObj,
|
||||
success: function(data)
|
||||
{
|
||||
if(data=="true")
|
||||
{
|
||||
//Image und Value aendern
|
||||
if(value=="true")
|
||||
value="false";
|
||||
else
|
||||
value="true";
|
||||
document.getElementById(name+ort_kurzbz).value=value;
|
||||
document.getElementById(name+"img"+ort_kurzbz).src="../../skin/images/"+value+".png";
|
||||
}
|
||||
else
|
||||
alert("ERROR:"+data)
|
||||
},
|
||||
error: function() { alert("error"); }
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user