mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
SYNC Fachbereich
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007 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: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
/**
|
||||
* Klasse aufmerksamdurch
|
||||
* @create 02-01-2007
|
||||
*/
|
||||
|
||||
class aufmerksamdurch
|
||||
{
|
||||
var $conn; // @var resource DB-Handle
|
||||
var $new; // @var boolean
|
||||
var $errormsg; // @var string
|
||||
var $done=false; // @var boolean
|
||||
|
||||
//Tabellenspalten
|
||||
Var $aufmerksamdurch_kurzbz; // @var string
|
||||
var $beschreibung; // @var integer
|
||||
var $ext_id; // @var integer
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $conn Connection
|
||||
* $aufmerksamdurch_kurzbz = ID (Default=null)
|
||||
*/
|
||||
function aufmerksamdurch($conn,$aufmerksamdurch_kurzbz=null, $unicode=false)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
if ($unicode)
|
||||
{
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
}
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = "Encoding konnte nicht gesetzt werden";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aufmerksam_kurzbz ID
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function load($aufmerksam_kurzbz)
|
||||
{
|
||||
//noch nicht implementiert
|
||||
}
|
||||
|
||||
// ************************************************
|
||||
// * wenn $var '' ist wird "null" zurueckgegeben
|
||||
// * wenn $var !='' ist werden datenbankkritische
|
||||
// * Zeichen mit backslash versehen und das Ergebnis
|
||||
// * unter Hochkomma gesetzt.
|
||||
// ************************************************
|
||||
function addslashes($var)
|
||||
{
|
||||
return ($var!=''?"'".addslashes($var)."'":'null');
|
||||
}
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz in die Datenbank
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
* andernfalls wird der Datensatz mit der ID in $schluessel_id aktualisiert
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
$this->done=false;
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
|
||||
$qry='INSERT INTO tbl_aufmerksamdurch (aufmerksamdurch_kurzbz, beschreibung) VALUES('.
|
||||
$this->addslashes($this->aufmerksamdurch_kurzbz).', '.
|
||||
$this->addslashes($this->beschreibung).', '.
|
||||
$this->addslashes($this->ext_id).');';
|
||||
$this->done=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$qryz="SELECT * FROM tbl_aufmerksamdurch WHERE aufmerksamdurch_kurzbz='$this->aufmerksamdurch_kurzbz';";
|
||||
if($resultz = pg_query($this->conn, $qryz))
|
||||
{
|
||||
while($rowz = pg_fetch_object($resultz))
|
||||
{
|
||||
$update=false;
|
||||
if($rowz->beschreibung!=$this->beschreibung) $update=true;
|
||||
if($rowz->beschreibung!=$this->ext_id) $update=true;
|
||||
|
||||
if($update)
|
||||
{
|
||||
$qry='UPDATE tbl_aufmerksamdurch SET '.
|
||||
'beschreibung='.$this->addslashes($this->beschreibung).', '.
|
||||
'ext_id='.$this->addslashes($this->ext_id).' '.
|
||||
'WHERE aufmerksamdurch_kurzbz='.$this->addslashes($this->aufmerksamdurch_kurzbz).';';
|
||||
$this->done=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->done)
|
||||
{
|
||||
if(pg_query($this->conn, $qry))
|
||||
{
|
||||
//Log schreiben
|
||||
/*$sql = $qry;
|
||||
$qry = "SELECT nextval('log_seq') as id;";
|
||||
if(!$row = pg_fetch_object(pg_query($this->conn, $qry)))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Log-Sequence';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "INSERT INTO log(log_pk, creationdate, creationuser, sql) VALUES('$row->id', now(), '$this->updatevon', '".addslashes($sql)."')";
|
||||
if(pg_query($this->conn, $qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Log-Eintrages';
|
||||
return false;
|
||||
} */
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht den Datenensatz mit der ID die uebergeben wird
|
||||
* @param $aufmerksamdurch_kurzbz ID die geloescht werden soll
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function delete($aufmerksamdurch_kurzbz)
|
||||
{
|
||||
//noch nicht implementiert!
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -187,8 +187,8 @@ class bankverbindung
|
||||
$this->errormsg = 'person_id muss eine gueltige Zahl sein: '.$this->person_id.'';
|
||||
return false;
|
||||
}
|
||||
$qry="SELECT * FROM tbl_bankverbindung WHERE bankverbindung_id='$this->bankverbindung_id';";
|
||||
if($resultz = pg_query($this->conn, $qry))
|
||||
$qryz="SELECT * FROM tbl_bankverbindung WHERE bankverbindung_id='$this->bankverbindung_id';";
|
||||
if($resultz = pg_query($this->conn, $qryz))
|
||||
{
|
||||
while($rowz = pg_fetch_object($resultz))
|
||||
{
|
||||
@@ -206,7 +206,7 @@ class bankverbindung
|
||||
|
||||
if($update)
|
||||
{
|
||||
$qry='UPDATE bankverbindung SET '.
|
||||
$qry='UPDATE tbl_bankverbindung SET '.
|
||||
'person_id='.$this->addslashes($this->person_id).', '.
|
||||
'name='.$this->addslashes($this->name).', '.
|
||||
'anschrift='.$this->addslashes($this->anschrift).', '.
|
||||
@@ -215,7 +215,7 @@ class bankverbindung
|
||||
'kontonr='.$this->addslashes($this->kontonr).', '.
|
||||
'iban='.$this->addslashes($this->iban).', '.
|
||||
'typ='.$this->addslashes($this->typ).', '.
|
||||
'zustellung='.($this->zustellung?'true':'false').', '.
|
||||
'verrechnung='.($this->verrechnung?'true':'false').', '.
|
||||
'ext_id='.$this->addslashes($this->ext_id).' '.
|
||||
'WHERE bankverbindung_id='.$this->addslashes($this->bankverbindung_id).';';
|
||||
$this->done=true;
|
||||
@@ -223,9 +223,10 @@ class bankverbindung
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo $qry;
|
||||
|
||||
if ($this->done)
|
||||
{
|
||||
//echo $qry."\n";
|
||||
if(pg_query($this->conn, $qry))
|
||||
{
|
||||
//Log schreiben
|
||||
|
||||
@@ -48,7 +48,9 @@ class fachbereich
|
||||
{
|
||||
$this->conn = $conn;
|
||||
if($fachbereich_kurzbz != null)
|
||||
{
|
||||
$this->load($fachbereich_kurzbz);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +169,7 @@ class fachbereich
|
||||
//Pruefen ob fachbereich_kurzbz gueltig ist
|
||||
if($this->fachbereich_kurzbz == '')
|
||||
{
|
||||
$this->errormsg = 'fachbereich_id ungueltig!';
|
||||
$this->errormsg = 'fachbereich_id ungueltig! ('.$this->fachbereich_kurzbz.'/'.$this->ext_id.')';
|
||||
return false;
|
||||
}
|
||||
//Neuen Datensatz anlegen
|
||||
|
||||
@@ -232,7 +232,6 @@ class lvinfo
|
||||
}
|
||||
|
||||
$qry = 'BEGIN; UPDATE campus.tbl_lvinfo SET '.
|
||||
//'lvinfo_id='.$this->addslashes($this->lvinfo_id).', '.
|
||||
'lehrziele='.$this->addslashes($this->lehrziele).', '.
|
||||
'lehrinhalte='.$this->addslashes($this->lehrinhalte).', '.
|
||||
'voraussetzungen='.$this->addslashes($this->voraussetzungen).', '.
|
||||
|
||||
@@ -212,11 +212,11 @@ class person
|
||||
$this->errormsg = 'FotoOID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
if(strlen($this->anmerkungen)>256)
|
||||
/*if(strlen($this->anmerkungen)>256)
|
||||
{
|
||||
$this->errormsg = 'Anmerkungen darf nicht laenger als 256 Zeichen sein';
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
if(strlen($this->homepage)>256)
|
||||
{
|
||||
$this->errormsg = 'Homepage darf nicht laenger als 256 Zeichen sein';
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 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: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
/**
|
||||
* Klasse Schüssel
|
||||
* @create 22-12-2006
|
||||
*/
|
||||
|
||||
class schluessel
|
||||
{
|
||||
var $conn; // @var resource DB-Handle
|
||||
var $new; // @var boolean
|
||||
var $errormsg; // @var string
|
||||
var $done=false; // @var boolean
|
||||
|
||||
//Tabellenspalten
|
||||
Var $schluessel_id; // @var integer
|
||||
var $person_id; // @var integer
|
||||
var $schluesseltyp; // @var string
|
||||
var $nummer; // @var string
|
||||
var $kaution; // @var numeric(5,2)
|
||||
var $ausgegebenam; // @var date
|
||||
var $ext_id; // @var integer
|
||||
var $insertamum; // @var timestamp
|
||||
var $insertvon; // @var bigint
|
||||
var $updateamum; // @var timestamp
|
||||
var $updatevon; // @var bigint
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $conn Connection
|
||||
* $kontakt_id ID der Adresse die geladen werden soll (Default=null)
|
||||
*/
|
||||
function schluessel($conn,$schluessel_id=null, $unicode=false)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
if ($unicode)
|
||||
{
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
}
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = "Encoding konnte nicht gesetzt werden";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt den Schlüssel mit der ID $schluessel_id
|
||||
* @param $schluessel_id ID dem zu ladenden Schlüssel
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function load($schluessel_id)
|
||||
{
|
||||
//noch nicht implementiert
|
||||
}
|
||||
|
||||
// ************************************************
|
||||
// * wenn $var '' ist wird "null" zurueckgegeben
|
||||
// * wenn $var !='' ist werden datenbankkritische
|
||||
// * Zeichen mit backslash versehen und das Ergebnis
|
||||
// * unter Hochkomma gesetzt.
|
||||
// ************************************************
|
||||
function addslashes($var)
|
||||
{
|
||||
return ($var!=''?"'".addslashes($var)."'":'null');
|
||||
}
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz in die Datenbank
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
* andernfalls wird der Datensatz mit der ID in $schluessel_id aktualisiert
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
$this->done=false;
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
|
||||
$qry='INSERT INTO tbl_schluessel (person_id, schluesseltyp, nummer, kaution, ausgegebenam,
|
||||
ext_id, insertamum, insertvon, updateamum, updatevon) VALUES('.
|
||||
$this->addslashes($this->person_id).', '.
|
||||
$this->addslashes($this->schluesseltyp).', '.
|
||||
$this->addslashes($this->nummer).', '.
|
||||
$this->addslashes($this->kaution).', '.
|
||||
$this->addslashes($this->ausgegebenam).', '.
|
||||
$this->addslashes($this->ext_id).', now(), '.
|
||||
$this->addslashes($this->insertvon).', now(), '.
|
||||
$this->addslashes($this->updatevon).');';
|
||||
$this->done=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$qryz="SELECT * FROM tbl_schluessel WHERE schluessel_id='$this->schluessel_id';";
|
||||
if($resultz = pg_query($this->conn, $qryz))
|
||||
{
|
||||
while($rowz = pg_fetch_object($resultz))
|
||||
{
|
||||
$update=false;
|
||||
if($rowz->person_id!=$this->person_id) $update=true;
|
||||
if($rowz->schluesseltyp!=$this->schluesseltyp) $update=true;
|
||||
if($rowz->nummer!=$this->nummer) $update=true;
|
||||
if($rowz->kaution!=$this->kaution) $update=true;
|
||||
if($rowz->ausgegebenam!=$this->ausgegebenam) $update=true;
|
||||
if($rowz->ext_id!=$this->ext_id) $update=true;
|
||||
|
||||
if($update)
|
||||
{
|
||||
$qry='UPDATE tbl_schluessel SET '.
|
||||
'person_id='.$this->addslashes($this->person_id).', '.
|
||||
'schluesseltyp='.$this->addslashes($this->schluesseltyp).', '.
|
||||
'nummer='.$this->addslashes($this->nummer).', '.
|
||||
'kaution='.$this->addslashes($this->kaution).', '.
|
||||
'ausgegebenam='.$this->addslashes($this->ausgegebenam).', '.
|
||||
'ext_id='.$this->addslashes($this->ext_id).', '.
|
||||
'updateamum= now(), '.
|
||||
'updatevon='.$this->addslashes($this->updatevon).' '.
|
||||
'WHERE schluessel_id='.$this->addslashes($this->schluessel_id).';';
|
||||
$this->done=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->done)
|
||||
{
|
||||
if(pg_query($this->conn, $qry))
|
||||
{
|
||||
//Log schreiben
|
||||
/*$sql = $qry;
|
||||
$qry = "SELECT nextval('log_seq') as id;";
|
||||
if(!$row = pg_fetch_object(pg_query($this->conn, $qry)))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Log-Sequence';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "INSERT INTO log(log_pk, creationdate, creationuser, sql) VALUES('$row->id', now(), '$this->updatevon', '".addslashes($sql)."')";
|
||||
if(pg_query($this->conn, $qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Log-Eintrages';
|
||||
return false;
|
||||
} */
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht den Datenensatz mit der ID die uebergeben wird
|
||||
* @param $schluessel_id ID die geloescht werden soll
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function delete($schluessel_id)
|
||||
{
|
||||
//noch nicht implementiert!
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 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: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasse schluesseltyp (FAS-Online)
|
||||
* @create 22-12-2006
|
||||
*/
|
||||
|
||||
class schluesseltyp
|
||||
{
|
||||
var $conn; // resource DB-Handle
|
||||
var $errormsg; // string
|
||||
var $new; // boolean
|
||||
//var $schluesseltyp = array(); // schluesseltyp Objekt
|
||||
|
||||
//Tabellenspalten
|
||||
var $schluesseltyp; //string
|
||||
var $beschreibung; //string
|
||||
var $anzahl; //smallint
|
||||
var $kaution; //numeric(5,2)
|
||||
var $nummer; //string
|
||||
var $ext_id; //bigint
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $conn Connection
|
||||
* $code Zu ladende Schluesseltyp
|
||||
*/
|
||||
function schluesseltyp($conn, $code=null, $unicode=false)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
|
||||
if($unicode)
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
else
|
||||
$qry = "SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = 'Encoding konnte nicht gesetzt werden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt die Funktion mit der ID $schluesseltyp
|
||||
* @param $code code des zu ladenden schluesseltyps
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function load($code)
|
||||
{
|
||||
$this->errormsg = 'Noch nicht implementiert';
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle schluesseltypen
|
||||
*/
|
||||
function getAll()
|
||||
{
|
||||
$this->errormsg = 'Noch nicht implementiert';
|
||||
return false;
|
||||
}
|
||||
function addslashes($var)
|
||||
{
|
||||
return ($var!=''?"'".addslashes($var)."'":'null');
|
||||
}
|
||||
// ************************************************************
|
||||
// * Speichert die Daten in die Datenbank
|
||||
// * @return true wenn erfolgreich, false im Fehlerfall
|
||||
// ************************************************************
|
||||
function save()
|
||||
{
|
||||
|
||||
|
||||
$qry='INSERT INTO tbl_schluesseltyp (schluesseltyp, beschreibung, anzahl, kaution, nummer, ext_id) VALUES('.
|
||||
$this->addslashes($this->schluesseltyp).', '.
|
||||
$this->addslashes($this->beschreibung).', '.
|
||||
$this->addslashes($this->anzahl).', '.
|
||||
$this->addslashes($this->kaution).', '.
|
||||
$this->addslashes($this->nummer).', '.
|
||||
$this->addslashes($this->ext_id).');';
|
||||
|
||||
|
||||
if(pg_query($this->conn,$qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Schluesseltypen-Datensatzes:'.$this->schluesseltyp.' '.$qry;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user