bugfix in class lehrveranstaltung, added function to class akadgrad

This commit is contained in:
Stefan Puraner
2016-01-19 08:04:21 +01:00
parent fc92c0bafb
commit 7ea7d07ff8
2 changed files with 165 additions and 161 deletions
+163 -159
View File
@@ -1,159 +1,163 @@
<?php <?php
/* Copyright (C) 2006 Technikum-Wien /* Copyright (C) 2006 Technikum-Wien
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as * it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* Authors: Christian Paminger <[email protected]>, * Authors: Christian Paminger <[email protected]>,
* Andreas Oesterreicher <[email protected]> and * Andreas Oesterreicher <[email protected]> and
* Rudolf Hangl <[email protected]>. * Rudolf Hangl <[email protected]>.
*/ */
require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/basis_db.class.php');
class akadgrad extends basis_db class akadgrad extends basis_db
{ {
public $new; public $new;
public $result = array(); public $result = array();
//Tabellenspalten //Tabellenspalten
public $akadgrad_id; public $akadgrad_id;
public $akadgrad_kurzbz; public $akadgrad_kurzbz;
public $studiengang_kz; public $studiengang_kz;
public $titel; public $titel;
public $geschlecht; public $geschlecht;
/** /**
* Konstruktor * Konstruktor
* @param akadgrad_id ID des zu ladenden Datensatzes * @param akadgrad_id ID des zu ladenden Datensatzes
*/ */
public function __construct($akadgrad_id=null) public function __construct($akadgrad_id=null)
{ {
parent::__construct(); parent::__construct();
if(!is_null($akadgrad_id)) if(!is_null($akadgrad_id))
$this->load($akadgrad_id); $this->load($akadgrad_id);
} }
/** /**
* Laedt einen Datensatz * Laedt einen Datensatz
* @param akadgrad_id ID des zu ladenden Datensatzes * @param akadgrad_id ID des zu ladenden Datensatzes
*/ */
public function load($akadgrad_id) public function load($akadgrad_id)
{ {
//akadgrad_id auf gueltigkeit pruefen //akadgrad_id auf gueltigkeit pruefen
if(!is_numeric($akadgrad_id) || $akadgrad_id == '') if(!is_numeric($akadgrad_id) || $akadgrad_id == '')
{ {
$this->errormsg = 'akadgrad_id muss eine gültige Zahl sein'; $this->errormsg = 'akadgrad_id muss eine gültige Zahl sein';
return false; return false;
} }
//laden des Datensatzes //laden des Datensatzes
$qry = "SELECT * FROM lehre.tbl_akadgrad WHERE akadgrad_id=".$this->db_add_param($akadgrad_id, FHC_INTEGER); $qry = "SELECT * FROM lehre.tbl_akadgrad WHERE akadgrad_id=".$this->db_add_param($akadgrad_id, FHC_INTEGER);
if($this->db_query($qry)) if($this->db_query($qry))
{ {
if($row = $this->db_fetch_object()) if($row = $this->db_fetch_object())
{ {
$this->akadgrad_id = $row->akadgrad_id; $this->akadgrad_id = $row->akadgrad_id;
$this->akadgrad_kurzbz = $row->akadgrad_kurzbz; $this->akadgrad_kurzbz = $row->akadgrad_kurzbz;
$this->studiengang_kz = $row->studiengang_kz; $this->studiengang_kz = $row->studiengang_kz;
$this->titel = $row->titel; $this->titel = $row->titel;
$this->geschlecht = $row->geschlecht; $this->geschlecht = $row->geschlecht;
return true; return true;
} }
else else
{ {
$this->errormsg = 'Fehler bei der Datenbankabfrage'; $this->errormsg = 'Fehler bei der Datenbankabfrage';
return false; return false;
} }
} }
else else
{ {
$this->errormsg = 'Fehler bei der Datenbankabfrage'; $this->errormsg = 'Fehler bei der Datenbankabfrage';
return false; return false;
} }
} }
/** /**
* Laedt alle Eintraege * Laedt alle Eintraege
*/ */
public function getAll() public function getAll()
{ {
//laden des Datensatzes //laden des Datensatzes
$qry = "SELECT * FROM lehre.tbl_akadgrad"; $qry = "SELECT * FROM lehre.tbl_akadgrad";
if($this->db_query($qry)) if($this->db_query($qry))
{ {
while($row = $this->db_fetch_object()) while($row = $this->db_fetch_object())
{ {
$obj = new akadgrad(); $obj = new akadgrad();
$obj->akadgrad_id = $row->akadgrad_id; $obj->akadgrad_id = $row->akadgrad_id;
$obj->akadgrad_kurzbz = $row->akadgrad_kurzbz; $obj->akadgrad_kurzbz = $row->akadgrad_kurzbz;
$obj->studiengang_kz = $row->studiengang_kz; $obj->studiengang_kz = $row->studiengang_kz;
$obj->titel = $row->titel; $obj->titel = $row->titel;
$obj->geschlecht = $row->geschlecht; $obj->geschlecht = $row->geschlecht;
$this->result[] = $obj; $this->result[] = $obj;
} }
return true; return true;
} }
else else
{ {
$this->errormsg = 'Fehler bei der Datenbankabfrage'; $this->errormsg = 'Fehler bei der Datenbankabfrage';
return false; return false;
} }
} }
/** /**
* Liefert den Akademischen Grad eines Studenten aus der Tabelle Akadgrad * Liefert den Akademischen Grad eines Studenten aus der Tabelle Akadgrad
* @param student_uid * @param student_uid
*/ */
public function getAkadgradStudent($student_uid) public function getAkadgradStudent($student_uid)
{ {
//laden des Datensatzes //laden des Datensatzes
$qry = "SELECT * FROM lehre.tbl_akadgrad WHERE $qry = "SELECT * FROM lehre.tbl_akadgrad WHERE
studiengang_kz = ( SELECT studiengang_kz FROM public.tbl_student WHERE student_uid=".$this->db_add_param($student_uid).") AND studiengang_kz = ( SELECT studiengang_kz FROM public.tbl_student WHERE student_uid=".$this->db_add_param($student_uid).") AND
( geschlecht = ( SELECT geschlecht FROM public.tbl_student ( geschlecht = ( SELECT geschlecht FROM public.tbl_student
JOIN public.tbl_benutzer ON (student_uid=uid) JOIN public.tbl_benutzer ON (student_uid=uid)
JOIN public.tbl_person USING (person_id) JOIN public.tbl_person USING (person_id)
WHERE student_uid=".$this->db_add_param($student_uid).") WHERE student_uid=".$this->db_add_param($student_uid).")
OR geschlecht IS NULL) OR geschlecht IS NULL)
LIMIT 1"; LIMIT 1";
if($this->db_query($qry)) if($this->db_query($qry))
{ {
if($row = $this->db_fetch_object()) if($row = $this->db_fetch_object())
{ {
$this->akadgrad_id = $row->akadgrad_id; $this->akadgrad_id = $row->akadgrad_id;
$this->akadgrad_kurzbz = $row->akadgrad_kurzbz; $this->akadgrad_kurzbz = $row->akadgrad_kurzbz;
$this->studiengang_kz = $row->studiengang_kz; $this->studiengang_kz = $row->studiengang_kz;
$this->titel = $row->titel; $this->titel = $row->titel;
$this->geschlecht = $row->geschlecht; $this->geschlecht = $row->geschlecht;
return true; return true;
} }
else else
{ {
$this->errormsg = 'Fehler bei der Datenbankabfrage'; $this->errormsg = 'Fehler bei der Datenbankabfrage';
return false; return false;
} }
} }
else else
{ {
$this->errormsg = 'Fehler bei der Datenbankabfrage'; $this->errormsg = 'Fehler bei der Datenbankabfrage';
return false; return false;
} }
} }
}
?> public function __toString(){
return $this->akadgrad_kurzbz;
}
}
?>
+2 -2
View File
@@ -79,8 +79,8 @@ class lehrveranstaltung extends basis_db
public $lvps; public $lvps;
public $las; public $las;
public $benotung; public $benotung=false;
public $lvinfo; public $lvinfo=false;
/** /**
* Konstruktor * Konstruktor