mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-07 23:29:28 +00:00
Verwaltungsseite für Infoscreens
This commit is contained in:
@@ -57,7 +57,7 @@ class infoscreen extends basis_db
|
||||
*/
|
||||
public function load($infoscreen_id)
|
||||
{
|
||||
//infoscreen_id auf gueltigkeit pruefen
|
||||
//infoscreen_id auf Gueltigkeit pruefen
|
||||
if(!is_numeric($infoscreen_id) || $infoscreen_id == '')
|
||||
{
|
||||
$this->errormsg = 'infoscreen_id muss eine gültige Zahl sein';
|
||||
@@ -90,6 +90,214 @@ class infoscreen extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen InfoscreenContent Datensatz
|
||||
* @param infoscreen_content_id ID des zu ladenden Datensatzes
|
||||
*/
|
||||
public function loadContent($infoscreen_content_id)
|
||||
{
|
||||
//infoscreen_content_id auf Gueltigkeit pruefen
|
||||
if(!is_numeric($infoscreen_content_id) || $infoscreen_content_id == '')
|
||||
{
|
||||
$this->errormsg = 'infoscreen__content_id muss eine gültige Zahl sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
//laden des Datensatzes
|
||||
$qry = "SELECT * FROM campus.tbl_infoscreen_content WHERE infoscreen_content_id='".addslashes($infoscreen_content_id)."';";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->infoscreen_content_id = $row->infoscreen_content_id;
|
||||
$this->infoscreen_id = $row->infoscreen_id;
|
||||
$this->content_id = $row->content_id;
|
||||
$this->gueltigvon = $row->gueltigvon;
|
||||
$this->gueltigbis = $row->gueltigbis;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Infoscreens
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$qry = "SELECT * FROM campus.tbl_infoscreen";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new infoscreen();
|
||||
|
||||
$obj->infoscreen_id = $row->infoscreen_id;
|
||||
$obj->bezeichnung = $row->bezeichnung;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->ipadresse = $row->ipadresse;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Speichert einen Infoscreen in der Datenbank
|
||||
* @return boolean
|
||||
*/
|
||||
public function save($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = "BEGIN;INSERT INTO campus.tbl_infoscreen(bezeichnung, beschreibung, ipadresse) VALUES(".
|
||||
$this->addslashes($this->bezeichnung).','.
|
||||
$this->addslashes($this->beschreibung).','.
|
||||
$this->addslashes($this->ipadresse).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE campus.tbl_infoscreen SET '.
|
||||
' bezeichnung='.$this->addslashes($this->bezeichnung).','.
|
||||
' beschreibung='.$this->addslashes($this->beschreibung).','.
|
||||
' ipadresse='.$this->addslashes($this->ipadresse).' '.
|
||||
' WHERE infoscreen_id='.$this->addslashes($this->infoscreen_id).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry = "SELECT currval('campus.seq_infoscreen_infoscreen_id') as id";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->infoscreen_id = $row->id;
|
||||
$this->db_query('COMMIT');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Speichert eine Contentzuordnung in der Datenbank
|
||||
* @return boolean
|
||||
*/
|
||||
public function saveContent($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = "BEGIN;INSERT INTO campus.tbl_infoscreen_content(infoscreen_id, content_id,
|
||||
gueltigvon, gueltigbis, insertamum, insertvon, updateamum, updatevon) VALUES(".
|
||||
$this->addslashes($this->infoscreen_id).','.
|
||||
$this->addslashes($this->content_id).','.
|
||||
$this->addslashes($this->gueltigvon).','.
|
||||
$this->addslashes($this->gueltigbis).','.
|
||||
$this->addslashes($this->insertamum).','.
|
||||
$this->addslashes($this->insertvon).','.
|
||||
$this->addslashes($this->updateamum).','.
|
||||
$this->addslashes($this->updatevon).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE campus.tbl_infoscreen_content SET '.
|
||||
' infoscreen_id='.$this->addslashes($this->infoscreen_id).','.
|
||||
' content_id='.$this->addslashes($this->content_id).','.
|
||||
' gueltigvon='.$this->addslashes($this->gueltigvon).','.
|
||||
' gueltigbis='.$this->addslashes($this->gueltigbis).','.
|
||||
' updateamum='.$this->addslashes($this->updateamum).','.
|
||||
' updatevon='.$this->addslashes($this->updatevon).' '.
|
||||
' WHERE infoscreen_content_id='.$this->addslashes($this->infoscreen_content_id).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry = "SELECT currval('campus.seq_infoscreen_content_infoscreen_content_id') as id";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->infoscreen_content_id = $row->id;
|
||||
$this->db_query('COMMIT');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Liefert den Infoscreen anhand der IP-Adresse
|
||||
@@ -125,15 +333,23 @@ class infoscreen extends basis_db
|
||||
*
|
||||
* Liefert den Content der am betreffenden Infoscreen angezeigt werden soll
|
||||
* @param $infoscreen_id id des Infoscreens
|
||||
* @param $aktuell wenn true werden nur die aktuell gueltigen Contents geliefert
|
||||
*/
|
||||
public function getScreenContent($infoscreen_id)
|
||||
public function getScreenContent($infoscreen_id, $aktuell=true)
|
||||
{
|
||||
if(!is_numeric($infoscreen_id))
|
||||
{
|
||||
$this->errormsg = 'InfoscreenID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
campus.tbl_infoscreen_content
|
||||
WHERE
|
||||
(infoscreen_id='".addslashes($infoscreen_id)."' OR infoscreen_id is null)
|
||||
(infoscreen_id='".addslashes($infoscreen_id)."' OR infoscreen_id is null)";
|
||||
if($aktuell)
|
||||
$qry.="
|
||||
AND (gueltigvon<=now() OR gueltigvon is null)
|
||||
AND (gueltigbis>=now() OR gueltigbis is null)";
|
||||
if($result = $this->db_query($qry))
|
||||
@@ -162,5 +378,28 @@ class infoscreen extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Entfernt eine Content Zuordnung
|
||||
*
|
||||
* @param $infoscreen_content_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function deleteContent($infoscreen_content_id)
|
||||
{
|
||||
if(!is_numeric($infoscreen_content_id))
|
||||
{
|
||||
$this->errormsg = 'ID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
$qry = "DELETE FROM campus.tbl_infoscreen_content WHERE infoscreen_content_id='".addslashes($infoscreen_content_id)."'";
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -165,6 +165,7 @@ $menu=array
|
||||
'Organisationseinheiten'=>array('name'=>'Organisationseinheiten', 'link'=>'stammdaten/organisationseinheiten.php', 'target'=>'main','permissions'=>array('basis/organisationseinheit')),
|
||||
'Statistik'=>array('name'=>'Statistik', 'link'=>'stammdaten/statistik_frameset.html', 'target'=>'main','permissions'=>array('basis/statistik')),
|
||||
'Ampel'=>array('name'=>'Ampel', 'link'=>'stammdaten/ampel_frameset.html', 'target'=>'main','permissions'=>array('basis/ampel')),
|
||||
'Infoscreen'=>array('name'=>'Infoscreen', 'link'=>'stammdaten/infoscreen_frameset.html', 'target'=>'main','permissions'=>array('basis/infoscreen')),
|
||||
'ImExport'=>array
|
||||
(
|
||||
'name'=>'ImExport','permissions'=>array('admin'),
|
||||
|
||||
Executable
+201
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH Technikum-Wien
|
||||
*
|
||||
* 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: Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at >
|
||||
*/
|
||||
/**
|
||||
* Seite zur Wartung der Infoscreens
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/infoscreen.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
require_once('../../include/datum.class.php');
|
||||
|
||||
if (!$db = new basis_db())
|
||||
die('Es konnte keine Verbindung zum Server aufgebaut werden.');
|
||||
|
||||
$user = get_uid();
|
||||
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/infoscreen'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
$datum_obj = new datum();
|
||||
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Infoscreen - Details</title>
|
||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css">
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
|
||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#myTable").tablesorter(
|
||||
{
|
||||
sortList: [[0,0]],
|
||||
widgets: ['zebra']
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$action = (isset($_GET['action'])?$_GET['action']:'show');
|
||||
$infoscreen_id = (isset($_GET['infoscreen_id'])?$_GET['infoscreen_id']:'');
|
||||
$infoscreen = new infoscreen();
|
||||
|
||||
if($infoscreen_id=='')
|
||||
exit;
|
||||
|
||||
if(!$infoscreen->load($infoscreen_id))
|
||||
die($infoscreen->errormsg);
|
||||
|
||||
echo '<h2>Details von Infoscreen ',$infoscreen_id,' - ',$infoscreen->bezeichnung.'</h2>';
|
||||
|
||||
echo '
|
||||
<div style="text-align:right">
|
||||
<a href="infoscreen_details.php?action=new&infoscreen_id=',$infoscreen_id,'" target="detail_infoscreen">Neuen Eintrag hinzufügen</a>
|
||||
</div>';
|
||||
|
||||
if($action=='save')
|
||||
{
|
||||
if(!$rechte->isBerechtigt('basis/infoscreen', null, 'sui'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
$my_infoscreen_id = $_POST['infoscreen_id'];
|
||||
$infoscreen_content_id = $_POST['infoscreen_content_id'];
|
||||
$content_id = $_POST['content_id'];
|
||||
$gueltigvon = $_POST['gueltigvon'];
|
||||
$gueltigbis = $_POST['gueltigbis'];
|
||||
|
||||
$infoscreen = new infoscreen();
|
||||
if($infoscreen_content_id!='')
|
||||
{
|
||||
$infoscreen->loadContent($infoscreen_content_id);
|
||||
$infoscreen->new = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$infoscreen->new = true;
|
||||
$infoscreen->insertamum = date('Y-m-d H:i:s');
|
||||
$infoscreen->insertvon = $user;
|
||||
}
|
||||
|
||||
$infoscreen->infoscreen_id = $my_infoscreen_id;
|
||||
$infoscreen->content_id = $content_id;
|
||||
$infoscreen->gueltigvon = $datum_obj->formatDatum($gueltigvon,'Y-m-d H:i:s');
|
||||
$infoscreen->gueltigbis = $datum_obj->formatDatum($gueltigbis,'Y-m-d H:i:s');
|
||||
$infoscreen->updateamum = date('Y-m-d H:i:s');
|
||||
$infoscreen->updatevon = $user;
|
||||
|
||||
if(!$infoscreen->saveContent())
|
||||
echo '<span class="error">',$db->convert_html_chars($infoscreen->errormsg),'</span>';
|
||||
else
|
||||
echo '<span class="ok">Daten erfolgreich gespeichert</span>';
|
||||
}
|
||||
if($action=='delete')
|
||||
{
|
||||
if(!$rechte->isBerechtigt('basis/infoscreen', null, 'suid'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
$infoscreen = new infoscreen();
|
||||
$infoscreen_content_id = (isset($_REQUEST['infoscreen_content_id'])?$_REQUEST['infoscreen_content_id']:'');
|
||||
if(!$infoscreen->deleteContent($infoscreen_content_id))
|
||||
echo '<span class="error">',$db->convert_html_chars($infoscreen->errormsg),'</span>';
|
||||
}
|
||||
//Formular fuer neu/update
|
||||
if($action=='new' || $action=='update')
|
||||
{
|
||||
$infoscreen_content_id = (isset($_REQUEST['infoscreen_content_id'])?$_REQUEST['infoscreen_content_id']:'');
|
||||
$infoscreen = new infoscreen();
|
||||
if($action=='new')
|
||||
{
|
||||
echo '<h3>Neu</h3>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<h3>Bearbeiten von ID ',$infoscreen_content_id,'</h3>';
|
||||
if(!$infoscreen->loadContent($infoscreen_content_id))
|
||||
die('Fehler: '.$infoscreen->errormsg);
|
||||
}
|
||||
echo '
|
||||
<form action="',$_SERVER['PHP_SELF'],'?action=save&infoscreen_id=',$infoscreen_id,'" method="POST">
|
||||
<input type="hidden" name="infoscreen_content_id" value="',$db->convert_html_chars($infoscreen->infoscreen_content_id),'">
|
||||
<table>
|
||||
<tr>
|
||||
<td>InfoscreenID</td>
|
||||
<td><input type="text" size="5" name="infoscreen_id" value="',$db->convert_html_chars($infoscreen->infoscreen_id),'" /> (Wenn keine ID eingetragen wird, gilt der Eintrag für alle Infoscreens)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Content ID</td>
|
||||
<td><input type="text" size="5" name="content_id" value="',$db->convert_html_chars($infoscreen->content_id),'" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gültig von</td>
|
||||
<td><input type="text" size="18" name="gueltigvon" value="',$db->convert_html_chars($datum_obj->formatDatum($infoscreen->gueltigvon,'d.m.Y H:i:s')),'" /> ( Format: ',date('d.m.Y H:i:s'),' )</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gültig bis</td>
|
||||
<td><input type="text" size="18" name="gueltigbis" value="',$db->convert_html_chars($datum_obj->formatDatum($infoscreen->gueltigbis,'d.m.Y H:i:s')),'" /> ( Format: ',date('d.m.Y H:i:s'),' )</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Speichern" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
}
|
||||
|
||||
if(!$infoscreen->getScreenContent($infoscreen_id, false))
|
||||
die('Fehler:'.$infoscreen->errormsg);
|
||||
echo '<table class="tablesorter" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>InfoscreenID</th>
|
||||
<th>ContentID</th>
|
||||
<th>Gültig von</th>
|
||||
<th>Gültig bis</th>
|
||||
<th colspan="2">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
foreach($infoscreen->result as $row)
|
||||
{
|
||||
echo '<tr>';
|
||||
echo '<td>',$db->convert_html_chars($row->infoscreen_content_id),'</td>';
|
||||
echo '<td>',$db->convert_html_chars($row->infoscreen_id),'</td>';
|
||||
echo '<td>',$db->convert_html_chars($row->content_id),'</td>';
|
||||
echo '<td>',$db->convert_html_chars($datum_obj->formatDatum($row->gueltigvon,'d.m.Y H:i:s')),'</td>';
|
||||
echo '<td>',$db->convert_html_chars($datum_obj->formatDatum($row->gueltigbis,'d.m.Y H:i:s')),'</td>';
|
||||
echo '<td><a href="infoscreen_details.php?action=update&infoscreen_id=',$db->convert_html_chars($infoscreen_id),'&infoscreen_content_id=',$db->convert_html_chars($row->infoscreen_content_id),'">bearbeiten</a>';
|
||||
echo '<td><a href="infoscreen_details.php?action=delete&infoscreen_id=',$db->convert_html_chars($infoscreen_id),'&infoscreen_content_id=',$db->convert_html_chars($row->infoscreen_content_id),'">entfernen</a>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody>
|
||||
</table>';
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
|
||||
<html lang="de_AT">
|
||||
|
||||
<head>
|
||||
<title>VileSci</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<frameset rows="50%,*">
|
||||
<frame src="infoscreen_uebersicht.php" name="uebersicht_infoscreen" frameborder="0" />
|
||||
<frame src="infoscreen_details.php" name="detail_infoscreen" frameborder="0" />
|
||||
<noframes>
|
||||
<body bgcolor="#FFFFFF">
|
||||
This application works only with a frames-enabled browser.<br />
|
||||
</body>
|
||||
</noframes>
|
||||
</frameset>
|
||||
|
||||
</html>
|
||||
Executable
+161
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH Technikum-Wien
|
||||
*
|
||||
* 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: Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at >
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/infoscreen.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
require_once('../../include/datum.class.php');
|
||||
|
||||
$user = get_uid();
|
||||
$basis = new basis();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/infoscreen'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
$datum_obj = new datum();
|
||||
|
||||
$action = isset($_GET['action'])?$_GET['action']:'show';
|
||||
$infoscreen_id = isset($_GET['infoscreen_id'])?$_GET['infoscreen_id']:'';
|
||||
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Infoscreen</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css">
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
|
||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#myTable").tablesorter(
|
||||
{
|
||||
sortList: [[2,0]],
|
||||
widgets: [\'zebra\']
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Infoscreen Übersicht</h2>
|
||||
<div style="text-align:right">
|
||||
<a href="infoscreen_uebersicht.php?action=new" target="uebersicht_infoscreen">Neuen Infoscreen hinzufügen</a>
|
||||
</div>';
|
||||
|
||||
if($action=='save')
|
||||
{
|
||||
$infoscreen_id = $_POST['infoscreen_id'];
|
||||
$bezeichnung = $_POST['bezeichnung'];
|
||||
$beschreibung = $_POST['beschreibung'];
|
||||
$ipadresse = $_POST['ipadresse'];
|
||||
|
||||
$infoscreen = new infoscreen();
|
||||
if($infoscreen_id!='')
|
||||
{
|
||||
$infoscreen->load($infoscreen_id);
|
||||
$infoscreen->new = false;
|
||||
}
|
||||
else
|
||||
$infoscreen->new = true;
|
||||
|
||||
$infoscreen->bezeichnung = $bezeichnung;
|
||||
$infoscreen->beschreibung = $beschreibung;
|
||||
$infoscreen->ipadresse = $ipadresse;
|
||||
|
||||
if(!$infoscreen->save())
|
||||
echo '<span class="error">',$basis->convert_html_chars($infoscreen->errormsg),'</span>';
|
||||
else
|
||||
echo '<span class="ok">Daten erfolgreich gespeichert</span>';
|
||||
}
|
||||
|
||||
if($action=='new' || $action=='update')
|
||||
{
|
||||
$infoscreen = new infoscreen();
|
||||
if($action=='new')
|
||||
{
|
||||
echo '<h3>Neu</h3>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<h3>Bearbeiten von ID ',$basis->convert_html_chars($infoscreen_id),'</h3>';
|
||||
if(!$infoscreen->load($infoscreen_id))
|
||||
die('Fehler: '.$infoscreen->errormsg);
|
||||
}
|
||||
echo '
|
||||
<form action="',$_SERVER['PHP_SELF'],'?action=save" method="POST">
|
||||
<input type="hidden" name="infoscreen_id" value="',$basis->convert_html_chars($infoscreen->infoscreen_id),'">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Bezeichnung</td>
|
||||
<td><input type="text" name="bezeichnung" value="',$basis->convert_html_chars($infoscreen->bezeichnung),'" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Beschreibung</td>
|
||||
<td><input type="text" name="beschreibung" value="',$basis->convert_html_chars($infoscreen->beschreibung),'" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IP Adresse</td>
|
||||
<td><input type="text" name="ipadresse" value="',$basis->convert_html_chars($infoscreen->ipadresse),'" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Speichern" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
}
|
||||
$infoscreen = new infoscreen();
|
||||
|
||||
if(!$infoscreen->getAll())
|
||||
die($infoscreen->errormsg);
|
||||
|
||||
echo '<table class="tablesorter" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>IP</th>
|
||||
<th colspan="2">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
foreach($infoscreen->result as $row)
|
||||
{
|
||||
echo '<tr>';
|
||||
echo '<td>',$basis->convert_html_chars($row->infoscreen_id),'</td>';
|
||||
echo '<td>',$basis->convert_html_chars($row->bezeichnung),'</td>';
|
||||
echo '<td>',$basis->convert_html_chars($row->beschreibung),'</td>';
|
||||
echo '<td>',$basis->convert_html_chars($row->ipadresse),'</td>';
|
||||
echo '<td><a href="infoscreen_details.php?action=show&infoscreen_id=',$basis->convert_html_chars($row->infoscreen_id),' " target="detail_infoscreen">details</a></td>';
|
||||
echo '<td><a href="infoscreen_uebersicht.php?action=update&infoscreen_id=',$basis->convert_html_chars($row->infoscreen_id),' " target="uebersicht_infoscreen">bearbeiten</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>';
|
||||
?>
|
||||
Reference in New Issue
Block a user