ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ($a_user_id)
 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$

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.

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

29  {
30  global $ilCtrl, $lng;
31 
32  if($a_user_id)
33  {
34  $this->setUserId($a_user_id);
35  }
36  else
37  {
38  $this->setUserId((int)$_GET["user_id"]);
39  }
40 
41  $ilCtrl->saveParameter($this, array("user_id","back_url", "user"));
42  if ($_GET["back_url"] != "")
43  {
44  $this->setBackUrl($_GET["back_url"]);
45  }
46 
47  $lng->loadLanguageModule("user");
48  }
$_GET["client_id"]
setUserId($a_userid)
Set User ID.
global $ilCtrl
Definition: ilias.php:18
setBackUrl($a_backurl)
Set Back Link URL.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Member Function Documentation

◆ deliverVCard()

ilPublicUserProfileGUI::deliverVCard ( )

Deliver vcard information.

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

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

708  {
709  // get user object
710  if (!ilObject::_exists($this->getUserId()))
711  {
712  return "";
713  }
714  $user = new ilObjUser($this->getUserId());
715 
716  require_once "./Services/User/classes/class.ilvCard.php";
717  $vcard = new ilvCard();
718 
719  // ilsharedresourceGUI: embedded in shared portfolio
720  if ($user->getPref("public_profile") != "y" &&
721  $user->getPref("public_profile") != "g" &&
722  $_GET["baseClass"] != "ilsharedresourceGUI")
723  {
724  return;
725  }
726 
727  $vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
728  $vcard->setNickname($user->getLogin());
729 
730  $webspace_dir = ilUtil::getWebspaceDir("output");
731  $imagefile = $webspace_dir."/usr_images/".$user->getPref("profile_image");
732  if ($user->getPref("public_upload")=="y" && @is_file($imagefile))
733  {
734  $fh = fopen($imagefile, "r");
735  if ($fh)
736  {
737  $image = fread($fh, filesize($imagefile));
738  fclose($fh);
739  require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
740  $mimetype = ilObjMediaObject::getMimeType($imagefile);
741  if (preg_match("/^image/", $mimetype))
742  {
743  $type = $mimetype;
744  }
745  $vcard->setPhoto($image, $type);
746  }
747  }
748 
749  $val_arr = array("getOrgUnitsRepresentation" => "org_units", "getInstitution" => "institution",
750  "getDepartment" => "department", "getStreet" => "street",
751  "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country",
752  "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
753  "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
754  "getHobby" => "hobby", "getMatriculation" => "matriculation",
755  "getClientIP" => "client_ip", "dummy" => "location");
756 
757  $org = array();
758  $adr = array();
759  foreach ($val_arr as $key => $value)
760  {
761  // if value "y" show information
762  if ($user->getPref("public_".$value) == "y")
763  {
764  switch ($value)
765  {
766  case "institution":
767  $org[0] = $user->$key();
768  break;
769  case "department":
770  $org[1] = $user->$key();
771  break;
772  case "street":
773  $adr[2] = $user->$key();
774  break;
775  case "zipcode":
776  $adr[5] = $user->$key();
777  break;
778  case "city":
779  $adr[3] = $user->$key();
780  break;
781  case "country":
782  $adr[6] = $user->$key();
783  break;
784  case "phone_office":
785  $vcard->setPhone($user->$key(), TEL_TYPE_WORK);
786  break;
787  case "phone_home":
788  $vcard->setPhone($user->$key(), TEL_TYPE_HOME);
789  break;
790  case "phone_mobile":
791  $vcard->setPhone($user->$key(), TEL_TYPE_CELL);
792  break;
793  case "fax":
794  $vcard->setPhone($user->$key(), TEL_TYPE_FAX);
795  break;
796  case "email":
797  $vcard->setEmail($user->$key());
798  break;
799  case "hobby":
800  $vcard->setNote($user->$key());
801  break;
802  case "location":
803  $vcard->setPosition($user->getLatitude(), $user->getLongitude());
804  break;
805  }
806  }
807  }
808 
809  if (count($org))
810  {
811  $vcard->setOrganization(join(";", $org));
812  }
813  if (count($adr))
814  {
815  $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
816  }
817 
818  ilUtil::deliverData($vcard->buildVCard(), $vcard->getFilename(), $vcard->getMimetype());
819  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
const TEL_TYPE_FAX
const TEL_TYPE_HOME
const TEL_TYPE_WORK
const TEL_TYPE_CELL
Create styles array
The data for the language used.
static getMimeType($a_file, $a_external=false)
get mime type for file
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ doProfileAutoComplete()

ilPublicUserProfileGUI::doProfileAutoComplete ( )
protected

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

References $ilCtrl, $result, array, ilJsonUtil\encode(), exit, getUserId(), and string.

935  {
936  $field_id = (string)$_REQUEST["f"];
937  $term = (string)$_REQUEST["term"];
938 
939  $result = self::getAutocompleteResult($field_id, $term);
940 
941  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
943 
944  exit();
945  }
$result
Add rich text string
The name of the decorator.
static encode($mixed, $suppress_native=false)
+ Here is the call graph for this function:

◆ executeCommand()

ilPublicUserProfileGUI::executeCommand ( )

Execute Command.

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

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

188  {
189  global $ilCtrl, $tpl;
190 
191  if(!self::validateUser($this->getUserId()))
192  {
193  return;
194  }
195 
196  $next_class = $ilCtrl->getNextClass($this);
197  $cmd = $ilCtrl->getCmd();
198 
199  $tpl->getStandardTemplate();
200 
201  switch($next_class)
202  {
203  case "ilobjportfoliogui":
204  $portfolio_id = $this->getProfilePortfolio();
205  if($portfolio_id)
206  {
207  $this->handleBackUrl(true);
208 
209  include_once "Modules/Portfolio/classes/class.ilObjPortfolioGUI.php";
210  $gui = new ilObjPortfolioGUI($portfolio_id); // #11876
211  $gui->setAdditional($this->getAdditional());
212  $gui->setPermaLink($this->getUserId(), "usr");
213  $ilCtrl->forwardCommand($gui);
214  break;
215  }
216  case 'ilbuddysystemgui':
217  if(isset($_REQUEST['osd_id']))
218  {
219  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
221  }
222 
223  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
224  $gui = new ilBuddySystemGUI();
225  $ilCtrl->setReturn($this, 'view');
226  $ilCtrl->forwardCommand($gui);
227  break;
228  default:
229  $ret = $this->$cmd();
230  $tpl->setContent($ret);
231  break;
232  }
233 
234  // only for direct links
235  if (strtolower($_GET["baseClass"]) == "ilpublicuserprofilegui")
236  {
237  $tpl->show();
238  }
239  }
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...
Class ilBuddySystemGUI.
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
getAdditional()
Get Additonal Information.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
getProfilePortfolio()
Check if current profile portfolio is accessible.
Portfolio view gui class.
$ret
Definition: parser.php:6
handleBackUrl($a_is_portfolio=false)
+ Here is the call graph for this function:

◆ getAdditional()

ilPublicUserProfileGUI::getAdditional ( )

Get Additonal Information.

Returns
array Additonal Information

Definition at line 85 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 893 of file class.ilPublicUserProfileGUI.php.

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

Referenced by ilAccountRegistrationGUI\doProfileAutoComplete().

894  {
895  global $ilUser;
896 
897  $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
898  if(in_array($a_field_id, $multi_fields) && $a_term)
899  {
900  // registration has no current user
901  $user_id = null;
902  if($ilUser && $ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID)
903  {
904  $user_id = $ilUser->getId();
905  }
906 
907  $result = array();
908  $cnt = 0;
909 
910  // term is searched in ALL interest fields, no distinction
911  foreach(ilObjUser::findInterests($a_term, $ilUser->getId()) as $item)
912  {
913  $result[$cnt] = new stdClass();
914  $result[$cnt]->value = $item;
915  $result[$cnt]->label = $item;
916  $cnt++;
917  }
918 
919  // :TODO: search in skill data
920  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
921  foreach (ilSkillTreeNode::findSkills($a_term) as $skill)
922  {
923  $result[$cnt] = new stdClass();
924  $result[$cnt]->value = $skill;
925  $result[$cnt]->label = $skill;
926  $cnt++;
927  }
928 
929  }
930 
931  return $result;
932  }
$result
static findSkills($a_term)
Find skills.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
+ 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 115 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 311 of file class.ilPublicUserProfileGUI.php.

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

Referenced by getHTML().

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

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

Referenced by view().

253  {
254  global $ilCtrl, $ilSetting;
255 
256  if($this->embedded)
257  {
258  return $this->getEmbeddable();
259  }
260 
261  // #15438 - (currently) inactive user?
262  $is_active = true;
263  $user = new ilObjUser($this->getUserId());
264  if(!$user->getActive() ||
265  !$user->checkTimeLimit())
266  {
267  $is_active = false;
268  }
269 
270  if($is_active && $this->getProfilePortfolio())
271  {
272  $ilCtrl->redirectByClass("ilobjportfoliogui", "preview");
273  }
274  else
275  {
276 
277  if(!$is_active)
278  {
279  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
280  }
281 
282  // Check from Database if value
283  // of public_profile = "y" show user infomation
284  $user = new ilObjUser($this->getUserId());
285  $current = $user->getPref("public_profile");
286 
287  // #17462 - see ilPersonalProfileGUI::initPublicProfileForm()
288  if($user->getPref("public_profile") == "g" && !$ilSetting->get('enable_global_profiles'))
289  {
290  $current = "y";
291  }
292 
293  if ($current != "y" &&
294  ($current != "g" || !$ilSetting->get('enable_global_profiles')) &&
295  !$this->custom_prefs)
296  {
297  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
298  }
299 
300  $this->renderTitle();
301 
302  return $this->getEmbeddable(true);
303  }
304  }
global $ilCtrl
Definition: ilias.php:18
getProfilePortfolio()
Check if current profile portfolio is accessible.
getEmbeddable($a_add_goto=false)
get public profile html code
global $ilSetting
Definition: privfeed.php:17
static redirect($a_script)
http redirect to other script
+ 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 878 of file class.ilPublicUserProfileGUI.php.

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

Referenced by executeCommand(), and getHTML().

879  {
880  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
881  $portfolio_id = ilObjPortfolio::getDefaultPortfolio($this->getUserId());
882  if($portfolio_id)
883  {
884  include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
885  $access_handler = new ilPortfolioAccessHandler();
886  if($access_handler->checkAccess("read", "", $portfolio_id))
887  {
888  return $portfolio_id;
889  }
890  }
891  }
Access handler for portfolio.
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
+ 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 166 of file class.ilPublicUserProfileGUI.php.

References ilObjUser\getPref().

Referenced by getEmbeddable().

167  {
168  if(!$this->custom_prefs)
169  {
170  return $a_user->getPref($a_id);
171  }
172  else
173  {
174  return $this->custom_prefs[$a_id];
175  }
176  }
getPref($a_keyword)
get a user preference
+ 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 65 of file class.ilPublicUserProfileGUI.php.

References $userid.

Referenced by deliverVCard(), doProfileAutoComplete(), 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 120 of file class.ilPublicUserProfileGUI.php.

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

Referenced by executeCommand(), and renderTitle().

121  {
122  global $ilMainMenu, $ilTabs, $lng;
123 
124  $back = ($this->getBackUrl() != "")
125  ? $this->getBackUrl()
126  : $_GET["back_url"];
127 
128  if(!$back)
129  {
130  // #15984
131  $back = 'ilias.php?baseClass=ilPersonalDesktopGUI';
132  }
133 
134  if((bool)$a_is_portfolio)
135  {
136  $ilMainMenu->setTopBarBack($back);
137  }
138  else
139  {
140  // #17838
141  $ilTabs->clearTargets();
142  $ilTabs->setBackTarget($lng->txt("back"),
143  $back);
144  }
145  }
$_GET["client_id"]
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderTitle()

ilPublicUserProfileGUI::renderTitle ( )

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

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

Referenced by getHTML().

861  {
862  global $tpl;
863 
864  $tpl->resetHeaderBlock();
865 
866  include_once("./Services/User/classes/class.ilUserUtil.php");
867  $tpl->setTitle(ilUserUtil::getNamePresentation($this->getUserId()));
868  $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->getUserId(), "xxsmall"));
869 
870  $this->handleBackUrl();
871  }
global $tpl
Definition: ilias.php:8
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)
Default behaviour is:
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
handleBackUrl($a_is_portfolio=false)
+ 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 75 of file class.ilPublicUserProfileGUI.php.

76  {
77  $this->additional = $a_additional;
78  }

◆ setBackUrl()

ilPublicUserProfileGUI::setBackUrl (   $a_backurl)

Set Back Link URL.

Parameters
string$a_backurlBack Link URL

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

References $ilCtrl.

Referenced by __construct().

96  {
97  global $ilCtrl;
98 
99  // we only allow relative links
100  $parts = parse_url($a_backurl);
101  if($parts["host"])
102  {
103  $a_backurl = "#";
104  }
105 
106  $this->backurl = $a_backurl;
107  $ilCtrl->setParameter($this, "back_url", rawurlencode($a_backurl));
108  }
global $ilCtrl
Definition: ilias.php:18
+ 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 152 of file class.ilPublicUserProfileGUI.php.

153  {
154  $this->custom_prefs = $a_prefs;
155  }

◆ setEmbedded()

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

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

179  {
180  $this->embedded = (bool)$a_value;
181  $this->offline = (bool)$a_offline;
182  }

◆ setUserId()

ilPublicUserProfileGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

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

Referenced by __construct().

56  {
57  $this->userid = $a_userid;
58  }
+ Here is the caller graph for this function:

◆ validateUser()

static ilPublicUserProfileGUI::validateUser (   $a_user_id)
staticprotected

Check if given user id is valid.

Returns
bool

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

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

827  {
828  global $ilUser, $ilCtrl;
829 
830  if (ilObject::_lookupType($a_user_id) != "usr")
831  {
832  return false;
833  }
834  $user = new ilObjUser($a_user_id);
835  if ($ilUser->getId() == ANONYMOUS_USER_ID && $user->getPref("public_profile") != "g")
836  {
837  // #12151
838  if($user->getPref("public_profile") == "y")
839  {
840  ilUtil::redirect("login.php?cmd=force_login&target=usr_".$a_user_id);
841  }
842  return false;
843  }
844 
845  if($ilUser->isAnonymous())
846  {
847  if(strtolower($ilCtrl->getCmd()) == strtolower('approveContactRequest'))
848  {
849  ilUtil::redirect('login.php?cmd=force_login&target=usr_' . $a_user_id . '_contact_approved');
850  }
851  else if(strtolower($ilCtrl->getCmd()) == strtolower('ignoreContactRequest'))
852  {
853  ilUtil::redirect('login.php?cmd=force_login&target=usr_' . $a_user_id . '_contact_ignored');
854  }
855  }
856 
857  return true;
858  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
static redirect($a_script)
http redirect to other script
+ 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 244 of file class.ilPublicUserProfileGUI.php.

References getHTML().

245  {
246  return $this->getHTML();
247  }
+ 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: