45 $this->current_user =
$DIC->user();
47 $this->setting =
$DIC[
"ilSetting"];
55 $ilCtrl->saveParameter($this, array(
"user_id",
"back_url",
"user"));
56 if (
$_GET[
"back_url"] !=
"") {
60 $lng->loadLanguageModule(
"user");
70 $this->userid = $a_userid;
90 $this->additional = $a_additional;
115 $parts = parse_url($a_backurl);
116 if ($parts[
"host"]) {
120 $this->backurl = $a_backurl;
121 $ilCtrl->setParameter($this,
"back_url", rawurlencode($a_backurl));
138 $ilMainMenu =
$DIC[
'ilMainMenu'];
139 $ilTabs =
$DIC[
'ilTabs'];
148 $back =
'ilias.php?baseClass=ilDashboardGUI';
151 if ((
bool) $a_is_portfolio) {
152 $ilMainMenu->setTopBarBack($back);
155 $ilTabs->clearTargets();
156 $ilTabs->setBackTarget(
170 $this->custom_prefs = $a_prefs;
184 if (!$this->custom_prefs) {
185 return $a_user->
getPref($a_id);
187 return $this->custom_prefs[$a_id];
193 $this->embedded = (bool) $a_value;
194 $this->offline = (bool) $a_offline;
207 if (!self::validateUser($this->
getUserId())) {
211 $next_class =
$ilCtrl->getNextClass($this);
214 $tpl->loadStandardTemplate();
216 switch ($next_class) {
217 case "ilobjportfoliogui":
222 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
225 $gui->setPermaLink($this->
getUserId(),
"usr");
230 case 'ilbuddysystemgui':
231 if (isset($_REQUEST[
'osd_id'])) {
232 require_once
'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
236 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
238 $ilCtrl->setReturn($this,
'view');
242 $ret = $this->$cmd();
248 if (strtolower(
$_GET[
"baseClass"]) ==
"ilpublicuserprofilegui") {
249 $tpl->printToStdout();
269 $current = $user->getPref(
"public_profile");
271 if ($user->getPref(
"public_profile") ==
"g" && !
$setting->get(
'enable_global_profiles')) {
274 return in_array($current, [
"g",
"y"]);
286 if ($this->embedded) {
293 if (!$user->getActive() ||
294 !$user->checkTimeLimit()) {
299 $ilCtrl->redirectByClass(
"ilobjportfoliogui",
"preview");
308 $current = $user->getPref(
"public_profile");
310 if ($user->getPref(
"public_profile") ==
"g" && !
$ilSetting->get(
'enable_global_profiles')) {
314 if ($current !=
"y" &&
315 ($current !=
"g" || !
$ilSetting->get(
'enable_global_profiles')) &&
316 !$this->custom_prefs) {
349 "tpl.usr_public_profile.html",
356 $tpl->setVariable(
"ROWCOL1",
"tblrow1");
357 $tpl->setVariable(
"ROWCOL2",
"tblrow2");
359 if (!$this->offline &&
$ilUser->getId() != ANONYMOUS_USER_ID) {
360 $ref_url = str_replace(
"&",
"&", $this->
getBackUrl());
362 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
365 $tpl->setCurrentBlock(
"mail");
366 $tpl->setVariable(
"TXT_MAIL",
$lng->txt(
"send_mail"));
367 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
374 array(
'type' =>
'new',
'rcp_to' => $user->getLogin())
377 $tpl->parseCurrentBlock();
383 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
390 $first_name .= $user->getUTitle() .
" ";
392 $first_name .= $user->getFirstName();
394 if ($this->
getPublicPref($user,
"public_gender") ==
"y" && in_array($user->getGender(), [
'm',
'f'])) {
395 $sal =
$lng->txt(
"salutation_" . $user->getGender()) .
" ";
396 $tpl->setVariable(
"SALUTATION", $sal);
399 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
400 $tpl->setVariable(
"FIRSTNAME", $first_name);
401 $tpl->setVariable(
"LASTNAME", $user->getLastName());
403 if ($user->getBirthday() &&
404 $this->getPublicPref($user,
"public_birthday") ==
"y") {
406 $tpl->setCurrentBlock(
"bday_bl");
407 $tpl->setVariable(
"TXT_BIRTHDAY",
$lng->txt(
"birthday"));
409 $tpl->parseCurrentBlock();
412 if (!$this->offline) {
414 $tpl->setCurrentBlock(
"vcard");
415 $tpl->setVariable(
"TXT_VCARD",
$lng->txt(
"vcard"));
416 $tpl->setVariable(
"TXT_DOWNLOAD_VCARD",
$lng->txt(
"vcard_download"));
418 $tpl->setVariable(
"HREF_VCARD",
$ilCtrl->getLinkTarget($this,
"deliverVCard"));
423 $random = new \ilRandom();
424 $imagefile = $webspace_dir .
"/usr_images/" . $user->getPref(
"profile_image") .
"?dummy=" . $random->int(1, 999999);
425 $check_file = $check_dir .
"/usr_images/" . $user->getPref(
"profile_image");
427 if (!@is_file($check_file)) {
428 $imagefile = $check_file =
431 if ($this->offline) {
432 $imagefile = basename($imagefile);
438 if ($this->
getPublicPref($user,
"public_upload") ==
"y" && $imagefile !=
"" &&
439 (
$ilUser->getId() != ANONYMOUS_USER_ID || $user->getPref(
"public_profile") ==
"g")) {
442 $tpl->setCurrentBlock(
"image");
443 $tpl->setVariable(
"TXT_IMAGE",
$lng->txt(
"image"));
444 $tpl->setVariable(
"IMAGE_PATH", $imagefile);
445 $tpl->setVariable(
"IMAGE_ALT",
$lng->txt(
"personal_picture"));
446 $tpl->parseCurrentBlock();
455 $val_arr = array(
"getStreet" =>
"street",
456 "getZipcode" =>
"zipcode",
458 "getCountry" =>
"country",
459 "getSelectedCountry" =>
"sel_country");
460 foreach ($val_arr as $key => $value) {
462 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
463 $address_value = $user->$key();
466 if (trim($address_value) !=
"") {
469 $address[0] = $address_value;
474 $address[1] .=
" " . $address_value;
478 $lng->loadLanguageModule(
"meta");
479 $address[2] =
$lng->txt(
"meta_c_" . $address_value);
483 $address[2] = $address_value;
489 if (
sizeof($address)) {
490 $tpl->setCurrentBlock(
"address_line");
491 foreach ($address as $line) {
493 $tpl->setVariable(
"TXT_ADDRESS_LINE", trim($line));
494 $tpl->parseCurrentBlock();
497 $tpl->setCurrentBlock(
"address");
498 $tpl->setVariable(
"TXT_ADDRESS",
$lng->txt(
"address"));
499 $tpl->parseCurrentBlock();
504 if ($this->
getPublicPref($user,
"public_org_units") ==
"y") {
505 $tpl->setCurrentBlock(
"org_units");
506 $tpl->setVariable(
"TXT_ORG_UNITS",
$lng->txt(
"objs_orgu"));
507 $tpl->setVariable(
"ORG_UNITS", $user->getOrgUnitsRepresentation());
508 $tpl->parseCurrentBlock();
512 if ($this->
getPublicPref($user,
"public_institution") ==
"y" ||
514 $tpl->setCurrentBlock(
"inst_dep");
516 if ($this->
getPublicPref($user,
"public_institution") ==
"y") {
517 $h =
$lng->txt(
"institution");
518 $v = $user->getInstitution();
521 if ($this->
getPublicPref($user,
"public_department") ==
"y") {
522 $h .= $sep .
$lng->txt(
"department");
523 $v .= $sep . $user->getDepartment();
525 $tpl->setVariable(
"TXT_INST_DEP", $h);
526 $tpl->setVariable(
"INST_DEP", $v);
527 $tpl->parseCurrentBlock();
532 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
533 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
"getSecondEmail" =>
"second_email");
535 foreach ($val_arr as $key => $value) {
537 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
538 $v .= $sep .
$lng->txt($value) .
": " . $user->$key();
543 $tpl->parseCurrentBlock(
"contact");
544 $tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"contact"));
545 $tpl->setVariable(
"CONTACT", $v);
546 $tpl->parseCurrentBlock();
551 "getHobby" =>
"hobby",
552 "getGeneralInterestsAsText" =>
"interests_general",
553 "getOfferingHelpAsText" =>
"interests_help_offered",
554 "getLookingForHelpAsText" =>
"interests_help_looking",
555 "getMatriculation" =>
"matriculation",
556 "getClientIP" =>
"client_ip");
558 foreach ($val_arr as $key => $value) {
560 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
561 $tpl->setCurrentBlock(
"profile_data");
562 $tpl->setVariable(
"TXT_DATA",
$lng->txt($value));
563 $tpl->setVariable(
"DATA", $user->$key());
564 $tpl->parseCurrentBlock();
569 include_once(
"./Services/Link/classes/class.ilLink.php");
570 include_once(
"./Modules/Portfolio/classes/class.ilObjPortfolio.php");
576 if (count($port) > 0) {
577 foreach ($port as $u) {
578 $tpl->setCurrentBlock(
"portfolio");
579 foreach ($u as $link => $title) {
581 $tpl->setVariable(
"HREF_PORTFOLIO", $link);
582 $tpl->setVariable(
"TITLE_PORTFOLIO", $title);
583 $tpl->parseCurrentBlock();
586 $tpl->setCurrentBlock(
"portfolios");
588 $lng->loadLanguageModule(
"prtf");
589 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"prtf_portfolios"));
591 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"portfolio"));
593 $tpl->parseCurrentBlock();
597 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
600 $user->getLatitude() !=
"") {
601 $tpl->setVariable(
"TXT_LOCATION",
$lng->txt(
"location"));
604 $map_gui->setMapId(
"user_map")
607 ->setLatitude($user->getLatitude())
608 ->setLongitude($user->getLongitude())
609 ->setZoom($user->getLocationZoom())
610 ->setEnableNavigationControl(
true)
611 ->addUserMarker($user->getId());
613 $tpl->setVariable(
"MAP_CONTENT", $map_gui->getHTML());
617 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
619 $user_defined_data = $user->getUserDefinedData();
620 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
622 if ($this->
getPublicPref($user,
"public_udf_" . $definition[
"field_id"]) ==
"y") {
623 if ($user_defined_data[
"f_" . $definition[
"field_id"]] !=
"") {
624 $tpl->setCurrentBlock(
"udf_data");
625 $tpl->setVariable(
"TXT_UDF_DATA", $definition[
"field_name"]);
626 $tpl->setVariable(
"UDF_DATA", $user_defined_data[
"f_" . $definition[
"field_id"]]);
627 $tpl->parseCurrentBlock();
636 $tpl->setCurrentBlock(
"profile_data");
637 $tpl->setVariable(
"TXT_DATA", $key);
638 $tpl->setVariable(
"DATA", $val);
639 $tpl->parseCurrentBlock();
648 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
650 $tpl->setVariable(
'BUDDY_HTML', $button->getHtml());
654 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
657 $has_public_badge =
false;
662 include_once
"Services/Badge/classes/class.ilBadgeRenderer.php";
663 foreach ($user_badges as $ass) {
665 if ($ass->getPosition()) {
672 $tpl->setCurrentBlock(
"badge_bl");
673 $tpl->setVariable(
"BADGE", $renderer->getHTML());
674 $tpl->parseCurrentBlock();
676 $tpl->setCurrentBlock(
"badge_hidden_item_bl");
677 $tpl->setVariable(
"BADGE_HIDDEN", $renderer->getHTML());
678 $tpl->parseCurrentBlock();
681 $has_public_badge =
true;
686 $lng->loadLanguageModule(
"badge");
687 $tpl->setVariable(
"BADGE_HIDDEN_TXT_MORE",
$lng->txt(
"badge_profile_more"));
688 $tpl->setVariable(
"BADGE_HIDDEN_TXT_LESS",
$lng->txt(
"badge_profile_less"));
689 $tpl->touchBlock(
"badge_js_bl");
692 if ($has_public_badge) {
693 $tpl->setVariable(
"TXT_BADGES",
$lng->txt(
"obj_bdga"));
701 $mtpl =
$DIC->ui()->mainTemplate();
703 $mtpl->setPermanentLink(
714 return $tpl->get() . $goto;
728 require_once
"./Services/User/classes/class.ilvCard.php";
732 if ($user->getPref(
"public_profile") !=
"y" &&
733 $user->getPref(
"public_profile") !=
"g" &&
734 $_GET[
"baseClass"] !=
"ilsharedresourceGUI" &&
735 $this->current_user->getId() != $this->getUserId()
740 $vcard->setName($user->getLastName(), $user->getFirstName(),
"", $user->getUTitle());
741 $vcard->setNickname($user->getLogin());
744 $imagefile = $webspace_dir .
"/usr_images/" . $user->getPref(
"profile_image");
745 if ($user->getPref(
"public_upload") ==
"y" && @is_file($imagefile)) {
746 $fh = fopen($imagefile,
"r");
748 $image = fread($fh, filesize($imagefile));
750 require_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
752 if (preg_match(
"/^image/", $mimetype)) {
755 $vcard->setPhoto($image,
$type);
759 $val_arr = array(
"getOrgUnitsRepresentation" =>
"org_units",
"getInstitution" =>
"institution",
760 "getDepartment" =>
"department",
"getStreet" =>
"street",
761 "getZipcode" =>
"zipcode",
"getCity" =>
"city",
"getCountry" =>
"country",
762 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
763 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
764 "getHobby" =>
"hobby",
"getMatriculation" =>
"matriculation",
765 "getClientIP" =>
"client_ip",
"dummy" =>
"location");
769 foreach ($val_arr as $key => $value) {
771 if ($user->getPref(
"public_" . $value) ==
"y") {
774 $org[0] = $user->$key();
777 $org[1] = $user->$key();
780 $adr[2] = $user->$key();
783 $adr[5] = $user->$key();
786 $adr[3] = $user->$key();
789 $adr[6] = $user->$key();
804 $vcard->setEmail($user->$key());
807 $vcard->setNote($user->$key());
810 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
817 $vcard->setOrganization(join(
";", $org));
820 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
845 if (strtolower(
$ilCtrl->getCmd()) == strtolower(
'approveContactRequest')) {
846 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
847 } elseif (strtolower(
$ilCtrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
848 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
851 if ($user->getPref(
"public_profile") !=
"g") {
853 if ($user->getPref(
"public_profile") ==
"y") {
854 $ilCtrl->redirectToURL(
"login.php?cmd=force_login&target=usr_" . $usrId);
870 $tpl->resetHeaderBlock();
872 include_once(
"./Services/User/classes/class.ilUserUtil.php");
886 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
889 include_once(
'./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
891 if ($access_handler->checkAccess(
"read",
"", $portfolio_id)) {
892 return $portfolio_id;
903 $multi_fields = array(
"interests_general",
"interests_help_offered",
"interests_help_looking");
904 if (in_array($a_field_id, $multi_fields) && $a_term) {
916 $result[$cnt] =
new stdClass();
923 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
925 $result[$cnt] =
new stdClass();
937 $field_id = (string) $_REQUEST[
"f"];
938 $term = (string) $_REQUEST[
"term"];
942 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
951 protected function approveContactRequest()
960 if (isset($_REQUEST[
'osd_id'])) {
961 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $_REQUEST[
'osd_id']);
964 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
965 $ilCtrl->redirectByClass(array(
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'),
'link');
971 protected function ignoreContactRequest()
980 if (isset($_REQUEST[
'osd_id'])) {
981 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $_REQUEST[
'osd_id']);
984 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
985 $ilCtrl->redirectByClass(array(
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'),
'ignore');
An exception for terminatinating execution or to throw for unit testing.
static getInstancesByUserId($a_user_id)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static encode($mixed, $suppress_native=false)
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static isActivated()
Checks whether Map feature is activated.
static getMapGUI()
Get an instance of the GUI class.
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...
Portfolio view gui class.
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
getPref($a_keyword)
get a user preference
static _isAnonymous($usr_id)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupType($a_id, $a_reference=false)
lookup object type
Access handler for portfolio.
GUI class for public user profile presentation.
setEmbedded($a_value, $a_offline=false)
setUserId($a_userid)
Set User ID.
deliverVCard()
Deliver vcard information.
setBackUrl($a_backurl)
Set Back Link URL.
setAdditional($a_additional)
Set Additonal Information.
getAdditional()
Get Additonal Information.
static validateUser($usrId)
Check if given user id is valid.
handleBackUrl($a_is_portfolio=false)
static getAutocompleteResult($a_field_id, $a_term)
getBackUrl()
Get Back Link URL.
getProfilePortfolio()
Check if current profile portfolio is accessible.
setCustomPrefs(array $a_prefs)
Set custom preferences for public profile fields.
getEmbeddable($a_add_goto=false)
get public profile html code
__construct($a_user_id=0)
Constructor.
getPublicPref(ilObjUser $a_user, $a_id)
Get user preference for public profile.
executeCommand()
Execute Command.
static findSkills($a_term)
Find skills.
special template class to simplify handling of ITX/PEAR
static _getInstance()
Get instance.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getWebspaceDir($mode="filesystem")
get webspace directory
static redirect($a_script)
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static signFile($path_to_file)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl