mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
array cleanups
This commit is contained in:
Regular → Executable
+9
-9
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+7
-7
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user