diff --git a/application/controllers/api/frontend/v1/Lehre.php b/application/controllers/api/frontend/v1/Lehre.php index c25dc1986..f079a5b37 100644 --- a/application/controllers/api/frontend/v1/Lehre.php +++ b/application/controllers/api/frontend/v1/Lehre.php @@ -30,6 +30,7 @@ class Lehre extends FHCAPI_Controller parent::__construct([ 'lvStudentenMail' => self::PERM_LOGGED, 'LV' => self::PERM_LOGGED, + 'Pruefungen' => self::PERM_LOGGED, ]); @@ -76,6 +77,23 @@ class Lehre extends FHCAPI_Controller $this->terminateWithSuccess($result); } + + /** + * fetches all Pruefungen of a student for a specific lehrveranstaltung + * if the student passed the Pruefung on the first attempt, no information about the Pruefungen is stored in the database + * @param mixed $lehrveranstaltung_id + * @return void + */ + public function Pruefungen($lehrveranstaltung_id) + { + $this->load->model('education/Pruefung_model', 'PruefungModel'); + + $result = $this->PruefungModel->getByStudentAndLv(getAuthUID(), $lehrveranstaltung_id, getUserLanguage()); + + $result = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($result); + } diff --git a/application/controllers/api/frontend/v1/Phrasen.php b/application/controllers/api/frontend/v1/Phrasen.php index 3509e6630..7cc652c71 100644 --- a/application/controllers/api/frontend/v1/Phrasen.php +++ b/application/controllers/api/frontend/v1/Phrasen.php @@ -73,11 +73,22 @@ class Phrasen extends FHCAPI_Controller // gets all languages that are set as active in the database public function getAllLanguages() { - $langs = getDBActiveLanguages(); + $this->load->model('system/Sprache_model', 'SprachenModel'); + + // Add order clause by index and select the sprache,bezeichnung and index column + $this->SprachenModel->addOrder('index'); + $this->SprachenModel->addSelect('sprache, bezeichnung, index'); + + // Retrieves from public.tbl_sprache + $langs = $this->SprachenModel->loadWhere(array('content' => true)); $langs = $this->getDataOrTerminateWithError($langs); $langs = array_map(function($lang){ - return $lang->sprache; + $data = new stdClass(); + $data->sprache = $lang->sprache; + $data->bezeichnung = $lang->bezeichnung[($lang->index-1)]; + return $data; }, $langs); + $this->terminateWithSuccess($langs); } diff --git a/public/js/api/lehre.js b/public/js/api/lehre.js index 743439722..cd7129d61 100644 --- a/public/js/api/lehre.js +++ b/public/js/api/lehre.js @@ -13,4 +13,10 @@ export default { , {} ); }, + getStudentPruefungen(lehrveranstaltung_id){ + return this.$fhcApi.get( + `/api/frontend/v1/Lehre/Pruefungen/${lehrveranstaltung_id}` + , {} + ); + } } \ No newline at end of file diff --git a/public/js/components/Cis/Cms/News.js b/public/js/components/Cis/Cms/News.js index 0f742e21e..bd32d0304 100644 --- a/public/js/components/Cis/Cms/News.js +++ b/public/js/components/Cis/Cms/News.js @@ -3,43 +3,44 @@ import StudiengangInformation from "./StudiengangInformation/StudiengangInformat export default { name: "NewsComponent", - components: { - Pagination, - }, - data() { - return { - content: null, - maxPageCount: 0, - page_size: 10, - }; - }, - methods: { - loadNewPageContent: function (data) { - this.$fhcApi.factory.cms.getNews(data.page, data.rows) - .then(res => res.data) - .then(result => { - this.content = result; - }); + components: { + Pagination, + StudiengangInformation, + }, + data() { + return { + content: null, + maxPageCount: 0, + page_size: 10, + }; + }, + methods: { + loadNewPageContent: function (data) { + this.$fhcApi.factory.cms.getNews(data.page, data.rows) + .then(res => res.data) + .then(result => { + this.content = result; + }); + + }, + }, + created() { + this.$fhcApi.factory.cms.getNews(1, this.page_size) + .then(res => res.data) + .then(result => { + this.content = result; + }); - }, - }, - created() { - this.$fhcApi.factory.cms.getNews(1, this.page_size) - .then(res => res.data) - .then(result => { - this.content = result; - }); - - this.$fhcApi.factory.cms.getNewsRowCount() - .then(res => res.data) - .then(result => { - this.maxPageCount = result; - }); - }, - template: /*html*/ ` + this.$fhcApi.factory.cms.getNewsRowCount() + .then(res => res.data) + .then(result => { + this.maxPageCount = result; + }); + }, + template: /*html*/ `
+
Keine Prüfungen vorhanden!
| Note | -||
| {{pruefung.pruefungstyp_kurzbz}} | {{pruefung.datum}} | {{pruefung.note}} | diff --git a/public/js/components/Cis/Sprachen.js b/public/js/components/Cis/Sprachen.js index bd63b9741..72768e9f2 100644 --- a/public/js/components/Cis/Sprachen.js +++ b/public/js/components/Cis/Sprachen.js @@ -2,6 +2,7 @@ export default { data(){ return { allActiveLanguages: null, + sprachenTranslation:null, } }, methods:{ @@ -11,20 +12,25 @@ export default { this.$p.setLanguage(lang, this.$fhcApi); } }, + getSprachenBezeichnung: function(lang){ + if (!Array.isArray(this.sprachenTranslation) || this.sprachenTranslation.length == 0) return; + return this.sprachenTranslation.find(s=>s.sprache == lang)?.bezeichnung; + }, }, mounted(){ this.$fhcApi.factory.phrasen.getActiveDbLanguages() .then(res => res.data) .then( (langs) => { - this.allActiveLanguages = langs; + this.allActiveLanguages = langs.map(l=>l.sprache); + this.sprachenTranslation = langs; } ); }, template:/*html*/`
|---|