mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Admin-GUI für Vertrags- und Buchungstypen hinzugefügt
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 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: Nikolaus Krondraf <nikolaus.krondraf@technikum-wien.at>
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class buchung extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result = array();
|
||||
|
||||
public $buchungstyp_kurzbz;
|
||||
public $buchungstyp_bezeichnung;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den Buchungstyp in der Datenbank
|
||||
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
|
||||
* angelegt, ansonsten der Datensatz upgedated
|
||||
* @return true wenn erfolgreich, false im Fehlerfall
|
||||
*/
|
||||
public function saveBuchungstyp($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($this->buchungstyp_kurzbz=='')
|
||||
{
|
||||
$this->errormsg = 'Buchungstyp_kurzbz muss angegeben werden';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($new)
|
||||
{
|
||||
//Prüfung, ob Eintrag bereits vorhanden
|
||||
$qry='SELECT buchungstyp_kurzbz FROM wawi.tbl_buchungstyp
|
||||
WHERE buchungstyp_kurzbz='.$this->db_add_param($this->buchungstyp_kurzbz);
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($this->db_fetch_object())
|
||||
{
|
||||
$this->errormsg = 'Eintrag bereits vorhanden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Durchführen der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = 'INSERT INTO wawi.tbl_buchungstyp(buchungstyp_kurzbz, bezeichnung) VALUES('.
|
||||
$this->db_add_param($this->buchungstyp_kurzbz).','.
|
||||
$this->db_add_param($this->buchungstyp_bezeichnung).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE wawi.tbl_buchungstyp SET '.
|
||||
'bezeichnung = '.$this->db_add_param($this->buchungstyp_bezeichnung).
|
||||
'WHERE buchungstyp_kurzbz = '.$this->db_add_param($this->buchungstyp_kurzbz);
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Buchungstyps';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht einen Buchungstyp
|
||||
* @param buchungstyp_kurzbz
|
||||
*/
|
||||
public function deleteBuchungstyp($buchungstyp_kurzbz)
|
||||
{
|
||||
if(is_null($buchungstyp_kurzbz))
|
||||
{
|
||||
$this->errormsg = 'Buchungstyp_kurzbz darf nicht leer sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "DELETE FROM wawi.tbl_buchungstyp
|
||||
WHERE buchungstyp_kurzbz=".$this->db_add_param($buchungstyp_kurzbz).";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen des Buchungstyps';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert alle Buchungstypen
|
||||
* @return true wenn ok false im Fehlerfall
|
||||
*/
|
||||
public function getAllBuchungstypen()
|
||||
{
|
||||
$qry = "SELECT * FROM wawi.tbl_buchungstyp ORDER BY bezeichnung;";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$buchung = new buchung();
|
||||
|
||||
$buchung->buchungstyp_kurzbz = $row->buchungstyp_kurzbz;
|
||||
$buchung->buchungstyp_bezeichnung = $row->bezeichnung;
|
||||
|
||||
$this->result[] = $buchung;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Buchungstyp
|
||||
*
|
||||
* @param $buchungstyp_kurzbz
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function loadBuchungstyp($buchungstyp_kurzbz)
|
||||
{
|
||||
$qry="SELECT * FROM wawi.tbl_buchungstyp
|
||||
WHERE
|
||||
buchungstyp_kurzbz=".$this->db_add_param($buchungstyp_kurzbz);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->buchungstyp_kurzbz = $row->buchungstyp_kurzbz;
|
||||
$this->buchungstyp_bezeichnung = $row->bezeichnung;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 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: Nikolaus Krondraf <nikolaus.krondraf@technikum-wien.at>
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class vertrag extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result = array();
|
||||
|
||||
public $vertragtyp_kurzbz;
|
||||
public $vertragtyp_bezeichnung;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den Vertragstyp in der Datenbank
|
||||
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
|
||||
* angelegt, ansonsten der Datensatz upgedated
|
||||
* @return true wenn erfolgreich, false im Fehlerfall
|
||||
*/
|
||||
public function saveVertragtyp($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($this->vertragtyp_kurzbz=='')
|
||||
{
|
||||
$this->errormsg = 'Vertragtyp_kurzbz muss angegeben werden';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($new)
|
||||
{
|
||||
//Prüfung, ob Eintrag bereits vorhanden
|
||||
$qry='SELECT vertragstyp_kurzbz FROM lehre.tbl_vertragstyp
|
||||
WHERE vertragstyp_kurzbz='.$this->db_add_param($this->vertragtyp_kurzbz);
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($this->db_fetch_object())
|
||||
{
|
||||
$this->errormsg = 'Eintrag bereits vorhanden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Durchführen der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = 'INSERT INTO lehre.tbl_vertragstyp(vertragstyp_kurzbz, bezeichnung) VALUES('.
|
||||
$this->db_add_param($this->vertragtyp_kurzbz).','.
|
||||
$this->db_add_param($this->vertragtyp_bezeichnung).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE lehre.tbl_vertragstyp SET '.
|
||||
'bezeichnung = '.$this->db_add_param($this->vertragtyp_bezeichnung).
|
||||
'WHERE vertragstyp_kurzbz = '.$this->db_add_param($this->vertragtyp_kurzbz);
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Vertragstyps';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht einen Vertragstyp
|
||||
* @param vertragtyp_kurzbz
|
||||
*/
|
||||
public function deleteVertragtyp($vertragtyp_kurzbz)
|
||||
{
|
||||
if(is_null($vertragtyp_kurzbz))
|
||||
{
|
||||
$this->errormsg = 'Vertragtyp_kurzbz darf nicht leer sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "DELETE FROM lehre.tbl_vertragstyp
|
||||
WHERE vertragstyp_kurzbz=".$this->db_add_param($vertragtyp_kurzbz).";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen des Vertragstyps';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert alle Vertragsytpen
|
||||
* @return true wenn ok false im Fehlerfall
|
||||
*/
|
||||
public function getAllVertragtypen()
|
||||
{
|
||||
$qry = "SELECT * FROM lehre.tbl_vertragstyp ORDER BY bezeichnung;";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$vertrag = new vertrag();
|
||||
|
||||
$vertrag->vertragtyp_kurzbz = $row->vertragstyp_kurzbz;
|
||||
$vertrag->vertragtyp_bezeichnung = $row->bezeichnung;
|
||||
|
||||
$this->result[] = $vertrag;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Vertragstyp
|
||||
*
|
||||
* @param $vertragtyp_kurzbz
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function loadVertragtyp($vertragtyp_kurzbz)
|
||||
{
|
||||
$qry="SELECT * FROM lehre.tbl_vertragstyp
|
||||
WHERE
|
||||
vertragstyp_kurzbz=".$this->db_add_param($vertragtyp_kurzbz);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->vertragtyp_kurzbz = $row->vertragstyp_kurzbz;
|
||||
$this->vertragtyp_bezeichnung = $row->bezeichnung;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2014 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., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Authors: Nikolaus Krondraf <nikolaus.krondraf@technikum-wien.at>
|
||||
*
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/functions.inc.php');
|
||||
require_once('../../include/buchung.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
|
||||
$buchungstyp_kurzbz=isset($_REQUEST['buchungstyp_kurzbz'])?$_REQUEST['buchungstyp_kurzbz']:'';
|
||||
$buchungstyp_bezeichnung=isset($_REQUEST['buchungstyp_bezeichnung'])?$_REQUEST['buchungstyp_bezeichnung']:'';
|
||||
|
||||
$action=isset($_GET['action'])?$_GET['action']:'';
|
||||
if(isset($_POST['add']))
|
||||
$action='add';
|
||||
|
||||
$uid = get_uid();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($uid);
|
||||
if(!isset($stg_kz))
|
||||
$stg_kz = null;
|
||||
|
||||
if(!$rechte->isBerechtigt('buchung/typen', $stg_kz, 'suid'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
if($action=='add')
|
||||
{
|
||||
if($buchungstyp_kurzbz != '')
|
||||
{
|
||||
$buchung = new buchung();
|
||||
$buchung->buchungstyp_kurzbz = $buchungstyp_kurzbz;
|
||||
$buchung->buchungstyp_bezeichnung = $buchungstyp_bezeichnung;
|
||||
$buchung->saveBuchungstyp();
|
||||
}
|
||||
}
|
||||
|
||||
if($action=='delete')
|
||||
{
|
||||
if($buchungstyp_kurzbz != '')
|
||||
{
|
||||
$buchung = new buchung();
|
||||
if(!$buchung->deleteBuchungstyp($buchungstyp_kurzbz))
|
||||
echo 'Fehler beim Löschen: ' . $buchung->errormsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link href="../../skin/fhcomplete.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../skin/vilesci.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css">
|
||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#t1").tablesorter(
|
||||
{
|
||||
sortList: [[0,0]],
|
||||
widgets: ["zebra"],
|
||||
headers: {0:{sorter:false}}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<title>Buchungstypen</title>
|
||||
</head>
|
||||
<body>';
|
||||
|
||||
|
||||
echo '<h1>Buchungstypen</h1>';
|
||||
|
||||
if(isset($_GET['type']))
|
||||
{
|
||||
if($_GET['type']=='delete')
|
||||
{
|
||||
$buchung = new buchung();
|
||||
if(!$buchung->deleteBuchungstyp($_GET['buchungstyp_kurzbz']))
|
||||
echo $buchung->errormsg;
|
||||
}
|
||||
}
|
||||
if(isset($_POST['saveBuchungstyp']))
|
||||
{
|
||||
$buchung = new buchung();
|
||||
$buchung->buchungstyp_kurzbz = $_POST['buchungstyp_kurzbz'];
|
||||
$buchung->buchungstyp_bezeichnung = $_POST['buchungstyp_bezeichnung'];
|
||||
|
||||
if(isset($_POST['neu']) && $_POST['neu']=='true')
|
||||
$neu=true;
|
||||
else
|
||||
$neu=false;
|
||||
|
||||
if(!$buchung->saveBuchungstyp($neu))
|
||||
echo $buchung->errormsg;
|
||||
}
|
||||
|
||||
$buchung = new buchung();
|
||||
$buchung->getAllBuchungstypen();
|
||||
|
||||
echo '
|
||||
<form action="'.$_SERVER['PHP_SELF'].'?action=buchungstypen" method="post">
|
||||
<table id="t1" class="tablesorter" style="width:auto">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>Kurzbz</th>
|
||||
<th>Bezeichnung</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
foreach($buchung->result as $row)
|
||||
{
|
||||
echo '<tr>
|
||||
<td>
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=buchungstypen&type=edit&buchungstyp_kurzbz='.$row->buchungstyp_kurzbz.'"><img src="../../skin/images/edit.png" title="Bearbeiten" /></a>
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=buchungstypen&type=delete&buchungstyp_kurzbz='.$row->buchungstyp_kurzbz.'"><img src="../../skin/images/cross.png" title="Löschen" /></a>';
|
||||
echo '
|
||||
</td>
|
||||
<td>'.$buchung->convert_html_chars($row->buchungstyp_kurzbz).'</td>
|
||||
<td>'.$buchung->convert_html_chars($row->buchungstyp_bezeichnung).'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$buchungstyp_kurzbz = '';
|
||||
$buchungstyp_bezeichnung = '';
|
||||
|
||||
if(isset($_GET['type']) && $_GET['type']=='edit')
|
||||
{
|
||||
$buchung = new buchung();
|
||||
if($buchung->loadBuchungstyp($_GET['buchungstyp_kurzbz']))
|
||||
{
|
||||
$buchungstyp_kurzbz = $buchung->buchungstyp_kurzbz;
|
||||
$buchungstyp_bezeichnung = $buchung->buchungstyp_bezeichnung;
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<input typ="text" id="buchungstyp_kurzbz" name="buchungstyp_kurzbz" maxlength="8" size="8" '.($buchungstyp_kurzbz!=''?'readonly':'').' value="'.$buchungstyp_kurzbz.'"/>
|
||||
<input type="hidden" id="neu" name="neu" value="'.($buchungstyp_kurzbz==''?'true':'false').'" />
|
||||
</td>
|
||||
<td><input type="text" id="buchungstyp_bezeichnung" name="buchungstyp_bezeichnung" maxlength="128" value="'.$buchung->convert_html_chars($buchungstyp_bezeichnung).'">
|
||||
<input type="submit" name="saveBuchungstyp" value="Speichern"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>';
|
||||
|
||||
|
||||
echo '
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2014 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., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* Authors: Nikolaus Krondraf <nikolaus.krondraf@technikum-wien.at>
|
||||
*
|
||||
*/
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/functions.inc.php');
|
||||
require_once('../../include/vertrag.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
|
||||
$vertragtyp_kurzbz=isset($_REQUEST['vertragtyp_kurzbz'])?$_REQUEST['vertragtyp_kurzbz']:'';
|
||||
$vertragtyp_bezeichnung=isset($_REQUEST['vertragtyp_bezeichnung'])?$_REQUEST['vertragtyp_bezeichnung']:'';
|
||||
|
||||
$action=isset($_GET['action'])?$_GET['action']:'';
|
||||
if(isset($_POST['add']))
|
||||
$action='add';
|
||||
|
||||
$uid = get_uid();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($uid);
|
||||
if(!isset($stg_kz))
|
||||
$stg_kz = null;
|
||||
|
||||
if(!$rechte->isBerechtigt('vertrag/typen', $stg_kz, 'suid'))
|
||||
die('Sie haben keine Berechtigung für diese Seite');
|
||||
|
||||
if($action=='add')
|
||||
{
|
||||
if($vertragtyp_kurzbz != '')
|
||||
{
|
||||
$vertrag = new vertrag();
|
||||
$vertrag->vertragtyp_kurzbz = $vertragtyp_kurzbz;
|
||||
$vertrag->vertragtyp_bezeichnung = $vertragtyp_bezeichnung;
|
||||
$vertrag->saveVertragtyp();
|
||||
}
|
||||
}
|
||||
|
||||
if($action=='delete')
|
||||
{
|
||||
if($vertragtyp_kurzbz != '')
|
||||
{
|
||||
$vertrag = new vertrag();
|
||||
if(!$vertrag->deleteVertragtyp($vertragtyp_kurzbz))
|
||||
echo 'Fehler beim Löschen: ' . $vertrag->errormsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link href="../../skin/vilesci.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css">
|
||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#t1").tablesorter(
|
||||
{
|
||||
sortList: [[0,0]],
|
||||
widgets: ["zebra"],
|
||||
headers: {0:{sorter:false}}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<title>Vertragstypen</title>
|
||||
</head>
|
||||
<body>';
|
||||
|
||||
|
||||
echo '<h1>Vertragstypen</h1>';
|
||||
|
||||
if(isset($_GET['type']))
|
||||
{
|
||||
if($_GET['type']=='delete')
|
||||
{
|
||||
$vertrag = new vertrag();
|
||||
if(!$vertrag->deleteVertragtyp($_GET['vertragtyp_kurzbz']))
|
||||
echo $vertrag->errormsg;
|
||||
}
|
||||
}
|
||||
if(isset($_POST['saveVertragtyp']))
|
||||
{
|
||||
$vertrag = new vertrag();
|
||||
$vertrag->vertragtyp_kurzbz=$_POST['vertragtyp_kurzbz'];
|
||||
$vertrag->vertragtyp_bezeichnung = $_POST['vertragtyp_bezeichnung'];
|
||||
if(isset($_POST['neu']) && $_POST['neu']=='true')
|
||||
$neu=true;
|
||||
else
|
||||
$neu=false;
|
||||
|
||||
if(!$vertrag->saveVertragtyp($neu))
|
||||
echo $vertrag->errormsg;
|
||||
}
|
||||
|
||||
$vertrag = new vertrag();
|
||||
$vertrag->getAllVertragtypen();
|
||||
|
||||
echo '
|
||||
<form action="'.$_SERVER['PHP_SELF'].'?action=vertragtypen" method="post">
|
||||
<table id="t1" class="tablesorter" style="width:auto">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>Kurzbz</th>
|
||||
<th>Bezeichnung</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
foreach($vertrag->result as $row)
|
||||
{
|
||||
echo '<tr>
|
||||
<td>
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=vertragtypen&type=edit&vertragtyp_kurzbz='.$row->vertragtyp_kurzbz.'"><img src="../../skin/images/edit.png" title="Bearbeiten" /></a>
|
||||
';
|
||||
// Lichtbil und Zeugnis duerfen nicht geloescht werden da diese fuer Bildupload und
|
||||
// Zeugnisarchivierung verwendet werden
|
||||
if(!in_array($row->vertragtyp_kurzbz,array('Lichtbil','Zeugnis')))
|
||||
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=vertragtypen&type=delete&vertragtyp_kurzbz='.$row->vertragtyp_kurzbz.'"><img src="../../skin/images/cross.png" title="Löschen" /></a>';
|
||||
|
||||
echo '
|
||||
</td>
|
||||
<td>'.$row->vertragtyp_kurzbz.'</td>
|
||||
<td>'.$row->vertragtyp_bezeichnung.'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$vertragtyp_kurzbz='';
|
||||
$vertragtyp_bezeichnung='';
|
||||
|
||||
if(isset($_GET['type']) && $_GET['type']=='edit')
|
||||
{
|
||||
$vertrag = new vertrag();
|
||||
if($vertrag->loadVertragtyp($_GET['vertragtyp_kurzbz']))
|
||||
{
|
||||
$vertragtyp_kurzbz = $vertrag->vertragtyp_kurzbz;
|
||||
$vertragtyp_bezeichnung = $vertrag->vertragtyp_bezeichnung;
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<input typ="text" id="vertragtyp_kurzbz" name="vertragtyp_kurzbz" maxlength="8" size="8" '.($vertragtyp_kurzbz!=''?'readonly':'').' value="'.$vertragtyp_kurzbz.'"/>
|
||||
<input type="hidden" id="neu" name="neu" value="'.($vertragtyp_kurzbz==''?'true':'false').'" />
|
||||
</td>
|
||||
<td><input type="text" id="vertragtyp_bezeichnung" name="vertragtyp_bezeichnung" maxlength="128" value="'.$vertragtyp_bezeichnung.'">
|
||||
<input type="submit" name="saveVertragtyp" value="Speichern"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>';
|
||||
|
||||
|
||||
echo '
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user