diff --git a/application/controllers/api/frontend/v1/Zeitsperren.php b/application/controllers/api/frontend/v1/Zeitsperren.php index 66efa81a7..d2698d205 100644 --- a/application/controllers/api/frontend/v1/Zeitsperren.php +++ b/application/controllers/api/frontend/v1/Zeitsperren.php @@ -58,8 +58,8 @@ class Zeitsperren extends FHCAPI_Controller public function getTypenZeitsperren() { - $this->ZeitsperretypModel->addOrder('beschreibung', 'ASC'); - $result = $this->ZeitsperretypModel->load(); + $excludedTypes = array('ZVerfueg'); + $result = $this->ZeitsperretypModel->getTypenZeitsperren($excludedTypes); if (isError($result)) { $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } diff --git a/application/models/ressource/Zeitsperretyp_model.php b/application/models/ressource/Zeitsperretyp_model.php index ef54571e8..b693d189b 100644 --- a/application/models/ressource/Zeitsperretyp_model.php +++ b/application/models/ressource/Zeitsperretyp_model.php @@ -11,4 +11,20 @@ class Zeitsperretyp_model extends DB_Model $this->dbTable = 'campus.tbl_zeitsperretyp'; $this->pk = 'zeitsperretyp_kurzbz'; } + + public function getTypenZeitsperren($excludedTypes = []) + { + $whereNotClause = ""; + if (count($excludedTypes)) { + $excludedTypes = array_map( + function ($type) { + return "'$type'"; + }, + $excludedTypes + ); + $excludedTypes = implode(", ", $excludedTypes); + $whereNotClause = "WHERE NOT zeitsperretyp_kurzbz IN ($excludedTypes)"; + } + return $this->execQuery("SELECT * FROM $this->dbTable $whereNotClause ORDER BY beschreibung ASC"); + } }