19declare(strict_types=1);
47 private \ilGlobalTemplateInterface
$tpl;
57 $this->
ctrl = $DIC[
'ilCtrl'];
58 $this->
lng = $DIC[
'lng'];
59 $this->current_user =
$DIC[
'ilUser'];
60 $this->setting =
$DIC[
'ilSetting'];
61 $this->
tabs = $DIC[
'ilTabs'];
62 $this->tpl =
$DIC[
'tpl'];
63 $this->rbac_system =
$DIC[
'rbacsystem'];
64 $this->
lng = $DIC[
'lng'];
78 $this->
setUserId($this->profile_request->getUserId());
81 $this->
ctrl->saveParameter($this, [
'user_id',
'back_url',
'user']);
82 $back_url = $this->profile_request->getBackUrl();
83 if ($back_url !==
'') {
87 $this->
lng->loadLanguageModule(
'user');
92 $this->userid = $a_userid;
105 $this->additional = $a_additional;
120 $host =
$parts[
'host'] ??
'';
125 $this->
ctrl->setParameter($this,
'back_url', rawurlencode(
$backurl));
138 $this->custom_prefs = $a_prefs;
146 if (!$this->custom_prefs) {
147 return (
string) $a_user->
getPref($a_id);
149 return (
string) ($this->custom_prefs[$a_id] ??
'');
153 public function setEmbedded(
bool $a_value,
bool $a_offline =
false): void
155 $this->embedded = $a_value;
156 $this->offline = $a_offline;
165 $next_class = $this->
ctrl->getNextClass($this);
166 $cmd = $this->
ctrl->getCmd();
168 $this->tpl->loadStandardTemplate();
170 switch ($next_class) {
171 case strtolower(\ilBuddySystemGUI::class):
172 $gui = new \ilBuddySystemGUI();
173 $this->
ctrl->setReturn($this,
'view');
174 $this->
ctrl->forwardCommand($gui);
176 case strtolower(\ilObjPortfolioGUI::class):
179 && $cmd !==
'deliverVCard') {
180 $gui = new \ilObjPortfolioGUI($portfolio_id);
182 $gui->setPermaLink($this->
getUserId(),
'usr');
183 $this->
ctrl->forwardCommand($gui);
188 $ret = $this->$cmd();
189 $this->tpl->setContent($ret);
194 if (strtolower($this->profile_request->getBaseClass()) === strtolower(self::class)) {
195 $this->tpl->printToStdout();
197 return (
string) $ret;
210 $user = new \ilObjUser($this->
getUserId());
211 $current = $user->getPref(
'public_profile');
212 if ($user->getPref(
'public_profile') ===
'g' && !$this->setting->get(
'enable_global_profiles')) {
215 return in_array($current, [
'g',
'y']);
220 if ($this->embedded) {
226 $user = new \ilObjUser($this->
getUserId());
227 if (!$user->getActive() ||
228 !$user->checkTimeLimit()) {
233 $this->
ctrl->redirectByClass(
'ilobjportfoliogui',
'preview');
240 $profile_public = $user->getPref(
'public_profile');
241 if ($user->getPref(
'public_profile') ===
'g' && !$this->setting->get(
'enable_global_profiles')) {
242 $profile_public =
'y';
245 if ($profile_public !==
'y'
246 && ($profile_public !==
'g' || !$this->setting->get(
'enable_global_profiles'))
247 && !$this->custom_prefs) {
268 $user = new \ilObjUser($this->
getUserId());
270 $tpl = new \ilTemplate(
271 'tpl.usr_public_profile.html',
274 'components/ILIAS/User'
282 $ref_url = str_replace(
'&',
'&', $this->
getBackUrl());
283 if ($ref_url ===
'') {
284 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
295 'rcp_to' => $user->getLogin()
298 } elseif ($user->getPref(
'public_profile') ===
'g'
299 || !$this->current_user->isAnonymous()
300 && $user->getPref(
'public_profile') ===
'y'
301 && $user->getPref(
'public_email')
302 && $user->getEmail() !==
'') {
303 $mail_url =
'mailto:' . $user->getEmail();
306 if ($mail_url !==
'') {
309 $tpl->setVariable(
'HREF_MAIL', $mail_url);
315 $tpl->setVariable(
'TXT_NAME', $this->
lng->txt(
'name'));
322 $first_name .= $user->getUTitle() .
' ';
324 $first_name .= $user->getFirstname();
326 if ($this->
getPublicPref($user,
'public_gender') ===
'y' && in_array($user->getGender(), [
'm',
'f'])) {
329 "{$this->lng->txt("salutation_{$user->getGender()}
")} "
334 $tpl->setVariable(
'FIRSTNAME', $first_name);
337 if ($user->getBirthday()
338 && $this->getPublicPref($user,
'public_birthday') ==
'y') {
345 if (!$this->offline) {
348 $tpl->setVariable(
'TXT_DOWNLOAD_VCARD', $this->
lng->txt(
'vcard_download'));
349 $this->
ctrl->setParameter($this,
'user_id', $this->
getUserId());
350 $tpl->setVariable(
'HREF_VCARD', $this->
ctrl->getLinkTarget($this,
'deliverVCard'));
354 if ($this->
getPublicPref($user,
'public_upload') ===
'y' && $imagefile !==
''
355 && ($this->current_user->getId() !==
ANONYMOUS_USER_ID || $user->getPref(
'public_profile') ===
'g')) {
359 $tpl->setVariable(
'IMAGE_PATH', $imagefile);
361 $tpl->parseCurrentBlock();
371 'getStreet' =>
'street',
372 'getZipcode' =>
'zipcode',
374 'getCountry' =>
'country',
375 'getSelectedCountry' =>
'sel_country'
377 foreach ($val_arr as $key => $value) {
379 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
380 $address_value = $user->$key();
383 if (trim($address_value) !=
'') {
386 $address[0] = $address_value;
391 $address[1] = isset($address[1])
392 ?
"{$address[1]} {$address_value}"
397 $this->
lng->loadLanguageModule(
'meta');
398 $address[2] = $this->
lng->txt(
'meta_c_' . $address_value);
402 $address[2] = $address_value;
408 if ($address !== []) {
410 foreach ($address as $line) {
418 $tpl->parseCurrentBlock();
423 if ($this->
getPublicPref($user,
'public_org_units') ===
'y') {
426 $tpl->setVariable(
'ORG_UNITS', $user->getOrgUnitsRepresentation());
430 if ($this->
getPublicPref($user,
'public_institution') ===
'y'
431 || $this->
getPublicPref($user,
'public_department') ===
'y') {
434 if ($this->
getPublicPref($user,
'public_institution') ===
'y') {
435 $h = $this->
lng->txt(
'institution');
436 $v = $user->getInstitution();
439 if ($this->
getPublicPref($user,
'public_department') ===
'y') {
440 $h .= $sep . $this->
lng->txt(
'department');
441 $v .= $sep . $user->getDepartment();
450 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
451 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
'getSecondEmail' =>
'second_email'
454 foreach ($val_arr as $key => $value) {
456 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
457 $v .= $sep . $this->
lng->txt($value) .
': ' . $user->$key();
464 $tpl->setVariable(
'CONTACT', $v);
470 'getHobby' =>
'hobby',
471 'getGeneralInterestsAsText' =>
'interests_general',
472 'getOfferingHelpAsText' =>
'interests_help_offered',
473 'getLookingForHelpAsText' =>
'interests_help_looking',
474 'getMatriculation' =>
'matriculation',
475 'getClientIP' =>
'client_ip'
478 foreach ($val_arr as $key => $value) {
480 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
498 foreach ($port as $u) {
500 foreach ($u as $link => $title) {
509 $this->
lng->loadLanguageModule(
'prtf');
510 $tpl->setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'prtf_portfolios'));
512 $tpl->setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'portfolio'));
514 $tpl->parseCurrentBlock();
520 && $user->getLatitude() !=
'') {
524 $map_gui->setMapId(
'user_map_' . md5($user->login))
527 ->setLatitude($user->getLatitude())
528 ->setLongitude($user->getLongitude())
529 ->setZoom($user->getLocationZoom())
530 ->setEnableNavigationControl(
true)
531 ->addUserMarker($user->getId());
536 foreach ($this->
profile->getVisibleUserDefinedFields(Context::User) as $field) {
538 if ($this->
getPublicPref($user,
'public_udf_' . $field->getIdentifier()) ===
'y'
539 && !empty(($value = $field->retrieveValueFromUser($user)))) {
554 if ($this->
getUserId() !== $this->current_user->getId()
555 && !$this->current_user->isAnonymous()
562 $tpl->
setVariable(
'USER_BADGES', $this->badges_renderer->render($user->getId()));
587 $user = new \ilObjUser($this->
getUserId());
589 $vcard =
new VCard();
592 if ($user->getPref(
'public_profile') !=
'y' &&
593 $user->getPref(
'public_profile') !=
'g' &&
594 strtolower($this->profile_request->getBaseClass()) !=
'ilsharedresourcegui' &&
595 $this->current_user->getId() != $this->getUserId()
600 $vcard->setName($user->getLastname(), $user->getFirstname(),
'', $user->getUTitle());
601 $vcard->setNickname($user->getLogin());
603 list($image, $type) = (new \ilUserAvatarResolver($this->
getUserId()))->getUserPictureForVCard();
604 if ($image !==
null) {
605 $vcard->setPhoto($image, $type);
609 'getOrgUnitsRepresentation' =>
'org_units',
'getInstitution' =>
'institution',
610 'getDepartment' =>
'department',
'getStreet' =>
'street',
611 'getZipcode' =>
'zipcode',
'getCity' =>
'city',
'getCountry' =>
'country',
612 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
613 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
614 'getHobby' =>
'hobby',
'getMatriculation' =>
'matriculation',
615 'getClientIP' =>
'client_ip',
'dummy' =>
'location'
620 foreach ($val_arr as $key => $value) {
622 if ($user->getPref(
'public_' . $value) ==
'y') {
625 $org[0] = $user->$key();
628 $org[1] = $user->$key();
631 $adr[2] = $user->$key();
634 $adr[5] = $user->$key();
637 $adr[3] = $user->$key();
640 $adr[6] = $user->$key();
655 $vcard->setEmail($user->$key());
658 $vcard->setNote($user->$key());
661 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
668 $vcard->setOrganization(implode(
';', $org));
694 $user = new \ilObjUser($usrId);
696 if ($this->current_user->isAnonymous()) {
697 if (strtolower($this->
ctrl->getCmd()) == strtolower(
'approveContactRequest')) {
698 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
699 } elseif (strtolower($this->
ctrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
700 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
703 if ($user->getPref(
'public_profile') !=
'g') {
705 if ($user->getPref(
'public_profile') ==
'y') {
706 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId);
718 $this->tpl->resetHeaderBlock();
730 $access_handler = new \ilPortfolioAccessHandler();
731 if ($access_handler->checkAccess(
'read',
'', $portfolio_id)) {
732 return $portfolio_id;
740 $field_id = $this->profile_request->getFieldId();
741 $term = $this->profile_request->getTerm();
746 'interests_help_offered',
747 'interests_help_looking'
749 if (in_array($field_id, $multi_fields) && $term) {
752 if ($this->current_user->getId() !== 0 && $this->current_user->getId() !==
ANONYMOUS_USER_ID) {
753 $user_id = $this->current_user->getId();
761 $result[$cnt] =
new stdClass();
762 $result[$cnt]->value = $item;
763 $result[$cnt]->label = $item;
768 echo json_encode($result, JSON_THROW_ON_ERROR);
774 $osd_id = $this->profile_request->getOsdId();
776 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
778 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
779 $this->
ctrl->redirectByClass([self::class,
'ilBuddySystemGUI'],
'link');
784 $osd_id = $this->profile_request->getOsdId();
786 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
789 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
790 $this->
ctrl->redirectByClass([self::class,
'ilBuddySystemGUI'],
'ignore');
GUI class for public user profile presentation.
getProfilePortfolio()
Check if current profile portfolio is accessible.
setCustomPrefs(array $a_prefs)
Set custom preferences for public profile fields.
GUIRequest $profile_request
PublicUserProfileBadgesRenderer $badges_renderer
deliverVCard()
Deliver vcard information.
setBackUrl(string $backurl)
Set Back Link URL.
setAdditional(array $a_additional)
Set Additonal Information.
getEmbeddable(bool $a_add_goto=false)
get public profile html code Used in Personal Profile (as preview) and Portfolio (as page block)
validateUser(int $usrId)
Check if given user id is valid.
ilRbacSystem $rbac_system
ilGlobalTemplateInterface $tpl
setEmbedded(bool $a_value, bool $a_offline=false)
getPublicPref(\ilObjUser $a_user, string $a_id)
Get user preference for public profile.
RFC 2426 vCard MIME Directory Profile 3.0 class.
__construct()
Constructor setup ILIAS global object @access public.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static getMailObjectRefId()
static isActivated()
Checks whether Map feature is activated.
static getMapGUI()
Get an instance of the GUI class.
static getDefaultPortfolio(int $a_user_id)
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
static _isAnonymous(int $usr_id)
getPref(string $a_keyword)
static findInterests(string $a_term, ?int $a_user_id=null, ?string $a_field_id=null)
static _getPersonalPicturePath(int $a_usr_id, string $a_size='small', bool $a_force_pic=false)
static _lookupType(int $id, bool $reference=false)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
static redirect(string $a_script)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...