42 $ilCtrl =
$DIC[
'ilCtrl'];
44 $this->current_user =
$DIC->user();
46 $this->setting =
$DIC[
"ilSetting"];
54 $ilCtrl->saveParameter($this, array(
"user_id",
"back_url",
"user"));
55 if (
$_GET[
"back_url"] !=
"") {
59 $lng->loadLanguageModule(
"user");
69 $this->userid = $a_userid;
89 $this->additional = $a_additional;
111 $ilCtrl =
$DIC[
'ilCtrl'];
114 $parts = parse_url($a_backurl);
115 if ($parts[
"host"]) {
119 $this->backurl = $a_backurl;
120 $ilCtrl->setParameter($this,
"back_url", rawurlencode($a_backurl));
137 $ilMainMenu =
$DIC[
'ilMainMenu'];
138 $ilTabs =
$DIC[
'ilTabs'];
147 $back =
'ilias.php?baseClass=ilDashboardGUI';
150 if ((
bool) $a_is_portfolio) {
151 $ilMainMenu->setTopBarBack($back);
154 $ilTabs->clearTargets();
155 $ilTabs->setBackTarget(
169 $this->custom_prefs = $a_prefs;
183 if (!$this->custom_prefs) {
184 return $a_user->
getPref($a_id);
186 return $this->custom_prefs[$a_id];
192 $this->embedded = (bool) $a_value;
193 $this->offline = (bool) $a_offline;
202 $ilCtrl =
$DIC[
'ilCtrl'];
205 if (!self::validateUser($this->
getUserId())) {
208 $next_class = $ilCtrl->getNextClass($this);
209 $cmd = $ilCtrl->getCmd();
211 $tpl->loadStandardTemplate();
213 switch ($next_class) {
214 case "ilobjportfoliogui":
219 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
222 $gui->setPermaLink($this->
getUserId(),
"usr");
223 $ilCtrl->forwardCommand($gui);
227 case 'ilbuddysystemgui':
228 if (isset($_REQUEST[
'osd_id'])) {
229 require_once
'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
233 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
235 $ilCtrl->setReturn($this,
'view');
236 $ilCtrl->forwardCommand($gui);
239 $ret = $this->$cmd();
245 if (strtolower(
$_GET[
"baseClass"]) ==
"ilpublicuserprofilegui") {
246 $tpl->printToStdout();
266 $current = $user->getPref(
"public_profile");
268 if ($user->getPref(
"public_profile") ==
"g" && !
$setting->get(
'enable_global_profiles')) {
271 return in_array($current, [
"g",
"y"]);
280 $ilCtrl =
$DIC[
'ilCtrl'];
283 if ($this->embedded) {
290 if (!$user->getActive() ||
291 !$user->checkTimeLimit()) {
296 $ilCtrl->redirectByClass(
"ilobjportfoliogui",
"preview");
305 $current = $user->getPref(
"public_profile");
307 if ($user->getPref(
"public_profile") ==
"g" && !
$ilSetting->get(
'enable_global_profiles')) {
311 if ($current !=
"y" &&
312 ($current !=
"g" || !
$ilSetting->get(
'enable_global_profiles')) &&
313 !$this->custom_prefs) {
334 $ilCtrl =
$DIC[
'ilCtrl'];
346 "tpl.usr_public_profile.html",
353 $tpl->setVariable(
"ROWCOL1",
"tblrow1");
354 $tpl->setVariable(
"ROWCOL2",
"tblrow2");
357 $ref_url = str_replace(
"&",
"&", $this->
getBackUrl());
359 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
370 'rcp_to' => $user->getLogin()
373 } elseif ($user->getPref(
'public_profile') ===
'g' ||
374 (!
$ilUser->isAnonymous() && $user->getPref(
'public_profile') ===
'y') &&
375 $user->getPref(
'public_email') &&
376 $user->getEmail() !==
'') {
377 $mail_url =
'mailto:' . $user->getEmail();
380 if ($mail_url !==
'') {
381 $tpl->setCurrentBlock(
"mail");
382 $tpl->setVariable(
"TXT_MAIL",
$lng->txt(
"send_mail"));
383 $tpl->setVariable(
'HREF_MAIL', $mail_url);
384 $tpl->parseCurrentBlock();
391 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
398 $first_name .= $user->getUTitle() .
" ";
400 $first_name .= $user->getFirstName();
402 if ($this->
getPublicPref($user,
"public_gender") ==
"y" && in_array($user->getGender(), [
'm',
'f'])) {
403 $sal =
$lng->txt(
"salutation_" . $user->getGender()) .
" ";
404 $tpl->setVariable(
"SALUTATION", $sal);
407 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
408 $tpl->setVariable(
"FIRSTNAME", $first_name);
409 $tpl->setVariable(
"LASTNAME", $user->getLastName());
411 if ($user->getBirthday() &&
412 $this->getPublicPref($user,
"public_birthday") ==
"y") {
414 $tpl->setCurrentBlock(
"bday_bl");
415 $tpl->setVariable(
"TXT_BIRTHDAY",
$lng->txt(
"birthday"));
417 $tpl->parseCurrentBlock();
420 if (!$this->offline) {
422 $tpl->setCurrentBlock(
"vcard");
423 $tpl->setVariable(
"TXT_VCARD",
$lng->txt(
"vcard"));
424 $tpl->setVariable(
"TXT_DOWNLOAD_VCARD",
$lng->txt(
"vcard_download"));
425 $ilCtrl->setParameter($this,
"user_id", $this->
getUserId());
426 $tpl->setVariable(
"HREF_VCARD", $ilCtrl->getLinkTarget($this,
"deliverVCard"));
431 $random = new \ilRandom();
432 $imagefile = $webspace_dir .
"/usr_images/" . $user->getPref(
"profile_image") .
"?dummy=" . $random->int(1, 999999);
433 $check_file = $check_dir .
"/usr_images/" . $user->getPref(
"profile_image");
435 if (!@is_file($check_file)) {
436 $imagefile = $check_file =
439 if ($this->offline) {
440 $imagefile = basename($imagefile);
446 if ($this->
getPublicPref($user,
"public_upload") ==
"y" && $imagefile !=
"" &&
450 $tpl->setCurrentBlock(
"image");
451 $tpl->setVariable(
"TXT_IMAGE",
$lng->txt(
"image"));
452 $tpl->setVariable(
"IMAGE_PATH", $imagefile);
453 $tpl->setVariable(
"IMAGE_ALT",
$lng->txt(
"personal_picture"));
454 $tpl->parseCurrentBlock();
463 $val_arr = array(
"getStreet" =>
"street",
464 "getZipcode" =>
"zipcode",
466 "getCountry" =>
"country",
467 "getSelectedCountry" =>
"sel_country");
468 foreach ($val_arr as $key => $value) {
470 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
471 $address_value = $user->$key();
474 if (trim($address_value) !=
"") {
477 $address[0] = $address_value;
482 $address[1] .=
" " . $address_value;
486 $lng->loadLanguageModule(
"meta");
487 $address[2] =
$lng->txt(
"meta_c_" . $address_value);
491 $address[2] = $address_value;
497 if (
sizeof($address)) {
498 $tpl->setCurrentBlock(
"address_line");
499 foreach ($address as $line) {
501 $tpl->setVariable(
"TXT_ADDRESS_LINE", trim($line));
502 $tpl->parseCurrentBlock();
505 $tpl->setCurrentBlock(
"address");
506 $tpl->setVariable(
"TXT_ADDRESS",
$lng->txt(
"address"));
507 $tpl->parseCurrentBlock();
512 if ($this->
getPublicPref($user,
"public_org_units") ==
"y") {
513 $tpl->setCurrentBlock(
"org_units");
514 $tpl->setVariable(
"TXT_ORG_UNITS",
$lng->txt(
"objs_orgu"));
515 $tpl->setVariable(
"ORG_UNITS", $user->getOrgUnitsRepresentation());
516 $tpl->parseCurrentBlock();
520 if ($this->
getPublicPref($user,
"public_institution") ==
"y" ||
522 $tpl->setCurrentBlock(
"inst_dep");
524 if ($this->
getPublicPref($user,
"public_institution") ==
"y") {
525 $h =
$lng->txt(
"institution");
526 $v = $user->getInstitution();
529 if ($this->
getPublicPref($user,
"public_department") ==
"y") {
530 $h .= $sep .
$lng->txt(
"department");
531 $v .= $sep . $user->getDepartment();
533 $tpl->setVariable(
"TXT_INST_DEP", $h);
534 $tpl->setVariable(
"INST_DEP", $v);
535 $tpl->parseCurrentBlock();
540 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
541 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
"getSecondEmail" =>
"second_email");
543 foreach ($val_arr as $key => $value) {
545 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
546 $v .= $sep .
$lng->txt($value) .
": " . $user->$key();
551 $tpl->parseCurrentBlock(
"contact");
552 $tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"contact"));
553 $tpl->setVariable(
"CONTACT", $v);
554 $tpl->parseCurrentBlock();
559 "getHobby" =>
"hobby",
560 "getGeneralInterestsAsText" =>
"interests_general",
561 "getOfferingHelpAsText" =>
"interests_help_offered",
562 "getLookingForHelpAsText" =>
"interests_help_looking",
563 "getMatriculation" =>
"matriculation",
564 "getClientIP" =>
"client_ip");
566 foreach ($val_arr as $key => $value) {
568 if ($this->
getPublicPref($user,
"public_" . $value) ==
"y") {
569 $tpl->setCurrentBlock(
"profile_data");
570 $tpl->setVariable(
"TXT_DATA",
$lng->txt($value));
571 $tpl->setVariable(
"DATA", $user->$key());
572 $tpl->parseCurrentBlock();
577 include_once(
"./Services/Link/classes/class.ilLink.php");
578 include_once(
"./Modules/Portfolio/classes/class.ilObjPortfolio.php");
584 if (count($port) > 0) {
585 foreach ($port as $u) {
586 $tpl->setCurrentBlock(
"portfolio");
587 foreach ($u as $link => $title) {
589 $tpl->setVariable(
"HREF_PORTFOLIO", $link);
590 $tpl->setVariable(
"TITLE_PORTFOLIO", $title);
591 $tpl->parseCurrentBlock();
594 $tpl->setCurrentBlock(
"portfolios");
596 $lng->loadLanguageModule(
"prtf");
597 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"prtf_portfolios"));
599 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"portfolio"));
601 $tpl->parseCurrentBlock();
605 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
608 $user->getLatitude() !=
"") {
609 $tpl->setVariable(
"TXT_LOCATION",
$lng->txt(
"location"));
612 $map_gui->setMapId(
"user_map")
615 ->setLatitude($user->getLatitude())
616 ->setLongitude($user->getLongitude())
617 ->setZoom($user->getLocationZoom())
618 ->setEnableNavigationControl(
true)
619 ->addUserMarker($user->getId());
621 $tpl->setVariable(
"MAP_CONTENT", $map_gui->getHTML());
625 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
627 $user_defined_data = $user->getUserDefinedData();
628 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
630 if ($this->
getPublicPref($user,
"public_udf_" . $definition[
"field_id"]) ==
"y") {
631 if ($user_defined_data[
"f_" . $definition[
"field_id"]] !=
"") {
632 $tpl->setCurrentBlock(
"udf_data");
633 $tpl->setVariable(
"TXT_UDF_DATA", $definition[
"field_name"]);
634 $tpl->setVariable(
"UDF_DATA", $user_defined_data[
"f_" . $definition[
"field_id"]]);
635 $tpl->parseCurrentBlock();
644 $tpl->setCurrentBlock(
"profile_data");
645 $tpl->setVariable(
"TXT_DATA", $key);
646 $tpl->setVariable(
"DATA", $val);
647 $tpl->parseCurrentBlock();
656 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
658 $tpl->setVariable(
'BUDDY_HTML', $button->getHtml());
662 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
665 $has_public_badge =
false;
670 include_once
"Services/Badge/classes/class.ilBadgeRenderer.php";
671 foreach ($user_badges as $ass) {
673 if ($ass->getPosition()) {
680 $tpl->setCurrentBlock(
"badge_bl");
681 $tpl->setVariable(
"BADGE", $renderer->getHTML());
682 $tpl->parseCurrentBlock();
684 $tpl->setCurrentBlock(
"badge_hidden_item_bl");
685 $tpl->setVariable(
"BADGE_HIDDEN", $renderer->getHTML());
686 $tpl->parseCurrentBlock();
689 $has_public_badge =
true;
694 $lng->loadLanguageModule(
"badge");
695 $tpl->setVariable(
"BADGE_HIDDEN_TXT_MORE",
$lng->txt(
"badge_profile_more"));
696 $tpl->setVariable(
"BADGE_HIDDEN_TXT_LESS",
$lng->txt(
"badge_profile_less"));
697 $tpl->touchBlock(
"badge_js_bl");
700 if ($has_public_badge) {
701 $tpl->setVariable(
"TXT_BADGES",
$lng->txt(
"obj_bdga"));
709 $mtpl =
$DIC->ui()->mainTemplate();
711 $mtpl->setPermanentLink(
722 return $tpl->get() . $goto;
736 require_once
"./Services/User/classes/class.ilvCard.php";
740 if ($user->getPref(
"public_profile") !=
"y" &&
741 $user->getPref(
"public_profile") !=
"g" &&
742 $_GET[
"baseClass"] !=
"ilsharedresourceGUI" &&
743 $this->current_user->getId() != $this->getUserId()
748 $vcard->setName($user->getLastName(), $user->getFirstName(),
"", $user->getUTitle());
749 $vcard->setNickname($user->getLogin());
752 $imagefile = $webspace_dir .
"/usr_images/" . $user->getPref(
"profile_image");
753 if ($user->getPref(
"public_upload") ==
"y" && @is_file($imagefile)) {
754 $fh = fopen($imagefile,
"r");
756 $image = fread($fh, filesize($imagefile));
758 require_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
760 if (preg_match(
"/^image/", $mimetype)) {
763 $vcard->setPhoto($image,
$type);
767 $val_arr = array(
"getOrgUnitsRepresentation" =>
"org_units",
"getInstitution" =>
"institution",
768 "getDepartment" =>
"department",
"getStreet" =>
"street",
769 "getZipcode" =>
"zipcode",
"getCity" =>
"city",
"getCountry" =>
"country",
770 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
771 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
772 "getHobby" =>
"hobby",
"getMatriculation" =>
"matriculation",
773 "getClientIP" =>
"client_ip",
"dummy" =>
"location");
777 foreach ($val_arr as $key => $value) {
779 if ($user->getPref(
"public_" . $value) ==
"y") {
782 $org[0] = $user->$key();
785 $org[1] = $user->$key();
788 $adr[2] = $user->$key();
791 $adr[5] = $user->$key();
794 $adr[3] = $user->$key();
797 $adr[6] = $user->$key();
812 $vcard->setEmail($user->$key());
815 $vcard->setNote($user->$key());
818 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
825 $vcard->setOrganization(join(
";", $org));
828 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
844 $ilCtrl =
$DIC->ctrl();
852 if (strtolower($ilCtrl->getCmd()) == strtolower(
'approveContactRequest')) {
853 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
854 } elseif (strtolower($ilCtrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
855 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
858 if ($user->getPref(
"public_profile") !=
"g") {
860 if ($user->getPref(
"public_profile") ==
"y") {
861 $ilCtrl->redirectToURL(
"login.php?cmd=force_login&target=usr_" . $usrId);
877 $tpl->resetHeaderBlock();
879 include_once(
"./Services/User/classes/class.ilUserUtil.php");
893 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
896 include_once(
'./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
898 if ($access_handler->checkAccess(
"read",
"", $portfolio_id)) {
899 return $portfolio_id;
910 $multi_fields = array(
"interests_general",
"interests_help_offered",
"interests_help_looking");
911 if (in_array($a_field_id, $multi_fields) && $a_term) {
943 $field_id = (string) $_REQUEST[
"f"];
944 $term = (string) $_REQUEST[
"term"];
948 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
957 protected function approveContactRequest()
964 $ilCtrl =
$DIC[
'ilCtrl'];
966 if (isset($_REQUEST[
'osd_id'])) {
967 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $_REQUEST[
'osd_id']);
970 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
971 $ilCtrl->redirectByClass(array(
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'),
'link');
977 protected function ignoreContactRequest()
984 $ilCtrl =
$DIC[
'ilCtrl'];
986 if (isset($_REQUEST[
'osd_id'])) {
987 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $_REQUEST[
'osd_id']);
990 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
991 $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 getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
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, $html_export=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($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl