19 declare(strict_types=1);
55 $this->
ctrl = $DIC[
'ilCtrl'];
56 $this->
lng = $DIC[
'lng'];
57 $this->current_user = $DIC[
'ilUser'];
58 $this->setting = $DIC[
'ilSetting'];
59 $this->
tabs = $DIC[
'ilTabs'];
60 $this->tpl = $DIC[
'tpl'];
61 $this->rbac_system = $DIC[
'rbacsystem'];
62 $this->
lng = $DIC[
'lng'];
74 $this->
setUserId($this->profile_request->getUserId());
77 $this->
ctrl->saveParameter($this, [
'user_id',
'back_url',
'user']);
78 $back_url = $this->profile_request->getBackUrl();
79 if ($back_url !==
'') {
83 $this->
lng->loadLanguageModule(
'user');
88 $this->userid = $a_userid;
101 $this->additional = $a_additional;
115 $parts = parse_url($backurl);
116 $host =
$parts[
'host'] ??
'';
121 $this->
ctrl->setParameter($this,
'back_url', rawurlencode($backurl));
134 $this->custom_prefs = $a_prefs;
142 if (!$this->custom_prefs) {
143 return (
string) $a_user->
getPref($a_id);
145 return (
string) ($this->custom_prefs[$a_id] ??
'');
149 public function setEmbedded(
bool $a_value,
bool $a_offline =
false): void
151 $this->embedded = $a_value;
152 $this->offline = $a_offline;
161 $next_class = $this->
ctrl->getNextClass($this);
162 $cmd = $this->
ctrl->getCmd();
164 $this->tpl->loadStandardTemplate();
166 switch ($next_class) {
167 case 'ilbuddysystemgui':
169 $this->
ctrl->setReturn($this,
'view');
170 $this->
ctrl->forwardCommand($gui);
172 case 'ilobjportfoliogui':
175 && $cmd !==
'deliverVCard') {
178 $gui->setPermaLink($this->
getUserId(),
'usr');
179 $this->
ctrl->forwardCommand($gui);
184 $ret = $this->$cmd();
185 $this->tpl->setContent($ret);
190 if (strtolower($this->profile_request->getBaseClass()) ==
'ilpublicuserprofilegui') {
191 $this->tpl->printToStdout();
193 return (
string) $ret;
207 $current = $user->getPref(
'public_profile');
209 if ($user->getPref(
'public_profile') ===
'g' && !$this->setting->get(
'enable_global_profiles')) {
212 return in_array($current, [
'g',
'y']);
217 if ($this->embedded) {
224 if (!$user->getActive() ||
225 !$user->checkTimeLimit()) {
230 $this->
ctrl->redirectByClass(
'ilobjportfoliogui',
'preview');
239 $current = $user->getPref(
'public_profile');
240 if ($user->getPref(
'public_profile') ==
'g' && !$this->setting->get(
'enable_global_profiles')) {
244 if ($current !=
'y' &&
245 ($current !=
'g' || !$this->setting->get(
'enable_global_profiles')) &&
246 !$this->custom_prefs) {
272 'tpl.usr_public_profile.html',
275 'components/ILIAS/User' 283 $ref_url = str_replace(
'&',
'&', $this->
getBackUrl());
285 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
296 'rcp_to' => $user->getLogin()
299 } elseif ($user->getPref(
'public_profile') ===
'g' ||
300 (!$this->current_user->isAnonymous() && $user->getPref(
'public_profile') ===
'y') &&
301 $user->getPref(
'public_email') &&
302 $user->getEmail() !==
'') {
303 $mail_url =
'mailto:' . $user->getEmail();
306 if ($mail_url !==
'') {
324 $first_name .= $user->getUTitle() .
' ';
326 $first_name .= $user->getFirstname();
328 if ($this->
getPublicPref($user,
'public_gender') ==
'y' && in_array($user->getGender(), [
'm',
'f'])) {
329 $sal = $this->
lng->txt(
'salutation_' . $user->getGender()) .
' ';
335 $tpl->
setVariable(
'LASTNAME', $user->getLastname());
337 if ($user->getBirthday() &&
346 if (!$this->offline) {
350 $tpl->
setVariable(
'TXT_DOWNLOAD_VCARD', $this->
lng->txt(
'vcard_download'));
351 $this->
ctrl->setParameter($this,
'user_id', $this->
getUserId());
352 $tpl->
setVariable(
'HREF_VCARD', $this->
ctrl->getLinkTarget($this,
'deliverVCard'));
356 if ($this->
getPublicPref($user,
'public_upload') ===
'y' && $imagefile !==
'' 357 && ($this->current_user->getId() !==
ANONYMOUS_USER_ID || $user->getPref(
'public_profile') ===
'g')) {
362 $tpl->
setVariable(
'IMAGE_ALT', $this->
lng->txt(
'personal_picture'));
373 'getStreet' =>
'street',
374 'getZipcode' =>
'zipcode',
376 'getCountry' =>
'country',
377 'getSelectedCountry' =>
'sel_country' 379 foreach ($val_arr as $key => $value) {
381 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
382 $address_value = $user->$key();
385 if (trim($address_value) !=
'') {
388 $address[0] = $address_value;
393 $address[1] = isset($address[1])
394 ?
"{$address[1]} {$address_value}" 399 $this->
lng->loadLanguageModule(
'meta');
400 $address[2] = $this->
lng->txt(
'meta_c_' . $address_value);
404 $address[2] = $address_value;
410 if (count($address)) {
412 foreach ($address as $line) {
414 $tpl->
setVariable(
'TXT_ADDRESS_LINE', trim($line));
425 if ($this->
getPublicPref($user,
'public_org_units') ==
'y') {
428 $tpl->
setVariable(
'ORG_UNITS', $user->getOrgUnitsRepresentation());
432 if ($this->
getPublicPref($user,
'public_institution') ==
'y' ||
436 if ($this->
getPublicPref($user,
'public_institution') ==
'y') {
437 $h = $this->
lng->txt(
'institution');
438 $v = $user->getInstitution();
441 if ($this->
getPublicPref($user,
'public_department') ==
'y') {
442 $h .= $sep . $this->
lng->txt(
'department');
443 $v .= $sep . $user->getDepartment();
452 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
453 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
'getSecondEmail' =>
'second_email' 456 foreach ($val_arr as $key => $value) {
458 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
459 $v .= $sep . $this->
lng->txt($value) .
': ' . $user->$key();
472 'getHobby' =>
'hobby',
473 'getGeneralInterestsAsText' =>
'interests_general',
474 'getOfferingHelpAsText' =>
'interests_help_offered',
475 'getLookingForHelpAsText' =>
'interests_help_looking',
476 'getMatriculation' =>
'matriculation',
477 'getClientIP' =>
'client_ip' 480 foreach ($val_arr as $key => $value) {
482 if ($this->
getPublicPref($user,
'public_' . $value) ==
'y') {
499 if (count($port) > 0) {
500 foreach ($port as $u) {
502 foreach ($u as $link => $title) {
511 $this->
lng->loadLanguageModule(
'prtf');
512 $tpl->
setVariable(
'TXT_PORTFOLIO', $this->
lng->txt(
'prtf_portfolios'));
522 $user->getLatitude() !=
'') {
526 $map_gui->setMapId(
'user_map')
529 ->setLatitude($user->getLatitude())
530 ->setLongitude($user->getLongitude())
531 ->setZoom($user->getLocationZoom())
532 ->setEnableNavigationControl(
true)
533 ->addUserMarker($user->getId());
535 $tpl->
setVariable(
'MAP_CONTENT', $map_gui->getHtml());
540 $user_defined_data = $user->getUserDefinedData();
541 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
543 if ($this->
getPublicPref($user,
'public_udf_' . $definition[
'field_id']) ==
'y') {
544 if ($user_defined_data[
'f_' . $definition[
'field_id']] !=
'') {
546 $tpl->
setVariable(
'TXT_UDF_DATA', $definition[
'field_name']);
547 $tpl->
setVariable(
'UDF_DATA', $user_defined_data[
'f_' . $definition[
'field_id']]);
555 if (is_array($additional)) {
556 foreach ($additional as $key => $val) {
565 $this->
getUserId() != $this->current_user->getId() &&
566 !$this->current_user->isAnonymous() &&
570 $tpl->
setVariable(
'BUDDY_HTML', $button->getHtml());
574 $tpl->
setVariable(
'USER_BADGES', $this->badges_renderer->render($user->getId()));
587 return $tpl->
get() . $goto;
601 $vcard =
new VCard();
604 if ($user->getPref(
'public_profile') !=
'y' &&
605 $user->getPref(
'public_profile') !=
'g' &&
606 strtolower($this->profile_request->getBaseClass()) !=
'ilsharedresourcegui' &&
607 $this->current_user->getId() != $this->
getUserId()
612 $vcard->setName($user->getLastname(), $user->getFirstname(),
'', $user->getUTitle());
613 $vcard->setNickname($user->getLogin());
616 if ($image !==
null) {
617 $vcard->setPhoto($image, $type);
621 'getOrgUnitsRepresentation' =>
'org_units',
'getInstitution' =>
'institution',
622 'getDepartment' =>
'department',
'getStreet' =>
'street',
623 'getZipcode' =>
'zipcode',
'getCity' =>
'city',
'getCountry' =>
'country',
624 'getPhoneOffice' =>
'phone_office',
'getPhoneHome' =>
'phone_home',
625 'getPhoneMobile' =>
'phone_mobile',
'getFax' =>
'fax',
'getEmail' =>
'email',
626 'getHobby' =>
'hobby',
'getMatriculation' =>
'matriculation',
627 'getClientIP' =>
'client_ip',
'dummy' =>
'location' 632 foreach ($val_arr as $key => $value) {
634 if ($user->getPref(
'public_' . $value) ==
'y') {
637 $org[0] = $user->$key();
640 $org[1] = $user->$key();
643 $adr[2] = $user->$key();
646 $adr[5] = $user->$key();
649 $adr[3] = $user->$key();
652 $adr[6] = $user->$key();
655 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_WORK);
658 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_HOME);
661 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_CELL);
664 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_FAX);
667 $vcard->setEmail($user->$key());
670 $vcard->setNote($user->$key());
673 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
680 $vcard->setOrganization(implode(
';', $org));
708 if ($this->current_user->isAnonymous()) {
709 if (strtolower($this->
ctrl->getCmd()) == strtolower(
'approveContactRequest')) {
710 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
711 } elseif (strtolower($this->
ctrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
712 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
715 if ($user->getPref(
'public_profile') !=
'g') {
717 if ($user->getPref(
'public_profile') ==
'y') {
718 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId);
730 $this->tpl->resetHeaderBlock();
743 if ($access_handler->checkAccess(
'read',
'', $portfolio_id)) {
744 return $portfolio_id;
756 $ilUser = $DIC[
'ilUser'];
761 'interests_help_offered',
762 'interests_help_looking' 764 if (in_array($a_field_id, $multi_fields) && $a_term) {
777 $result[$cnt]->value = $item;
778 $result[$cnt]->label = $item;
788 $field_id = $this->profile_request->getFieldId();
789 $term = $this->profile_request->getTerm();
791 $result = self::getAutocompleteResult($field_id, $term);
793 echo json_encode($result, JSON_THROW_ON_ERROR);
799 $osd_id = $this->profile_request->getOsdId();
801 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
803 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
804 $this->
ctrl->redirectByClass([
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'],
'link');
809 $osd_id = $this->profile_request->getOsdId();
811 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
814 $this->
ctrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
815 $this->
ctrl->redirectByClass([
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'],
'ignore');
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
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...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Additional user data fields definition.
deliverVCard()
Deliver vcard information.
static getAutocompleteResult(string $a_field_id, string $a_term)
static getDefaultPortfolio(int $a_user_id)
setAdditional(array $a_additional)
Set Additonal Information.
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.
setBackUrl(string $backurl)
Set Back Link URL.
RFC 2426 vCard MIME Directory Profile 3.0 class.
getPublicPref(ilObjUser $a_user, string $a_id)
Get user preference for public profile.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getProfilePortfolio()
Check if current profile portfolio is accessible.
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.
ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI ilObjPortfolioGUI: ilWorkspaceAccessGUI, ilCommentGUI, ilCommonActionDispatcherGUI ilObjPortfolioGUI: ilObjectContentStyleSettingsGUI, ilPortfolioExerciseGUI ilObjPortfolioGUI: ILIAS
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="")
GUIRequest $profile_request
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) ...
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
Class ilUserAvatarResolver.
static _isAnonymous(int $usr_id)
static redirect(string $a_script)
static isActivated()
Checks whether Map feature is activated.
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)
static findInterests(string $a_term, ?int $a_user_id=null, ?string $a_field_id=null)
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
__construct(Container $dic, ilPlugin $plugin)
Access handler for portfolio NOTE: This file needs to stay in the classes directory, WAC will be confused otherwise.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static getMailObjectRefId()
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
static _lookupType(int $id, bool $reference=false)
PublicUserProfileBadgesRenderer $badges_renderer
ilGlobalTemplateInterface $tpl