mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 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 <[email protected]>,
|
||||
* Andreas Oesterreicher <[email protected]>,
|
||||
* Rudolf Hangl <[email protected]> and
|
||||
* Gerald Simane-Sequens <[email protected]>
|
||||
*/
|
||||
/**
|
||||
* Klasse Organisationseinheit
|
||||
*
|
||||
*/
|
||||
require_once('basis_db.class.php');
|
||||
|
||||
class organisationseinheit extends basis_db
|
||||
{
|
||||
public $new; // @var boolean
|
||||
public $errormsg; // @var string
|
||||
|
||||
//Tabellenspalten
|
||||
public $oe_kurzbz;
|
||||
public $oe_parent_kurzbz;
|
||||
public $bezeichnung;
|
||||
public $organisationseinheittyp_kurzbz;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $oe_kurzbz Kurzbz der Organisationseinheit
|
||||
*/
|
||||
public function __construct($oe_kurzbz=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if($oe_kurzbz != null)
|
||||
$this->load($oe_kurzbz);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt eine Organisationseinheit
|
||||
* @param $oe_kurzbz
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function load($oe_kurzbz)
|
||||
{
|
||||
if($oe_kurzbz == '')
|
||||
{
|
||||
$this->errormsg = 'kurzbz darf nicht leer sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz = '$oe_kurzbz';";
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($row=$this->db_fetch_object())
|
||||
{
|
||||
$this->oe_kurzbz = $row->oe_kurzbz;
|
||||
$this->bezeichnung = $row->bezeichnung;
|
||||
$this->oe_parent_kurzbz = $row->oe_parent_kurzbz;
|
||||
$this->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Es ist kein Datensatz mit dieser ID vorhanden';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die ChildNodes einer Organisationseinheit
|
||||
*
|
||||
* @param $oe_kurzbz
|
||||
* @return Array mit den Childs inkl derm Uebergebenen Element
|
||||
*/
|
||||
public function getChilds($oe_kurzbz)
|
||||
{
|
||||
$childs[] = $oe_kurzbz;
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_parent_kurzbz = '$oe_kurzbz'";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$myresult = $this->db_result;
|
||||
while($row = $this->db_fetch_object($myresult))
|
||||
{
|
||||
$childs = array_merge($childs, $this->getChilds($row->oe_kurzbz));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Ermitteln der Childs';
|
||||
}
|
||||
return array_unique($childs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die Direkten KindElemente der Organisationseinheit
|
||||
*
|
||||
* @param $oe_kurzbz
|
||||
* @return Array mit den Childs inkl derm Uebergebenen Element
|
||||
*/
|
||||
public function getDirectChilds($oe_kurzbz)
|
||||
{
|
||||
$childs = array();
|
||||
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_parent_kurzbz = '$oe_kurzbz' ORDER BY organisationseinheittyp_kurzbz DESC, bezeichnung";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$childs[] = $row->oe_kurzbz;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Ermitteln der Childs';
|
||||
}
|
||||
return $childs;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -35,9 +35,12 @@ class basis_db extends db
|
||||
return pg_num_rows($this->db_result);
|
||||
}
|
||||
|
||||
function db_fetch_object()
|
||||
function db_fetch_object($result = null)
|
||||
{
|
||||
return pg_fetch_object($this->db_result);
|
||||
if(is_null($result))
|
||||
return pg_fetch_object($this->db_result);
|
||||
else
|
||||
return pg_fetch_object($result);
|
||||
}
|
||||
|
||||
function db_last_error()
|
||||
|
||||
@@ -133,6 +133,7 @@ $menu=array
|
||||
'Betriebsmittel'=>array('name'=>'Betriebsmittel', 'link'=>'stammdaten/betriebsmittel_frameset.html', 'target'=>'main'),
|
||||
'Reihungstest'=>array('name'=>'Reihungstest', 'link'=>'stammdaten/reihungstestverwaltung.php', 'target'=>'main'),
|
||||
'Firmen'=>array('name'=>'Firmen', 'link'=>'stammdaten/firma_frameset.html', 'target'=>'main'),
|
||||
'Organisationseinheiten'=>array('name'=>'Organisationseinheiten', 'link'=>'stammdaten/organisationseinheiten.php', 'target'=>'main'),
|
||||
'ImExport'=>array
|
||||
(
|
||||
'name'=>'ImExport',
|
||||
|
||||
Reference in New Issue
Block a user