diff --git a/application/controllers/api/frontend/v1/stv/Lists.php b/application/controllers/api/frontend/v1/stv/Lists.php index 9b0c705d1..eceaf8c8c 100644 --- a/application/controllers/api/frontend/v1/stv/Lists.php +++ b/application/controllers/api/frontend/v1/stv/Lists.php @@ -29,7 +29,11 @@ class Lists extends FHCAPI_Controller { parent::__construct([ 'getStudiensemester' => self::PERM_LOGGED, - 'getStgs' => self::PERM_LOGGED + 'getStgs' => self::PERM_LOGGED, + 'getSprachen' => self::PERM_LOGGED, + 'getGeschlechter' => self::PERM_LOGGED, + 'getAusbildungen' => self::PERM_LOGGED, + 'getOrgforms' => self::PERM_LOGGED ]); } @@ -62,4 +66,56 @@ class Lists extends FHCAPI_Controller $this->terminateWithSuccess($data); } + + public function getSprachen() + { + $this->load->model('system/Sprache_model', 'SpracheModel'); + + $this->SpracheModel->addOrder('sprache'); + + $result = $this->SpracheModel->load(); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getGeschlechter() + { + $this->load->model('person/Geschlecht_model', 'GeschlechtModel'); + + $this->GeschlechtModel->addOrder('sort'); + $this->GeschlechtModel->addOrder('geschlecht'); + + $this->GeschlechtModel->addSelect('*'); + $this->GeschlechtModel->addSelect("bezeichnung_mehrsprachig[(SELECT index FROM public.tbl_sprache WHERE sprache=" . $this->GeschlechtModel->escape(DEFAULT_LANGUAGE) . " LIMIT 1)] AS bezeichnung"); + + $result = $this->GeschlechtModel->load(); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getAusbildungen() + { + $this->load->model('codex/Ausbildung_model', 'AusbildungModel'); + + $this->AusbildungModel->addOrder('ausbildungcode'); + + $result = $this->AusbildungModel->load(); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getOrgforms() + { + $this->load->model('codex/Orgform_model', 'OrgformModel'); + + $this->OrgformModel->addOrder('bezeichnung'); + + $result = $this->OrgformModel->loadWhere(['rolle' => true]); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } } diff --git a/application/controllers/components/stv/Lists.php b/application/controllers/components/stv/Lists.php deleted file mode 100644 index 959de7a12..000000000 --- a/application/controllers/components/stv/Lists.php +++ /dev/null @@ -1,85 +0,0 @@ -load->model('system/Sprache_model', 'SpracheModel'); - - $this->SpracheModel->addOrder('sprache'); - - $result = $this->SpracheModel->load(); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - } - $this->outputJson($result); - } - - public function getGeschlechter() - { - $this->load->model('person/Geschlecht_model', 'GeschlechtModel'); - - $this->GeschlechtModel->addOrder('sort'); - $this->GeschlechtModel->addOrder('geschlecht'); - - $this->GeschlechtModel->addSelect('*'); - $this->GeschlechtModel->addSelect("bezeichnung_mehrsprachig[(SELECT index FROM public.tbl_sprache WHERE sprache=" . $this->GeschlechtModel->escape(DEFAULT_LANGUAGE) . " LIMIT 1)] AS bezeichnung"); - - $result = $this->GeschlechtModel->load(); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - } - $this->outputJson($result); - } - - public function getAusbildungen() - { - $this->load->model('codex/Ausbildung_model', 'AusbildungModel'); - - $this->AusbildungModel->addOrder('ausbildungcode'); - - $result = $this->AusbildungModel->load(); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - } - $this->outputJson($result); - } - - public function getStgs() - { - $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); - - $this->StudiengangModel->addSelect('*'); - $this->StudiengangModel->addSelect('UPPER(typ || kurzbz) AS kuerzel'); - - $this->StudiengangModel->addOrder('typ'); - $this->StudiengangModel->addOrder('kurzbz'); - - $result = $this->StudiengangModel->loadWhere(['aktiv' => true]); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - } - $this->outputJson($result); - } - - public function getOrgforms() - { - $this->load->model('codex/Orgform_model', 'OrgformModel'); - - $this->OrgformModel->addOrder('bezeichnung'); - - $result = $this->OrgformModel->loadWhere(['rolle' => true]); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - } - $this->outputJson($result); - } -} diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js index 69fa03dee..05a84499d 100644 --- a/public/js/components/Stv/Studentenverwaltung.js +++ b/public/js/components/Stv/Studentenverwaltung.js @@ -128,25 +128,22 @@ export default { this.lists.nations = result; }) .catch(this.$fhcAlert.handleSystemError); - CoreRESTClient - .get('components/stv/Lists/getSprachen') - .then(result => CoreRESTClient.getData(result.data) || []) + this.$fhcApi + .get('api/frontend/v1/stv/lists/getSprachen') .then(result => { - this.lists.sprachen = result; + this.lists.sprachen = result.data; }) .catch(this.$fhcAlert.handleSystemError); - CoreRESTClient - .get('components/stv/Lists/getGeschlechter') - .then(result => CoreRESTClient.getData(result.data) || []) + this.$fhcApi + .get('api/frontend/v1/stv/lists/getGeschlechter') .then(result => { - this.lists.geschlechter = result; + this.lists.geschlechter = result.data; }) .catch(this.$fhcAlert.handleSystemError); - CoreRESTClient - .get('components/stv/Lists/getAusbildungen') - .then(result => CoreRESTClient.getData(result.data) || []) + this.$fhcApi + .get('api/frontend/v1/stv/lists/getAusbildungen') .then(result => { - this.lists.ausbildungen = result; + this.lists.ausbildungen = result.data; }) .catch(this.$fhcAlert.handleSystemError); this.$fhcApi @@ -156,11 +153,10 @@ export default { this.lists.active_stgs = this.lists.stgs.filter(stg => stg.aktiv); }) .catch(this.$fhcAlert.handleSystemError); - CoreRESTClient - .get('components/stv/Lists/getOrgforms') - .then(result => CoreRESTClient.getData(result.data) || []) + this.$fhcApi + .get('api/frontend/v1/stv/lists/getOrgforms') .then(result => { - this.lists.orgforms = result; + this.lists.orgforms = result.data; }) .catch(this.$fhcAlert.handleSystemError); this.$fhcApi