diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php old mode 100644 new mode 100755 index b3d13f336..aca1451da --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -13,7 +13,7 @@ class Organisationseinheit_model extends DB_Model public function getRecursiveList($typ) { - $qry = "WITH RECURSIVE tree (oe_kurzbz, bezeichnung, path, organisationseinheittyp_kurzbz) AS + $qry = "WITH RECURSIVE tree (oe_kurzbz, bezeichnung, path, organisationseinheittyp_kurzbz) AS ( SELECT oe_kurzbz, @@ -28,23 +28,23 @@ class Organisationseinheit_model extends DB_Model oe.bezeichnung||' ('||oe.organisationseinheittyp_kurzbz||')' AS bezeichnung, tree.path ||oe.oe_kurzbz||'|' AS path, oe.organisationseinheittyp_kurzbz - FROM tree + FROM tree JOIN tbl_organisationseinheit oe ON (tree.oe_kurzbz=oe.oe_parent_kurzbz) ) SELECT oe_kurzbz AS value, substring(regexp_replace(path, '[A-z]+\|', '-','g')||bezeichnung,2) AS name, path FROM tree "; if (!empty($typ)) $qry .= 'WHERE organisationseinheittyp_kurzbz IN ('.$typ.') '; $qry .= 'ORDER BY path;'; - - return $this->execQuery($query); + + return $this->execQuery($qry); } - + /** * getOneLevel * * This method get one level of the organisation tree, using the given parameters. * It returns even the data from another table linked by the oe_kurzbz - * + * * @param string $schema REQUIRED * @param string $table REQUIRED * @param mixed $fields REQUIRED @@ -72,9 +72,9 @@ class Organisationseinheit_model extends DB_Model ) _joined_table ON (orgs._pk = _joined_table._pk) WHERE orgs._pk = ? ORDER BY %s"; - + $query = sprintf($query, $table, $fields, $schema, $table, $where, $orderby); - + return $this->execQuery($query, array($oe_kurzbz)); } -} \ No newline at end of file +} diff --git a/application/widgets/organisationseinheit_widget.php b/application/widgets/organisationseinheit_widget.php old mode 100644 new mode 100755 index 05a19714a..bac1b1a3f --- a/application/widgets/organisationseinheit_widget.php +++ b/application/widgets/organisationseinheit_widget.php @@ -3,26 +3,26 @@ /* * OE widget */ -class organisationseinheit_widget extends Widget +class organisationseinheit_widget extends Widget { protected $_htmltagname = 'oe_kurzbz'; - - public function display($data) + + public function display($data) { $this->load->model('organisation/Organisationseinheit_model'); if (isset($data['typ'])) $typ = $data['typ']; - else + else $typ = null; $res = $this->Organisationseinheit_model->getRecursiveList($typ); // *** set data *** if (isset($data['htmltagname'])) $this->_htmltagname = $data['htmltagname']; - + // items from db - foreach ($res->retval->result() as $obj) + foreach ($res->retval as $obj) { $item = array ( @@ -39,5 +39,5 @@ class organisationseinheit_widget extends Widget $this->view('widgets/organisationseinheit', $data); } - + }