mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
retrieving user data from mitarbeiter and benutzer models
This commit is contained in:
@@ -18,6 +18,8 @@ class Profil extends Auth_Controller
|
||||
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
|
||||
'getUser' => ['student/anrechnung_beantragen:r','user:r']
|
||||
]);
|
||||
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
@@ -33,15 +35,26 @@ class Profil extends Auth_Controller
|
||||
$this->load->view('Cis/Profil', ["uid" => getAuthUID()]);
|
||||
}
|
||||
|
||||
|
||||
//? public function getUser returns information related to a user
|
||||
public function getUser()
|
||||
{
|
||||
$myObj = new stdClass();
|
||||
$myObj->name = "John";
|
||||
$myObj->age = 30;
|
||||
$myObj->city = "New York";
|
||||
echo json_encode($myObj);
|
||||
//* retrieve info from the Mitarbeiter model
|
||||
$mitarbeiter_result = $this->MitarbeiterModel->load(getAuthUID());
|
||||
//* retrieve info from the Benutzer model
|
||||
$benutzer_result = $this->BenutzerModel->load([getAuthUID()]);
|
||||
//* return JSON with info
|
||||
$res = ['mitarbeiter' => $mitarbeiter_result,
|
||||
'Benutzer' => $benutzer_result];
|
||||
|
||||
echo json_encode($res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//? this idea was to use _remap, to call different views based on the type of user
|
||||
/*
|
||||
public function _remap($param)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,9 @@ const app = Vue.createApp({
|
||||
methods: {
|
||||
testsearch: function() {
|
||||
return Vue.$fhcapi.UserData.getUser();
|
||||
},
|
||||
testsearch2: function() {
|
||||
return Vue.$fhcapi.UserData.getUser2("ma0594");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -5,6 +5,11 @@ export default {
|
||||
+ 'Cis/Profil/getUser';
|
||||
return axios.get(url);
|
||||
},
|
||||
getUser2: function(uid) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ 'models/person/Benutzer_model/getFromPersonId';
|
||||
return axios.get(url,{params: {uid}});
|
||||
},
|
||||
getUserDumy: function(){
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ 'public/js/apps/api/dummyapi.php/getUser';
|
||||
|
||||
@@ -16,6 +16,8 @@ export default {
|
||||
this.$parent.testsearch().then((res) => {
|
||||
this.person = res.data;
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
template: `
|
||||
|
||||
Reference in New Issue
Block a user