diff --git a/application/config/routes.php b/application/config/routes.php index d6ecf2dcf..a58fded36 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -127,6 +127,8 @@ $route['api/frontend/v1/treemenudata/stv/.*'] = 'api/frontend/v1/stv/students/in $route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2'; $route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/semester/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3'; $route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/semester/(:any)/.*'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3'; +$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/orgform/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3'; +$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/orgform/(:any)/.*'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3'; $route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/emp/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByEmp/$1/$2'; $route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/emp/(:any)/stg/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByEmp/$1/$2/$3'; diff --git a/application/controllers/api/frontend/v1/Lehrveranstaltung.php b/application/controllers/api/frontend/v1/Lehrveranstaltung.php index df4dc9cc5..66bda9ebf 100644 --- a/application/controllers/api/frontend/v1/Lehrveranstaltung.php +++ b/application/controllers/api/frontend/v1/Lehrveranstaltung.php @@ -87,7 +87,7 @@ class Lehrveranstaltung extends FHCAPI_Controller $verband = null; if (!is_null($semester) && !is_numeric($semester)) { - $verband = $semester; + $verband = $this->getOrgformKurzbz($semester); $semester = null; } @@ -295,4 +295,22 @@ class Lehrveranstaltung extends FHCAPI_Controller $this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL); } + + protected function getOrgformKurzbz($orgform_kurzbz) + { + if ($orgform_kurzbz === null) + return null; + + $this->load->model('codex/Orgform_model', 'OrgformModel'); + $result = $this->OrgformModel->loadWhere([ + 'LOWER(orgform_kurzbz) =' => strtolower($orgform_kurzbz) + ]); + + $data = $this->getDataOrTerminateWithError($result); + + if (!$data) + return $orgform_kurzbz; + + return current($data)->orgform_kurzbz; + } }