diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index de6f115da..9dfbc741d 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -618,20 +618,31 @@ class Profil extends Auth_Controller $uid = $uid != "Profil" ? $uid : null; + $isMitarbeiter = null; - if($uid) + if($uid){ + + if(isSuccess($this->PersonModel->addSelect(["person_id"]))){ + $pid = $this->PersonModel->getByUid($uid); + $pid = hasData($pid) ? getData($pid)[0] : null; + + } + if(!$pid){ + return null; + } + $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid); + } else $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($this->uid); if(isError($isMitarbeiter)){ //catch error - echo "error"; - return; } $isMitarbeiter = hasData($isMitarbeiter) ? getData($isMitarbeiter) : null; + $res = new stdClass(); if($uid == $this->uid || !$uid ){ @@ -639,10 +650,12 @@ class Profil extends Auth_Controller if($isMitarbeiter ) { $res->view= "MitarbeiterProfil"; $res->data = $this->mitarbeiterProfil(); + $res->data->pid = $this->pid; } else { $res->view= "StudentProfil"; $res->data = $this->studentProfil(); + $res->data->pid = $this->pid; } } elseif($uid){ @@ -650,10 +663,12 @@ class Profil extends Auth_Controller if($isMitarbeiter ){ $res->view= "ViewMitarbeiterProfil"; $res->data= $this->viewMitarbeiterProfil($uid); + } else { $res->view= "ViewStudentProfil"; $res->data= $this->viewStudentProfil($uid); + } } @@ -661,9 +676,14 @@ class Profil extends Auth_Controller echo json_encode($res); } - public function foto_sperre_function($value, $uid=""){ + + public function foto_sperre_function($value){ + //? Nur der Index User hat die Erlaubniss das Profilbild zu sperren $res = $this->PersonModel->update($this->pid,array("foto_sperre"=>$value)); + if(isError($res)){ + echo json_encode("error encountered when updating foto_sperre"); + return; // error handling }else{ //? select the value of the column foto_sperre to return diff --git a/public/js/apps/Cis/Profil.js b/public/js/apps/Cis/Profil.js index c48d7ef23..a6f811478 100644 --- a/public/js/apps/Cis/Profil.js +++ b/public/js/apps/Cis/Profil.js @@ -21,6 +21,8 @@ const app = Vue.createApp({ return { view:null, data:null, + // notfound is null by default, but contains an UID if no user exists with that UID + notFoundUID:null, } }, @@ -32,21 +34,22 @@ const app = Vue.createApp({ let path = location.pathname; let uid = path.substring(path.lastIndexOf('/')).replace("/",""); - - /* const payload = { - ...(uid != "Profil" ? {uid} : {}) - }; - */ + Vue.$fhcapi.UserData.getView(uid).then((res)=>{ - this.view = res.data.view; - this.data = res.data.data; + if(!res.data){ + this.notFoundUID=uid; + } + this.view = res.data?.view; + this.data = res.data?.data; }); }, template:`
+ + +
FH-Ausweis Status
-{{"Der FH Ausweis ist am "+ wert+ " ausgegeben worden."}}
+Private Kontakte
-