diff --git a/application/controllers/components/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php similarity index 81% rename from application/controllers/components/stv/Config.php rename to application/controllers/api/frontend/v1/stv/Config.php index 1f3d9bb72..9aaf49651 100644 --- a/application/controllers/components/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -1,21 +1,44 @@ . + */ -if (! defined('BASEPATH')) exit('No direct script access allowed'); +if (!defined('BASEPATH')) exit('No direct script access allowed'); use CI3_Events as Events; -class Config extends FHC_Controller +/** + * This controller operates between (interface) the JS (GUI) and the back-end + * Provides data to the ajax get calls about the StV Config + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class Config extends FHCAPI_Controller { public function __construct() { // TODO(chris): access! - parent::__construct(); + parent::__construct([ + 'student' => self::PERM_LOGGED, + 'students' => self::PERM_LOGGED + ]); - $this->load->library('AuthLib'); - $this->load->library('PermissionLib'); + // Load Phrases $this->loadPhrases([ 'global', 'person', @@ -48,10 +71,6 @@ class Config extends FHC_Controller 'title' => 'Status', 'component' => './Stv/Studentenverwaltung/Details/MultiStatus.js' ]; - $result['konto'] = [ - 'title' => 'Konto', - 'component' => './Stv/Studentenverwaltung/Details/Konto.js' - ]; $result['banking'] = [ 'title' => $this->p->t('stv', 'tab_banking'), 'component' => './Stv/Studentenverwaltung/Details/Konto.js', @@ -77,7 +96,7 @@ class Config extends FHC_Controller return $result; }); - $this->outputJsonSuccess($result); + $this->terminateWithSuccess($result); } public function students() @@ -111,7 +130,7 @@ class Config extends FHC_Controller return $result; }); - $this->outputJsonSuccess($result); + $this->terminateWithSuccess($result); } protected function kontoColumns() diff --git a/public/js/api/fhcapifactory.js b/public/js/api/fhcapifactory.js index 41c89ef50..2932efd83 100644 --- a/public/js/api/fhcapifactory.js +++ b/public/js/api/fhcapifactory.js @@ -20,11 +20,13 @@ import phrasen from "./phrasen.js"; import navigation from "./navigation.js"; import filter from "./filter.js"; import studstatus from "./studstatus.js"; +import stv from "./stv.js"; export default { search, phrasen, navigation, filter, - studstatus + studstatus, + stv }; diff --git a/public/js/api/stv.js b/public/js/api/stv.js index ab3e918a1..3f16b0847 100644 --- a/public/js/api/stv.js +++ b/public/js/api/stv.js @@ -3,5 +3,11 @@ import konto from './stv/konto.js'; export default { filter, - konto + konto, + configStudent() { + return this.$fhcApi.get('api/frontend/v1/stv/config/student'); + }, + configStudents() { + return this.$fhcApi.get('api/frontend/v1/stv/config/students'); + } }; \ No newline at end of file diff --git a/public/js/apps/Studentenverwaltung.js b/public/js/apps/Studentenverwaltung.js index a282a45e3..9b24008e3 100644 --- a/public/js/apps/Studentenverwaltung.js +++ b/public/js/apps/Studentenverwaltung.js @@ -18,7 +18,6 @@ import FhcStudentenverwaltung from "../components/Stv/Studentenverwaltung.js"; import fhcapifactory from "./api/fhcapifactory.js"; -import FhcApi from "../plugin/FhcApi.js"; import Phrasen from "../plugin/Phrasen.js"; //import PrimeVue form "../../../../index.ci.php/public/js/components/primevue/config/config.esm.min.js"); @@ -48,7 +47,6 @@ import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_route overlay: 1100 } }) - .use(FhcApi) .use(Phrasen) .mount('#main'); }); diff --git a/public/js/components/Stv/Studentenverwaltung/Details.js b/public/js/components/Stv/Studentenverwaltung/Details.js index c34cf2684..9b888093f 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details.js @@ -33,8 +33,8 @@ export default {