/** * Render content */ public function render() { CssLoader::getInstance()->load('profile', 'all'); load_kernel_config('user_profile'); $userData = user_get_properties($this->userId); $pictureUrl = ''; if (get_conf('allow_profile_picture')) { $picturePath = user_get_picture_path($userData); if ($picturePath && file_exists($picturePath)) { $pictureUrl = user_get_picture_url($userData); } else { $pictureUrl = get_icon_url('nopicture'); } } $userFullName = claro_htmlspecialchars(get_lang('%firstName %lastName', array('%firstName' => $userData['firstname'], '%lastName' => $userData['lastname']))); $dock = new ClaroDock('userProfileBox'); $template = new CoreTemplate('user_profilebox.tpl.php'); $template->assign('userId', $this->userId); $template->assign('pictureUrl', $pictureUrl); $template->assign('userFullName', $userFullName); $template->assign('dock', $dock); $template->assign('condensedMode', $this->condensedMode); $template->assign('userData', $userData); return $template->render(); }
/** * Constructor */ public function __construct($creatorFirstName = '', $creatorLastName = '', $creatorEmail = '') { load_kernel_config('CLHOME'); $this->id = null; $this->courseId = ''; $this->isSourceCourse = null; $this->sourceCourseId = null; $this->title = ''; $this->officialCode = ''; $this->titular = $creatorFirstName . ' ' . $creatorLastName; $this->email = $creatorEmail; $this->categories = array(); $this->departmentName = ''; $this->extLinkUrl = ''; $this->language = get_conf('platformLanguage'); # FIXME FIXME FIXME $this->access = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) && get_conf('defaultAccessOnCourseCreation') == 'public' ? 'platform' : get_conf('defaultAccessOnCourseCreation'); $this->visibility = get_conf('defaultVisibilityOnCourseCreation'); $this->registration = get_conf('defaultRegistrationOnCourseCreation') ? 'open' : 'close'; $this->registrationKey = ''; $this->publicationDate = time(); $this->expirationDate = 0; $this->useExpirationDate = false; $this->status = 'enable'; $this->userLimit = 0; $this->backlog = new Backlog(); }
/** * Set the authentication profile options. Contains * $data['courseRegistrationAllowed'] with value true, false or null (let the platform decide) * $data['courseEnrolmentMode'] with value 'open', 'close', 'validation' or null (let the platform decide) * $data['defaultCourseProfile'] profile attributed by default to the user when registering to a new course or null * $data['editableProfileFields'] array of editable fileds in the user profile or null * @return $this */ public function setAuthDriverOptions($data) { if (isset($data['courseEnrolmentMode'])) { $this->courseEnrolmentMode = $data['courseEnrolmentMode']; } else { $this->courseEnrolmentMode = null; } if (isset($data['defaultCourseProfile']) && !is_null($data['defaultCourseProfile'])) { $this->defaultCourseProfile = $data['defaultCourseProfile']; } else { $this->defaultCourseProfile = 'user'; } if (isset($data['editableProfileFields']) && !empty($data['editableProfileFields'])) { $this->editableProfileFields = $data['editableProfileFields']; } else { load_kernel_config('user_profile'); if (empty($data['readonlyProfileFields'])) { $this->editableProfileFields = get_conf('profile_editable'); } else { $baseProfileFeilds = get_conf('profile_editable'); $this->editableProfileFields = array(); foreach ($baseProfileFeilds as $profileField) { if (!in_array($profileField, $data['readonlyProfileFields'])) { $this->editableProfileFields[] = $profileField; } } } } if (isset($data['courseRegistrationAllowed']) && !is_null($data['courseRegistrationAllowed'])) { $this->courseRegistrationAllowed = $data['courseRegistrationAllowed']; } else { $this->courseRegistrationAllowed = get_conf('allowToSelfEnroll', true); } return $this; }