ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPublicUserProfileGUI Class Reference

GUI class for public user profile presentation. More...

+ Collaboration diagram for ilPublicUserProfileGUI:

Public Member Functions

 __construct ($a_user_id=0)
 Constructor. More...
 
 setUserId ($a_userid)
 Set User ID. More...
 
 getUserId ()
 Get User ID. More...
 
 setAdditional ($a_additional)
 Set Additonal Information. More...
 
 getAdditional ()
 Get Additonal Information. More...
 
 setBackUrl ($a_backurl)
 Set Back Link URL. More...
 
 getBackUrl ()
 Get Back Link URL. More...
 
 setCustomPrefs (array $a_prefs)
 Set custom preferences for public profile fields. More...
 
 setEmbedded ($a_value, $a_offline=false)
 
 executeCommand ()
 Execute Command. More...
 
 view ()
 View. More...
 
 getHTML ()
 Show user page. More...
 
 getEmbeddable ($a_add_goto=false)
 get public profile html code More...
 
 deliverVCard ()
 Deliver vcard information. More...
 
 renderTitle ()
 

Static Public Member Functions

static getAutocompleteResult ($a_field_id, $a_term)
 

Protected Member Functions

 handleBackUrl ($a_is_portfolio=false)
 
 getPublicPref (ilObjUser $a_user, $a_id)
 Get user preference for public profile. More...
 
 getProfilePortfolio ()
 Check if current profile portfolio is accessible. More...
 
 doProfileAutoComplete ()
 

Static Protected Member Functions

static validateUser ($usrId)
 Check if given user id is valid. More...
 

Protected Attributes

 $userid
 
 $portfolioid
 
 $backurl
 
 $additional
 
 $embedded
 
 $custom_prefs
 

Detailed Description

GUI class for public user profile presentation.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilPublicUserProfileGUI: ilObjPortfolioGUI

Definition at line 14 of file class.ilPublicUserProfileGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPublicUserProfileGUI::__construct (   $a_user_id = 0)

Constructor.

Parameters
intUser ID.

Definition at line 28 of file class.ilPublicUserProfileGUI.php.

29 {
30 global $ilCtrl, $lng;
31
32 if ($a_user_id) {
33 $this->setUserId($a_user_id);
34 } else {
35 $this->setUserId((int) $_GET["user_id"]);
36 }
37
38 $ilCtrl->saveParameter($this, array("user_id","back_url", "user"));
39 if ($_GET["back_url"] != "") {
40 $this->setBackUrl($_GET["back_url"]);
41 }
42
43 $lng->loadLanguageModule("user");
44 }
$_GET["client_id"]
setBackUrl($a_backurl)
Set Back Link URL.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17

References $_GET, $ilCtrl, $lng, setBackUrl(), and setUserId().

+ Here is the call graph for this function:

Member Function Documentation

◆ deliverVCard()

ilPublicUserProfileGUI::deliverVCard ( )

Deliver vcard information.

Definition at line 649 of file class.ilPublicUserProfileGUI.php.

650 {
651 // get user object
652 if (!ilObject::_exists($this->getUserId())) {
653 return "";
654 }
655 $user = new ilObjUser($this->getUserId());
656
657 require_once "./Services/User/classes/class.ilvCard.php";
658 $vcard = new ilvCard();
659
660 // ilsharedresourceGUI: embedded in shared portfolio
661 if ($user->getPref("public_profile") != "y" &&
662 $user->getPref("public_profile") != "g" &&
663 $_GET["baseClass"] != "ilsharedresourceGUI") {
664 return;
665 }
666
667 $vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
668 $vcard->setNickname($user->getLogin());
669
670 $webspace_dir = ilUtil::getWebspaceDir("output");
671 $imagefile = $webspace_dir . "/usr_images/" . $user->getPref("profile_image");
672 if ($user->getPref("public_upload")=="y" && @is_file($imagefile)) {
673 $fh = fopen($imagefile, "r");
674 if ($fh) {
675 $image = fread($fh, filesize($imagefile));
676 fclose($fh);
677 require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
678 $mimetype = ilObjMediaObject::getMimeType($imagefile);
679 if (preg_match("/^image/", $mimetype)) {
680 $type = $mimetype;
681 }
682 $vcard->setPhoto($image, $type);
683 }
684 }
685
686 $val_arr = array("getOrgUnitsRepresentation" => "org_units", "getInstitution" => "institution",
687 "getDepartment" => "department", "getStreet" => "street",
688 "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country",
689 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
690 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
691 "getHobby" => "hobby", "getMatriculation" => "matriculation",
692 "getClientIP" => "client_ip", "dummy" => "location");
693
694 $org = array();
695 $adr = array();
696 foreach ($val_arr as $key => $value) {
697 // if value "y" show information
698 if ($user->getPref("public_" . $value) == "y") {
699 switch ($value) {
700 case "institution":
701 $org[0] = $user->$key();
702 break;
703 case "department":
704 $org[1] = $user->$key();
705 break;
706 case "street":
707 $adr[2] = $user->$key();
708 break;
709 case "zipcode":
710 $adr[5] = $user->$key();
711 break;
712 case "city":
713 $adr[3] = $user->$key();
714 break;
715 case "country":
716 $adr[6] = $user->$key();
717 break;
718 case "phone_office":
719 $vcard->setPhone($user->$key(), TEL_TYPE_WORK);
720 break;
721 case "phone_home":
722 $vcard->setPhone($user->$key(), TEL_TYPE_HOME);
723 break;
724 case "phone_mobile":
725 $vcard->setPhone($user->$key(), TEL_TYPE_CELL);
726 break;
727 case "fax":
728 $vcard->setPhone($user->$key(), TEL_TYPE_FAX);
729 break;
730 case "email":
731 $vcard->setEmail($user->$key());
732 break;
733 case "hobby":
734 $vcard->setNote($user->$key());
735 break;
736 case "location":
737 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
738 break;
739 }
740 }
741 }
742
743 if (count($org)) {
744 $vcard->setOrganization(join(";", $org));
745 }
746 if (count($adr)) {
747 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
748 }
749
750 ilUtil::deliverData($vcard->buildVCard(), $vcard->getFilename(), $vcard->getMimetype());
751 }
const TEL_TYPE_HOME
const TEL_TYPE_FAX
const TEL_TYPE_CELL
const TEL_TYPE_WORK
static getMimeType($a_file, $a_external=null)
get mime type for file
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static getWebspaceDir($mode="filesystem")
get webspace directory
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
$key
Definition: croninfo.php:18
$type

References $_GET, $fh, $key, $type, ilObject\_exists(), ilUtil\deliverData(), ilObjMediaObject\getMimeType(), getUserId(), ilUtil\getWebspaceDir(), TEL_TYPE_CELL, TEL_TYPE_FAX, TEL_TYPE_HOME, and TEL_TYPE_WORK.

+ Here is the call graph for this function:

◆ doProfileAutoComplete()

ilPublicUserProfileGUI::doProfileAutoComplete ( )
protected

Definition at line 858 of file class.ilPublicUserProfileGUI.php.

859 {
860 $field_id = (string) $_REQUEST["f"];
861 $term = (string) $_REQUEST["term"];
862
863 $result = self::getAutocompleteResult($field_id, $term);
864
865 include_once 'Services/JSON/classes/class.ilJsonUtil.php';
867
868 exit();
869 }
$result
static encode($mixed, $suppress_native=false)
static getAutocompleteResult($a_field_id, $a_term)

References $result, ilJsonUtil\encode(), exit, and getAutocompleteResult().

+ Here is the call graph for this function:

◆ executeCommand()

ilPublicUserProfileGUI::executeCommand ( )

Execute Command.

Definition at line 177 of file class.ilPublicUserProfileGUI.php.

178 {
179 global $ilCtrl, $tpl;
180
181 if (!self::validateUser($this->getUserId())) {
182 return;
183 }
184
185 $next_class = $ilCtrl->getNextClass($this);
186 $cmd = $ilCtrl->getCmd();
187
188 $tpl->getStandardTemplate();
189
190 switch ($next_class) {
191 case "ilobjportfoliogui":
192 $portfolio_id = $this->getProfilePortfolio();
193 if ($portfolio_id) {
194 $this->handleBackUrl(true);
195
196 include_once "Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
197 $gui = new ilObjPortfolioGUI($portfolio_id); // #11876
198 $gui->setAdditional($this->getAdditional());
199 $gui->setPermaLink($this->getUserId(), "usr");
200 $ilCtrl->forwardCommand($gui);
201 break;
202 }
203 // no break
204 case 'ilbuddysystemgui':
205 if (isset($_REQUEST['osd_id'])) {
206 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
208 }
209
210 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
211 $gui = new ilBuddySystemGUI();
212 $ilCtrl->setReturn($this, 'view');
213 $ilCtrl->forwardCommand($gui);
214 break;
215 default:
216 $ret = $this->$cmd();
217 $tpl->setContent($ret);
218 break;
219 }
220
221 // only for direct links
222 if (strtolower($_GET["baseClass"]) == "ilpublicuserprofilegui") {
223 $tpl->show();
224 }
225 }
$tpl
Definition: ilias.php:10
Class ilBuddySystemGUI.
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.
getAdditional()
Get Additonal Information.
handleBackUrl($a_is_portfolio=false)
getProfilePortfolio()
Check if current profile portfolio is accessible.
$ret
Definition: parser.php:6

References $_GET, $ilCtrl, $ret, $tpl, getAdditional(), getProfilePortfolio(), getUserId(), handleBackUrl(), and ilNotificationOSDHandler\removeNotification().

+ Here is the call graph for this function:

◆ getAdditional()

ilPublicUserProfileGUI::getAdditional ( )

Get Additonal Information.

Returns
array Additonal Information

Definition at line 81 of file class.ilPublicUserProfileGUI.php.

References $additional.

Referenced by executeCommand(), and getEmbeddable().

+ Here is the caller graph for this function:

◆ getAutocompleteResult()

static ilPublicUserProfileGUI::getAutocompleteResult (   $a_field_id,
  $a_term 
)
static

Definition at line 822 of file class.ilPublicUserProfileGUI.php.

823 {
824 global $ilUser;
825
826 $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
827 if (in_array($a_field_id, $multi_fields) && $a_term) {
828 // registration has no current user
829 $user_id = null;
830 if ($ilUser && $ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) {
831 $user_id = $ilUser->getId();
832 }
833
834 $result = array();
835 $cnt = 0;
836
837 // term is searched in ALL interest fields, no distinction
838 foreach (ilObjUser::findInterests($a_term, $ilUser->getId()) as $item) {
839 $result[$cnt] = new stdClass();
840 $result[$cnt]->value = $item;
841 $result[$cnt]->label = $item;
842 $cnt++;
843 }
844
845 // :TODO: search in skill data
846 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
847 foreach (ilSkillTreeNode::findSkills($a_term) as $skill) {
848 $result[$cnt] = new stdClass();
849 $result[$cnt]->value = $skill;
850 $result[$cnt]->label = $skill;
851 $cnt++;
852 }
853 }
854
855 return $result;
856 }
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
static findSkills($a_term)
Find skills.
$ilUser
Definition: imgupload.php:18

References $ilUser, $result, ilObjUser\findInterests(), and ilSkillTreeNode\findSkills().

Referenced by ilAccountRegistrationGUI\doProfileAutoComplete(), and doProfileAutoComplete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBackUrl()

ilPublicUserProfileGUI::getBackUrl ( )

Get Back Link URL.

Returns
string Back Link URL

Definition at line 110 of file class.ilPublicUserProfileGUI.php.

References $backurl.

Referenced by getEmbeddable(), and handleBackUrl().

+ Here is the caller graph for this function:

◆ getEmbeddable()

ilPublicUserProfileGUI::getEmbeddable (   $a_add_goto = false)

get public profile html code

Used in Personal Profile (as preview) and Portfolio (as page block)

Definition at line 288 of file class.ilPublicUserProfileGUI.php.

289 {
291
292 // get user object
293 if (!ilObject::_exists($this->getUserId())) {
294 return "";
295 }
296 $user = new ilObjUser($this->getUserId());
297
298 $tpl = new ilTemplate(
299 "tpl.usr_public_profile.html",
300 true,
301 true,
302 "Services/User"
303 );
304
305 $tpl->setVariable("ROWCOL1", "tblrow1");
306 $tpl->setVariable("ROWCOL2", "tblrow2");
307
308 if (!$this->offline && $ilUser->getId() != ANONYMOUS_USER_ID) {
309 $ref_url = str_replace("&", "&", $this->getBackUrl());
310 if (!$ref_url) {
311 $ref_url = basename($_SERVER['REQUEST_URI']);
312 }
313
314 $tpl->setCurrentBlock("mail");
315 $tpl->setVariable("TXT_MAIL", $lng->txt("send_mail"));
316 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
317 $tpl->setVariable(
318 'HREF_MAIL',
320 $ref_url,
321 '',
322 array(),
323 array('type' => 'new', 'rcp_to' => $user->getLogin())
324 )
325 );
326 $tpl->parseCurrentBlock();
327 }
328
329 $first_name = "";
330 if ($this->getPublicPref($user, "public_title") == "y") {
331 $first_name .= $user->getUTitle() . " ";
332 }
333 $first_name .= $user->getFirstName();
334
335 if ($this->getPublicPref($user, "public_gender") == "y") {
336 $sal = $lng->txt("salutation_" . $user->getGender()) . " ";
337 $tpl->setVariable("SALUTATION", $sal);
338 }
339
340 $tpl->setVariable("TXT_NAME", $lng->txt("name"));
341 $tpl->setVariable("FIRSTNAME", $first_name);
342 $tpl->setVariable("LASTNAME", $user->getLastName());
343
344 if ($user->getBirthday() &&
345 $this->getPublicPref($user, "public_birthday") == "y") {
346 // #17574
347 $tpl->setCurrentBlock("bday_bl");
348 $tpl->setVariable("TXT_BIRTHDAY", $lng->txt("birthday"));
349 $tpl->setVariable("VAL_BIRTHDAY", ilDatePresentation::formatDate(new ilDate($user->getBirthday(), IL_CAL_DATE)));
350 $tpl->parseCurrentBlock();
351 }
352
353 if (!$this->offline) {
354 // vcard
355 $tpl->setCurrentBlock("vcard");
356 $tpl->setVariable("TXT_VCARD", $lng->txt("vcard"));
357 $tpl->setVariable("TXT_DOWNLOAD_VCARD", $lng->txt("vcard_download"));
358 $ilCtrl->setParameter($this, "user", $this->getUserId());
359 $tpl->setVariable("HREF_VCARD", $ilCtrl->getLinkTarget($this, "deliverVCard"));
360 }
361
362 $webspace_dir = ilUtil::getWebspaceDir("user");
363 $check_dir = ilUtil::getWebspaceDir();
364 $random = new \ilRandom();
365 $imagefile = $webspace_dir . "/usr_images/" . $user->getPref("profile_image") . "?dummy=" . $random->int(1, 999999);
366 $check_file = $check_dir . "/usr_images/" . $user->getPref("profile_image");
367
368 if (!@is_file($check_file)) {
369 $imagefile = $check_file =
370 ilObjUser::_getPersonalPicturePath($user->getId(), "small", false, true);
371 }
372
373 if ($this->offline) {
374 $imagefile = basename($imagefile);
375 }
376
377 if ($this->getPublicPref($user, "public_upload")=="y" && $imagefile != "" &&
378 ($ilUser->getId() != ANONYMOUS_USER_ID || $user->getPref("public_profile") == "g")) {
379 //Getting the flexible path of image form ini file
380 //$webspace_dir = ilUtil::getWebspaceDir("output");
381 $tpl->setCurrentBlock("image");
382 $tpl->setVariable("TXT_IMAGE", $lng->txt("image"));
383 $tpl->setVariable("IMAGE_PATH", $imagefile);
384 $tpl->setVariable("IMAGE_ALT", $lng->txt("personal_picture"));
385 $tpl->parseCurrentBlock();
386 }
387
388 // address
389 if ($this->getPublicPref($user, "public_street") == "y" ||
390 $this->getPublicPref($user, "public_zipcode") == "y" ||
391 $this->getPublicPref($user, "public_city") == "y" ||
392 $this->getPublicPref($user, "public_country") == "y") {
393 $address = array();
394 $val_arr = array("getStreet" => "street",
395 "getZipcode" => "zipcode",
396 "getCity" => "city",
397 "getCountry" => "country",
398 "getSelectedCountry" => "sel_country");
399 foreach ($val_arr as $key => $value) {
400 // if value "y" show information
401 if ($this->getPublicPref($user, "public_" . $value) == "y") {
402 $address_value = $user->$key();
403
404 // only if set
405 if (trim($address_value) != "") {
406 switch ($value) {
407 case "street":
408 $address[0] = $address_value;
409 break;
410
411 case "zipcode":
412 case "city":
413 $address[1] .= " " . $address_value;
414 break;
415
416 case "sel_country":
417 $lng->loadLanguageModule("meta");
418 $address[2] = $lng->txt("meta_c_" . $address_value);
419 break;
420
421 case "country":
422 $address[2] = $address_value;
423 break;
424 }
425 }
426 }
427 }
428 if (sizeof($address)) {
429 $tpl->setCurrentBlock("address_line");
430 foreach ($address as $line) {
431 if (trim($line)) {
432 $tpl->setVariable("TXT_ADDRESS_LINE", trim($line));
433 $tpl->parseCurrentBlock();
434 }
435 }
436 $tpl->setCurrentBlock("address");
437 $tpl->setVariable("TXT_ADDRESS", $lng->txt("address"));
438 $tpl->parseCurrentBlock();
439 }
440 }
441
442 // if value "y" show information
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();
448 }
449
450 // institution / department
451 if ($this->getPublicPref($user, "public_institution") == "y" ||
452 $this->getPublicPref($user, "public_department") == "y") {
453 $tpl->setCurrentBlock("inst_dep");
454 $sep = "";
455 if ($this->getPublicPref($user, "public_institution") == "y") {
456 $h = $lng->txt("institution");
457 $v = $user->getInstitution();
458 $sep = " / ";
459 }
460 if ($this->getPublicPref($user, "public_department") == "y") {
461 $h.= $sep . $lng->txt("department");
462 $v.= $sep . $user->getDepartment();
463 }
464 $tpl->setVariable("TXT_INST_DEP", $h);
465 $tpl->setVariable("INST_DEP", $v);
466 $tpl->parseCurrentBlock();
467 }
468
469 // contact
470 $val_arr = array(
471 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
472 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email", "getSecondEmail" => "second_email");
473 $v = $sep = "";
474 foreach ($val_arr as $key => $value) {
475 // if value "y" show information
476 if ($this->getPublicPref($user, "public_" . $value) == "y") {
477 $v.= $sep . $lng->txt($value) . ": " . $user->$key();
478 $sep = "<br />";
479 }
480 }
481 if ($v != "") {
482 $tpl->parseCurrentBlock("contact");
483 $tpl->setVariable("TXT_CONTACT", $lng->txt("contact"));
484 $tpl->setVariable("CONTACT", $v);
485 $tpl->parseCurrentBlock();
486 }
487
488
489 $val_arr = array(
490 "getHobby" => "hobby",
491 "getGeneralInterestsAsText" => "interests_general",
492 "getOfferingHelpAsText" => "interests_help_offered",
493 "getLookingForHelpAsText" => "interests_help_looking",
494 "getMatriculation" => "matriculation",
495 "getClientIP" => "client_ip");
496
497 foreach ($val_arr as $key => $value) {
498 // if value "y" show information
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();
504 }
505 }
506
507 // portfolios
508 include_once("./Services/Link/classes/class.ilLink.php");
509 include_once("./Modules/Portfolio/classes/class.ilObjPortfolio.php");
510 $back = ($this->getBackUrl() != "")
511 ? $this->getBackUrl()
512 : ilLink::_getStaticLink($this->getUserId(), "usr", true);
514 $cnt=0;
515 if (count($port) > 0) {
516 foreach ($port as $u) {
517 $tpl->setCurrentBlock("portfolio");
518 foreach ($u as $link => $title) {
519 $cnt++;
520 $tpl->setVariable("HREF_PORTFOLIO", $link);
521 $tpl->setVariable("TITLE_PORTFOLIO", $title);
522 $tpl->parseCurrentBlock();
523 }
524 }
525 $tpl->setCurrentBlock("portfolios");
526 if ($cnt > 1) {
527 $lng->loadLanguageModule("prtf");
528 $tpl->setVariable("TXT_PORTFOLIO", $lng->txt("prtf_portfolios"));
529 } else {
530 $tpl->setVariable("TXT_PORTFOLIO", $lng->txt("portfolio"));
531 }
532 $tpl->parseCurrentBlock();
533 }
534
535 // map
536 include_once("./Services/Maps/classes/class.ilMapUtil.php");
538 $this->getPublicPref($user, "public_location") == "y" &&
539 $user->getLatitude() != "") {
540 $tpl->setVariable("TXT_LOCATION", $lng->txt("location"));
541
542 $map_gui = ilMapUtil::getMapGUI();
543 $map_gui->setMapId("user_map")
544 ->setWidth("350px")
545 ->setHeight("230px")
546 ->setLatitude($user->getLatitude())
547 ->setLongitude($user->getLongitude())
548 ->setZoom($user->getLocationZoom())
549 ->setEnableNavigationControl(true)
550 ->addUserMarker($user->getId());
551
552 $tpl->setVariable("MAP_CONTENT", $map_gui->getHTML());
553 }
554
555 // additional defined user data fields
556 include_once './Services/User/classes/class.ilUserDefinedFields.php';
557 $this->user_defined_fields =&ilUserDefinedFields::_getInstance();
558 $user_defined_data = $user->getUserDefinedData();
559 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
560 // public setting
561 if ($this->getPublicPref($user, "public_udf_" . $definition["field_id"]) == "y") {
562 if ($user_defined_data["f_" . $definition["field_id"]] != "") {
563 $tpl->setCurrentBlock("udf_data");
564 $tpl->setVariable("TXT_UDF_DATA", $definition["field_name"]);
565 $tpl->setVariable("UDF_DATA", $user_defined_data["f_" . $definition["field_id"]]);
566 $tpl->parseCurrentBlock();
567 }
568 }
569 }
570
571 // additional information
572 $additional = $this->getAdditional();
573 if (is_array($additional)) {
574 foreach ($additional as $key => $val) {
575 $tpl->setCurrentBlock("profile_data");
576 $tpl->setVariable("TXT_DATA", $key);
577 $tpl->setVariable("DATA", $val);
578 $tpl->parseCurrentBlock();
579 }
580 }
581
582 if (
583 $this->getUserId() != $ilUser->getId() &&
584 !$ilUser->isAnonymous() &&
585 !ilObjUser::_isAnonymous($this->getUserId())
586 ) {
587 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
588 $button = ilBuddySystemLinkButton::getInstanceByUserId($user->getId());
589 $tpl->setVariable('BUDDY_HTML', $button->getHtml());
590 }
591
592 // badges
593 include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
594 $user_badges = ilBadgeAssignment::getInstancesByUserId($user->getId());
595 if ($user_badges) {
596 $has_public_badge = false;
597 $cnt = 0;
598
599 $cut = 20;
600
601 include_once "Services/Badge/classes/class.ilBadgeRenderer.php";
602 foreach ($user_badges as $ass) {
603 // only active
604 if ($ass->getPosition()) {
605 $cnt++;
606
607 $renderer = new ilBadgeRenderer($ass);
608
609 // limit to 20, [MORE] link
610 if ($cnt <= $cut) {
611 $tpl->setCurrentBlock("badge_bl");
612 $tpl->setVariable("BADGE", $renderer->getHTML());
613 $tpl->parseCurrentBlock();
614 } else {
615 $tpl->setCurrentBlock("badge_hidden_item_bl");
616 $tpl->setVariable("BADGE_HIDDEN", $renderer->getHTML());
617 $tpl->parseCurrentBlock();
618 }
619
620 $has_public_badge = true;
621 }
622 }
623
624 if ($cnt > $cut) {
625 $lng->loadLanguageModule("badge");
626 $tpl->setVariable("BADGE_HIDDEN_TXT_MORE", $lng->txt("badge_profile_more"));
627 $tpl->setVariable("BADGE_HIDDEN_TXT_LESS", $lng->txt("badge_profile_less"));
628 $tpl->touchBlock("badge_js_bl");
629 }
630
631 if ($has_public_badge) {
632 $tpl->setVariable("TXT_BADGES", $lng->txt("obj_bdga"));
633 }
634 }
635
636 $goto = "";
637 if ($a_add_goto) {
638 include_once('Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
639 $goto = new ilPermanentLinkGUI("usr", $user->getId());
640 $goto = $goto->getHTML();
641 }
642
643 return $tpl->get() . $goto;
644 }
const IL_CAL_DATE
static getInstancesByUserId($a_user_id)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
Class for single dates.
static getLinkTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), $context_params=array())
static isActivated()
Checks whether Map feature is activated.
static getMapGUI()
Get an instance of the GUI class.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
static _isAnonymous($usr_id)
Class for permanent links.
getPublicPref(ilObjUser $a_user, $a_id)
Get user preference for public profile.
special template class to simplify handling of ITX/PEAR
static _getInstance()
Get instance.
$h
global $ilSetting
Definition: privfeed.php:17
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, $additional, $h, $ilCtrl, $ilSetting, $ilUser, $key, $lng, $title, $tpl, ilObject\_exists(), ilUserDefinedFields\_getInstance(), ilLink\_getStaticLink(), ilObjUser\_isAnonymous(), ilDatePresentation\formatDate(), getAdditional(), ilObjPortfolio\getAvailablePortfolioLinksForUserIds(), getBackUrl(), ilBuddySystemLinkButton\getInstanceByUserId(), ilBadgeAssignment\getInstancesByUserId(), ilMailFormCall\getLinkTarget(), ilMapUtil\getMapGUI(), getPublicPref(), getUserId(), ilUtil\getWebspaceDir(), IL_CAL_DATE, and ilMapUtil\isActivated().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilPublicUserProfileGUI::getHTML ( )

Show user page.

Definition at line 238 of file class.ilPublicUserProfileGUI.php.

239 {
240 global $ilCtrl, $ilSetting;
241
242 if ($this->embedded) {
243 return $this->getEmbeddable();
244 }
245
246 // #15438 - (currently) inactive user?
247 $is_active = true;
248 $user = new ilObjUser($this->getUserId());
249 if (!$user->getActive() ||
250 !$user->checkTimeLimit()) {
251 $is_active = false;
252 }
253
254 if ($is_active && $this->getProfilePortfolio()) {
255 $ilCtrl->redirectByClass("ilobjportfoliogui", "preview");
256 } else {
257 if (!$is_active) {
258 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
259 }
260
261 // Check from Database if value
262 // of public_profile = "y" show user infomation
263 $user = new ilObjUser($this->getUserId());
264 $current = $user->getPref("public_profile");
265
266 // #17462 - see ilPersonalProfileGUI::initPublicProfileForm()
267 if ($user->getPref("public_profile") == "g" && !$ilSetting->get('enable_global_profiles')) {
268 $current = "y";
269 }
270
271 if ($current != "y" &&
272 ($current != "g" || !$ilSetting->get('enable_global_profiles')) &&
273 !$this->custom_prefs) {
274 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
275 }
276
277 $this->renderTitle();
278
279 return $this->getEmbeddable(true);
280 }
281 }
getEmbeddable($a_add_goto=false)
get public profile html code
static redirect($a_script)

References $current, $ilCtrl, $ilSetting, getEmbeddable(), getProfilePortfolio(), getUserId(), ilUtil\redirect(), and renderTitle().

Referenced by view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfilePortfolio()

ilPublicUserProfileGUI::getProfilePortfolio ( )
protected

Check if current profile portfolio is accessible.

Returns
int

Definition at line 809 of file class.ilPublicUserProfileGUI.php.

810 {
811 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
812 $portfolio_id = ilObjPortfolio::getDefaultPortfolio($this->getUserId());
813 if ($portfolio_id) {
814 include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
815 $access_handler = new ilPortfolioAccessHandler();
816 if ($access_handler->checkAccess("read", "", $portfolio_id)) {
817 return $portfolio_id;
818 }
819 }
820 }
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
Access handler for portfolio.

References ilObjPortfolio\getDefaultPortfolio(), and getUserId().

Referenced by executeCommand(), and getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPublicPref()

ilPublicUserProfileGUI::getPublicPref ( ilObjUser  $a_user,
  $a_id 
)
protected

Get user preference for public profile.

Will use original or custom preferences

Parameters
ilObjUser$a_user
string$a_id
Returns
string

Definition at line 159 of file class.ilPublicUserProfileGUI.php.

160 {
161 if (!$this->custom_prefs) {
162 return $a_user->getPref($a_id);
163 } else {
164 return $this->custom_prefs[$a_id];
165 }
166 }
getPref($a_keyword)
get a user preference

References ilObjUser\getPref().

Referenced by getEmbeddable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserId()

ilPublicUserProfileGUI::getUserId ( )

Get User ID.

Returns
int User ID

Definition at line 61 of file class.ilPublicUserProfileGUI.php.

References $userid.

Referenced by deliverVCard(), executeCommand(), getEmbeddable(), getHTML(), getProfilePortfolio(), and renderTitle().

+ Here is the caller graph for this function:

◆ handleBackUrl()

ilPublicUserProfileGUI::handleBackUrl (   $a_is_portfolio = false)
protected

Definition at line 115 of file class.ilPublicUserProfileGUI.php.

116 {
117 global $ilMainMenu, $ilTabs, $lng;
118
119 $back = ($this->getBackUrl() != "")
120 ? $this->getBackUrl()
121 : $_GET["back_url"];
122
123 if (!$back) {
124 // #15984
125 $back = 'ilias.php?baseClass=ilPersonalDesktopGUI';
126 }
127
128 if ((bool) $a_is_portfolio) {
129 $ilMainMenu->setTopBarBack($back);
130 } else {
131 // #17838
132 $ilTabs->clearTargets();
133 $ilTabs->setBackTarget(
134 $lng->txt("back"),
135 $back
136 );
137 }
138 }

References $_GET, $lng, and getBackUrl().

Referenced by executeCommand(), and renderTitle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderTitle()

ilPublicUserProfileGUI::renderTitle ( )

Definition at line 791 of file class.ilPublicUserProfileGUI.php.

792 {
793 global $tpl;
794
795 $tpl->resetHeaderBlock();
796
797 include_once("./Services/User/classes/class.ilUserUtil.php");
799 $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->getUserId(), "xsmall"));
800
801 $this->handleBackUrl();
802 }
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:

References $tpl, ilUserUtil\getNamePresentation(), getUserId(), and handleBackUrl().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdditional()

ilPublicUserProfileGUI::setAdditional (   $a_additional)

Set Additonal Information.

Parameters
array$a_additionalAdditonal Information

Definition at line 71 of file class.ilPublicUserProfileGUI.php.

72 {
73 $this->additional = $a_additional;
74 }

◆ setBackUrl()

ilPublicUserProfileGUI::setBackUrl (   $a_backurl)

Set Back Link URL.

Parameters
string$a_backurlBack Link URL

Definition at line 91 of file class.ilPublicUserProfileGUI.php.

92 {
93 global $ilCtrl;
94
95 // we only allow relative links
96 $parts = parse_url($a_backurl);
97 if ($parts["host"]) {
98 $a_backurl = "#";
99 }
100
101 $this->backurl = $a_backurl;
102 $ilCtrl->setParameter($this, "back_url", rawurlencode($a_backurl));
103 }

References $ilCtrl.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setCustomPrefs()

ilPublicUserProfileGUI::setCustomPrefs ( array  $a_prefs)

Set custom preferences for public profile fields.

Parameters
array$a_prefs

Definition at line 145 of file class.ilPublicUserProfileGUI.php.

146 {
147 $this->custom_prefs = $a_prefs;
148 }

◆ setEmbedded()

ilPublicUserProfileGUI::setEmbedded (   $a_value,
  $a_offline = false 
)

Definition at line 168 of file class.ilPublicUserProfileGUI.php.

169 {
170 $this->embedded = (bool) $a_value;
171 $this->offline = (bool) $a_offline;
172 }

◆ setUserId()

ilPublicUserProfileGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

Definition at line 51 of file class.ilPublicUserProfileGUI.php.

52 {
53 $this->userid = $a_userid;
54 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ validateUser()

static ilPublicUserProfileGUI::validateUser (   $usrId)
staticprotected

Check if given user id is valid.

Parameters
int$usrIdThe user id of the subject user
Returns
bool

Definition at line 758 of file class.ilPublicUserProfileGUI.php.

759 {
760 global $DIC;
761
762 $ilUser = $DIC->user();
763 $ilCtrl = $DIC->ctrl();
764
765 if (ilObject::_lookupType($usrId) != "usr") {
766 return false;
767 }
768
769 $user = new ilObjUser($usrId);
770
771 if ($ilUser->isAnonymous()) {
772 if (strtolower($ilCtrl->getCmd()) == strtolower('approveContactRequest')) {
773 $ilCtrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usrId . '_contact_approved');
774 } elseif (strtolower($ilCtrl->getCmd()) == strtolower('ignoreContactRequest')) {
775 $ilCtrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usrId . '_contact_ignored');
776 }
777
778 if ($user->getPref("public_profile") != "g") {
779 // #12151
780 if ($user->getPref("public_profile") == "y") {
781 $ilCtrl->redirectToURL("login.php?cmd=force_login&target=usr_" . $usrId);
782 }
783
784 return false;
785 }
786 }
787
788 return true;
789 }
static _lookupType($a_id, $a_reference=false)
lookup object type
global $DIC
Definition: saml.php:7

References $DIC, $ilCtrl, $ilUser, and ilObject\_lookupType().

+ Here is the call graph for this function:

◆ view()

ilPublicUserProfileGUI::view ( )

View.

This one is called e.g. through the goto script

Definition at line 230 of file class.ilPublicUserProfileGUI.php.

231 {
232 return $this->getHTML();
233 }

References getHTML().

+ Here is the call graph for this function:

Field Documentation

◆ $additional

ilPublicUserProfileGUI::$additional
protected

Definition at line 19 of file class.ilPublicUserProfileGUI.php.

Referenced by getAdditional(), and getEmbeddable().

◆ $backurl

ilPublicUserProfileGUI::$backurl
protected

Definition at line 18 of file class.ilPublicUserProfileGUI.php.

Referenced by getBackUrl().

◆ $custom_prefs

ilPublicUserProfileGUI::$custom_prefs
protected

Definition at line 21 of file class.ilPublicUserProfileGUI.php.

◆ $embedded

ilPublicUserProfileGUI::$embedded
protected

Definition at line 20 of file class.ilPublicUserProfileGUI.php.

◆ $portfolioid

ilPublicUserProfileGUI::$portfolioid
protected

Definition at line 17 of file class.ilPublicUserProfileGUI.php.

◆ $userid

ilPublicUserProfileGUI::$userid
protected

Definition at line 16 of file class.ilPublicUserProfileGUI.php.

Referenced by getUserId().


The documentation for this class was generated from the following file: