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'
376 foreach ($val_arr as $key => $value) {
378 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
379 $address_value = $user->$key();
382 if (trim($address_value) !=
'') {
385 $address[0] = $address_value;
390 $address[1] = isset($address[1])
391 ?
"{$address[1]} {$address_value}"
396 $this->
lng->loadLanguageModule(
'meta');
397 $address[2] = $this->
lng->txt(
'meta_c_' . $address_value);
401 $address[2] = $address_value;
407 if ($address !== []) {
409 foreach ($address as $line) {
417 $tpl->parseCurrentBlock();
422 if ($this->
getPublicPref($user,
'public_org_units') ===
'y') {
425 $tpl->setVariable(
'ORG_UNITS', $user->getOrgUnitsRepresentation());
429 if ($this->
getPublicPref($user,
'public_institution') ===
'y'
430 || $this->
getPublicPref($user,
'public_department') ===
'y') {
433 if ($this->
getPublicPref($user,
'public_institution') ===
'y') {
434 $h = $this->
lng->txt(
'institution');
435 $v = $user->getInstitution();
438 if ($this->
getPublicPref($user,
'public_department') ===
'y') {
439 $h .= $sep . $this->
lng->txt(
'department');
440 $v .= $sep . $user->getDepartment();
449 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
450 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
'getSecondEmail' =>
'second_email'
453 foreach ($val_arr as $key => $value) {
455 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
456 $v .= $sep . $this->
lng->txt($value) .
': ' . $user->$key();
463 $tpl->setVariable(
'CONTACT', $v);
469 'getHobby' =>
'hobby',
470 'getGeneralInterestsAsText' =>
'interests_general',
471 'getOfferingHelpAsText' =>
'interests_help_offered',
472 'getLookingForHelpAsText' =>
'interests_help_looking',
473 'getMatriculation' =>
'matriculation',
474 'getClientIP' =>
'client_ip'
477 foreach ($val_arr as $key => $value) {
479 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
493 foreach ($port as $u) {
495 foreach ($u as $link => $title) {
504 $this->
lng->loadLanguageModule(
'prtf');
505 $tpl->setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'prtf_portfolios'));
507 $tpl->setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'portfolio'));
509 $tpl->parseCurrentBlock();
515 && $user->getLatitude() !=
'') {
519 $map_gui->setMapId(
'user_map_' . md5($user->getLogin()))
522 ->setLatitude($user->getLatitude())
523 ->setLongitude($user->getLongitude())
524 ->setZoom($user->getLocationZoom())
525 ->setEnableNavigationControl(
true)
526 ->addUserMarker($user->getId());
531 foreach ($this->
profile->getVisibleUserDefinedFields(Context::User) as $field) {
532 $value = $field->retrieveValueFromUser($user);
533 if ($value ===
'' || $value ===
'-' || $value ===
null) {
549 if ($this->
getUserId() !== $this->current_user->getId()
550 && !$this->current_user->isAnonymous()
557 $tpl->
setVariable(
'USER_BADGES', $this->badges_renderer->render($user->getId()));
582 $user = new \ilObjUser($this->
getUserId());
584 $vcard =
new VCard();
587 if ($user->getPref(
'public_profile') !=
'y' &&
588 $user->getPref(
'public_profile') !=
'g' &&
589 strtolower($this->profile_request->getBaseClass()) !=
'ilsharedresourcegui' &&
590 $this->current_user->getId() != $this->getUserId()
595 $vcard->setName($user->getLastname(), $user->getFirstname(),
'', $user->getUTitle());
596 $vcard->setNickname($user->getLogin());
598 list($image, $type) = (new \ilUserAvatarResolver($this->
getUserId()))->getUserPictureForVCard();
599 if ($image !==
null) {
600 $vcard->setPhoto($image, $type);
604 'getOrgUnitsRepresentation' =>
'org_units',
'getInstitution' =>
'institution',
605 'getDepartment' =>
'department',
'getStreet' =>
'street',
606 'getZipcode' =>
'zipcode',
'getCity' =>
'city',
'getCountry' =>
'country',
607 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
608 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
609 'getHobby' =>
'hobby',
'getMatriculation' =>
'matriculation',
610 'getClientIP' =>
'client_ip',
'dummy' =>
'location'
615 foreach ($val_arr as $key => $value) {
617 if ($user->getPref(
'public_' . $value) ==
'y') {
620 $org[0] = $user->$key();
623 $org[1] = $user->$key();
626 $adr[2] = $user->$key();
629 $adr[5] = $user->$key();
632 $adr[3] = $user->$key();
635 $adr[6] = $user->$key();
650 $vcard->setEmail($user->$key());
653 $vcard->setNote($user->$key());
656 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
663 $vcard->setOrganization(implode(
';', $org));
689 $user = new \ilObjUser($usr_id);
691 if ($this->current_user->isAnonymous()) {
692 if (strtolower($this->
ctrl->getCmd()) == strtolower(
'approveContactRequest')) {
693 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usr_id .
'_contact_approved');
694 } elseif (strtolower($this->
ctrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
695 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usr_id .
'_contact_ignored');
698 if ($user->getPref(
'public_profile') !=
'g') {
700 if ($user->getPref(
'public_profile') ==
'y') {
701 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usr_id);
713 $this->tpl->resetHeaderBlock();
725 $access_handler = new \ilPortfolioAccessHandler();
726 if ($access_handler->checkAccess(
'read',
'', $portfolio_id)) {
727 return $portfolio_id;
735 $field_id = $this->profile_request->getFieldId();
736 $term = $this->profile_request->getTerm();
741 'interests_help_offered',
742 'interests_help_looking'
744 if (in_array($field_id, $multi_fields) && $term) {
747 if ($this->current_user->getId() !== 0 && $this->current_user->getId() !==
ANONYMOUS_USER_ID) {
748 $user_id = $this->current_user->getId();
756 $result[$cnt] =
new stdClass();
757 $result[$cnt]->value = $item;
758 $result[$cnt]->label = $item;
763 echo json_encode($result, JSON_THROW_ON_ERROR);
769 $osd_id = $this->profile_request->getOsdId();
771 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
773 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
774 $this->
ctrl->redirectByClass([self::class,
'ilBuddySystemGUI'],
'link');
779 $osd_id = $this->profile_request->getOsdId();
781 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
784 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
785 $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...