From 2aecc6e0f2448cd0a212c3c72fa47cbbbb2f9de2 Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Thu, 16 Apr 2026 15:49:16 +0200 Subject: [PATCH 1/4] removed use of viewData object as passed by controller thru routerview to component -- component fetches data instead --- application/controllers/Cis/Abgabetool.php | 31 +- application/controllers/Cis/LvPlan.php | 8 +- application/controllers/Cis/MyLv.php | 7 +- application/controllers/Cis/MyLvPlan.php | 10 +- application/controllers/Cis/OtherLvPlan.php | 7 +- application/controllers/Cis/Profil.php | 52 +-- application/controllers/Cis/Raumsuche.php | 7 +- application/controllers/Cis/StgOrgLvPlan.php | 8 +- application/controllers/Cis/Studium.php | 5 +- application/controllers/Cis4.php | 12 +- .../api/frontend/v1/Cis4FhcApi.php | 13 +- .../controllers/api/frontend/v1/LvPlan.php | 1 + .../api/frontend/v1/OtherLvPlan.php | 30 +- .../controllers/api/frontend/v1/Profil.php | 121 ++++-- .../api/frontend/v1/StgOrgLvPlan.php | 64 +++ .../views/CisRouterView/CisRouterView.php | 4 +- public/js/api/factory/lvPlan.js | 6 + public/js/api/factory/otherLvPlan.js | 4 +- public/js/api/factory/profil.js | 2 +- public/js/api/factory/stgOrgLvPlan.js | 25 ++ public/js/apps/Dashboard/Fhc.js | 2 +- .../Cis/Abgabetool/AbgabetoolAssistenz.js | 8 - .../Cis/Abgabetool/AbgabetoolMitarbeiter.js | 10 - .../Cis/Abgabetool/AbgabetoolStudent.js | 37 +- .../Cis/Abgabetool/DeadlineOverview.js | 8 - public/js/components/Cis/LvPlan/LvPlan.js | 11 +- .../Cis/LvPlan/{Personal.js => MyLvPlan.js} | 31 +- .../js/components/Cis/LvPlan/OtherLvPlan.js | 380 +++++++++--------- public/js/components/Cis/LvPlan/StgOrg.js | 105 ++--- .../Cis/Profil/MitarbeiterProfil.js | 6 +- .../Cis/Profil/MitarbeiterViewProfil.js | 167 ++++---- public/js/components/Cis/Profil/Profil.js | 37 +- .../js/components/Cis/Profil/StudentProfil.js | 6 +- .../Cis/Profil/StudentViewProfil.js | 66 ++- .../js/components/Cis/Raumsuche/Raumsuche.js | 3 - public/js/components/Dashboard/Dashboard.js | 24 +- 36 files changed, 680 insertions(+), 638 deletions(-) create mode 100644 application/controllers/api/frontend/v1/StgOrgLvPlan.php create mode 100644 public/js/api/factory/stgOrgLvPlan.js rename public/js/components/Cis/LvPlan/{Personal.js => MyLvPlan.js} (87%) diff --git a/application/controllers/Cis/Abgabetool.php b/application/controllers/Cis/Abgabetool.php index 04338b1a9..28414dafa 100644 --- a/application/controllers/Cis/Abgabetool.php +++ b/application/controllers/Cis/Abgabetool.php @@ -31,12 +31,8 @@ class Abgabetool extends Auth_Controller { // TODO: routing from index based on berechtigung? - $viewData = array( - 'uid'=>getAuthUID(), - ); - if(defined('CIS4') && CIS4) { - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Abgabetool']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'Abgabetool']); } else { $this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'Abgabetool']); } @@ -44,12 +40,8 @@ class Abgabetool extends Auth_Controller public function Student($student_uid_prop = '') { - $viewData = array( - 'uid'=>getAuthUID(), - ); - if(defined('CIS4') && CIS4) { - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'AbgabetoolStudent']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'AbgabetoolStudent']); } else { $this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'AbgabetoolStudent', 'student_uid_prop' => $student_uid_prop]); } @@ -57,12 +49,8 @@ class Abgabetool extends Auth_Controller public function Mitarbeiter() { - $viewData = array( - 'uid'=>getAuthUID(), - ); - if(defined('CIS4') && CIS4) { - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'AbgabetoolMitarbeiter']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'AbgabetoolMitarbeiter']); } else { $this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'AbgabetoolMitarbeiter']); } @@ -70,13 +58,8 @@ class Abgabetool extends Auth_Controller public function Assistenz($stg_kz_prop = '') { - - $viewData = array( - 'uid'=>getAuthUID(), - ); - if(defined('CIS4') && CIS4) { - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'AbgabetoolAssistenz']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'AbgabetoolAssistenz']); } else { $this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'AbgabetoolAssistenz', 'stg_kz_prop' => $stg_kz_prop]); } @@ -84,12 +67,8 @@ class Abgabetool extends Auth_Controller public function Deadlines() { - $viewData = array( - 'uid'=>getAuthUID(), - ); - if(defined('CIS4') && CIS4) { - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'DeadlinesOverview']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'DeadlinesOverview']); } else { $this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'DeadlinesOverview']); } diff --git a/application/controllers/Cis/LvPlan.php b/application/controllers/Cis/LvPlan.php index 884c8a9a0..32e622f5a 100644 --- a/application/controllers/Cis/LvPlan.php +++ b/application/controllers/Cis/LvPlan.php @@ -28,12 +28,6 @@ class LvPlan extends Auth_Controller */ public function index() { - - $viewData = array( - 'uid'=>getAuthUID(), - 'timezone' => $this->config->item('timezone') - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'LvPlan']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'LvPlan']); } } diff --git a/application/controllers/Cis/MyLv.php b/application/controllers/Cis/MyLv.php index 819d56b05..0f24d3a80 100644 --- a/application/controllers/Cis/MyLv.php +++ b/application/controllers/Cis/MyLv.php @@ -26,11 +26,6 @@ class MyLv extends Auth_Controller */ public function index() { - - $viewData = array( - - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'MyLv']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'MyLv']); } } diff --git a/application/controllers/Cis/MyLvPlan.php b/application/controllers/Cis/MyLvPlan.php index 366ce8e65..a7f21aa20 100644 --- a/application/controllers/Cis/MyLvPlan.php +++ b/application/controllers/Cis/MyLvPlan.php @@ -27,13 +27,7 @@ class MyLvPlan extends Auth_Controller * @return void */ public function index() - { - - $viewData = array( - 'uid'=>getAuthUID(), - 'timezone' => $this->config->item('timezone') - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'MyLvPlan']); + { + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'MyLvPlan']); } } diff --git a/application/controllers/Cis/OtherLvPlan.php b/application/controllers/Cis/OtherLvPlan.php index c657ec3d2..e62644dd1 100644 --- a/application/controllers/Cis/OtherLvPlan.php +++ b/application/controllers/Cis/OtherLvPlan.php @@ -29,11 +29,6 @@ class OtherLvPlan extends Auth_Controller */ public function index() { - - $viewData = array( - 'timezone' => $this->config->item('timezone') - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'OtherLvPlan']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'OtherLvPlan']); } } diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index 83b8f5493..dd7963228 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -55,16 +55,7 @@ class Profil extends Auth_Controller */ public function index() { - - $this->load->library('ProfilLib'); - $profil_data = $this->profillib->getView(getAuthUID()); - $profil_data = hasData($profil_data) ? getData($profil_data) : null; - $viewData = array( - 'editable' => true, - 'profil_data' => $profil_data, - 'calendarSyncUrls' => $this->getCalendarSyncUrlData(), - ); - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'profilIndex']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'profilIndex']); } /** @@ -74,20 +65,7 @@ class Profil extends Auth_Controller */ public function View($uid) { - $this->load->library('ProfilLib'); - $profil_data = $this->profillib->getView($uid); - $profil_data = hasData($profil_data) ? getData($profil_data) : null; - $viewData = array( - 'uid' => $uid, - 'profil_data' => $profil_data, - 'permissions' => [ - 'basis/other_lv_plan' => $this->permissionlib->isBerechtigt(('basis/other_lv_plan')), - ] - ); - if ($uid == getAuthUID()) { - $viewData['editable'] = true; - } - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'profilViewUid']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'profilViewUid']); } /** @@ -754,30 +732,4 @@ class Profil extends Auth_Controller $zutrittskarte_ausgegebenam = str_replace("-", ".", $zutrittskarte_ausgegebenam); return $zutrittskarte_ausgegebenam; } - - /** - * gets the identifier, phrase, and url for each calendar sync option - * @access private - * @return array array of arrays, where each child array is a sync option - */ - private function getCalendarSyncUrlData() - { - return [ - [ - "identifier" => "cal_dav", - "labelPhrase" => "profil/calendar_sync_cal_dav", - "url" => APP_ROOT . "webdav/lvplan.php/calendars/" . $this->uid . "/LVPlan-" . $this->uid, - ], - [ - "identifier" => "cal_dav_principal", - "labelPhrase" => "profil/calendar_sync_cal_dav_principal", - "url" => APP_ROOT . "webdav/lvplan.php/principals/" . $this->uid, - ], - [ - "identifier" => "i_cal", - "labelPhrase" => "profil/calendar_sync_i_cal", - "url" => APP_ROOT . "webdav/google.php?cal=" . encryptData($this->uid, LVPLAN_CYPHER_KEY) . "&" . microtime(true), - ], - ]; - } } diff --git a/application/controllers/Cis/Raumsuche.php b/application/controllers/Cis/Raumsuche.php index 055038275..f48beb0f3 100644 --- a/application/controllers/Cis/Raumsuche.php +++ b/application/controllers/Cis/Raumsuche.php @@ -25,11 +25,6 @@ class Raumsuche extends Auth_Controller */ public function index() { - - $viewData = array( - 'uid'=>getAuthUID(), - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Raumsuche']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'Raumsuche']); } } diff --git a/application/controllers/Cis/StgOrgLvPlan.php b/application/controllers/Cis/StgOrgLvPlan.php index 834d49d55..bf329fcb8 100644 --- a/application/controllers/Cis/StgOrgLvPlan.php +++ b/application/controllers/Cis/StgOrgLvPlan.php @@ -28,12 +28,6 @@ class StgOrgLvPlan extends Auth_Controller */ public function index() { - - $viewData = array( - 'uid'=>getAuthUID(), - 'timezone' => $this->config->item('timezone') - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'StgOrgLvPlan']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'StgOrgLvPlan']); } } diff --git a/application/controllers/Cis/Studium.php b/application/controllers/Cis/Studium.php index a298de648..20f323dff 100644 --- a/application/controllers/Cis/Studium.php +++ b/application/controllers/Cis/Studium.php @@ -29,10 +29,7 @@ class Studium extends Auth_Controller */ public function index() { - $viewData = array( - - ); - $this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'studium']); + $this->load->view('CisRouterView/CisRouterView.php',['route' => 'studium']); } diff --git a/application/controllers/Cis4.php b/application/controllers/Cis4.php index 11c723226..48fd6c240 100644 --- a/application/controllers/Cis4.php +++ b/application/controllers/Cis4.php @@ -31,16 +31,6 @@ class Cis4 extends Auth_Controller */ public function index() { - $this->load->model('person/Person_model', 'PersonModel'); - $personData = getData($this->PersonModel->getByUid(getAuthUID()))[0]; - - $viewData = array( - 'uid' => getAuthUID(), - 'name' => $personData->vorname, - 'person_id' => $personData->person_id, - 'timezone' => $this->config->item('timezone'), - ); - - $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'FhcDashboard']); + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'FhcDashboard']); } } diff --git a/application/controllers/api/frontend/v1/Cis4FhcApi.php b/application/controllers/api/frontend/v1/Cis4FhcApi.php index 372e4bfaa..b8698e3e8 100644 --- a/application/controllers/api/frontend/v1/Cis4FhcApi.php +++ b/application/controllers/api/frontend/v1/Cis4FhcApi.php @@ -36,17 +36,22 @@ class Cis4FhcApi extends FHCAPI_Controller // Public methods /** - * fetches ViewData - */ - public function getViewData() + * retrieves view data for dashboard view + * @access public + * @param $uid the userID for which profile is being viewed, null or missing value implies one's own profile + */ + public function dashboardViewData() { $this->load->model('person/Person_model','PersonModel'); $personData = getData($this->PersonModel->getByUid(getAuthUID()))[0]; + $this->load->config('calendar'); + $viewData = array( 'uid' => getAuthUID(), 'name' => $personData->vorname, - 'person_id' => $personData->person_id + 'person_id' => $personData->person_id, + 'timezone' => $this->config->item('timezone'), ); $this->terminateWithSuccess($viewData); diff --git a/application/controllers/api/frontend/v1/LvPlan.php b/application/controllers/api/frontend/v1/LvPlan.php index 99dc8bf59..606874ffe 100644 --- a/application/controllers/api/frontend/v1/LvPlan.php +++ b/application/controllers/api/frontend/v1/LvPlan.php @@ -33,6 +33,7 @@ class LvPlan extends FHCAPI_Controller { parent::__construct([ + 'myLvPlanViewData' => self::PERM_LOGGED, 'getRoomplan' => self::PERM_LOGGED, 'Stunden' => self::PERM_LOGGED, 'getReservierungen' => self::PERM_LOGGED, diff --git a/application/controllers/api/frontend/v1/OtherLvPlan.php b/application/controllers/api/frontend/v1/OtherLvPlan.php index a144fb549..cad654f12 100644 --- a/application/controllers/api/frontend/v1/OtherLvPlan.php +++ b/application/controllers/api/frontend/v1/OtherLvPlan.php @@ -28,12 +28,9 @@ class OtherLvPlan extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'getBasicUserAttributesForLvPlanDisplay' => self::PERM_LOGGED, + 'otherLvPlanViewData' => ['basis/other_lv_plan:r'], ]); - $this->load->library('PermissionLib'); - $this->load->library('form_validation'); - $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); $this->load->model('person/Benutzer_model', 'BenutzerModel'); @@ -43,12 +40,11 @@ class OtherLvPlan extends FHCAPI_Controller // Public methods /** - * retrieves basic user attributes necessary for LV Plan display + * retrieves viewData for other lv plan view * @access public - * @param $uid the userID for which basic attributes are retrieved - * @return stdClass consisting of basic user attributes + * @param $uid the userID for which the other lv plan is being viewed */ - public function getBasicUserAttributesForLvPlanDisplay($uid) + public function otherLvPlanViewData($uid) { $isMitarbeiterResult = $this->MitarbeiterModel->isMitarbeiter($uid); $isMitarbeiter = getData($isMitarbeiterResult); @@ -59,16 +55,18 @@ class OtherLvPlan extends FHCAPI_Controller $personResult = $this->BenutzerModel->load([$uid]); $person = hasData($personResult) ? getData($personResult) : null; - $result = [ - "username" => $uid, - "is_student" => $isStudent, - "is_mitarbeiter" => $isMitarbeiter, - "foto" => $person[0]->foto, - "vorname" => $person[0]->vorname, - "nachname" => $person[0]->nachname, + $viewData = [ + "user_data" => [ + "username" => $uid, + "is_student" => $isStudent, + "is_mitarbeiter" => $isMitarbeiter, + "foto" => $person[0]->foto, + "vorname" => $person[0]->vorname, + "nachname" => $person[0]->nachname, + ], ]; - $this->terminateWithSuccess($result); + $this->terminateWithSuccess($viewData); } // ----------------------------------------------------------------------------------------------------------------- diff --git a/application/controllers/api/frontend/v1/Profil.php b/application/controllers/api/frontend/v1/Profil.php index 3133b107a..96cdea855 100644 --- a/application/controllers/api/frontend/v1/Profil.php +++ b/application/controllers/api/frontend/v1/Profil.php @@ -16,7 +16,8 @@ * along with this program. If not, see . */ -if (! defined('BASEPATH')) exit('No direct script access allowed'); +if (!defined('BASEPATH')) + exit('No direct script access allowed'); class Profil extends FHCAPI_Controller { @@ -27,13 +28,13 @@ class Profil extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'fotoSperre' => self::PERM_LOGGED, + 'fotoSperre' => self::PERM_LOGGED, 'getGemeinden' => self::PERM_LOGGED, 'getAllNationen' => self::PERM_LOGGED, 'isMitarbeiter' => self::PERM_LOGGED, 'profilViewData' => self::PERM_LOGGED, ]); - + $this->load->library('PermissionLib'); $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); @@ -48,28 +49,37 @@ class Profil extends FHCAPI_Controller //------------------------------------------------------------------------------------------------------------------ // Public methods - public function profilViewData($uid=null){ + + /** + * retrieves view data for profile view + * @access public + * @param $uid the userID for which profile is being viewed, null or missing value implies one's own profile + */ + public function profilViewData($uid = null) + { + $authUid = getAuthUID(); + $isProfilOfAuthUser = !$uid || $uid === $authUid; + $this->load->library('ProfilLib'); - $editable = false; - if(isset($uid) && $uid != null){ - $profil_data = $this->profillib->getView($uid); - if($uid == getAuthUID()){ - $editable = true; - } - }else{ - $editable = true; - $profil_data = $this->profillib->getView(getAuthUID()); + $profileData = $this->profillib->getView($uid ?? $authUid); + $profileData = hasData($profileData) ? getData($profileData) : null; + + $viewData = [ + 'editable' => $isProfilOfAuthUser, + 'profil_data' => $profileData, + 'permissions' => [ + 'basis/other_lv_plan' => $this->permissionlib->isBerechtigt(('basis/other_lv_plan')) + ] + ]; + + if ($isProfilOfAuthUser) { + $viewData['calendar_sync_urls'] = $this->getCalendarSyncUrlData(); } - - $profil_data = hasData($profil_data) ? getData($profil_data) : null; - $viewData = array( - 'editable'=>$editable, - 'profil_data' => $profil_data, - ); + $this->terminateWithSuccess($viewData); } - /** + /** * update column foto_sperre in public.tbl_person * @access public * @param boolean $value new value for the column @@ -77,9 +87,9 @@ class Profil extends FHCAPI_Controller */ public function fotoSperre($value) { - if(!isset($value)){ - $this->terminateWithError("Missing parameter", self::ERROR_TYPE_GENERAL); - } + if (!isset($value)) { + $this->terminateWithError("Missing parameter", self::ERROR_TYPE_GENERAL); + } $res = $this->PersonModel->update($this->pid, ["foto_sperre" => $value]); if (isError($res)) { @@ -87,10 +97,10 @@ class Profil extends FHCAPI_Controller } $this->PersonModel->addSelect("foto_sperre"); $res = $this->PersonModel->load($this->pid); - - $res = $this->getDataOrTerminateWithError($res); - - $this->terminateWithSuccess(current($res)); + + $res = $this->getDataOrTerminateWithError($res); + + $this->terminateWithSuccess(current($res)); } /** @@ -109,7 +119,7 @@ class Profil extends FHCAPI_Controller if (isError($nation_res)) { $this->terminateWithError("error while trying to query table codex.tbl_nation", self::ERROR_TYPE_GENERAL); } - + $nation_res = $this->getDataOrTerminateWithError($nation_res); $this->terminateWithSuccess($nation_res); @@ -117,30 +127,30 @@ class Profil extends FHCAPI_Controller public function getGemeinden($nation, $zip) { - if(!isset($nation) || !isset($zip)){ + if (!isset($nation) || !isset($zip)) { echo json_encode(error("Missing parameters")); return; } - + $this->load->model('codex/Gemeinde_model', "GemeindeModel"); - + $gemeinde_res = $this->GemeindeModel->getGemeindeByPlz($zip); - + if (isError($gemeinde_res)) { - $this->terminateWithError(getError($gemeinde_res),self::ERROR_TYPE_GENERAL); + $this->terminateWithError(getError($gemeinde_res), self::ERROR_TYPE_GENERAL); } $gemeinde_res = $this->getDataOrTerminateWithError($gemeinde_res); - + /* $gemeinde_res = array_map(function ($obj) { return $obj->ortschaftsname; }, $gemeinde_res); */ - $this->terminateWithSuccess($gemeinde_res); - + $this->terminateWithSuccess($gemeinde_res); + } - + /** * checks whether a specific userID is a mitarbeiter or not (foreword declaration of the function isMitarbeiter in Mitarbeiter_model.php) * @access public @@ -150,23 +160,48 @@ class Profil extends FHCAPI_Controller public function isMitarbeiter($uid) { - if(!$uid) $this->terminateWithError("No uid provided", self::ERROR_TYPE_GENERAL); - - + if (!$uid) + $this->terminateWithError("No uid provided", self::ERROR_TYPE_GENERAL); + + $result = $this->MitarbeiterModel->isMitarbeiter($uid); - + if (isError($result)) { $this->terminateWithError("error when calling Mitarbeiter_model function isMitarbeiter with uid " . $uid, self::ERROR_TYPE_GENERAL); } $result = $this->getDataOrTerminateWithError($result); - + $this->terminateWithSuccess($result); } // ----------------------------------------------------------------------------------------------------------------- // Private methods - + /** + * gets the identifier, phrase, and url for each calendar sync option + * @access private + * @return array array of arrays, where each child array is a sync option + */ + private function getCalendarSyncUrlData() + { + return [ + [ + "identifier" => "cal_dav", + "labelPhrase" => "profil/calendar_sync_cal_dav", + "url" => APP_ROOT . "webdav/lvplan.php/calendars/" . $this->uid . "/LVPlan-" . $this->uid, + ], + [ + "identifier" => "cal_dav_principal", + "labelPhrase" => "profil/calendar_sync_cal_dav_principal", + "url" => APP_ROOT . "webdav/lvplan.php/principals/" . $this->uid, + ], + [ + "identifier" => "i_cal", + "labelPhrase" => "profil/calendar_sync_i_cal", + "url" => APP_ROOT . "webdav/google.php?cal=" . encryptData($this->uid, LVPLAN_CYPHER_KEY) . "&" . microtime(true), + ], + ]; + } } diff --git a/application/controllers/api/frontend/v1/StgOrgLvPlan.php b/application/controllers/api/frontend/v1/StgOrgLvPlan.php new file mode 100644 index 000000000..ffbf85e57 --- /dev/null +++ b/application/controllers/api/frontend/v1/StgOrgLvPlan.php @@ -0,0 +1,64 @@ +. + */ + +if (!defined('BASEPATH')) + exit('No direct script access allowed'); + +class StgOrgLvPlan extends FHCAPI_Controller +{ + + /** + * Object initialization + */ + public function __construct() + { + parent::__construct([ + 'stgOrgLvPlanViewData' => self::PERM_LOGGED, + ]); + + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * fetches view data for stg org lv plan + * @access public + */ + public function stgOrgLvPlanViewData() + { + $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); + $this->StudiengangModel->addOrder('typ'); + $this->StudiengangModel->addOrder('kurzbz'); + $result = $this->StudiengangModel->loadWhere([ + 'aktiv' => true + ]); + $studiengaenge = $this->getDataOrTerminateWithError($result); + + $viewData = array( + 'studiengaenge' => $studiengaenge, + ); + + $this->terminateWithSuccess($viewData); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + +} + diff --git a/application/views/CisRouterView/CisRouterView.php b/application/views/CisRouterView/CisRouterView.php index 6ff428362..12e748a6c 100644 --- a/application/views/CisRouterView/CisRouterView.php +++ b/application/views/CisRouterView/CisRouterView.php @@ -47,8 +47,6 @@ $includesArray = array( $this->load->view('templates/CISVUE-Header', $includesArray); ?>
> - +
load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/public/js/api/factory/lvPlan.js b/public/js/api/factory/lvPlan.js index 41aa29299..e6285ec9a 100644 --- a/public/js/api/factory/lvPlan.js +++ b/public/js/api/factory/lvPlan.js @@ -16,6 +16,12 @@ */ export default { + getMyLvPlanViewData() { + return { + method: 'get', + url: `/api/frontend/v1/LvPlan/myLvPlanViewData`, + }; + }, getRoomInfo(ort_kurzbz, start_date, end_date) { return { method: 'post', diff --git a/public/js/api/factory/otherLvPlan.js b/public/js/api/factory/otherLvPlan.js index 698531ea3..21a115496 100644 --- a/public/js/api/factory/otherLvPlan.js +++ b/public/js/api/factory/otherLvPlan.js @@ -16,10 +16,10 @@ */ export default { - getBasicUserAttributesForLvPlanDisplay(uid) { + getOtherLvPlanViewData(uid) { return { method: 'get', - url: `/api/frontend/v1/OtherLvPlan/getBasicUserAttributesForLvPlanDisplay/${uid}`, + url: `/api/frontend/v1/OtherLvPlan/otherLvPlanViewData/${uid}`, }; }, }; \ No newline at end of file diff --git a/public/js/api/factory/profil.js b/public/js/api/factory/profil.js index 1d884c714..6959b4345 100644 --- a/public/js/api/factory/profil.js +++ b/public/js/api/factory/profil.js @@ -17,7 +17,7 @@ export default { - profilViewData(uid) { + getProfilViewData(uid = null) { let url = "/api/frontend/v1/Profil/profilViewData"; if(uid){ url += `/${uid}`; diff --git a/public/js/api/factory/stgOrgLvPlan.js b/public/js/api/factory/stgOrgLvPlan.js new file mode 100644 index 000000000..bac753f6b --- /dev/null +++ b/public/js/api/factory/stgOrgLvPlan.js @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2025 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 . + */ + +export default { + getStgOrgLvPlanViewData(uid) { + return { + method: 'get', + url: `/api/frontend/v1/StgOrgLvPlan/stgOrgLvPlanViewData`, + }; + }, +}; \ No newline at end of file diff --git a/public/js/apps/Dashboard/Fhc.js b/public/js/apps/Dashboard/Fhc.js index b2b7752df..551a259b4 100644 --- a/public/js/apps/Dashboard/Fhc.js +++ b/public/js/apps/Dashboard/Fhc.js @@ -4,7 +4,7 @@ import Theme from '../../plugins/Theme.js'; import contrast from '../../directives/contrast.js'; import {setScrollbarWidth} from "../../helpers/CssVarCalcHelpers.js"; import LvPlan from "../../components/Cis/LvPlan/Lehrveranstaltung.js"; -import MyLvPlan from "../../components/Cis/LvPlan/Personal.js"; +import MyLvPlan from "../../components/Cis/LvPlan/MyLvPlan.js"; import MylvStudent from "../../components/Cis/Mylv/Student.js"; import Profil from "../../components/Cis/Profil/Profil.js"; import Raumsuche from "../../components/Cis/Raumsuche/Raumsuche.js"; diff --git a/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js b/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js index bb5c6a710..0d6ec1ab0 100644 --- a/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js +++ b/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js @@ -42,14 +42,6 @@ export const AbgabetoolAssistenz = { stg_kz_prop: { default: null }, - viewData: { - type: Object, - required: true, - default: () => ({name: '', uid: ''}), - validator(value) { - return value && value.uid // && value.name -> extensive viewData use only for cis4 onwards - } - } }, data() { return { diff --git a/public/js/components/Cis/Abgabetool/AbgabetoolMitarbeiter.js b/public/js/components/Cis/Abgabetool/AbgabetoolMitarbeiter.js index 6791d31aa..0acb46bb6 100644 --- a/public/js/components/Cis/Abgabetool/AbgabetoolMitarbeiter.js +++ b/public/js/components/Cis/Abgabetool/AbgabetoolMitarbeiter.js @@ -31,16 +31,6 @@ export const AbgabetoolMitarbeiter = { old_abgabe_beurteilung_link: Vue.computed(() => this.old_abgabe_beurteilung_link) } }, - props: { - viewData: { - type: Object, - required: true, - default: () => ({name: '', uid: ''}), - validator(value) { - return value && value.uid // && value.name -> extensive viewData use only for cis4 onwards - } - } - }, data() { return { tableData: null, diff --git a/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js b/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js index e8401d309..24b2f7619 100644 --- a/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js +++ b/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js @@ -3,6 +3,7 @@ import ApiAbgabe from '../../../api/factory/abgabe.js' import BsModal from "../../Bootstrap/Modal.js"; import FhcOverlay from "../../Overlay/FhcOverlay.js"; import { getDateStyleClass} from "./getDateStyleClass.js"; +import ApiAuthinfo from "../../../api/factory/authinfo.js"; export const AbgabetoolStudent = { name: "AbgabetoolStudent", @@ -24,14 +25,6 @@ export const AbgabetoolStudent = { student_uid_prop: { default: null }, - viewData: { - type: Object, - required: true, - default: () => ({uid: ''}), - validator(value) { - return value && value.uid - } - } }, data() { return { @@ -44,9 +37,18 @@ export const AbgabetoolStudent = { detail: null, projektarbeiten: null, selectedProjektarbeit: null, - moodle_link: null + moodle_link: null, + uid: null, }; }, + computed: { + isViewMode() { + return this.student_uid !== this.uid + }, + student_uid() { + return this.student_uid_prop || this.uid || null + } + }, methods: { checkQualityGatesStrict(termine) { let qgate1Passed = false @@ -258,18 +260,11 @@ export const AbgabetoolStudent = { }, handleDownloadBeurteilung2(projektarbeit) { window.open(projektarbeit.beurteilung2) - } - }, - watch: { - - }, - computed: { - isViewMode() { - return this.student_uid !== this.viewData.uid }, - student_uid() { - return this.student_uid_prop || this.viewData?.uid || null - } + async fetchAuthUID() { + const authIdResponse = await this.$api.call(ApiAuthinfo.getAuthUID()); + this.uid = authIdResponse.data.uid; + }, }, async created() { this.phrasenPromise = this.$p.loadCategory(['abgabetool', 'global']) @@ -302,6 +297,8 @@ export const AbgabetoolStudent = { }).catch(e => { this.loading = false }) + + await this.fetchAuthUID(); }, mounted() { this.setupMounted() diff --git a/public/js/components/Cis/Abgabetool/DeadlineOverview.js b/public/js/components/Cis/Abgabetool/DeadlineOverview.js index 6d0ddd02d..5f6d1e159 100644 --- a/public/js/components/Cis/Abgabetool/DeadlineOverview.js +++ b/public/js/components/Cis/Abgabetool/DeadlineOverview.js @@ -10,14 +10,6 @@ export const DeadlineOverview = { person_uid_prop: { default: null }, - viewData: { - type: Object, - required: true, - default: () => ({name: '', uid: ''}), - validator(value) { - return value && value.name && value.uid - } - } }, data() { return { diff --git a/public/js/components/Cis/LvPlan/LvPlan.js b/public/js/components/Cis/LvPlan/LvPlan.js index f7763c54b..bbc12a47f 100644 --- a/public/js/components/Cis/LvPlan/LvPlan.js +++ b/public/js/components/Cis/LvPlan/LvPlan.js @@ -11,22 +11,21 @@ export default { FhcCalendar }, props: { - viewData: Object, // NOTE(chris): this is inherited from router-view propsViewData: Object }, data() { - const now = luxon.DateTime.now().setZone(this.viewData.timezone); return { studiensemester_kurzbz: null, studiensemester_start: null, studiensemester_ende: null, uid: null, - lv: null + lv: null, + timezone: FHC_JS_DATA_STORAGE_OBJECT.timezone, }; }, computed:{ currentDay() { - return this.propsViewData?.focus_date || luxon.DateTime.now().setZone(this.viewData.timezone).toISODate(); + return this.propsViewData?.focus_date || luxon.DateTime.now().setZone(this.timezone).toISODate(); }, currentMode() { return this.propsViewData?.mode || DEFAULT_MODE_LVPLAN; @@ -35,7 +34,7 @@ export default { if (!this.studiensemester_start || !this.studiensemester_ende || !this.uid) return false; - const opts = { zone: this.viewData.timezone }; + const opts = { zone: this.timezone }; const start = luxon.DateTime .fromISO(this.studiensemester_start, opts) .toUnixInteger(); @@ -115,7 +114,7 @@ export default { { - this.uid = res.data.uid; - this.isMitarbeiter = res.data.isMitarbeiter; - this.isStudent = res.data.isStudent; - }); + async created() { + await this.fetchAuthInfo(); }, template: /*html*/`
@@ -123,8 +125,9 @@ export default {
{ - this.studiensemester_kurzbz = res.data.studiensemester_kurzbz; - this.studiensemester_start = res.data.start; - this.studiensemester_ende = res.data.ende; - }); - }, - getPromiseFunc(start, end) { - return [ - this.$api.call( - ApiLvPlan.eventsPersonal( - start.toISODate(), - end.toISODate(), - this.propsViewData.otherUid, - ), - ), - this.$api.call( - ApiLvPlan.getLvPlanReservierungen( - start.toISODate(), - end.toISODate(), - this.propsViewData.otherUid, - ), - ), - ]; - }, - }, - async created() { - const authInfoResponse = await this.$api.call(ApiAuthinfo.getAuthInfo()); - const authId = authInfoResponse.data.uid; - if (authId === this.propsViewData.otherUid) { - this.$router.push({ name: "MyLvPlan" }); - } + this.$router.push({ + name: "OtherLvPlan", + params: { + mode, + focus_date, + }, + }); + }, + updateRange(rangeInterval) { + this.$api + .call( + ApiLvPlan.studiensemesterDateInterval( + rangeInterval.end.startOf("week").toISODate(), + ), + ) + .then((res) => { + this.studiensemester_kurzbz = + res.data.studiensemester_kurzbz; + this.studiensemester_start = res.data.start; + this.studiensemester_ende = res.data.ende; + }); + }, + getPromiseFunc(start, end) { + return [ + this.$api.call( + ApiLvPlan.eventsPersonal( + start.toISODate(), + end.toISODate(), + this.propsViewData.otherUid, + ), + ), + this.$api.call( + ApiLvPlan.getLvPlanReservierungen( + start.toISODate(), + end.toISODate(), + this.propsViewData.otherUid, + ), + ), + ]; + }, + async fetchViewData() { + const viewDataResponse = await this.$api.call( + ApiOtherLvPlan.getOtherLvPlanViewData( + this.propsViewData.otherUid, + ), + ); - const userDataResponse = await this.$api.call( - ApiOtherLvPlan.getBasicUserAttributesForLvPlanDisplay( - this.propsViewData.otherUid, - ), - ); + const viewData = viewDataResponse.data; - const userData = userDataResponse.data; - this.isOtherPersonMitarbeiter = !!userData.is_mitarbeiter; - this.isOtherPersonStudent = !!userData.is_student; - this.otherPersonData.fullName = userData.vorname + " " + userData.nachname; - this.otherPersonData.photo = userData.foto; - }, - template: ` + this.isOtherPersonMitarbeiter = + !!viewData?.user_data?.is_mitarbeiter; + this.isOtherPersonStudent = !!viewData?.user_data?.is_student; + this.otherPersonData.fullName = + viewData?.user_data?.vorname + + " " + + viewData?.user_data?.nachname; + this.otherPersonData.photo = viewData?.user_data?.foto; + }, + async redirectToMyLvPlanIfAuthUid() { + const authInfoResponse = await this.$api.call( + ApiAuthinfo.getAuthInfo(), + ); + const authId = authInfoResponse.data.uid; + if (authId === this.propsViewData.otherUid) { + this.$router.push({ name: "MyLvPlan" }); + } + }, + }, + async created() { + await this.redirectToMyLvPlanIfAuthUid(); + await this.fetchViewData(); + }, + template: `

@@ -215,8 +228,9 @@ export default {


i + 1); @@ -208,24 +209,26 @@ export default { this.$api.call(ApiLvPlan.eventsStgOrg(start, end, this.formData.stgkz, this.formData.sem, this.formData.verband, this.formData.gruppe)) ]; }, + async fetchAuthInfo() { + const authInfoResponse = await this.$api.call(ApiAuthinfo.getAuthInfo()); + + const authInfo = authInfoResponse.data; + this.uid = authInfo.uid; + this.isMitarbeiter = authInfo.isMitarbeiter; + this.isStudent = authInfo.isStudent; + }, + async fetchViewData() { + const viewDataResponse = await this.$api.call(ApiStgOrgLvPlan.getStgOrgLvPlanViewData()); + + const viewData = viewDataResponse.data; + this.listStg = viewData.studiengaenge; + }, }, - created(){ - this.$api - .call(ApiAuthinfo.getAuthInfo()) - .then(res => { - this.uid = res.data.uid; - this.isMitarbeiter = res.data.isMitarbeiter; - this.isStudent = res.data.isStudent; - }); + async created(){ + await this.fetchAuthInfo(); + await this.fetchViewData(); - this.$api - .call(ApiLvPlan.getStudiengaenge()) - .then(result => { - this. listStg = result.data; - }) - .catch(this.$fhcAlert.handleSystemError); - - if(this.propsViewData) { + if (this.propsViewData) { this.formData.stgkz = this.propsViewData.stgkz ? this.propsViewData.stgkz: null; this.formData.sem = this.propsViewData.sem ? this.propsViewData.sem: null; this.formData.verband = this.propsViewData.verband ? this.propsViewData.verband: null; @@ -298,37 +301,39 @@ export default {
- - `, diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js index 44e0ca6eb..fd3c1b072 100644 --- a/public/js/components/Cis/Profil/MitarbeiterProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js @@ -105,7 +105,6 @@ export default { }, ], }, - quickLinks: [], betriebsmittel_table_options: { persistenceID: "filterTableMaProfilBetriebsmittel", persistence: { @@ -299,6 +298,11 @@ export default { } }; }, + quickLinks() { + let quickLinks = []; + // + return quickLinks; + }, }, created() { diff --git a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js index 42a2700f3..459ad6d29 100644 --- a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js @@ -1,11 +1,11 @@ -import {CoreFilterCmpt} from "../../../components/filter/Filter.js"; +import { CoreFilterCmpt } from "../../../components/filter/Filter.js"; import Mailverteiler from "./ProfilComponents/Mailverteiler.js"; import RoleInformation from "./ProfilComponents/RoleInformation.js"; import ProfilEmails from "./ProfilComponents/ProfilEmails.js"; import ProfilInformation from "./ProfilComponents/ProfilInformation.js"; import QuickLinks from "./ProfilComponents/QuickLinks.js"; -import { dateFilter } from '../../../tabulator/filters/Dates.js'; +import { dateFilter } from "../../../tabulator/filters/Dates.js"; export default { components: { @@ -20,11 +20,11 @@ export default { data() { return { collapseIconFunktionen: true, - preloadedPhrasen:{}, + preloadedPhrasen: {}, funktionen_table_options: { persistenceID: "filterTableMaViewProfilFunktionen", persistence: { - columns: false + columns: false, }, minHeight: 300, layout: "fitColumns", @@ -35,62 +35,68 @@ export default { //? option when wanting to hide the collapsed list { - title: - "", + title: "", field: "collapse", headerSort: false, headerFilter: false, formatter: "responsiveCollapse", maxWidth: 40, headerClick: this.collapseFunction, - visible: true + visible: true, }, { - title: Vue.computed(() => this.$p.t('ui/bezeichnung')), + title: Vue.computed(() => this.$p.t("ui/bezeichnung")), field: "Bezeichnung", headerFilter: true, minWidth: 200, - visible: true + visible: true, }, { - title: Vue.computed(() => this.$p.t('lehre/organisationseinheit')), + title: Vue.computed(() => + this.$p.t("lehre/organisationseinheit"), + ), field: "Organisationseinheit", headerFilter: true, minWidth: 200, - visible: true + visible: true, }, { - title: Vue.computed(() => this.$p.t('global/gueltigVon')), + title: Vue.computed(() => + this.$p.t("global/gueltigVon"), + ), field: "Gültig_von", - headerFilterFunc: 'dates', + headerFilterFunc: "dates", headerFilter: dateFilter, resizable: true, minWidth: 200, visible: true, - formatter:"datetime", - formatterParams: this.datetimeFormatterParams() + formatter: "datetime", + formatterParams: this.datetimeFormatterParams(), }, { - title: Vue.computed(() => this.$p.t('global/gueltigBis')), + title: Vue.computed(() => + this.$p.t("global/gueltigBis"), + ), field: "Gültig_bis", - headerFilterFunc: 'dates', + headerFilterFunc: "dates", headerFilter: dateFilter, resizable: true, minWidth: 200, visible: true, - formatter:"datetime", - formatterParams: this.datetimeFormatterParams() + formatter: "datetime", + formatterParams: this.datetimeFormatterParams(), }, { - title: Vue.computed(() => this.$p.t('profil/wochenstunden')), + title: Vue.computed(() => + this.$p.t("profil/wochenstunden"), + ), field: "Wochenstunden", headerFilter: true, minWidth: 200, - visible: true + visible: true, }, ], }, - quickLinks: [], }; }, @@ -100,42 +106,51 @@ export default { funktionenTableBuilt: function () { this.$refs.funktionenTable.tabulator.setData(this.data.funktionen); }, - datetimeFormatterParams: function() { + datetimeFormatterParams: function () { const params = { - inputFormat:"yyyy-MM-dd", - outputFormat:"dd.MM.yyyy", - invalidPlaceholder:"(invalid date)", - timezone:FHC_JS_DATA_STORAGE_OBJECT.timezone + inputFormat: "yyyy-MM-dd", + outputFormat: "dd.MM.yyyy", + invalidPlaceholder: "(invalid date)", + timezone: FHC_JS_DATA_STORAGE_OBJECT.timezone, }; return params; - } + }, }, watch: { - 'data.funktionen'(newVal) { - if(this.$refs.funktionenTable) this.$refs.funktionenTable.tabulator.setData(newVal); + "data.funktionen"(newVal) { + if (this.$refs.funktionenTable) + this.$refs.funktionenTable.tabulator.setData(newVal); + }, + "language.value"(newVal) { + // reevaluates computed phrasen + if (this.$refs.funktionenTable) + this.$refs.funktionenTable.tabulator.setColumns( + this.funktionen_table_options.columns, + ); }, - 'language.value'(newVal) { // reevaluates computed phrasen - if(this.$refs.funktionenTable) this.$refs.funktionenTable.tabulator.setColumns(this.funktionen_table_options.columns) - } }, computed: { getTelefonValue() { - if(this.data.standort_telefon?.kontakt) { - return this.data.standort_telefon.kontakt + " " + this.data.telefonklappe - } else if(this.data.standort_telefon) { - return this.data.standort_telefon + " " + this.data.telefonklappe + if (this.data.standort_telefon?.kontakt) { + return ( + this.data.standort_telefon.kontakt + + " " + + this.data.telefonklappe + ); + } else if (this.data.standort_telefon) { + return ( + this.data.standort_telefon + " " + this.data.telefonklappe + ); } else { - return this.data.telefonklappe + return this.data.telefonklappe; } }, fotoStatus() { return this.data?.fotoStatus ?? null; }, - personEmails() { return this.data?.emails ? this.data.emails : []; }, - profilInformation() { if (!this.data) { return {}; @@ -152,59 +167,69 @@ export default { foto: this.data.foto, }; }, - roleInformation() { if (!this.data) { return {}; } return { geburtsdatum: { - label: `${this.$p.t('profil','Geburtsdatum')}`, - value: this.data.gebdatum + label: `${this.$p.t("profil", "Geburtsdatum")}`, + value: this.data.gebdatum, }, geburtsort: { - label: `${this.$p.t('profil','Geburtsort')}`, - value: this.data.gebort + label: `${this.$p.t("profil", "Geburtsort")}`, + value: this.data.gebort, }, personenkennzeichen: { - label: `${this.$p.t('profil','Kurzzeichen')}`, - value: this.data.kurzbz + label: `${this.$p.t("profil", "Kurzzeichen")}`, + value: this.data.kurzbz, }, telefon: { - label: `${this.$p.t('profil','Telefon')}`, - value: this.getTelefonValue + label: `${this.$p.t("profil", "Telefon")}`, + value: this.getTelefonValue, }, office: { - label: `${this.$p.t('profil','Büro')}`, - value: this.data.ort_kurzbz - } + label: `${this.$p.t("profil", "Büro")}`, + value: this.data.ort_kurzbz, + }, }; }, - }, - created(){ - this.$p.loadCategory(["ui", "lehre", "global", "profil"]).then(() => { - this.preloadedPhrasen.bezeichnungPhrase = this.$p.t('ui/bezeichnung'); - this.preloadedPhrasen.organisationseinheitPhrase = this.$p.t('lehre/organisationseinheit'); - this.preloadedPhrasen.gueltigVonPhrase = this.$p.t('global/gueltigVon'); - this.preloadedPhrasen.gueltigBisPhrase = this.$p.t('global/gueltigBis'); - this.preloadedPhrasen.wochenstundenPhrase = this.$p.t('profil/wochenstunden'); - this.preloadedPhrasen.loaded = true; - }); - - if (this.$props.permissions["basis/other_lv_plan"]) { - this.quickLinks.push( - { + quickLinks() { + let quickLinks = []; + if ( + this.$props.permissions && + this.$props.permissions["basis/other_lv_plan"] + ) { + quickLinks.push({ icon: "fa-calendar-days", phrase: "lehre/stundenplan", action: () => { this.$router.push({ - name: "OtherLvPlan", - params: { otherUid: this.$props.data.username }, - }) + name: "OtherLvPlan", + params: { otherUid: this.$props.data.username }, + }); }, - } + }); + } + return quickLinks; + }, + }, + created() { + this.$p.loadCategory(["ui", "lehre", "global", "profil"]).then(() => { + this.preloadedPhrasen.bezeichnungPhrase = + this.$p.t("ui/bezeichnung"); + this.preloadedPhrasen.organisationseinheitPhrase = this.$p.t( + "lehre/organisationseinheit", ); - } + this.preloadedPhrasen.gueltigVonPhrase = + this.$p.t("global/gueltigVon"); + this.preloadedPhrasen.gueltigBisPhrase = + this.$p.t("global/gueltigBis"); + this.preloadedPhrasen.wochenstundenPhrase = this.$p.t( + "profil/wochenstunden", + ); + this.preloadedPhrasen.loaded = true; + }); }, template: /*html*/ ` diff --git a/public/js/components/Cis/Profil/Profil.js b/public/js/components/Cis/Profil/Profil.js index b5f3fd552..c965652a1 100644 --- a/public/js/components/Cis/Profil/Profil.js +++ b/public/js/components/Cis/Profil/Profil.js @@ -48,9 +48,6 @@ export const Profil = { type: String, required: false, }, - viewData: { - type: Object, - }, }, data() { return { @@ -62,7 +59,9 @@ export const Profil = { data: null, // notfound is null by default, but contains an UID if no user exists with that UID notFoundUID: null, - isEditable: this.viewData.editable ?? false, + isEditable: false, + authPermissions: null, + calendarSyncUrls: [], }; }, provide() { @@ -143,6 +142,8 @@ export const Profil = { }, methods: { async load() { + await this.fetchViewData(); + // fetch profilUpdateStates to provide them to children components await this.$api .call(ApiProfilUpdate.getStatus()) @@ -161,18 +162,20 @@ export const Profil = { .catch((error) => { console.error(error); }); + }, + async fetchViewData() { + let viewDataResult = await this.$api.call( + ApiProfil.getProfilViewData(this.$route.params.uid ?? null), + ); - this.$api - .call(ApiProfil.profilViewData(this.$route.params.uid ?? null)) - .then((response) => response.data) - .then((data) => { - this.view = data?.profil_data.view; - this.data = data?.profil_data.data; - this.isEditable = data?.editable ?? false; - }) - .catch((error) => { - console.error(error); - }); + const data = viewDataResult.data; + if (!data) return; + + this.view = data.profil_data.view; + this.isEditable = data.profil_data.editable; + this.data = data.profil_data.data; + this.calendarSyncUrls = data.calendar_sync_urls ?? []; + this.authPermissions = data.permissions; }, zustellAdressenCount() { if (!this.data || !this.data.adressen) { @@ -408,8 +411,8 @@ export const Profil = { :is="view" :data="data" :editData="filteredEditData" - :permissions="$props.viewData.permissions" - :calendarSyncUrls="$props.viewData.calendarSyncUrls"> + :permissions="authPermissions" + :calendarSyncUrls="calendarSyncUrls">
`, }; diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js index e3e90d3bf..57f933305 100644 --- a/public/js/components/Cis/Profil/StudentProfil.js +++ b/public/js/components/Cis/Profil/StudentProfil.js @@ -97,7 +97,6 @@ export default { }, ], }, - quickLinks: [], }; }, @@ -244,6 +243,11 @@ export default { } }; }, + quickLinks() { + let quickLinks = []; + // + return quickLinks; + }, }, created() { // preload phrasen diff --git a/public/js/components/Cis/Profil/StudentViewProfil.js b/public/js/components/Cis/Profil/StudentViewProfil.js index 3bc4dabd7..0f7a196f4 100644 --- a/public/js/components/Cis/Profil/StudentViewProfil.js +++ b/public/js/components/Cis/Profil/StudentViewProfil.js @@ -14,14 +14,14 @@ export default { }, props: ["data", "permissions"], data() { - return { - quickLinks: [], - }; + return {}; }, provide() { return { - studiengang_kz: Vue.computed({ get: () => this.data.studiengang_kz }), - } + studiengang_kz: Vue.computed({ + get: () => this.data.studiengang_kz, + }), + }; }, computed: { fotoStatus() { @@ -43,65 +43,61 @@ export default { foto: this.data.foto, }; }, - personEmails() { return this.data?.emails ? this.data.emails : []; }, - roleInformation() { if (!this.data) { return {}; } - return { geburtsdatum: { - label: `${this.$p.t('profil','Geburtsdatum')}`, - value: this.data.gebdatum + label: `${this.$p.t("profil", "Geburtsdatum")}`, + value: this.data.gebdatum, }, geburtsort: { - label: `${this.$p.t('profil','Geburtsort')}`, - value: this.data.gebort + label: `${this.$p.t("profil", "Geburtsort")}`, + value: this.data.gebort, }, personenkennzeichen: { - label: `${this.$p.t('person','personenkennzeichen')}`, - value: this.data.personenkennzeichen + label: `${this.$p.t("person", "personenkennzeichen")}`, + value: this.data.personenkennzeichen, }, studiengang: { - label: `${this.$p.t('lehre','studiengang')}`, - value: this.data.studiengang + label: `${this.$p.t("lehre", "studiengang")}`, + value: this.data.studiengang, }, semester: { - label: `${this.$p.t('lehre','semester')}`, - value: this.data.semester + label: `${this.$p.t("lehre", "semester")}`, + value: this.data.semester, }, verband: { - label: `${this.$p.t('lehre','lehrverband')}`, - value: this.data.verband + label: `${this.$p.t("lehre", "lehrverband")}`, + value: this.data.verband, }, gruppe: { - label: `${this.$p.t('lehre','gruppe')}`, - value: this.data.gruppe.trim() - } + label: `${this.$p.t("lehre", "gruppe")}`, + value: this.data.gruppe.trim(), + }, }; }, - }, - methods: {}, - created() { - if (this.$props.permissions["basis/other_lv_plan"]) { - this.quickLinks.push( - { + quickLinks() { + let quickLinks = []; + if (this.$props.permissions && this.$props.permissions["basis/other_lv_plan"]) { + quickLinks.push({ icon: "fa-calendar-days", phrase: "lehre/stundenplan", action: () => { this.$router.push({ - name: "OtherLvPlan", - params: { otherUid: this.$props.data.username }, - }) + name: "OtherLvPlan", + params: { otherUid: this.$props.data.username }, + }); }, - } - ); - } + }); + } + return quickLinks; + }, }, template: /*html*/ ` diff --git a/public/js/components/Cis/Raumsuche/Raumsuche.js b/public/js/components/Cis/Raumsuche/Raumsuche.js index 365da4911..5cdc164c0 100644 --- a/public/js/components/Cis/Raumsuche/Raumsuche.js +++ b/public/js/components/Cis/Raumsuche/Raumsuche.js @@ -3,9 +3,6 @@ import VueDatePicker from '../../vueDatepicker.js.php'; import ApiOrt from '../../../api/factory/ort.js' export const Raumsuche = { name: "Raumsuche", - props: { - - }, components: { VueDatePicker, CoreFilterCmpt, diff --git a/public/js/components/Dashboard/Dashboard.js b/public/js/components/Dashboard/Dashboard.js index e92e34f29..526bc45c7 100644 --- a/public/js/components/Dashboard/Dashboard.js +++ b/public/js/components/Dashboard/Dashboard.js @@ -2,6 +2,7 @@ import DashboardSection from "./Section.js"; import DashboardWidgetPicker from "./Widget/Picker.js"; import ObjectUtils from "../../helpers/ObjectUtils.js"; +import ApiDashboard from '../../api/factory/cis/dashboard.js'; import ApiDashboardWidget from '../../api/factory/dashboard/widget.js'; import ApiDashboardUser from '../../api/factory/dashboard/user.js'; @@ -17,27 +18,22 @@ export default { required: true, default: 'CIS' }, - viewData: { - type: Object, - required: true, - validator(value) { - return value && value.name && value.timezone - } - } }, data() { return { widgets: [], originalWidgets: {}, widgetsSetup: null, - editMode: false + editMode: false, + timezone: null, + userFirstName: null, } }, provide() { return { editMode: Vue.computed(()=>this.editMode), widgetsSetup: Vue.computed(() => this.widgetsSetup), - timezone: Vue.computed(() => this.viewData.timezone) + timezone: this.timezone } }, methods: { @@ -120,11 +116,19 @@ export default { this.widgets = this.widgets.filter(widget => widget.id != id); }) .catch(this.$fhcAlert.handleSystemError); + }, + async fetchViewData() { + let viewDataResult = await this.$api.call(ApiDashboard.getViewData()); + const viewData = viewDataResult.data; + this.timezone = viewData?.timezone; + this.userFirstName = viewData?.name; } }, created() { this.$p.loadCategory('dashboard'); + this.fetchViewData(); + this.$api .call(ApiDashboardWidget.listAllowed(this.dashboard)) .then(res => { @@ -158,7 +162,7 @@ export default { template: `

- {{ $p.t('global/personalGreeting', [ viewData?.name ]) }} + {{ userFirstName ? $p.t('global/personalGreeting', [ userFirstName ]) : '' }}

From d577ac6d542f2dce00059d6683fa1a756af91e3c Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Thu, 16 Apr 2026 15:54:12 +0200 Subject: [PATCH 2/4] naming cleanup --- application/controllers/api/frontend/v1/Cis4FhcApi.php | 2 +- application/controllers/api/frontend/v1/LvPlan.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/Cis4FhcApi.php b/application/controllers/api/frontend/v1/Cis4FhcApi.php index b8698e3e8..4d0f906f0 100644 --- a/application/controllers/api/frontend/v1/Cis4FhcApi.php +++ b/application/controllers/api/frontend/v1/Cis4FhcApi.php @@ -27,7 +27,7 @@ class Cis4FhcApi extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'getViewData' => self::PERM_LOGGED, + 'dashboardViewData' => self::PERM_LOGGED, ]); } diff --git a/application/controllers/api/frontend/v1/LvPlan.php b/application/controllers/api/frontend/v1/LvPlan.php index 606874ffe..99dc8bf59 100644 --- a/application/controllers/api/frontend/v1/LvPlan.php +++ b/application/controllers/api/frontend/v1/LvPlan.php @@ -33,7 +33,6 @@ class LvPlan extends FHCAPI_Controller { parent::__construct([ - 'myLvPlanViewData' => self::PERM_LOGGED, 'getRoomplan' => self::PERM_LOGGED, 'Stunden' => self::PERM_LOGGED, 'getReservierungen' => self::PERM_LOGGED, From 917a9ee7078d853aa9bcdf6928a5b2b6335773cc Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Thu, 16 Apr 2026 15:55:43 +0200 Subject: [PATCH 3/4] minor fix --- public/js/api/factory/cis/dashboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/api/factory/cis/dashboard.js b/public/js/api/factory/cis/dashboard.js index cb1ec16bb..694340b97 100644 --- a/public/js/api/factory/cis/dashboard.js +++ b/public/js/api/factory/cis/dashboard.js @@ -19,7 +19,7 @@ export default { getViewData() { return { method: 'get', - url: '/api/frontend/v1/Cis4FhcApi/getViewData' + url: '/api/frontend/v1/Cis4FhcApi/dashboardViewData' }; } }; \ No newline at end of file From 8f73489073db4d99c4c2e31b31d55cce91403753 Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Fri, 17 Apr 2026 14:51:20 +0200 Subject: [PATCH 4/4] code cleanup --- public/js/components/Dashboard/Dashboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/components/Dashboard/Dashboard.js b/public/js/components/Dashboard/Dashboard.js index 526bc45c7..d9684ea74 100644 --- a/public/js/components/Dashboard/Dashboard.js +++ b/public/js/components/Dashboard/Dashboard.js @@ -124,10 +124,10 @@ export default { this.userFirstName = viewData?.name; } }, - created() { + async created() { this.$p.loadCategory('dashboard'); - this.fetchViewData(); + await this.fetchViewData(); this.$api .call(ApiDashboardWidget.listAllowed(this.dashboard))