Speicheroptimierung bei Berechtigungskonzept

This commit is contained in:
Andreas Österreicher
2010-02-22 13:52:32 +00:00
parent fa748d84e2
commit 58ceb37c87
7 changed files with 266 additions and 1320 deletions
+53
View File
@@ -28,6 +28,7 @@ require_once(dirname(__FILE__).'/basis_db.class.php');
class organisationseinheit extends basis_db
{
public static $oe_parents_array=array();
public $new; // @var boolean
public $errormsg; // @var string
public $result;
@@ -42,6 +43,7 @@ class organisationseinheit extends basis_db
public $oe_kurzbz_orig;
public $beschreibung;
/**
* Konstruktor
* @param $oe_kurzbz Kurzbz der Organisationseinheit
@@ -362,5 +364,56 @@ class organisationseinheit extends basis_db
return true;
}
/**
* Laedt die Organisationseinheiten in ein Array
*
*/
public function loadParentsArray()
{
$qry = 'SELECT * FROM public.tbl_organisationseinheit';
if($this->db_query($qry))
{
while($row = $this->db_fetch_object())
{
organisationseinheit::$oe_parents_array[$row->oe_kurzbz]=$row->oe_parent_kurzbz;
}
}
}
public function isChild($oe_kurzbz, $child)
{
if(count(organisationseinheit::$oe_parents_array)<=0)
{
$this->loadParentsArray();
}
if(!isset(organisationseinheit::$oe_parents_array[$child]))
{
$this->errormsg = 'Organisationseinheit existiert nicht';
return false;
}
$childs = array_keys(organisationseinheit::$oe_parents_array, $oe_kurzbz);
foreach ($childs as $row)
{
if($row==$child)
{
return true;
}
else
{
if($this->isChild($row, $child))
return true;
}
}
return false;
}
}
?>