. */ if (!defined('BASEPATH')) exit('No direct script access allowed'); class OtherLvPlan extends FHCAPI_Controller { /** * Object initialization */ public function __construct() { parent::__construct([ 'getBasicUserAttributesForLvPlanDisplay' => self::PERM_LOGGED, ]); $this->load->library('PermissionLib'); $this->load->library('form_validation'); $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); $this->load->model('person/Benutzer_model', 'BenutzerModel'); } //------------------------------------------------------------------------------------------------------------------ // Public methods /** * retrieves basic user attributes necessary for LV Plan display * @access public * @param $uid the userID for which basic attributes are retrieved * @return stdClass consisting of basic user attributes */ public function getBasicUserAttributesForLvPlanDisplay($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; $result = [ "username" => $uid, "is_student" => $isStudent, "is_mitarbeiter" => $isMitarbeiter, "foto" => $person[0]->foto, "vorname" => $person[0]->vorname, "nachname" => $person[0]->nachname, ]; $this->terminateWithSuccess($result); } // ----------------------------------------------------------------------------------------------------------------- // Private methods }