- Added constant DOC_ROOT in system.config-default.inc.php

- Using DOC_ROOT in dbupdate_3.2.php to be compatible with checksystem.php and DBTools.php
- Rolled back all classes in the include directory from CI to basis_db
This commit is contained in:
bison
2016-08-17 11:14:52 +02:00
parent dd6ef9fdb1
commit cf999b6d82
17 changed files with 308 additions and 452 deletions
+20 -32
View File
@@ -23,19 +23,12 @@
* Klasse ort (FAS-Online)
* @create 04-12-2006
*/
require_once(dirname(__FILE__).'/datum.class.php');
require_once(dirname(__FILE__).'/basis_db.class.php');
// CI
require_once(dirname(__FILE__).'/../ci_hack.php');
require_once(dirname(__FILE__).'/../application/models/ressource/Ort_model.php');
class ort extends Ort_model
class ort extends basis_db
{
use db_extra; //CI Hack
public $new; // boolean
public $result = array(); // ort Objekt
public $errormsg; // string
//Tabellenspalten
public $ort_kurzbz; // string
@@ -82,31 +75,27 @@ class ort extends Ort_model
*/
public function getAll($raumtyp_kurzbz = null)
{
parent::addOrder('ort_kurzbz');
$qry = 'SELECT * FROM public.tbl_ort ORDER BY ort_kurzbz;';
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != '')
{
$result = parent::addJoin('public.tbl_ortraumtyp', 'ort_kurzbz');
if ($result->error == EXIT_SUCCESS)
{
$result = parent::loadWhere(array('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;';
}
else
{
$result = parent::load();
}
if (!is_object($result) || (is_object($result) && ($result->error != EXIT_SUCCESS || !is_array($result->retval))))
if (!$this->db_query($qry))
{
$this->errormsg = 'Fehler beim Laden der Datensaetze';
return false;
}
for ($i = 0; $i < count($result->retval); $i++)
while ($row = $this->db_fetch_object())
{
$row = $result->retval[$i];
$ort_obj = new ort();
$ort_obj->ort_kurzbz = $row->ort_kurzbz;
@@ -138,7 +127,7 @@ class ort extends Ort_model
* @param $fachb_id ID des zu ladenden Ortes
* @return true wenn ok, false im Fehlerfall
*/
public function load($ort_kurzbz = null)
public function load($ort_kurzbz)
{
if ($ort_kurzbz == '')
{
@@ -146,20 +135,19 @@ class ort extends Ort_model
return false;
}
$result = parent::load(trim($ort_kurzbz));
if (!is_object($result) || (is_object($result) && $result->error != EXIT_SUCCESS))
$qry = "SELECT * FROM public.tbl_ort WHERE trim(ort_kurzbz) = " . $this->db_add_param(trim($ort_kurzbz)) . ";";
if (!$this->db_query($qry))
{
$this->errormsg = 'Fehler beim Laden des Datensatzes';
return false;
}
if(is_array($result->retval) && count($result->retval) > 0)
if ($row = $this->db_fetch_object())
{
$row = $result->retval[0];
$this->ort_kurzbz = $row->ort_kurzbz;
$this->bezeichnung = $row->bezeichnung;
$this->planbezeichnung = $row->planbezeichnung;
$this->planbezeichnung = $row->planbezeichnung;
$this->max_person = $row->max_person;
$this->aktiv = $this->db_parse_bool($row->aktiv);
$this->lehre = $this->db_parse_bool($row->lehre);