mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Ampelsystem
- Datenbanktabellen - Verwaltungsoberfläche im Vilesci
This commit is contained in:
Executable
+332
@@ -0,0 +1,332 @@
|
||||
<?php
|
||||
/* Copyright (C) 20011 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> and
|
||||
*/
|
||||
/**
|
||||
* Klasse Ampel
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class ampel extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result = array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $ampel_id; // bigint
|
||||
public $kurzbz; // varchar(64)
|
||||
public $beschreibung; // text
|
||||
public $benutzer_select;// text
|
||||
public $deadline; // date
|
||||
public $vorlaufzeit; // smallint
|
||||
public $verfallszeit; // smallint
|
||||
public $insertamum; // timestamp
|
||||
public $insertvon; // varchar(32)
|
||||
public $updateamum; // timestamp
|
||||
public $updatevon; // varchar(32)
|
||||
|
||||
public $ampel_benutzer_id; // bigint
|
||||
public $uid; // varchar(32)
|
||||
|
||||
/**
|
||||
* Konstruktor - Laedt optional eine Ampel
|
||||
* @param $amepl_id
|
||||
*/
|
||||
public function __construct($ampel_id=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if(!is_null($ampel_id))
|
||||
$this->load($ampel_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt eine Ampel mit der uebergebenen ID
|
||||
*
|
||||
* @param $ampel_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function load($ampel_id)
|
||||
{
|
||||
if(!is_numeric($ampel_id))
|
||||
{
|
||||
$this->errormsg = 'Ampel ID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_ampel WHERE ampel_id='".addslashes($ampel_id)."'";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->ampel_id = $row->ampel_id;
|
||||
$this->kurzbz = $row->kurzbz;
|
||||
$this->beschreibung = $row->beschreibung;
|
||||
$this->benutzer_select = $row->benutzer_select;
|
||||
$this->deadline = $row->deadline;
|
||||
$this->vorlaufzeit = $row->vorlaufzeit;
|
||||
$this->verfallszeit = $row->verfallszeit;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Ampel mit dieser ID exisitert nicht';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Ampel';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle vorhandenen Ampeln
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$qry = "SELECT * FROM public.tbl_ampel ORDER BY deadline";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new ampel();
|
||||
|
||||
$obj->ampel_id = $row->ampel_id;
|
||||
$obj->kurzbz = $row->kurzbz;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->benutzer_select = $row->benutzer_select;
|
||||
$obj->deadline = $row->deadline;
|
||||
$obj->vorlaufzeit = $row->vorlaufzeit;
|
||||
$obj->verfallszeit = $row->verfallszeit;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft ob ein User eine Ampel schon bestaetigt hat
|
||||
*
|
||||
* @param $user
|
||||
* @param $ampel_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBestaetigt($user, $ampel_id)
|
||||
{
|
||||
$qry = "SELECT 1 FROM public.tbl_ampel_benutzer_bestaetigt WHERE ampel_id='".addslashes($ampel_id)."' AND uid='".addslashes($user)."'";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($this->db_num_rows($result)>0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft ob ein User zu einer Ampel zugeteilt ist
|
||||
* @param $user
|
||||
* @param $benutzer_select
|
||||
*/
|
||||
public function isZugeteilt($user, $benutzer_select)
|
||||
{
|
||||
$qry = "SELECT CASE WHEN '".addslashes($user)."' IN (".$row->benutzer_select.") THEN true ELSE false END as zugeteilt";
|
||||
if($result_zugeteilt = $this->db_query($qry))
|
||||
{
|
||||
if($row_zugeteilt = $this->db_fetch_object($result_zugeteilt))
|
||||
{
|
||||
if($row_zugeteilt->zugeteilt=='t')
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle aktuellen Ampeln eines Users
|
||||
* @param $user
|
||||
*/
|
||||
public function loadUserAmpel($user)
|
||||
{
|
||||
$qry = "SELECT * FROM public.tbl_ampel WHERE deadline+verfallszeit>now() AND deadline-vorlaufzeit<now()";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
if($this->isZugeteilt($user, $row->benutzer_select))
|
||||
{
|
||||
$obj = new ampel();
|
||||
|
||||
$obj->ampel_id = $row->ampel_id;
|
||||
$obj->kurzbz = $row->kurzbz;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->benutzer_select = $row->benutzer_select;
|
||||
$obj->deadline = $row->deadline;
|
||||
$obj->vorlaufzeit = $row->vorlaufzeit;
|
||||
$obj->verfallszeit = $row->verfallszeit;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert eine Ampel
|
||||
* @param $new
|
||||
*/
|
||||
public function save($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
$qry = "BEGIN;INSERT INTO public.tbl_ampel (kurzbz, beschreibung, benutzer_select, deadline,
|
||||
vorlaufzeit, verfallszeit, insertamum, insertvon , updateamum, updatevon) VALUES(".
|
||||
$this->addslashes($this->kurzbz).','.
|
||||
$this->addslashes($this->beschreibung).','.
|
||||
$this->addslashes($this->benutzer_select).','.
|
||||
$this->addslashes($this->deadline).','.
|
||||
$this->addslashes($this->vorlaufzeit).','.
|
||||
$this->addslashes($this->verfallszeit).','.
|
||||
$this->addslashes($this->insertamum).','.
|
||||
$this->addslashes($this->insertvon).','.
|
||||
$this->addslashes($this->updateamum).','.
|
||||
$this->addslashes($this->updatevon).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE public.tbl_ampel SET'.
|
||||
' kurzbz = '.$this->addslashes($this->kurzbz).','.
|
||||
' beschreibung = '.$this->addslashes($this->beschreibung).','.
|
||||
' benutzer_select = '.$this->addslashes($this->benutzer_select).','.
|
||||
' deadline = '.$this->addslashes($this->deadline).','.
|
||||
' vorlaufzeit = '.$this->addslashes($this->vorlaufzeit).','.
|
||||
' verfallszeit = '.$this->addslashes($this->verfallszeit).','.
|
||||
' updateamum ='.$this->addslashes($this->updateamum).','.
|
||||
' updatevon ='.$this->addslashes($this->updatevon).
|
||||
' WHERE ampel_id='.$this->addslashes($this->ampel_id).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry = "SELECT currval('public.seq_ampel_ampel_id') as id";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->ampel_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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht eine Ampel
|
||||
|
||||
* @param $ampel_id
|
||||
*/
|
||||
public function delete($ampel_id)
|
||||
{
|
||||
if(!is_numeric($ampel_id))
|
||||
{
|
||||
$this->errormsg='ID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
$qry = "DELETE FROM public.tbl_ampel WHERE ampel_id='".addslashes($ampel_id)."'";
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen der Ampel';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -162,6 +162,7 @@ $menu=array
|
||||
'Firmen'=>array('name'=>'Firmen', 'link'=>'stammdaten/firma_frameset.html', 'target'=>'main','permissions'=>array('basis/firma')),
|
||||
'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')),
|
||||
'ImExport'=>array
|
||||
(
|
||||
'name'=>'ImExport','permissions'=>array('admin'),
|
||||
|
||||
@@ -2889,6 +2889,10 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.tbl_ampel"))
|
||||
GRANT SELECT ON public.tbl_ampel TO web;
|
||||
GRANT SELECT, UPDATE, INSERT, DELETE ON public.tbl_ampel_benutzer_bestaetigt TO vilesci;
|
||||
GRANT SELECT, UPDATE, INSERT, DELETE ON public.tbl_ampel_benutzer_bestaetigt TO web;
|
||||
GRANT SELECT, UPDATE ON SEQUENCE public.seq_ampel_ampel_id TO web;
|
||||
GRANT SELECT, UPDATE ON SEQUENCE public.seq_ampel_ampel_id TO vilesci;
|
||||
GRANT SELECT, UPDATE ON SEQUENCE public.seq_ampel_benutzer_bestaetigt_ampel_benutzer_bestaetigt_id TO web;
|
||||
GRANT SELECT, UPDATE ON SEQUENCE public.seq_ampel_benutzer_bestaetigt_ampel_benutzer_bestaetigt_id TO vilesci;
|
||||
|
||||
";
|
||||
|
||||
|
||||
Executable
+165
@@ -0,0 +1,165 @@
|
||||
<?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 Ampeln
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/ampel.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/ampel'))
|
||||
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>Ampel - Details</title>
|
||||
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css">
|
||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$action = (isset($_GET['action'])?$_GET['action']:'new');
|
||||
$ampel_id = (isset($_REQUEST['ampel_id'])?$_REQUEST['ampel_id']:'');
|
||||
$ampel = new ampel();
|
||||
|
||||
if($action=='save')
|
||||
{
|
||||
$kurzbz = (isset($_POST['kurzbz'])?$_POST['kurzbz']:die('Kurzbz fehlt'));
|
||||
$beschreibung = (isset($_POST['beschreibung'])?$_POST['beschreibung']:die('Beschreibung fehlt'));
|
||||
$benutzer_select = (isset($_POST['benutzer_select'])?$_POST['benutzer_select']:die('Benutzer_select fehlt'));
|
||||
$deadline = (isset($_POST['deadline'])?$_POST['deadline']:die('Deadline fehlt'));
|
||||
$vorlaufzeit = (isset($_POST['vorlaufzeit'])?$_POST['vorlaufzeit']:die('Vorlaufzeit fehlt'));
|
||||
$verfallszeit = (isset($_POST['verfallszeit'])?$_POST['verfallszeit']:die('verfallszeit fehlt'));
|
||||
$new = (isset($_POST['new'])?$_POST['new']:'true');
|
||||
if($new=='true')
|
||||
{
|
||||
$ampel->insertamum=date('Y-m-d H:i:s');
|
||||
$ampel->insertvon = $user;
|
||||
$ampel->new = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$ampel->load($ampel_id))
|
||||
die($ampel->errormsg);
|
||||
|
||||
$ampel->new=false;
|
||||
}
|
||||
|
||||
$ampel->kurzbz=$kurzbz;
|
||||
$ampel->beschreibung = $beschreibung;
|
||||
$ampel->benutzer_select = $benutzer_select;
|
||||
$ampel->deadline = $datum_obj->formatDatum($deadline,'Y-m-d');
|
||||
$ampel->vorlaufzeit = $vorlaufzeit;
|
||||
$ampel->verfallszeit = $verfallszeit;
|
||||
$ampel->updateamum = date('Y-m-d H:i:s');
|
||||
$ampel->updatevon = $user;
|
||||
|
||||
if($ampel->save())
|
||||
{
|
||||
echo '<span class="ok">Daten erfolgreich gespeichert</span>';
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo " parent.uebersicht_ampel.location.href='ampel_uebersicht.php';";
|
||||
echo "</script>\n";
|
||||
$action='update';
|
||||
$ampel_id = $ampel->ampel_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='new';
|
||||
echo '<span class="error">'.$ampel->errormsg.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<fieldset>';
|
||||
switch($action)
|
||||
{
|
||||
case 'new':
|
||||
echo '<legend>Neu</legend>';
|
||||
$new = 'true';
|
||||
break;
|
||||
case 'update':
|
||||
if(!$ampel->load($ampel_id))
|
||||
die($ampel->errormsg);
|
||||
echo "<legend>Bearbeiten von ID $ampel_id</legend>";
|
||||
$new = 'false';
|
||||
break;
|
||||
case 'copy':
|
||||
if(!$ampel->load($ampel_id))
|
||||
die($ampel->errormsg);
|
||||
echo "<legend>Kopieren von ID $ampel_id</legend>";
|
||||
$new = 'true';
|
||||
$ampel->ampel_id='';
|
||||
break;
|
||||
default:
|
||||
die('Invalid Action');
|
||||
break;
|
||||
}
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?action=save" method="POST">';
|
||||
echo '<input type="hidden" name="new" value="'.$new.'">';
|
||||
echo '<input type="hidden" name="ampel_id" value="'.$ampel->ampel_id.'">';
|
||||
echo '<table>';
|
||||
echo '<tr>';
|
||||
echo ' <td>Kurzbz</td>';
|
||||
echo ' <td><input type="text" name="kurzbz" size="30" maxlength="64" value="'.$ampel->kurzbz.'"></td>';
|
||||
echo ' <td></td>';
|
||||
echo ' <td>Deadline</td>';
|
||||
echo ' <td><input type="text" name="deadline" size="10" maxlength="10" value="'.$datum_obj->formatDatum($ampel->deadline,'d.m.Y').'"></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td rowspan="2">Beschreibung</td>';
|
||||
echo ' <td rowspan="2"><textarea name="beschreibung" cols="60" rows="5">'.$ampel->beschreibung.'</textarea></td>';
|
||||
echo ' <td></td>';
|
||||
echo ' <td valign="middle">Vorlaufzeit (in Tagen)</td>';
|
||||
echo ' <td valign="middle"><input type="text" name="vorlaufzeit" size="4" maxlength="4" value="'.$ampel->vorlaufzeit.'"></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td></td>';
|
||||
echo ' <td>Verfallszeit (in Tagen)</td>';
|
||||
echo ' <td><input type="text" name="verfallszeit" size="4" maxlength="4" value="'.$ampel->verfallszeit.'"></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td rowspan="2">Benutzer Select</td>';
|
||||
echo ' <td rowspan="2"><textarea name="benutzer_select" cols="60" rows="5">'.$ampel->benutzer_select.'</textarea></td>';
|
||||
echo ' <td></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="bottom">';
|
||||
echo ' <td></td>';
|
||||
echo ' <td></td>';
|
||||
echo ' <td><input type="submit" value="Speichern" name="save"></td>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</fieldset>';
|
||||
?>
|
||||
</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="ampel_uebersicht.php" name="uebersicht_ampel" frameborder="0" />
|
||||
<frame src="ampel_details.php" name="detail_ampel" frameborder="0" />
|
||||
<noframes>
|
||||
<body bgcolor="#FFFFFF">
|
||||
This application works only with a frames-enabled browser.<br />
|
||||
</body>
|
||||
</noframes>
|
||||
</frameset>
|
||||
|
||||
</html>
|
||||
Executable
+118
@@ -0,0 +1,118 @@
|
||||
<?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/ampel.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
require_once('../../include/datum.class.php');
|
||||
|
||||
$user = get_uid();
|
||||
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/ampel'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
$datum_obj = new datum();
|
||||
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Ampel</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\']
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
function confdel()
|
||||
{
|
||||
return confirm("Wollen Sie diesen Eintrag wirklich löschen?");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Ampel Übersicht</h2>
|
||||
<div style="text-align:right">
|
||||
<a href="ampel_details.php?action=new" target="detail_ampel">Neu</a>
|
||||
</div>';
|
||||
if(isset($_GET['action']) && $_GET['action']=='delete')
|
||||
{
|
||||
if(!$rechte->isBerechtigt('basis/ampel', null, 'suid'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
if(!isset($_GET['ampel_id']))
|
||||
die('Fehlender Parameter Statistik');
|
||||
|
||||
$ampel = new ampel();
|
||||
if($ampel->delete($_GET['ampel_id']))
|
||||
echo '<span class="ok">Eintrag wurde erfolgreich gelöscht</span>';
|
||||
else
|
||||
echo '<span class="error">'.$ampel->errormsg.'</span>';
|
||||
}
|
||||
|
||||
$ampel = new ampel();
|
||||
|
||||
if(!$ampel->getAll())
|
||||
die($ampel->errormsg);
|
||||
|
||||
echo '<table class="tablesorter" id="myTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Kurzbz</th>
|
||||
<th>Deadline</th>
|
||||
<th>Vorlaufzeit</th>
|
||||
<th>Verfallszeit</th>
|
||||
<th colspan="3">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
foreach($ampel->result as $row)
|
||||
{
|
||||
echo '<tr>';
|
||||
echo '<td><a href="ampel_details.php?action=update&el_id=',$row->ampel_id,' " target="detail_ampel">',$row->ampel_id,'</a></td>';
|
||||
echo '<td>',$row->kurzbz,'</td>';
|
||||
echo '<td>',$datum_obj->formatDatum($row->deadline,'d.m.Y'),'</td>';
|
||||
echo '<td>',$row->vorlaufzeit,'</td>';
|
||||
echo '<td>',$row->verfallszeit,'</td>';
|
||||
echo '<td><a href="ampel_details.php?action=update&el_id=',$row->ampel_id,' " target="detail_ampel">bearbeiten</a></td>';
|
||||
echo '<td><a href="ampel_details.php?action=copy&el_id=',$row->ampel_id,' " target="detail_ampel">kopieren</a></td>';
|
||||
echo '<td><a href="ampel_uebersicht.php?action=delete&el_id=',$row->ampel_id,' " onclick="return confdel()">entfernen</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>';
|
||||
?>
|
||||
Reference in New Issue
Block a user