moved infocenter and sb admin js and css from include to public, get inactive parents/children oe is possible

This commit is contained in:
alex
2018-05-03 13:33:08 +02:00
parent 928fe549bb
commit e4cdac1acb
12 changed files with 21 additions and 67 deletions
@@ -119,15 +119,16 @@ class Organisationseinheit_model extends DB_Model
/**
* Liefert die ChildNodes einer Organisationseinheit
* @param $oe_kurzbz
* @return Array mit den Childs inkl dem Uebergebenen Element
* @param bool $includeinactive - wether to include inactive parent oes
* @return array mit den Childs inkl dem Uebergebenen Element
*/
public function getChilds($oe_kurzbz)
public function getChilds($oe_kurzbz, $includeinactive = false)
{
$query = "
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
(
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
WHERE oe_kurzbz=?
WHERE oe_kurzbz=? %s
UNION ALL
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
WHERE o.oe_parent_kurzbz=oes.oe_kurzbz
@@ -136,20 +137,22 @@ class Organisationseinheit_model extends DB_Model
FROM oes
GROUP BY oe_kurzbz;";
return $this->execQuery($query, array($oe_kurzbz));
return $this->execQuery(sprintf($query, $includeinactive === true ? "" : "AND aktiv = true"), array($oe_kurzbz));
}
/**
* Liefert die OEs die im Tree ueberhalb der uebergebene OE liegen
* @param $oe_kurzbz
* @param bool $includeinactive - wether to include inactive parent oes
* @return array|null
*/
public function getParents($oe_kurzbz)
public function getParents($oe_kurzbz, $includeinactive = false)
{
$query=
"WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
(
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
WHERE oe_kurzbz=? and aktiv = true
WHERE oe_kurzbz=? %s
UNION ALL
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz and aktiv = true
@@ -157,7 +160,7 @@ class Organisationseinheit_model extends DB_Model
SELECT oe_kurzbz
FROM oes";
return $this->execQuery($query, array($oe_kurzbz));
return $this->execQuery(sprintf($query, $includeinactive === true ? "" : "AND aktiv = true"), array($oe_kurzbz));
}
}