42 $ilCtrl = $DIC[
'ilCtrl'];
44 $this->current_user = $DIC->user();
46 $this->setting = $DIC[
"ilSetting"];
48 $this->profile_request = new \ILIAS\User\ProfileGUIRequest(
56 $this->
setUserId($this->profile_request->getUserId());
59 $ilCtrl->saveParameter($this, array(
"user_id",
"back_url",
"user"));
60 $back_url = $this->profile_request->getBackUrl();
61 if ($back_url !=
"") {
65 $lng->loadLanguageModule(
"user");
70 $this->userid = $a_userid;
83 $this->additional = $a_additional;
98 $ilCtrl = $DIC[
'ilCtrl'];
101 $parts = parse_url($a_backurl);
102 $host =
$parts[
'host'] ??
'';
106 $this->backurl = $a_backurl;
107 $ilCtrl->setParameter($this,
"back_url", rawurlencode($a_backurl));
120 $this->custom_prefs = $a_prefs;
128 if (!$this->custom_prefs) {
129 return (
string) $a_user->
getPref($a_id);
131 return (
string) ($this->custom_prefs[$a_id] ??
"");
135 public function setEmbedded(
bool $a_value,
bool $a_offline =
false): void
137 $this->embedded = $a_value;
138 $this->offline = $a_offline;
144 $ilCtrl = $DIC[
'ilCtrl'];
147 if (!self::validateUser($this->
getUserId())) {
150 $next_class = $ilCtrl->getNextClass($this);
151 $cmd = $ilCtrl->getCmd();
153 $tpl->loadStandardTemplate();
155 switch ($next_class) {
156 case 'ilbuddysystemgui':
158 $ilCtrl->setReturn($this,
'view');
159 $ilCtrl->forwardCommand($gui);
161 case "ilobjportfoliogui":
164 && $cmd !==
'deliverVCard') {
167 $gui->setPermaLink($this->
getUserId(),
"usr");
168 $ilCtrl->forwardCommand($gui);
173 $ret = $this->$cmd();
174 $tpl->setContent($ret);
179 if (strtolower($this->profile_request->getBaseClass()) ==
"ilpublicuserprofilegui") {
180 $tpl->printToStdout();
182 return (
string) $ret;
197 $current = $user->getPref(
"public_profile");
199 if ($user->getPref(
"public_profile") ==
"g" && !$setting->get(
'enable_global_profiles')) {
202 return in_array($current, [
"g",
"y"]);
208 $ilCtrl = $DIC[
'ilCtrl'];
211 if ($this->embedded) {
218 if (!$user->getActive() ||
219 !$user->checkTimeLimit()) {
224 $ilCtrl->redirectByClass(
"ilobjportfoliogui",
"preview");
233 $current = $user->getPref(
"public_profile");
235 if ($user->getPref(
"public_profile") ==
"g" && !
$ilSetting->get(
'enable_global_profiles')) {
239 if ($current !=
"y" &&
240 ($current !=
"g" || !
$ilSetting->get(
'enable_global_profiles')) &&
241 !$this->custom_prefs) {
262 $ilCtrl = $DIC[
'ilCtrl'];
275 "tpl.usr_public_profile.html",
282 $tpl->setVariable(
"ROWCOL1",
"tblrow1");
283 $tpl->setVariable(
"ROWCOL2",
"tblrow2");
286 $ref_url = str_replace(
"&",
"&", $this->
getBackUrl());
288 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
299 'rcp_to' => $user->getLogin()
302 } elseif ($user->getPref(
'public_profile') ===
'g' ||
303 (!
$ilUser->isAnonymous() && $user->getPref(
'public_profile') ===
'y') &&
304 $user->getPref(
'public_email') &&
305 $user->getEmail() !==
'') {
306 $mail_url =
'mailto:' . $user->getEmail();
309 if ($mail_url !==
'') {
310 $tpl->setCurrentBlock(
"mail");
311 $tpl->setVariable(
"TXT_MAIL",
$lng->txt(
"send_mail"));
312 $tpl->setVariable(
'HREF_MAIL', $mail_url);
313 $tpl->parseCurrentBlock();
320 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
327 $first_name .= $user->getUTitle() .
" ";
329 $first_name .= $user->getFirstname();
331 if ($this->
getPublicPref($user,
"public_gender") ==
"y" && in_array($user->getGender(), [
'm',
'f'])) {
332 $sal =
$lng->txt(
"salutation_" . $user->getGender()) .
" ";
333 $tpl->setVariable(
"SALUTATION", $sal);
336 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
337 $tpl->setVariable(
"FIRSTNAME", $first_name);
338 $tpl->setVariable(
"LASTNAME", $user->getLastname());
340 if ($user->getBirthday() &&
343 $tpl->setCurrentBlock(
"bday_bl");
344 $tpl->setVariable(
"TXT_BIRTHDAY",
$lng->txt(
"birthday"));
346 $tpl->parseCurrentBlock();
349 if (!$this->offline) {
351 $tpl->setCurrentBlock(
"vcard");
352 $tpl->setVariable(
"TXT_VCARD",
$lng->txt(
"vcard"));
353 $tpl->setVariable(
"TXT_DOWNLOAD_VCARD",
$lng->txt(
"vcard_download"));
354 $ilCtrl->setParameter($this,
"user_id", $this->
getUserId());
355 $tpl->setVariable(
"HREF_VCARD", $ilCtrl->getLinkTarget($this,
"deliverVCard"));
360 $random = new \ilRandom();
361 $imagefile = $webspace_dir .
"/usr_images/" . $user->getPref(
"profile_image") .
"?dummy=" . $random->int(1, 999999);
362 $check_file = $check_dir .
"/usr_images/" . $user->getPref(
"profile_image");
364 if (!is_file($check_file)) {
365 $imagefile = $check_file =
368 if ($this->offline) {
369 $imagefile = basename($imagefile);
375 if ($this->
getPublicPref($user,
"public_upload") ==
"y" && $imagefile !=
"" &&
379 $tpl->setCurrentBlock(
"image");
380 $tpl->setVariable(
"TXT_IMAGE",
$lng->txt(
"image"));
381 $tpl->setVariable(
"IMAGE_PATH", $imagefile);
382 $tpl->setVariable(
"IMAGE_ALT",
$lng->txt(
"personal_picture"));
383 $tpl->parseCurrentBlock();
392 $val_arr = array(
"getStreet" =>
"street",
393 "getZipcode" =>
"zipcode",
395 "getCountry" =>
"country",
396 "getSelectedCountry" =>
"sel_country");
397 foreach ($val_arr as
$key => $value) {
399 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
400 $address_value = $user->$key();
403 if (trim($address_value) !=
"") {
406 $address[0] = $address_value;
411 $address[1] = isset($address[1])
412 ?
"{$address[1]} {$address_value}" 417 $lng->loadLanguageModule(
"meta");
418 $address[2] =
$lng->txt(
"meta_c_" . $address_value);
422 $address[2] = $address_value;
428 if (count($address)) {
429 $tpl->setCurrentBlock(
"address_line");
430 foreach ($address as $line) {
432 $tpl->setVariable(
"TXT_ADDRESS_LINE", trim($line));
433 $tpl->parseCurrentBlock();
436 $tpl->setCurrentBlock(
"address");
437 $tpl->setVariable(
"TXT_ADDRESS",
$lng->txt(
"address"));
438 $tpl->parseCurrentBlock();
443 if ($this->
getPublicPref($user,
"public_org_units") ==
"y") {
444 $tpl->setCurrentBlock(
"org_units");
445 $tpl->setVariable(
"TXT_ORG_UNITS",
$lng->txt(
"objs_orgu"));
446 $tpl->setVariable(
"ORG_UNITS", $user->getOrgUnitsRepresentation());
447 $tpl->parseCurrentBlock();
451 if ($this->
getPublicPref($user,
"public_institution") ==
"y" ||
453 $tpl->setCurrentBlock(
"inst_dep");
455 if ($this->
getPublicPref($user,
"public_institution") ==
"y") {
456 $h =
$lng->txt(
"institution");
457 $v = $user->getInstitution();
460 if ($this->
getPublicPref($user,
"public_department") ==
"y") {
461 $h .= $sep .
$lng->txt(
"department");
462 $v .= $sep . $user->getDepartment();
464 $tpl->setVariable(
"TXT_INST_DEP", $h);
465 $tpl->setVariable(
"INST_DEP", $v);
466 $tpl->parseCurrentBlock();
471 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
472 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
"getSecondEmail" =>
"second_email");
474 foreach ($val_arr as
$key => $value) {
476 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
477 $v .= $sep .
$lng->txt($value) .
": " . $user->$key();
482 $tpl->parseCurrentBlock(
"contact");
483 $tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"contact"));
484 $tpl->setVariable(
"CONTACT", $v);
485 $tpl->parseCurrentBlock();
490 "getHobby" =>
"hobby",
491 "getGeneralInterestsAsText" =>
"interests_general",
492 "getOfferingHelpAsText" =>
"interests_help_offered",
493 "getLookingForHelpAsText" =>
"interests_help_looking",
494 "getMatriculation" =>
"matriculation",
495 "getClientIP" =>
"client_ip");
497 foreach ($val_arr as
$key => $value) {
499 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
500 $tpl->setCurrentBlock(
"profile_data");
501 $tpl->setVariable(
"TXT_DATA",
$lng->txt($value));
502 $tpl->setVariable(
"DATA", $user->$key());
503 $tpl->parseCurrentBlock();
513 if (count($port) > 0) {
514 foreach ($port as $u) {
515 $tpl->setCurrentBlock(
"portfolio");
516 foreach ($u as $link => $title) {
518 $tpl->setVariable(
"HREF_PORTFOLIO", $link);
519 $tpl->setVariable(
"TITLE_PORTFOLIO", $title);
520 $tpl->parseCurrentBlock();
523 $tpl->setCurrentBlock(
"portfolios");
525 $lng->loadLanguageModule(
"prtf");
526 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"prtf_portfolios"));
528 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"portfolio"));
530 $tpl->parseCurrentBlock();
536 $user->getLatitude() !=
"") {
537 $tpl->setVariable(
"TXT_LOCATION",
$lng->txt(
"location"));
540 $map_gui->setMapId(
"user_map")
543 ->setLatitude($user->getLatitude())
544 ->setLongitude($user->getLongitude())
545 ->setZoom($user->getLocationZoom())
546 ->setEnableNavigationControl(
true)
547 ->addUserMarker($user->getId());
549 $tpl->setVariable(
"MAP_CONTENT", $map_gui->getHtml());
554 $user_defined_data = $user->getUserDefinedData();
555 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
557 if ($this->
getPublicPref($user,
"public_udf_" . $definition[
"field_id"]) ==
"y") {
558 if ($user_defined_data[
"f_" . $definition[
"field_id"]] !=
"") {
559 $tpl->setCurrentBlock(
"udf_data");
560 $tpl->setVariable(
"TXT_UDF_DATA", $definition[
"field_name"]);
561 $tpl->setVariable(
"UDF_DATA", $user_defined_data[
"f_" . $definition[
"field_id"]]);
562 $tpl->parseCurrentBlock();
569 if (is_array($additional)) {
570 foreach ($additional as
$key => $val) {
571 $tpl->setCurrentBlock(
"profile_data");
572 $tpl->setVariable(
"TXT_DATA",
$key);
573 $tpl->setVariable(
"DATA", $val);
574 $tpl->parseCurrentBlock();
584 $tpl->setVariable(
'BUDDY_HTML', $button->getHtml());
590 $has_public_badge =
false;
595 foreach ($user_badges as $ass) {
597 if ($ass->getPosition()) {
604 $tpl->setCurrentBlock(
"badge_bl");
605 $tpl->setVariable(
"BADGE", $renderer->getHTML());
607 $tpl->setCurrentBlock(
"badge_hidden_item_bl");
608 $tpl->setVariable(
"BADGE_HIDDEN", $renderer->getHTML());
610 $tpl->parseCurrentBlock();
612 $has_public_badge =
true;
617 $lng->loadLanguageModule(
"badge");
618 $tpl->setVariable(
"BADGE_HIDDEN_TXT_MORE",
$lng->txt(
"badge_profile_more"));
619 $tpl->setVariable(
"BADGE_HIDDEN_TXT_LESS",
$lng->txt(
"badge_profile_less"));
620 $tpl->touchBlock(
"badge_js_bl");
623 if ($has_public_badge) {
624 $tpl->setVariable(
"TXT_BADGES",
$lng->txt(
"obj_bdga"));
632 $mtpl = $DIC->ui()->mainTemplate();
634 $mtpl->setPermanentLink(
641 return $tpl->get() . $goto;
659 if ($user->getPref(
"public_profile") !=
"y" &&
660 $user->getPref(
"public_profile") !=
"g" &&
661 strtolower($this->profile_request->getBaseClass()) !=
"ilsharedresourcegui" &&
662 $this->current_user->getId() != $this->
getUserId()
667 $vcard->setName($user->getLastname(), $user->getFirstname(),
"", $user->getUTitle());
668 $vcard->setNickname($user->getLogin());
671 $imagefile = $webspace_dir .
"/usr_images/" . $user->getPref(
"profile_image");
672 if ($user->getPref(
"public_upload") ==
"y" && is_file($imagefile)) {
673 $fh = fopen($imagefile,
'rb');
675 $image = fread($fh, filesize($imagefile));
678 if (0 === strpos($mimetype,
"image")) {
681 $vcard->setPhoto($image,
$type);
685 $val_arr = array(
"getOrgUnitsRepresentation" =>
"org_units",
"getInstitution" =>
"institution",
686 "getDepartment" =>
"department",
"getStreet" =>
"street",
687 "getZipcode" =>
"zipcode",
"getCity" =>
"city",
"getCountry" =>
"country",
688 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
689 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
690 "getHobby" =>
"hobby",
"getMatriculation" =>
"matriculation",
691 "getClientIP" =>
"client_ip",
"dummy" =>
"location");
695 foreach ($val_arr as
$key => $value) {
697 if ($user->getPref(
"public_" . $value) ==
"y") {
700 $org[0] = $user->$key();
703 $org[1] = $user->$key();
706 $adr[2] = $user->$key();
709 $adr[5] = $user->$key();
712 $adr[3] = $user->$key();
715 $adr[6] = $user->$key();
730 $vcard->setEmail($user->$key());
733 $vcard->setNote($user->$key());
736 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
743 $vcard->setOrganization(implode(
";", $org));
768 $ilCtrl = $DIC->ctrl();
776 if (strtolower($ilCtrl->getCmd()) == strtolower(
'approveContactRequest')) {
777 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
778 } elseif (strtolower($ilCtrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
779 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
782 if ($user->getPref(
"public_profile") !=
"g") {
784 if ($user->getPref(
"public_profile") ==
"y") {
785 $ilCtrl->redirectToURL(
"login.php?cmd=force_login&target=usr_" . $usrId);
801 $tpl->resetHeaderBlock();
814 if ($access_handler->checkAccess(
"read",
"", $portfolio_id)) {
815 return $portfolio_id;
830 $multi_fields = array(
"interests_general",
"interests_help_offered",
"interests_help_looking");
831 if (in_array($a_field_id, $multi_fields) && $a_term) {
844 $result[$cnt]->value = $item;
845 $result[$cnt]->label = $item;
864 $field_id = $this->profile_request->getFieldId();
865 $term = $this->profile_request->getTerm();
867 $result = self::getAutocompleteResult($field_id, $term);
869 echo json_encode($result, JSON_THROW_ON_ERROR);
877 $ilCtrl = $DIC->ctrl();
878 $osd_id = $this->profile_request->getOsdId();
880 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
882 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
883 $ilCtrl->redirectByClass(array(
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'),
'link');
890 $ilCtrl = $DIC->ctrl();
892 $osd_id = $this->profile_request->getOsdId();
894 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $osd_id);
897 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
898 $ilCtrl->redirectByClass(array(
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'),
'ignore');
static validateUser(int $usrId)
Check if given user id is valid.
static getWebspaceDir(string $mode="filesystem")
get webspace directory
setEmbedded(bool $a_value, bool $a_offline=false)
__construct(int $a_user_id=0)
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:
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
static getInstancesByUserId(int $a_user_id)
Additional user data fields definition.
deliverVCard()
Deliver vcard information.
static getAutocompleteResult(string $a_field_id, string $a_term)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
setAdditional(array $a_additional)
Set Additonal Information.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
ilUserDefinedFields $user_defined_fields
getPref(string $a_keyword)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
setBackUrl(string $a_backurl)
Set Back Link URL.
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) ...
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)
static isActivated()
Checks whether Map feature is activated.
Access handler for portfolio NOTE: This file needs to stay in the classes directory, WAC will be confused otherwise.
static getMailObjectRefId()
static signFile(string $path_to_file)
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static _lookupType(int $id, bool $reference=false)
ILIAS User ProfileGUIRequest $profile_request