From be4db980adcbcdf5dd307b95f36a33e7b860e9ed Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Wed, 29 Jul 2026 11:17:03 +0200 Subject: [PATCH 1/3] fixed issue with displayed locked profile images in other lv plan --- .../api/frontend/v1/OtherLvPlan.php | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/application/controllers/api/frontend/v1/OtherLvPlan.php b/application/controllers/api/frontend/v1/OtherLvPlan.php index cad654f12..d3eceae67 100644 --- a/application/controllers/api/frontend/v1/OtherLvPlan.php +++ b/application/controllers/api/frontend/v1/OtherLvPlan.php @@ -17,60 +17,62 @@ */ if (!defined('BASEPATH')) - exit('No direct script access allowed'); + exit('No direct script access allowed'); class OtherLvPlan extends FHCAPI_Controller { - /** - * Object initialization - */ - public function __construct() - { - parent::__construct([ - 'otherLvPlanViewData' => ['basis/other_lv_plan:r'], - ]); + /** + * Object initialization + */ + public function __construct() + { + parent::__construct([ + 'otherLvPlanViewData' => ['basis/other_lv_plan:r'], + ]); - $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); - $this->load->model('person/Benutzer_model', 'BenutzerModel'); + $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); + $this->load->model('person/Benutzer_model', 'BenutzerModel'); - } + } - //------------------------------------------------------------------------------------------------------------------ - // Public methods + //------------------------------------------------------------------------------------------------------------------ + // Public methods - /** - * retrieves viewData for other lv plan view - * @access public - * @param $uid the userID for which the other lv plan is being viewed - */ - public function otherLvPlanViewData($uid) - { - $isMitarbeiterResult = $this->MitarbeiterModel->isMitarbeiter($uid); - $isMitarbeiter = getData($isMitarbeiterResult); - $isStudent = !$isMitarbeiter; + /** + * retrieves viewData for other lv plan view + * @access public + * @param $uid the userID for which the other lv plan is being viewed + */ + public function otherLvPlanViewData($uid) + { + $isMitarbeiterResult = $this->MitarbeiterModel->isMitarbeiter($uid); + $isMitarbeiter = getData($isMitarbeiterResult); + $isStudent = !$isMitarbeiter; - $this->BenutzerModel->addSelect(["foto", "vorname", "nachname"]); - $this->BenutzerModel->addJoin("tbl_person", "person_id"); - $personResult = $this->BenutzerModel->load([$uid]); - $person = hasData($personResult) ? getData($personResult) : null; + $this->BenutzerModel->addSelect(["foto", "foto_sperre", "vorname", "nachname"]); + $this->BenutzerModel->addJoin("tbl_person", "person_id"); + $personResult = $this->BenutzerModel->load([$uid]); + $person = hasData($personResult) ? getData($personResult) : null; - $viewData = [ - "user_data" => [ - "username" => $uid, - "is_student" => $isStudent, - "is_mitarbeiter" => $isMitarbeiter, - "foto" => $person[0]->foto, - "vorname" => $person[0]->vorname, - "nachname" => $person[0]->nachname, - ], - ]; + $photo = $person[0]->foto_sperre ? base64_encode(file_get_contents(DOC_ROOT . 'skin/images/profilbild_dummy.jpg')) : $person[0]->foto; - $this->terminateWithSuccess($viewData); - } + $viewData = [ + "user_data" => [ + "username" => $uid, + "is_student" => $isStudent, + "is_mitarbeiter" => $isMitarbeiter, + "foto" => $photo, + "vorname" => $person[0]->vorname, + "nachname" => $person[0]->nachname, + ], + ]; - // ----------------------------------------------------------------------------------------------------------------- - // Private methods + $this->terminateWithSuccess($viewData); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods } From d1ca6eb988977f240b8eb3e179d5816ca7452c0d Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Wed, 29 Jul 2026 11:28:13 +0200 Subject: [PATCH 2/3] reworked other lv plan view data controller using profil library --- .../controllers/api/frontend/v1/OtherLvPlan.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/application/controllers/api/frontend/v1/OtherLvPlan.php b/application/controllers/api/frontend/v1/OtherLvPlan.php index d3eceae67..a48113270 100644 --- a/application/controllers/api/frontend/v1/OtherLvPlan.php +++ b/application/controllers/api/frontend/v1/OtherLvPlan.php @@ -33,6 +33,7 @@ class OtherLvPlan extends FHCAPI_Controller $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); $this->load->model('person/Benutzer_model', 'BenutzerModel'); + $this->load->library('ProfilLib'); } @@ -50,21 +51,17 @@ class OtherLvPlan extends FHCAPI_Controller $isMitarbeiter = getData($isMitarbeiterResult); $isStudent = !$isMitarbeiter; - $this->BenutzerModel->addSelect(["foto", "foto_sperre", "vorname", "nachname"]); - $this->BenutzerModel->addJoin("tbl_person", "person_id"); - $personResult = $this->BenutzerModel->load([$uid]); - $person = hasData($personResult) ? getData($personResult) : null; - - $photo = $person[0]->foto_sperre ? base64_encode(file_get_contents(DOC_ROOT . 'skin/images/profilbild_dummy.jpg')) : $person[0]->foto; + $profileData = $this->profillib->getView($uid); + $profileData = hasData($profileData) ? getData($profileData) : null; $viewData = [ "user_data" => [ "username" => $uid, "is_student" => $isStudent, "is_mitarbeiter" => $isMitarbeiter, - "foto" => $photo, - "vorname" => $person[0]->vorname, - "nachname" => $person[0]->nachname, + "foto" => $profileData->data->foto, + "vorname" => $profileData->data->vorname, + "nachname" => $profileData->data->nachname, ], ]; From 2686aee1583ed4eeae474ddcccdb75c0a50b6bdd Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 3 Aug 2026 19:30:49 +0200 Subject: [PATCH 3/3] avoid multiple assignments to one variable --- application/controllers/api/frontend/v1/OtherLvPlan.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/OtherLvPlan.php b/application/controllers/api/frontend/v1/OtherLvPlan.php index a48113270..af075fbc3 100644 --- a/application/controllers/api/frontend/v1/OtherLvPlan.php +++ b/application/controllers/api/frontend/v1/OtherLvPlan.php @@ -51,8 +51,8 @@ class OtherLvPlan extends FHCAPI_Controller $isMitarbeiter = getData($isMitarbeiterResult); $isStudent = !$isMitarbeiter; - $profileData = $this->profillib->getView($uid); - $profileData = hasData($profileData) ? getData($profileData) : null; + $resProfileData = $this->profillib->getView($uid); + $profileData = hasData($resProfileData) ? getData($resProfileData) : null; $viewData = [ "user_data" => [