update(Calendar exports): viewdata update

This commit is contained in:
SimonGschnell
2025-02-05 11:03:19 +01:00
parent 9ec57b6ce7
commit d889756302
5 changed files with 76 additions and 7 deletions
@@ -0,0 +1,52 @@
<?php
/**
* Copyright (C) 2024 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class AuthInfo extends FHCAPI_Controller
{
/**
* Object initialization
*/
public function __construct()
{
parent::__construct([
'getAuthUID' => self::PERM_LOGGED,
]);
$this->uid = getAuthUID();
$this->pid = getAuthPersonID();
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* returns the uid of the currently logged in user
* @access public
*
*/
public function getAuthUID()
{
$this->terminateWithSuccess(['uid'=>$this->uid]);
}
}
@@ -181,7 +181,7 @@ class Studiensemester_model extends DB_Model
$query = "
SELECT studiensemester_kurzbz, start, ende
FROM public.tbl_studiensemester
WHERE ( ende >= ?::date AND start <= ?::date ) OR ( ende >= ?::date + '45 days'::interval AND start <= ?::date + '45 days'::interval )
WHERE ( ende >= ?::date AND start <= ?::date ) OR ( ende >= ?::date + '-45 days'::interval AND start <= ?::date + '-45 days'::interval )
ORDER BY start DESC
LIMIT 1";
+10
View File
@@ -0,0 +1,10 @@
export default {
getAuthUID() {
return this.$fhcApi.get(
'/api/frontend/v1/AuthInfo/getAuthUID',
{ }
);
},
};
+3 -1
View File
@@ -35,7 +35,8 @@ import lehre from "./lehre.js";
import addons from "./addons.js";
import studiengang from "./studiengang.js";
import menu from "./menu.js";
import dashboard from "./dashboard";
import dashboard from "./dashboard.js";
import authinfo from "./authinfo.js";
export default {
search,
@@ -59,4 +60,5 @@ export default {
addons,
studiengang,
menu,
authinfo,
};
@@ -17,8 +17,12 @@ export const Stundenplan = {
studiensemester_kurzbz:null,
studiensemester_start:null,
studiensemester_ende:null,
uid:null,
}
},
props: [
"viewData",
],
watch: {
weekFirstDay: {
handler: async function (newValue) {
@@ -31,21 +35,18 @@ export const Stundenplan = {
immediate: true,
}
},
props: [
"viewData",
],
components: {
FhcCalendar, LvModal, LvMenu, LvInfo
},
computed:{
downloadLinks: function(){
if(!this.studiensemester_start || !this.studiensemester_ende)return;
if(!this.studiensemester_start || !this.studiensemester_ende || !this.uid )return;
let start = new Date(this.studiensemester_start);
start = Math.floor(start.getTime()/1000);
let ende = new Date(this.studiensemester_ende);
ende = Math.floor(ende.getTime() / 1000);
let download_link = (format, version = "", target = "") => `${FHC_JS_DATA_STORAGE_OBJECT.app_root}cis/private/lvplan/stpl_kalender.php?type=student&pers_uid=${this.viewData.uid}&begin=${start}&ende=${ende}&format=${format}${version ? '&version=' + version : ''}${target ? '&target=' + target : ''}`;
let download_link = (format, version = "", target = "") => `${FHC_JS_DATA_STORAGE_OBJECT.app_root}cis/private/lvplan/stpl_kalender.php?type=student&pers_uid=${this.uid}&begin=${start}&ende=${ende}&format=${format}${version ? '&version=' + version : ''}${target ? '&target=' + target : ''}`;
return [{ title: "excel", icon: 'fa-solid fa-file-excel', link: download_link('excel') }, { title: "csv", icon: 'fa-solid fa-file-csv', link: download_link('csv') }, { title: "ical1", icon: 'fa-regular fa-calendar', link: download_link('ical', '1', 'ical') }, { title: "ical2", icon: 'fa-regular fa-calendar', link: download_link('ical', '2', 'ical') }];
},
lv_id() { // computed so we can theoretically change path/lva selection and reload without page refresh
@@ -149,6 +150,10 @@ export const Stundenplan = {
},
created()
{
this.$fhcApi.factory.authinfo.getAuthUID().then((res) => res.data)
.then(data=>{
this.uid = data.uid;
})
this.loadEvents();
},
beforeUnmount() {