feature(News-StudiengangsInformationen): adds the Studiengangsinformationen next to the news view

This commit is contained in:
SimonGschnell
2024-12-04 15:04:05 +01:00
parent f7bc01e63f
commit ecbb65c2a4
6 changed files with 44 additions and 8 deletions
@@ -181,7 +181,6 @@ class Cms extends FHCAPI_Controller
$page_size = $page_size ?? 10;
$news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size);
$news = $this->getDataOrTerminateWithError($news);
$this->addMeta('test', $this->p->t('global', 'studiengangsleitung'));
+3 -3
View File
@@ -236,7 +236,7 @@ class CmsLib
return $news;
$news = getData($news);
//var_dump($news->maxPageCount);
foreach ($news as $newsobj) {
if ($studiengang_kz && $edit && !$newsobj->studiengang_kz)
continue;
@@ -247,7 +247,7 @@ class CmsLib
$xml .= "<newswrapper>" . $newsobj->content . $datum . $id . "</newswrapper>";
}
if ($studiengang_kz != 0) {
/* if ($studiengang_kz != 0) {
$stg_obj = $this->ci->StudiengangModel->load($studiengang_kz);
if (isError($stg_obj))
return $stg_obj;
@@ -262,7 +262,7 @@ class CmsLib
}
$xml .= '<studiengang_bezeichnung><![CDATA[' . $stg_obj->bezeichnung . ']]></studiengang_bezeichnung>';
}
}
} */
if ($titel != '') {
$xml .= '<news_titel>' . $titel . '</news_titel>';
@@ -687,11 +687,15 @@ class Studiengang_model extends DB_Model
$this->load->model('crm/Student_model', 'StudentModel');
//TODO: this does not work for Mitarbeiter
$student = $this->StudentModel->loadWhere(['student_uid' => getAuthUID()]);
if (isError($student))
return error($student);
if (getData($student)) {
//TODO: if a mitarbeiter requests this site, empty data should be returned
if(count($student) == 0)
{
return new stdClass();
}
$student = current(getData($student));
$studiengang_kz = $student->studiengang_kz;
$semester = $student->semester;
+11 -1
View File
@@ -1,8 +1,10 @@
import Pagination from "../../Pagination/Pagination.js";
import StudiengangInformation from "./StudiengangInformation/StudiengangInformation.js";
export default {
components: {
Pagination,
StudiengangInformation,
},
data() {
return {
@@ -39,6 +41,14 @@ export default {
<hr/>
<pagination :page_size="page_size" @page="loadNewPageContent" :maxPageCount="maxPageCount">
</pagination>
<div v-html="content"></div>
<div class="container-xxl">
<div class="row">
<div class="col-12 col-md-8 col-xl-9" v-html="content">
</div>
<div class="col-12 col-md-4 col-xl-3">
<studiengang-information></studiengang-information>
</div>
</div>
</div>
`,
};
@@ -18,14 +18,32 @@ components:{
StudiengangPerson
},
template:/*html*/`
<template v-if="studiengang?.bezeichnung && semester">
<h5>Studiengang: {{studiengang.bezeichnung}}</h5>
<h5>Semester: {{semester}}</h5>
</template>
<template v-for="{title, collection} in collection_array">
<h3 v-if="Array.isArray(collection) && collection.length !==0">{{title}}</h3>
<h5 v-if="Array.isArray(collection) && collection.length !==0">{{title}}</h5>
<template v-for="person in studiengangs_person_data(collection)">
<div class="mb-3">
<studiengang-person :person_data="person"></studiengang-person>
</div>
</template>
</template>
<div v-if="studiengang?.zusatzinfo_html" v-html="studiengang?.zusatzinfo_html"></div>
<template v-if="hochschulvertr && Array.isArray(hochschulvertr) && hochschulvertr.length >0">
<h5>Hochschulvertretung</h5>
<p v-for="vertretung in hochschulvertr">{{vertretungFormatedName(vertretung)}}</p>
</template>
<template v-if="stdv && Array.isArray(stdv) && stdv.length >0">
<h5>Studienvertretung {{studiengang.kurzbzlang??''}}</h5>
<p v-for="vertretung in stdv">{{vertretungFormatedName(vertretung,false)}}</p>
</template>
<template v-if="jahrgangsvertr && Array.isArray(jahrgangsvertr) && jahrgangsvertr.length >0">
<h5>Jahrgangsvertretung</h5>
<p v-for="vertretung in jahrgangsvertr">{{vertretungFormatedName(vertretung,false)}}</p>
</template>
`,
computed:{
collection_array: function(){
@@ -48,6 +66,10 @@ computed:{
},
},
methods:{
vertretungFormatedName: function(vertretung,bezeichnung=true){
if(!vertretung) return null;
return `${vertretung.vorname ?? ''} ${vertretung.nachname ?? ''} ${vertretung.bezeichnung && bezeichnung ? '('.concat(vertretung.bezeichnung.replace("(","").replace(")","")).concat(")") : ''}`
},
studiengangs_person_data: function (collection) {
// early return if the reactive data is not yet loaded or not present
if (!collection || !Array.isArray(collection) || collection.length === 0)
@@ -110,6 +132,7 @@ mounted(){
.then(res => res.data)
.then(studiengangInformationen => {
Object.assign(this, studiengangInformationen);
console.log(studiengangInformationen,"das sind die Informationen")
});
},
@@ -25,7 +25,7 @@ export default {
<img :src="person_data.foto" alt="person_dataFoto" style="width: 110px; height: auto; object-fir:scale-down;" class="card-img-top" >
</div>
<div class="card-body">
<h5 class="text-center card-title mb-0">{{person_data.fullname}}</h5>
<h6 class="text-center card-title mb-0">{{person_data.fullname}}</h6>
</div>
<hr class="my-0">
<div class="card-body">