40 $this->current_user =
$DIC->user();
48 $ilCtrl->saveParameter($this, array(
"user_id",
"back_url",
"user"));
49 if (
$_GET[
"back_url"] !=
"") {
53 $lng->loadLanguageModule(
"user");
63 $this->userid = $a_userid;
83 $this->additional = $a_additional;
108 $parts = parse_url($a_backurl);
109 if ($parts[
"host"]) {
113 $this->backurl = $a_backurl;
114 $ilCtrl->setParameter($this,
"back_url", rawurlencode($a_backurl));
131 $ilMainMenu =
$DIC[
'ilMainMenu'];
132 $ilTabs =
$DIC[
'ilTabs'];
141 $back =
'ilias.php?baseClass=ilPersonalDesktopGUI';
144 if ((
bool) $a_is_portfolio) {
145 $ilMainMenu->setTopBarBack($back);
148 $ilTabs->clearTargets();
149 $ilTabs->setBackTarget(
163 $this->custom_prefs = $a_prefs;
177 if (!$this->custom_prefs) {
178 return $a_user->
getPref($a_id);
180 return $this->custom_prefs[$a_id];
186 $this->embedded = (bool) $a_value;
187 $this->offline = (bool) $a_offline;
200 if (!self::validateUser($this->
getUserId())) {
204 $next_class =
$ilCtrl->getNextClass($this);
207 $tpl->getStandardTemplate();
209 switch ($next_class) {
210 case "ilobjportfoliogui":
215 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
218 $gui->setPermaLink($this->
getUserId(),
"usr");
223 case 'ilbuddysystemgui':
224 if (isset($_REQUEST[
'osd_id'])) {
225 require_once
'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
229 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
231 $ilCtrl->setReturn($this,
'view');
235 $ret = $this->$cmd();
241 if (strtolower(
$_GET[
"baseClass"]) ==
"ilpublicuserprofilegui") {
264 if ($this->embedded) {
271 if (!
$user->getActive() ||
272 !
$user->checkTimeLimit()) {
277 $ilCtrl->redirectByClass(
"ilobjportfoliogui",
"preview");
289 if (
$user->getPref(
"public_profile") ==
"g" && !
$ilSetting->get(
'enable_global_profiles')) {
295 !$this->custom_prefs) {
328 "tpl.usr_public_profile.html",
334 $tpl->setVariable(
"ROWCOL1",
"tblrow1");
335 $tpl->setVariable(
"ROWCOL2",
"tblrow2");
337 if (!$this->offline &&
$ilUser->getId() != ANONYMOUS_USER_ID) {
338 $ref_url = str_replace(
"&",
"&", $this->
getBackUrl());
340 $ref_url = basename(
$_SERVER[
'REQUEST_URI']);
343 $tpl->setCurrentBlock(
"mail");
344 $tpl->setVariable(
"TXT_MAIL",
$lng->txt(
"send_mail"));
345 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
352 array(
'type' =>
'new',
'rcp_to' =>
$user->getLogin())
355 $tpl->parseCurrentBlock();
360 $first_name .=
$user->getUTitle() .
" ";
362 $first_name .=
$user->getFirstName();
365 $sal =
$lng->txt(
"salutation_" .
$user->getGender()) .
" ";
366 $tpl->setVariable(
"SALUTATION", $sal);
369 $tpl->setVariable(
"TXT_NAME",
$lng->txt(
"name"));
370 $tpl->setVariable(
"FIRSTNAME", $first_name);
371 $tpl->setVariable(
"LASTNAME",
$user->getLastName());
373 if (
$user->getBirthday() &&
374 $this->getPublicPref(
$user,
"public_birthday") ==
"y") {
376 $tpl->setCurrentBlock(
"bday_bl");
377 $tpl->setVariable(
"TXT_BIRTHDAY",
$lng->txt(
"birthday"));
379 $tpl->parseCurrentBlock();
382 if (!$this->offline) {
384 $tpl->setCurrentBlock(
"vcard");
385 $tpl->setVariable(
"TXT_VCARD",
$lng->txt(
"vcard"));
386 $tpl->setVariable(
"TXT_DOWNLOAD_VCARD",
$lng->txt(
"vcard_download"));
388 $tpl->setVariable(
"HREF_VCARD",
$ilCtrl->getLinkTarget($this,
"deliverVCard"));
393 $random = new \ilRandom();
394 $imagefile = $webspace_dir .
"/usr_images/" .
$user->getPref(
"profile_image") .
"?dummy=" . $random->int(1, 999999);
395 $check_file = $check_dir .
"/usr_images/" .
$user->getPref(
"profile_image");
397 if (!@is_file($check_file)) {
398 $imagefile = $check_file =
399 ilObjUser::_getPersonalPicturePath(
$user->getId(),
"small",
false,
true);
402 if ($this->offline) {
403 $imagefile = basename($imagefile);
409 (
$ilUser->getId() != ANONYMOUS_USER_ID ||
$user->getPref(
"public_profile") ==
"g")) {
412 $tpl->setCurrentBlock(
"image");
413 $tpl->setVariable(
"TXT_IMAGE",
$lng->txt(
"image"));
414 $tpl->setVariable(
"IMAGE_PATH", $imagefile);
415 $tpl->setVariable(
"IMAGE_ALT",
$lng->txt(
"personal_picture"));
416 $tpl->parseCurrentBlock();
425 $val_arr = array(
"getStreet" =>
"street",
426 "getZipcode" =>
"zipcode",
428 "getCountry" =>
"country",
429 "getSelectedCountry" =>
"sel_country");
430 foreach ($val_arr as
$key => $value) {
433 $address_value =
$user->$key();
436 if (trim($address_value) !=
"") {
439 $address[0] = $address_value;
444 $address[1] .=
" " . $address_value;
448 $lng->loadLanguageModule(
"meta");
449 $address[2] =
$lng->txt(
"meta_c_" . $address_value);
453 $address[2] = $address_value;
459 if (
sizeof($address)) {
460 $tpl->setCurrentBlock(
"address_line");
461 foreach ($address as $line) {
463 $tpl->setVariable(
"TXT_ADDRESS_LINE", trim($line));
464 $tpl->parseCurrentBlock();
467 $tpl->setCurrentBlock(
"address");
468 $tpl->setVariable(
"TXT_ADDRESS",
$lng->txt(
"address"));
469 $tpl->parseCurrentBlock();
475 $tpl->setCurrentBlock(
"org_units");
476 $tpl->setVariable(
"TXT_ORG_UNITS",
$lng->txt(
"objs_orgu"));
477 $tpl->setVariable(
"ORG_UNITS",
$user->getOrgUnitsRepresentation());
478 $tpl->parseCurrentBlock();
484 $tpl->setCurrentBlock(
"inst_dep");
487 $h =
$lng->txt(
"institution");
488 $v =
$user->getInstitution();
492 $h .= $sep .
$lng->txt(
"department");
493 $v .= $sep .
$user->getDepartment();
495 $tpl->setVariable(
"TXT_INST_DEP",
$h);
496 $tpl->setVariable(
"INST_DEP", $v);
497 $tpl->parseCurrentBlock();
502 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
503 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
"getSecondEmail" =>
"second_email");
505 foreach ($val_arr as
$key => $value) {
508 $v .= $sep .
$lng->txt($value) .
": " .
$user->$key();
513 $tpl->parseCurrentBlock(
"contact");
514 $tpl->setVariable(
"TXT_CONTACT",
$lng->txt(
"contact"));
515 $tpl->setVariable(
"CONTACT", $v);
516 $tpl->parseCurrentBlock();
521 "getHobby" =>
"hobby",
522 "getGeneralInterestsAsText" =>
"interests_general",
523 "getOfferingHelpAsText" =>
"interests_help_offered",
524 "getLookingForHelpAsText" =>
"interests_help_looking",
525 "getMatriculation" =>
"matriculation",
526 "getClientIP" =>
"client_ip");
528 foreach ($val_arr as
$key => $value) {
531 $tpl->setCurrentBlock(
"profile_data");
532 $tpl->setVariable(
"TXT_DATA",
$lng->txt($value));
533 $tpl->setVariable(
"DATA",
$user->$key());
534 $tpl->parseCurrentBlock();
539 include_once(
"./Services/Link/classes/class.ilLink.php");
540 include_once(
"./Modules/Portfolio/classes/class.ilObjPortfolio.php");
546 if (count($port) > 0) {
547 foreach ($port as $u) {
548 $tpl->setCurrentBlock(
"portfolio");
549 foreach ($u as $link =>
$title) {
551 $tpl->setVariable(
"HREF_PORTFOLIO", $link);
553 $tpl->parseCurrentBlock();
556 $tpl->setCurrentBlock(
"portfolios");
558 $lng->loadLanguageModule(
"prtf");
559 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"prtf_portfolios"));
561 $tpl->setVariable(
"TXT_PORTFOLIO",
$lng->txt(
"portfolio"));
563 $tpl->parseCurrentBlock();
567 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
570 $user->getLatitude() !=
"") {
571 $tpl->setVariable(
"TXT_LOCATION",
$lng->txt(
"location"));
574 $map_gui->setMapId(
"user_map")
577 ->setLatitude(
$user->getLatitude())
578 ->setLongitude(
$user->getLongitude())
579 ->setZoom(
$user->getLocationZoom())
580 ->setEnableNavigationControl(
true)
581 ->addUserMarker(
$user->getId());
583 $tpl->setVariable(
"MAP_CONTENT", $map_gui->getHTML());
587 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
589 $user_defined_data =
$user->getUserDefinedData();
590 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
593 if ($user_defined_data[
"f_" . $definition[
"field_id"]] !=
"") {
594 $tpl->setCurrentBlock(
"udf_data");
595 $tpl->setVariable(
"TXT_UDF_DATA", $definition[
"field_name"]);
596 $tpl->setVariable(
"UDF_DATA", $user_defined_data[
"f_" . $definition[
"field_id"]]);
597 $tpl->parseCurrentBlock();
606 $tpl->setCurrentBlock(
"profile_data");
607 $tpl->setVariable(
"TXT_DATA",
$key);
608 $tpl->setVariable(
"DATA", $val);
609 $tpl->parseCurrentBlock();
618 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
620 $tpl->setVariable(
'BUDDY_HTML', $button->getHtml());
624 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
627 $has_public_badge =
false;
632 include_once
"Services/Badge/classes/class.ilBadgeRenderer.php";
633 foreach ($user_badges as $ass) {
635 if ($ass->getPosition()) {
642 $tpl->setCurrentBlock(
"badge_bl");
643 $tpl->setVariable(
"BADGE", $renderer->getHTML());
644 $tpl->parseCurrentBlock();
646 $tpl->setCurrentBlock(
"badge_hidden_item_bl");
647 $tpl->setVariable(
"BADGE_HIDDEN", $renderer->getHTML());
648 $tpl->parseCurrentBlock();
651 $has_public_badge =
true;
656 $lng->loadLanguageModule(
"badge");
657 $tpl->setVariable(
"BADGE_HIDDEN_TXT_MORE",
$lng->txt(
"badge_profile_more"));
658 $tpl->setVariable(
"BADGE_HIDDEN_TXT_LESS",
$lng->txt(
"badge_profile_less"));
659 $tpl->touchBlock(
"badge_js_bl");
662 if ($has_public_badge) {
663 $tpl->setVariable(
"TXT_BADGES",
$lng->txt(
"obj_bdga"));
669 include_once(
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
671 $goto = $goto->getHTML();
674 return $tpl->get() . $goto;
688 require_once
"./Services/User/classes/class.ilvCard.php";
692 if (
$user->getPref(
"public_profile") !=
"y" &&
693 $user->getPref(
"public_profile") !=
"g" &&
694 $_GET[
"baseClass"] !=
"ilsharedresourceGUI" &&
695 $this->current_user->getId() != $this->getUserId()
700 $vcard->setName(
$user->getLastName(),
$user->getFirstName(),
"",
$user->getUTitle());
701 $vcard->setNickname(
$user->getLogin());
704 $imagefile = $webspace_dir .
"/usr_images/" .
$user->getPref(
"profile_image");
705 if (
$user->getPref(
"public_upload") ==
"y" && @is_file($imagefile)) {
706 $fh = fopen($imagefile,
"r");
708 $image = fread($fh, filesize($imagefile));
710 require_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
712 if (preg_match(
"/^image/", $mimetype)) {
715 $vcard->setPhoto($image,
$type);
719 $val_arr = array(
"getOrgUnitsRepresentation" =>
"org_units",
"getInstitution" =>
"institution",
720 "getDepartment" =>
"department",
"getStreet" =>
"street",
721 "getZipcode" =>
"zipcode",
"getCity" =>
"city",
"getCountry" =>
"country",
722 "getPhoneOffice" =>
"phone_office",
"getPhoneHome" =>
"phone_home",
723 "getPhoneMobile" =>
"phone_mobile",
"getFax" =>
"fax",
"getEmail" =>
"email",
724 "getHobby" =>
"hobby",
"getMatriculation" =>
"matriculation",
725 "getClientIP" =>
"client_ip",
"dummy" =>
"location");
729 foreach ($val_arr as
$key => $value) {
731 if (
$user->getPref(
"public_" . $value) ==
"y") {
734 $org[0] =
$user->$key();
737 $org[1] =
$user->$key();
740 $adr[2] =
$user->$key();
743 $adr[5] =
$user->$key();
746 $adr[3] =
$user->$key();
749 $adr[6] =
$user->$key();
764 $vcard->setEmail(
$user->$key());
767 $vcard->setNote(
$user->$key());
770 $vcard->setPosition(
$user->getLatitude(),
$user->getLongitude());
777 $vcard->setOrganization(join(
";", $org));
780 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
805 if (strtolower(
$ilCtrl->getCmd()) == strtolower(
'approveContactRequest')) {
806 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_approved');
807 } elseif (strtolower(
$ilCtrl->getCmd()) == strtolower(
'ignoreContactRequest')) {
808 $ilCtrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . $usrId .
'_contact_ignored');
811 if (
$user->getPref(
"public_profile") !=
"g") {
813 if (
$user->getPref(
"public_profile") ==
"y") {
814 $ilCtrl->redirectToURL(
"login.php?cmd=force_login&target=usr_" . $usrId);
830 $tpl->resetHeaderBlock();
832 include_once(
"./Services/User/classes/class.ilUserUtil.php");
834 $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->
getUserId(),
"xsmall"));
846 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
849 include_once(
'./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
851 if ($access_handler->checkAccess(
"read",
"", $portfolio_id)) {
852 return $portfolio_id;
863 $multi_fields = array(
"interests_general",
"interests_help_offered",
"interests_help_looking");
864 if (in_array($a_field_id, $multi_fields) && $a_term) {
876 $result[$cnt] =
new stdClass();
883 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
885 $result[$cnt] =
new stdClass();
897 $field_id = (string) $_REQUEST[
"f"];
898 $term = (string) $_REQUEST[
"term"];
902 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
911 protected function approveContactRequest()
920 if (isset($_REQUEST[
'osd_id'])) {
921 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $_REQUEST[
'osd_id']);
924 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
925 $ilCtrl->redirectByClass(array(
'ilPublicUserProfileGUI',
'ilBuddySystemGUI'),
'link');
931 protected function ignoreContactRequest()
940 if (isset($_REQUEST[
'osd_id'])) {
941 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'osd_id', $_REQUEST[
'osd_id']);
944 $ilCtrl->setParameterByClass(
'ilBuddySystemGUI',
'user_id', $this->
getUserId());
945 $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 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
Class for permanent links.
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($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']