Personal LVPlan: generate download links also for employees not only for students

This commit is contained in:
Harald Bamberger
2025-08-07 15:34:23 +02:00
parent 73d269d54b
commit 8c797fb212
4 changed files with 47 additions and 6 deletions
@@ -20,6 +20,10 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class AuthInfo extends FHCAPI_Controller
{
protected $uid;
protected $pid;
protected $isMitarbeiter;
protected $isStudent;
/**
* Object initialization
@@ -28,10 +32,16 @@ class AuthInfo extends FHCAPI_Controller
{
parent::__construct([
'getAuthUID' => self::PERM_LOGGED,
'getAuthInfo' => self::PERM_LOGGED,
]);
$this->load->model('crm/Student_model', 'StudentModel');
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
$this->uid = getAuthUID();
$this->pid = getAuthPersonID();
$this->isMitarbeiter = getData($this->MitarbeiterModel->isMitarbeiter($this->uid)) ?? false;
$this->isStudent = getData($this->StudentModel->isStudent($this->uid)) ?? false;
}
//------------------------------------------------------------------------------------------------------------------
@@ -47,6 +57,14 @@ class AuthInfo extends FHCAPI_Controller
$this->terminateWithSuccess(['uid'=>$this->uid]);
}
public function getAuthInfo()
{
$data = (object) array(
'uid' => $this->uid,
'isMitarbeiter' => $this->isMitarbeiter,
'isStudent' => $this->isStudent
);
$this->terminateWithSuccess($data);
}
}
+6 -1
View File
@@ -6,5 +6,10 @@ export default {
{ }
);
},
getAuthInfo() {
return this.$fhcApi.get(
'/api/frontend/v1/AuthInfo/getAuthInfo',
{}
);
},
};
+6
View File
@@ -21,5 +21,11 @@ export default {
method: 'get',
url: '/api/frontend/v1/AuthInfo/getAuthUID'
};
},
getAuthInfo() {
return {
method: 'get',
url: '/api/frontend/v1/AuthInfo/getAuthInfo'
};
}
};
+16 -4
View File
@@ -19,7 +19,9 @@ export default {
studiensemester_kurzbz: null,
studiensemester_start: null,
studiensemester_ende: null,
uid: null
uid: null,
isMitarbeiter: false,
isStudent: false
};
},
computed:{
@@ -36,7 +38,15 @@ export default {
downloadLinks() {
if (!this.studiensemester_start || !this.studiensemester_ende || !this.uid)
return false;
let type = false;
type = this.isStudent ? 'student' : type;
type = this.isMitarbeiter ? 'lektor' : type;
if (false === type)
{
return;
}
const opts = { zone: this.viewData.timezone };
const start = luxon.DateTime
.fromISO(this.studiensemester_start, opts)
@@ -47,7 +57,7 @@ export default {
const download_link = FHC_JS_DATA_STORAGE_OBJECT.app_root
+ 'cis/private/lvplan/stpl_kalender.php'
+ '?type=student'
+ '?type=' + type
+ '&pers_uid=' + this.uid
+ '&begin=' + start
+ '&ende=' + ende;
@@ -96,9 +106,11 @@ export default {
},
created() {
this.$api
.call(ApiAuthinfo.getAuthUID())
.call(ApiAuthinfo.getAuthInfo())
.then(res => {
this.uid = res.data.uid;
this.isMitarbeiter = res.data.isMitarbeiter;
this.isStudent = res.data.isStudent;
});
},
template: /*html*/`