- Moved old libraries to CI

- Extended Controllers functionalities
- Added controls to ueberbuchung.php, zeitwuensche.php and funktion_det.php
pages to avoid warnings and notices, especially when no data are in DB
- Removed fhcdb_helper.php because it's no more needed
This commit is contained in:
paolo
2016-06-07 17:55:31 +02:00
parent 0dc605df3c
commit 3955d4b395
11 changed files with 176 additions and 544 deletions
+12 -6
View File
@@ -19,10 +19,16 @@
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/datum.class.php');
class berechtigung extends basis_db
// CI
require_once(dirname(__FILE__).'/../ci_hack.php');
require_once(dirname(__FILE__).'/../application/models/system/Berechtigung_model.php');
class berechtigung extends Berechtigung_model
{
use db_extra; //CI Hack
public $result=array();
public $new;
@@ -46,13 +52,13 @@ class berechtigung extends basis_db
*/
public function load($berechtigung_kurzbz)
{
$qry = "SELECT * FROM system.tbl_berechtigung WHERE berechtigung_kurzbz=".$this->db_add_param($berechtigung_kurzbz);
$result = parent::load($berechtigung_kurzbz);
if($result = $this->db_query($qry))
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
{
if($row = $this->db_fetch_object($result))
if (count($result->retval) > 0)
{
$this->berechtigung_kurzbz=$row->berechtigung_kurzbz;
$this->berechtigung_kurzbz = $row->berechtigung_kurzbz;
$this->beschreibung = $row->beschreibung;
return true;
}
+15 -7
View File
@@ -23,10 +23,16 @@
* Klasse funktion (FAS-Online)
* @create 14-03-2006
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/datum.class.php');
class funktion extends basis_db
// CI
require_once(dirname(__FILE__).'/../ci_hack.php');
require_once(dirname(__FILE__).'/../application/models/ressource/Funktion_model.php');
class funktion extends Funktion_model
{
use db_extra; //CI Hack
public $new; // boolean
public $result = array(); // fachbereich Objekt
@@ -105,22 +111,24 @@ class funktion extends basis_db
*/
public function load($funktion_kurzbz)
{
if($funktion_kurzbz == '')
if ($funktion_kurzbz == '')
{
$this->errormsg = 'funktion_bz darf nicht leer sein';
return false;
}
$qry = "SELECT * FROM public.tbl_funktion WHERE funktion_kurzbz = ".$this->db_add_param($funktion_kurzbz).";";
if(!$this->db_query($qry))
$result = parent::load($funktion_kurzbz);
if (!is_object($result) || (is_object($result) && $result->error != EXIT_SUCCESS))
{
$this->errormsg = 'Fehler beim Laden des Datensatzes';
return false;
}
if($row = $this->db_fetch_object())
if (is_array($result->retval) && count($result->retval) == 1)
{
$row = $result->retval[0];
$this->funktion_kurzbz = $row->funktion_kurzbz;
$this->beschreibung = $row->beschreibung;
$this->aktiv = $this->db_parse_bool($row->aktiv);
+26 -16
View File
@@ -23,10 +23,16 @@
* Klasse ort (FAS-Online)
* @create 04-12-2006
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/datum.class.php');
class ort extends basis_db
// CI
require_once(dirname(__FILE__).'/../ci_hack.php');
require_once(dirname(__FILE__).'/../application/models/ressource/Ort_model.php');
class ort extends Ort_model
{
use db_extra; //CI Hack
public $new; // boolean
public $result = array(); // ort Objekt
@@ -72,29 +78,33 @@ class ort extends basis_db
* Laedt alle verfuegbaren Orte
* @return true wenn ok, false im Fehlerfall
*/
public function getAll($raumtyp_kurzbz=null)
public function getAll($raumtyp_kurzbz = null)
{
$qry = 'SELECT * FROM public.tbl_ort ORDER BY ort_kurzbz;';
if(!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz!='')
parent::addOrder('ort_kurzbz');
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != '')
{
$qry = '
SELECT
tbl_ort.*
FROM
public.tbl_ort
JOIN public.tbl_ortraumtyp USING(ort_kurzbz)
WHERE raumtyp_kurzbz='.$this->db_add_param($raumtyp_kurzbz).'
ORDER BY ort_kurzbz;';
$result = parent::addJoin('public.tbl_ortraumtyp', 'ort_kurzbz');
if ($result->error == EXIT_SUCCESS)
{
$result = parent::loadWhere(array('raumtyp_kurzbz' => $raumtyp_kurzbz));
}
}
if(!$this->db_query($qry))
else
{
$result = parent::loadWhole();
}
if (!is_object($result) || (is_object($result) && ($result->error != EXIT_SUCCESS || !is_array($result->retval))))
{
$this->errormsg = 'Fehler beim Laden der Datensaetze';
return false;
}
while($row = $this->db_fetch_object())
for ($i = 0; $i < count($result->retval); $i++)
{
$row = $result->retval[$i];
$ort_obj = new ort();
$ort_obj->ort_kurzbz = $row->ort_kurzbz;
+16 -31
View File
@@ -20,8 +20,6 @@
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
require_once(dirname(__FILE__).'/datum.class.php');
// require_once(dirname(__FILE__).'/person.class.php');
// require_once(dirname(__FILE__).'/log.class.php');
// CI
require_once(dirname(__FILE__).'/../ci_hack.php');
@@ -108,20 +106,20 @@ class prestudent extends Prestudent_model
*/
public function load($prestudent_id)
{
if(!is_numeric($prestudent_id))
if (!is_numeric($prestudent_id))
{
$this->errormsg = 'ID ist ungueltig';
return false;
}
$qry = 'SELECT * '
. 'FROM public.tbl_prestudent '
. 'WHERE prestudent_id = '.$this->db_add_param($prestudent_id, FHC_INTEGER);
$result = parent::load($prestudent_id);
if($this->db_query($qry))
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval))
{
if($row = $this->db_fetch_object())
if (count($result->retval) > 0)
{
$row = $result->retval[0];
$this->prestudent_id = $row->prestudent_id;
$this->aufmerksamdurch_kurzbz = $row->aufmerksamdurch_kurzbz;
$this->studiengang_kz = $row->studiengang_kz;
@@ -156,10 +154,8 @@ class prestudent extends Prestudent_model
$this->zgvdoktordatum = $row->zgvdoktordatum;
$this->zgvdoktornation = $row->zgvdoktornation;
if(!person::load($row->person_id))
return false;
else
return true;
$person = new person();
return $person->load($row->person_id);
}
else
{
@@ -974,33 +970,22 @@ class prestudent extends Prestudent_model
* @param $studiensemester_kurzbz
* @return boolean
*/
public function getLastStatus($prestudent_id, $studiensemester_kurzbz='', $status_kurzbz = '')
public function getLastStatus($prestudent_id, $studiensemester_kurzbz = '', $status_kurzbz = '')
{
if($prestudent_id=='' || !is_numeric($prestudent_id))
if ($prestudent_id == '' || !is_numeric($prestudent_id))
{
$this->errormsg = 'Prestudent_id ist ungueltig';
return false;
}
$qry = "SELECT tbl_prestudentstatus.*, bezeichnung AS studienplan_bezeichnung,
tbl_status.bezeichnung_mehrsprachig
FROM public.tbl_prestudentstatus
LEFT JOIN lehre.tbl_studienplan USING (studienplan_id)
JOIN public.tbl_status USING (status_kurzbz)
WHERE tbl_status.status_kurzbz = tbl_prestudentstatus.status_kurzbz
AND prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER);
if($studiensemester_kurzbz!='')
$qry.=" AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz);
if($status_kurzbz !='')
$qry.= " AND status_kurzbz =".$this->db_add_param($status_kurzbz);
$qry.=" ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1";
if($this->db_query($qry))
$result = parent::getLastStatus($prestudent_id, $studiensemester_kurzbz, $status_kurzbz);
if (is_object($result) && $result->error != EXIT_SUCCESS && is_array($result->retval))
{
if($row = $this->db_fetch_object())
if (count($result->retval) > 0)
{
$row = $result->retval[0];
$this->prestudent_id = $row->prestudent_id;
$this->status_kurzbz = $row->status_kurzbz;
$this->status_mehrsprachig = $this->db_parse_lang_array($row->bezeichnung_mehrsprachig);