19 declare(strict_types=1);
51 $this->
ctrl = $DIC[
'ilCtrl'];
52 $this->
lng = $DIC[
'lng'];
53 $this->current_user = $DIC[
'ilUser'];
54 $this->setting = $DIC[
'ilSetting'];
55 $this->
tabs = $DIC[
'ilTabs'];
56 $this->tpl = $DIC[
'tpl'];
57 $this->rbac_system = $DIC[
'rbacsystem'];
58 $this->
lng = $DIC[
'lng'];
68 $this->
setUserId($this->profile_request->getUserId());
71 $this->
ctrl->saveParameter($this, [
'user_id',
'back_url',
'user']);
72 $back_url = $this->profile_request->getBackUrl();
73 if ($back_url !==
'') {
77 $this->
lng->loadLanguageModule(
'user');
82 $this->userid = $a_userid;
95 $this->additional = $a_additional;
109 $parts = parse_url($backurl);
110 $host =
$parts[
'host'] ??
'';
115 $this->
ctrl->setParameter($this,
'back_url', rawurlencode($backurl));
128 $this->custom_prefs = $a_prefs;
136 if (!$this->custom_prefs) {
137 return (
string) $a_user->
getPref($a_id);
139 return (
string) ($this->custom_prefs[$a_id] ??
'');
143 public function setEmbedded(
bool $a_value,
bool $a_offline =
false): void
145 $this->embedded = $a_value;
146 $this->offline = $a_offline;
155 $next_class = $this->
ctrl->getNextClass($this);
156 $cmd = $this->
ctrl->getCmd();
158 $this->tpl->loadStandardTemplate();
160 switch ($next_class) {
161 case 'ilbuddysystemgui':
163 $this->
ctrl->setReturn($this,
'view');
164 $this->
ctrl->forwardCommand($gui);
166 case 'ilobjportfoliogui':
169 && $cmd !==
'deliverVCard') {
172 $gui->setPermaLink($this->
getUserId(),
'usr');
173 $this->
ctrl->forwardCommand($gui);
178 $ret = $this->$cmd();
179 $this->tpl->setContent($ret);
184 if (strtolower($this->profile_request->getBaseClass()) ==
'ilpublicuserprofilegui') {
185 $this->tpl->printToStdout();
187 return (
string) $ret;
201 $current = $user->getPref(
'public_profile');
203 if ($user->getPref(
'public_profile') ===
'g' && !$this->setting->get(
'enable_global_profiles')) {
206 return in_array($current, [
'g',
'y']);
211 if ($this->embedded) {
218 if (!$user->getActive() ||
219 !$user->checkTimeLimit()) {
224 $this->
ctrl->redirectByClass(
'ilobjportfoliogui',
'preview');
233 $current = $user->getPref(
'public_profile');
234 if ($user->getPref(
'public_profile') ==
'g' && !$this->setting->get(
'enable_global_profiles')) {
238 if ($current !=
'y' &&
239 ($current !=
'g' || !$this->setting->get(
'enable_global_profiles')) &&
240 !$this->custom_prefs) {
266 'tpl.usr_public_profile.html',
277 $ref_url = str_replace(
'&',
'&', $this->
getBackUrl());
279 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
290 'rcp_to' => $user->getLogin()
293 } elseif ($user->getPref(
'public_profile') ===
'g' ||
294 (!$this->current_user->isAnonymous() && $user->getPref(
'public_profile') ===
'y') &&
295 $user->getPref(
'public_email') &&
296 $user->getEmail() !==
'') {
297 $mail_url =
'mailto:' . $user->getEmail();
300 if ($mail_url !==
'') {
318 $first_name .= $user->getUTitle() .
' ';
320 $first_name .= $user->getFirstname();
322 if ($this->
getPublicPref($user,
'public_gender') ==
'y' && in_array($user->getGender(), [
'm',
'f'])) {
323 $sal = $this->
lng->txt(
'salutation_' . $user->getGender()) .
' ';
329 $tpl->
setVariable(
'LASTNAME', $user->getLastname());
331 if ($user->getBirthday() &&
340 if (!$this->offline) {
344 $tpl->
setVariable(
'TXT_DOWNLOAD_VCARD', $this->
lng->txt(
'vcard_download'));
345 $this->
ctrl->setParameter($this,
'user_id', $this->
getUserId());
346 $tpl->
setVariable(
'HREF_VCARD', $this->
ctrl->getLinkTarget($this,
'deliverVCard'));
350 if ($this->
getPublicPref($user,
'public_upload') ===
'y' && $imagefile !==
'' 351 && ($this->current_user->getId() !==
ANONYMOUS_USER_ID || $user->getPref(
'public_profile') ===
'g')) {
356 $tpl->
setVariable(
'IMAGE_ALT', $this->
lng->txt(
'personal_picture'));
367 'getStreet' =>
'street',
368 'getZipcode' =>
'zipcode',
370 'getCountry' =>
'country',
371 'getSelectedCountry' =>
'sel_country' 373 foreach ($val_arr as
$key => $value) {
375 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
376 $address_value = $user->$key();
379 if (trim($address_value) !=
'') {
382 $address[0] = $address_value;
387 $address[1] = isset($address[1])
388 ?
"{$address[1]} {$address_value}" 393 $this->
lng->loadLanguageModule(
'meta');
394 $address[2] = $this->
lng->txt(
'meta_c_' . $address_value);
398 $address[2] = $address_value;
404 if (count($address)) {
406 foreach ($address as $line) {
408 $tpl->
setVariable(
'TXT_ADDRESS_LINE', trim($line));
419 if ($this->
getPublicPref($user,
'public_org_units') ==
'y') {
422 $tpl->
setVariable(
'ORG_UNITS', $user->getOrgUnitsRepresentation());
426 if ($this->
getPublicPref($user,
'public_institution') ==
'y' ||
430 if ($this->
getPublicPref($user,
'public_institution') ==
'y') {
431 $h = $this->
lng->txt(
'institution');
432 $v = $user->getInstitution();
435 if ($this->
getPublicPref($user,
'public_department') ==
'y') {
436 $h .= $sep . $this->
lng->txt(
'department');
437 $v .= $sep . $user->getDepartment();
446 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
447 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
'getSecondEmail' =>
'second_email' 450 foreach ($val_arr as
$key => $value) {
452 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
453 $v .= $sep . $this->
lng->txt($value) .
': ' . $user->$key();
466 'getHobby' =>
'hobby',
467 'getGeneralInterestsAsText' =>
'interests_general',
468 'getOfferingHelpAsText' =>
'interests_help_offered',
469 'getLookingForHelpAsText' =>
'interests_help_looking',
470 'getMatriculation' =>
'matriculation',
471 'getClientIP' =>
'client_ip' 474 foreach ($val_arr as
$key => $value) {
476 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
493 if (count($port) > 0) {
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'));
516 $user->getLatitude() !=
'') {
520 $map_gui->setMapId(
'user_map')
523 ->setLatitude($user->getLatitude())
524 ->setLongitude($user->getLongitude())
525 ->setZoom($user->getLocationZoom())
526 ->setEnableNavigationControl(
true)
527 ->addUserMarker($user->getId());
529 $tpl->
setVariable(
'MAP_CONTENT', $map_gui->getHtml());
534 $user_defined_data = $user->getUserDefinedData();
535 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
537 if ($this->
getPublicPref($user,
'public_udf_' . $definition[
'field_id']) ==
'y') {
538 if ($user_defined_data[
'f_' . $definition[
'field_id']] !=
'') {
540 $tpl->
setVariable(
'TXT_UDF_DATA', $definition[
'field_name']);
541 $tpl->
setVariable(
'UDF_DATA', $user_defined_data[
'f_' . $definition[
'field_id']]);
549 if (is_array($additional)) {
550 foreach ($additional as
$key => $val) {
559 $this->
getUserId() != $this->current_user->getId() &&
560 !$this->current_user->isAnonymous() &&
564 $tpl->
setVariable(
'BUDDY_HTML', $button->getHtml());
570 $has_public_badge =
false;
575 foreach ($user_badges as $ass) {
577 if ($ass->getPosition()) {
588 $tpl->
setVariable(
'BADGE_HIDDEN', $renderer->getHTML());
592 $has_public_badge =
true;
597 $this->
lng->loadLanguageModule(
'badge');
598 $tpl->
setVariable(
'BADGE_HIDDEN_TXT_MORE', $this->
lng->txt(
'badge_profile_more'));
599 $tpl->
setVariable(
'BADGE_HIDDEN_TXT_LESS', $this->
lng->txt(
'badge_profile_less'));
603 if ($has_public_badge) {
619 return $tpl->
get() . $goto;
636 if ($user->getPref(
'public_profile') !=
'y' &&
637 $user->getPref(
'public_profile') !=
'g' &&
638 strtolower($this->profile_request->getBaseClass()) !=
'ilsharedresourcegui' &&
639 $this->current_user->getId() != $this->
getUserId()
644 $vcard->setName($user->getLastname(), $user->getFirstname(),
'', $user->getUTitle());
645 $vcard->setNickname($user->getLogin());
648 if ($image !== null) {
649 $vcard->setPhoto($image, $type);
653 'getOrgUnitsRepresentation' =>
'org_units',
'getInstitution' =>
'institution',
654 'getDepartment' =>
'department',
'getStreet' =>
'street',
655 'getZipcode' =>
'zipcode',
'getCity' =>
'city',
'getCountry' =>
'country',
656 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
657 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
658 'getHobby' =>
'hobby',
'getMatriculation' =>
'matriculation',
659 'getClientIP' =>
'client_ip',
'dummy' =>
'location' 664 foreach ($val_arr as
$key => $value) {
666 if ($user->getPref(
'public_' . $value) ==
'y') {
669 $org[0] = $user->$key();
672 $org[1] = $user->$key();
675 $adr[2] = $user->$key();
678 $adr[5] = $user->$key();
681 $adr[3] = $user->$key();
684 $adr[6] = $user->$key();
699 $vcard->setEmail($user->$key());
702 $vcard->setNote($user->$key());
705 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
712 $vcard->setOrganization(implode(
';', $org));
740 if ($this->current_user->isAnonymous()) {
741 if (strtolower($this->
ctrl->getCmd()) == strtolower(
'approveContactRequest')) {
742 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
743 } elseif (strtolower($this->
ctrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
744 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
747 if ($user->getPref(
'public_profile') !=
'g') {
749 if ($user->getPref(
'public_profile') ==
'y') {
750 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId);
762 $this->tpl->resetHeaderBlock();
775 if ($access_handler->checkAccess(
'read',
'', $portfolio_id)) {
776 return $portfolio_id;
788 $ilUser = $DIC[
'ilUser'];
793 'interests_help_offered',
794 'interests_help_looking' 796 if (in_array($a_field_id, $multi_fields) && $a_term) {
800 $user_id = $ilUser->getId();
809 $result[$cnt]->value = $item;
810 $result[$cnt]->label = $item;
820 $field_id = $this->profile_request->getFieldId();
821 $term = $this->profile_request->getTerm();
823 $result = self::getAutocompleteResult($field_id, $term);
825 echo json_encode($result, JSON_THROW_ON_ERROR);
831 $osd_id = $this->profile_request->getOsdId();
833 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
835 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
836 $this->
ctrl->redirectByClass([
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'],
'link');
841 $osd_id = $this->profile_request->getOsdId();
843 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
846 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
847 $this->
ctrl->redirectByClass([
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'],
'ignore');
setEmbedded(bool $a_value, bool $a_offline=false)
ilRbacSystem $rbac_system
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
touchBlock(string $block)
overwrites ITX::touchBlock.
static getInstancesByUserId(int $a_user_id)
Additional user data fields definition.
deliverVCard()
Deliver vcard information.
static getAutocompleteResult(string $a_field_id, string $a_term)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getDefaultPortfolio(int $a_user_id)
Get default portfolio of user.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setAdditional(array $a_additional)
Set Additonal Information.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
setBackUrl(string $backurl)
Set Back Link URL.
getPublicPref(ilObjUser $a_user, string $a_id)
Get user preference for public profile.
static findInterests(string $a_term, ?int $a_user_id=null, string $a_field_id=null)
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
getProfilePortfolio()
Check if current profile portfolio is accessible.
RFC 2426 vCard MIME Directory Profile 3.0 class.
GUI class for public user profile presentation.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static getMapGUI()
Get an instance of the GUI class.
Portfolio view gui class.
ProfileGUIRequest $profile_request
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='ilpublicuserprofilegui')
Default behaviour is:
ilUserDefinedFields $user_defined_fields
validateUser(int $usrId)
Check if given user id is valid.
getPref(string $a_keyword)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
setCustomPrefs(array $a_prefs)
Set custom preferences for public profile fields.
getEmbeddable(bool $a_add_goto=false)
get public profile html code Used in Personal Profile (as preview) and Portfolio (as page block) ...
Class ilUserAvatarResolver.
static _isAnonymous(int $usr_id)
static redirect(string $a_script)
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
static isActivated()
Checks whether Map feature is activated.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
Access handler for portfolio NOTE: This file needs to stay in the classes directory, WAC will be confused otherwise.
static getMailObjectRefId()
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
static _lookupType(int $id, bool $reference=false)
ilGlobalTemplateInterface $tpl