19declare(strict_types=1);
49 private \ilGlobalTemplateInterface
$tpl;
59 $this->
ctrl = $DIC[
'ilCtrl'];
60 $this->
lng = $DIC[
'lng'];
61 $this->current_user =
$DIC[
'ilUser'];
62 $this->setting =
$DIC[
'ilSetting'];
63 $this->
tabs = $DIC[
'ilTabs'];
64 $this->tpl =
$DIC[
'tpl'];
65 $this->rbac_system =
$DIC[
'rbacsystem'];
66 $this->
lng = $DIC[
'lng'];
80 $this->
setUserId($this->profile_request->getUserId());
83 $this->
ctrl->saveParameter($this, [
'user_id',
'back_url',
'user']);
84 $back_url = $this->profile_request->getBackUrl();
85 if ($back_url !==
'') {
89 $this->
lng->loadLanguageModule(
'user');
94 $this->userid = $a_userid;
107 $this->additional = $a_additional;
122 $host =
$parts[
'host'] ??
'';
127 $this->
ctrl->setParameter($this,
'back_url', rawurlencode(
$backurl));
140 $this->custom_prefs = $a_prefs;
148 if (!$this->custom_prefs) {
149 return (
string) $a_user->
getPref($a_id);
151 return (
string) ($this->custom_prefs[$a_id] ??
'');
155 public function setEmbedded(
bool $a_value,
bool $a_offline =
false): void
157 $this->embedded = $a_value;
158 $this->offline = $a_offline;
167 $next_class = $this->
ctrl->getNextClass($this);
168 $cmd = $this->
ctrl->getCmd();
170 $this->tpl->loadStandardTemplate();
172 switch ($next_class) {
173 case strtolower(\ilBuddySystemGUI::class):
174 $gui = new \ilBuddySystemGUI();
175 $this->
ctrl->setReturn($this,
'view');
176 $this->
ctrl->forwardCommand($gui);
178 case strtolower(\ilObjPortfolioGUI::class):
181 && $cmd !==
'deliverVCard') {
182 $gui = new \ilObjPortfolioGUI($portfolio_id);
184 $gui->setPermaLink($this->
getUserId(),
'usr');
185 $this->
ctrl->forwardCommand($gui);
190 $ret = $this->$cmd();
191 $this->tpl->setContent($ret);
195 return (
string) $ret;
208 $user = new \ilObjUser($this->
getUserId());
209 $current = $user->getPref(
'public_profile');
210 if ($user->getPref(
'public_profile') ===
'g' && !$this->setting->get(
'enable_global_profiles')) {
213 return in_array($current, [
'g',
'y']);
218 if ($this->embedded) {
224 $user = new \ilObjUser($this->
getUserId());
225 if (!$user->getActive() ||
226 !$user->checkTimeLimit()) {
231 $this->
ctrl->redirectByClass(
'ilobjportfoliogui',
'preview');
238 $profile_public = $user->getPref(
'public_profile');
239 if ($user->getPref(
'public_profile') ===
'g' && !$this->setting->get(
'enable_global_profiles')) {
240 $profile_public =
'y';
243 if ($profile_public !==
'y'
244 && ($profile_public !==
'g' || !$this->setting->get(
'enable_global_profiles'))
245 && !$this->custom_prefs) {
266 $user = new \ilObjUser($this->
getUserId());
268 $tpl = new \ilTemplate(
269 'tpl.usr_public_profile.html',
272 'components/ILIAS/User'
280 $ref_url = str_replace(
'&',
'&', $this->
getBackUrl());
281 if ($ref_url ===
'') {
282 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
293 'rcp_to' => $user->getLogin()
296 } elseif ($user->getPref(
'public_profile') ===
'g'
297 || !$this->current_user->isAnonymous()
298 && $user->getPref(
'public_profile') ===
'y'
299 && $user->getPref(
'public_email')
300 && $user->getEmail() !==
'') {
301 $mail_url =
'mailto:' . $user->getEmail();
304 if ($mail_url !==
'') {
307 $tpl->setVariable(
'HREF_MAIL', $mail_url);
313 $tpl->setVariable(
'TXT_NAME', $this->
lng->txt(
'name'));
320 $first_name .= $user->getUTitle() .
' ';
322 $first_name .= $user->getFirstname();
324 if ($this->
getPublicPref($user,
'public_gender') ===
'y' && in_array($user->getGender(), [
'm',
'f'])) {
327 "{$this->lng->txt("salutation_{$user->getGender()}
")} "
332 $tpl->setVariable(
'FIRSTNAME', $first_name);
335 if ($user->getBirthday()
336 && $this->getPublicPref($user,
'public_birthday') ==
'y') {
343 if (!$this->offline) {
346 $tpl->setVariable(
'TXT_DOWNLOAD_VCARD', $this->
lng->txt(
'vcard_download'));
347 $this->
ctrl->setParameter($this,
'user_id', $this->
getUserId());
348 $tpl->setVariable(
'HREF_VCARD', $this->
ctrl->getLinkTarget($this,
'deliverVCard'));
352 && ($this->current_user->getId() !==
ANONYMOUS_USER_ID || $user->getPref(
'public_profile') ===
'g')) {
353 $define = new \ilUserAvatarResolver($user->getId());
354 $define->setForcePicture(
false);
355 $define->setSize(
'big');
359 $tpl->setVariable(
'IMAGE_PATH', $define->getLegacyPictureURL());
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') {
494 foreach ($port as $u) {
496 foreach ($u as $link => $title) {
505 $this->
lng->loadLanguageModule(
'prtf');
506 $tpl->setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'prtf_portfolios'));
508 $tpl->setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'portfolio'));
510 $tpl->parseCurrentBlock();
516 && $user->getLatitude() !=
'') {
520 $map_gui->setMapId(
'user_map_' . md5($user->getLogin()))
523 ->setLatitude($user->getLatitude())
524 ->setLongitude($user->getLongitude())
525 ->setZoom($user->getLocationZoom())
526 ->setEnableNavigationControl(
true)
527 ->addUserMarker($user->getId());
532 foreach ($this->
profile->getVisibleUserDefinedFields(Context::User) as $field) {
533 $value = $field->retrieveValueFromUser($user);
534 if ($value ===
'' || $value ===
'-' || $value ===
null) {
550 if ($this->
getUserId() !== $this->current_user->getId()
551 && !$this->current_user->isAnonymous()
558 $tpl->
setVariable(
'USER_BADGES', $this->badges_renderer->render($user->getId()));
583 $user = new \ilObjUser($this->
getUserId());
585 $vcard =
new VCard();
588 if ($user->getPref(
'public_profile') !=
'y' &&
589 $user->getPref(
'public_profile') !=
'g' &&
590 strtolower($this->profile_request->getBaseClass()) !=
'ilsharedresourcegui' &&
591 $this->current_user->getId() != $this->getUserId()
596 $vcard->setName($user->getLastname(), $user->getFirstname(),
'', $user->getUTitle());
597 $vcard->setNickname($user->getLogin());
599 list($image, $type) = (new \ilUserAvatarResolver($this->
getUserId()))->getUserPictureForVCard();
600 if ($image !==
null) {
601 $vcard->setPhoto($image, $type);
605 'getOrgUnitsRepresentation' =>
'org_units',
'getInstitution' =>
'institution',
606 'getDepartment' =>
'department',
'getStreet' =>
'street',
607 'getZipcode' =>
'zipcode',
'getCity' =>
'city',
'getCountry' =>
'country',
608 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
609 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
610 'getHobby' =>
'hobby',
'getMatriculation' =>
'matriculation',
611 'getClientIP' =>
'client_ip',
'dummy' =>
'location'
616 foreach ($val_arr as $key => $value) {
618 if ($user->getPref(
'public_' . $value) ==
'y') {
621 $org[0] = $user->$key();
624 $org[1] = $user->$key();
627 $adr[2] = $user->$key();
630 $adr[5] = $user->$key();
633 $adr[3] = $user->$key();
636 $adr[6] = $user->$key();
651 $vcard->setEmail($user->$key());
654 $vcard->setNote($user->$key());
657 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
664 $vcard->setOrganization(implode(
';', $org));
690 $user = new \ilObjUser($usr_id);
692 if ($this->current_user->isAnonymous()) {
693 if (strtolower($this->
ctrl->getCmd()) == strtolower(
'approveContactRequest')) {
694 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usr_id .
'_contact_approved');
695 } elseif (strtolower($this->
ctrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
696 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usr_id .
'_contact_ignored');
699 if ($user->getPref(
'public_profile') !=
'g') {
701 if ($user->getPref(
'public_profile') ==
'y') {
702 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usr_id);
714 $this->tpl->resetHeaderBlock();
726 $access_handler = new \ilPortfolioAccessHandler();
727 if ($access_handler->checkAccess(
'read',
'', $portfolio_id)) {
728 return $portfolio_id;
736 $field_id = $this->profile_request->getFieldId();
737 $term = $this->profile_request->getTerm();
742 'interests_help_offered',
743 'interests_help_looking'
745 if (in_array($field_id, $multi_fields) && $term) {
748 if ($this->current_user->getId() !== 0 && $this->current_user->getId() !==
ANONYMOUS_USER_ID) {
749 $user_id = $this->current_user->getId();
757 $result[$cnt] =
new stdClass();
758 $result[$cnt]->value = $item;
759 $result[$cnt]->label = $item;
764 echo json_encode($result, JSON_THROW_ON_ERROR);
770 $osd_id = $this->profile_request->getOsdId();
772 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
774 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
775 $this->
ctrl->redirectByClass([self::class,
'ilBuddySystemGUI'],
'link');
780 $osd_id = $this->profile_request->getOsdId();
782 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
785 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
786 $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
validateUser(int $usr_id)
Check if given user id is valid.
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)
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 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)
static _isAnonymous(int $usr_id)
static _getPersonalPicturePath(int $usr_id, string $size='small', bool $force_pic=false)
static findInterests(string $a_term, ?int $a_user_id=null, ?string $a_field_id=null)
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.
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...