ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, 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.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ deliverVCard()

ilPublicUserProfileGUI::deliverVCard ( )

Deliver vcard information.

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

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

675  {
676  // get user object
677  if (!ilObject::_exists($this->getUserId()))
678  {
679  return "";
680  }
681  $user = new ilObjUser($this->getUserId());
682 
683  require_once "./Services/User/classes/class.ilvCard.php";
684  $vcard = new ilvCard();
685 
686  // ilsharedresourceGUI: embedded in shared portfolio
687  if ($user->getPref("public_profile") != "y" &&
688  $user->getPref("public_profile") != "g" &&
689  $_GET["baseClass"] != "ilsharedresourceGUI")
690  {
691  return;
692  }
693 
694  $vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
695  $vcard->setNickname($user->getLogin());
696 
697  $webspace_dir = ilUtil::getWebspaceDir("output");
698  $imagefile = $webspace_dir."/usr_images/".$user->getPref("profile_image");
699  if ($user->getPref("public_upload")=="y" && @is_file($imagefile))
700  {
701  $fh = fopen($imagefile, "r");
702  if ($fh)
703  {
704  $image = fread($fh, filesize($imagefile));
705  fclose($fh);
706  require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
707  $mimetype = ilObjMediaObject::getMimeType($imagefile);
708  if (preg_match("/^image/", $mimetype))
709  {
710  $type = $mimetype;
711  }
712  $vcard->setPhoto($image, $type);
713  }
714  }
715 
716  $val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
717  "getStreet" => "street",
718  "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country",
719  "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
720  "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
721  "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip",
722  "dummy" => "location");
723 
724  $org = array();
725  $adr = array();
726  foreach ($val_arr as $key => $value)
727  {
728  // if value "y" show information
729  if ($user->getPref("public_".$value) == "y")
730  {
731  switch ($value)
732  {
733  case "institution":
734  $org[0] = $user->$key();
735  break;
736  case "department":
737  $org[1] = $user->$key();
738  break;
739  case "street":
740  $adr[2] = $user->$key();
741  break;
742  case "zipcode":
743  $adr[5] = $user->$key();
744  break;
745  case "city":
746  $adr[3] = $user->$key();
747  break;
748  case "country":
749  $adr[6] = $user->$key();
750  break;
751  case "phone_office":
752  $vcard->setPhone($user->$key(), TEL_TYPE_WORK);
753  break;
754  case "phone_home":
755  $vcard->setPhone($user->$key(), TEL_TYPE_HOME);
756  break;
757  case "phone_mobile":
758  $vcard->setPhone($user->$key(), TEL_TYPE_CELL);
759  break;
760  case "fax":
761  $vcard->setPhone($user->$key(), TEL_TYPE_FAX);
762  break;
763  case "email":
764  $vcard->setEmail($user->$key());
765  break;
766  case "hobby":
767  $vcard->setNote($user->$key());
768  break;
769  case "location":
770  $vcard->setPosition($user->getLatitude(), $user->getLongitude());
771  break;
772  }
773  }
774  }
775 
776  if (count($org))
777  {
778  $vcard->setOrganization(join(";", $org));
779  }
780  if (count($adr))
781  {
782  $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
783  }
784 
785  ilUtil::deliverData($vcard->buildVCard(), $vcard->getFilename(), $vcard->getMimetype());
786  }
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
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 901 of file class.ilPublicUserProfileGUI.php.

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

902  {
903  $field_id = (string)$_REQUEST["f"];
904  $term = (string)$_REQUEST["term"];
905 
906  $result = self::getAutocompleteResult($field_id, $term);
907 
908  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
910 
911  exit();
912  }
exit
Definition: login.php:54
$result
static encode($mixed, $suppress_native=false)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ executeCommand()

ilPublicUserProfileGUI::executeCommand ( )

Execute Command.

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

References $_GET, $_REQUEST, $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.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
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 860 of file class.ilPublicUserProfileGUI.php.

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

Referenced by ilAccountRegistrationGUI\doProfileAutoComplete().

861  {
862  global $ilUser;
863 
864  $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
865  if(in_array($a_field_id, $multi_fields) && $a_term)
866  {
867  // registration has no current user
868  $user_id = null;
869  if($ilUser && $ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID)
870  {
871  $user_id = $ilUser->getId();
872  }
873 
874  $result = array();
875  $cnt = 0;
876 
877  // term is searched in ALL interest fields, no distinction
878  foreach(ilObjUser::findInterests($a_term, $ilUser->getId()) as $item)
879  {
880  $result[$cnt] = new stdClass();
881  $result[$cnt]->value = $item;
882  $result[$cnt]->label = $item;
883  $cnt++;
884  }
885 
886  // :TODO: search in skill data
887  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
888  foreach (ilSkillTreeNode::findSkills($a_term) as $skill)
889  {
890  $result[$cnt] = new stdClass();
891  $result[$cnt]->value = $skill;
892  $result[$cnt]->label = $skill;
893  $cnt++;
894  }
895 
896  }
897 
898  return $result;
899  }
$result
static findSkills($a_term)
Find skills.
global $ilUser
Definition: imgupload.php:15
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, $tpl, ilObject\_exists(), ilUserDefinedFields\_getInstance(), ilObjUser\_getPersonalPicturePath(), ilLink\_getStaticLink(), ilObjUser\_isAnonymous(), ilDatePresentation\formatDate(), getAdditional(), ilObjPortfolio\getAvailablePortfolioLinksForUserIds(), getBackUrl(), ilPermanentLinkGUI\getHTML(), ilUtil\getImagePath(), ilBuddySystemLinkButton\getInstanceByUserId(), 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  // institution / department
470  if ($this->getPublicPref($user, "public_institution") == "y" ||
471  $this->getPublicPref($user, "public_department") == "y")
472  {
473  $tpl->setCurrentBlock("inst_dep");
474  $sep = "";
475  if ($this->getPublicPref($user, "public_institution") == "y")
476  {
477  $h = $lng->txt("institution");
478  $v = $user->getInstitution();
479  $sep = " / ";
480  }
481  if ($this->getPublicPref($user, "public_department") == "y")
482  {
483  $h.= $sep.$lng->txt("department");
484  $v.= $sep.$user->getDepartment();
485  }
486  $tpl->setVariable("TXT_INST_DEP", $h);
487  $tpl->setVariable("INST_DEP", $v);
488  $tpl->parseCurrentBlock();
489  }
490 
491  // contact
492  $val_arr = array(
493  "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
494  "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email");
495  $v = $sep = "";
496  foreach ($val_arr as $key => $value)
497  {
498  // if value "y" show information
499  if ($this->getPublicPref($user, "public_".$value) == "y")
500  {
501  $v.= $sep.$lng->txt($value).": ".$user->$key();
502  $sep = "<br />";
503  }
504  }
505  if ($ilSetting->get("usr_settings_hide_instant_messengers") != 1)
506  {
507  $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
508 
509  foreach ($im_arr as $im_name)
510  {
511  if ($im_id = $user->getInstantMessengerId($im_name))
512  {
513  if ($this->getPublicPref($user, "public_im_".$im_name) != "n")
514  {
515  $v.= $sep.$lng->txt('im_'.$im_name).": ".$im_id;
516  $sep = "<br />";
517  }
518  }
519  }
520  }
521  if ($v != "")
522  {
523  $tpl->parseCurrentBlock("contact");
524  $tpl->setVariable("TXT_CONTACT", $lng->txt("contact"));
525  $tpl->setVariable("CONTACT", $v);
526  $tpl->parseCurrentBlock();
527  }
528 
529 
530  $val_arr = array(
531  "getHobby" => "hobby",
532  "getGeneralInterestsAsText" => "interests_general",
533  "getOfferingHelpAsText" => "interests_help_offered",
534  "getLookingForHelpAsText" => "interests_help_looking",
535  "getMatriculation" => "matriculation",
536  "getClientIP" => "client_ip");
537 
538  foreach ($val_arr as $key => $value)
539  {
540  // if value "y" show information
541  if ($this->getPublicPref($user, "public_".$value) == "y")
542  {
543  $tpl->setCurrentBlock("profile_data");
544  $tpl->setVariable("TXT_DATA", $lng->txt($value));
545  $tpl->setVariable("DATA", $user->$key());
546  $tpl->parseCurrentBlock();
547  }
548  }
549 
550  // portfolios
551  include_once("./Services/Link/classes/class.ilLink.php");
552  include_once("./Modules/Portfolio/classes/class.ilObjPortfolio.php");
553  $back = ($this->getBackUrl() != "")
554  ? $this->getBackUrl()
555  : ilLink::_getStaticLink($this->getUserId(), "usr", true);
556  $port = ilObjPortfolio::getAvailablePortfolioLinksForUserIds(array($this->getUserId()), $back);
557  $cnt=0;
558  if (count($port) > 0)
559  {
560  foreach ($port as $u)
561  {
562  $tpl->setCurrentBlock("portfolio");
563  foreach ($u as $link => $title)
564  {
565  $cnt++;
566  $tpl->setVariable("HREF_PORTFOLIO", $link);
567  $tpl->setVariable("TITLE_PORTFOLIO", $title);
568  $tpl->parseCurrentBlock();
569  }
570  }
571  $tpl->setCurrentBlock("portfolios");
572  if ($cnt > 1)
573  {
574  $lng->loadLanguageModule("prtf");
575  $tpl->setVariable("TXT_PORTFOLIO", $lng->txt("prtf_portfolios"));
576  }
577  else
578  {
579  $tpl->setVariable("TXT_PORTFOLIO", $lng->txt("portfolio"));
580  }
581  $tpl->parseCurrentBlock();
582  }
583 
584  // delicious row
585  //$d_set = new ilSetting("delicious");
586  if ($this->getPublicPref($user, "public_delicious") == "y")
587  {
588  $tpl->setCurrentBlock("delicious_row");
589  $tpl->setVariable("TXT_DELICIOUS", $lng->txt("delicious"));
590  $tpl->setVariable("TXT_DEL_ICON", $lng->txt("delicious"));
591  $tpl->setVariable("SRC_DEL_ICON", ilUtil::getImagePath("icon_delicious.png"));
592  $tpl->setVariable("DEL_ACCOUNT", $user->getDelicious());
593  $tpl->parseCurrentBlock();
594  }
595 
596  // map
597  include_once("./Services/Maps/classes/class.ilMapUtil.php");
598  if (ilMapUtil::isActivated() &&
599  $this->getPublicPref($user, "public_location") == "y" &&
600  $user->getLatitude() != "")
601  {
602  $tpl->setVariable("TXT_LOCATION", $lng->txt("location"));
603 
604  $map_gui = ilMapUtil::getMapGUI();
605  $map_gui->setMapId("user_map")
606  ->setWidth("350px")
607  ->setHeight("230px")
608  ->setLatitude($user->getLatitude())
609  ->setLongitude($user->getLongitude())
610  ->setZoom($user->getLocationZoom())
611  ->setEnableNavigationControl(true)
612  ->addUserMarker($user->getId());
613 
614  $tpl->setVariable("MAP_CONTENT", $map_gui->getHTML());
615  }
616 
617  // additional defined user data fields
618  include_once './Services/User/classes/class.ilUserDefinedFields.php';
619  $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
620  $user_defined_data = $user->getUserDefinedData();
621  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
622  {
623  // public setting
624  if ($this->getPublicPref($user, "public_udf_".$definition["field_id"]) == "y")
625  {
626  if ($user_defined_data["f_".$definition["field_id"]] != "")
627  {
628  $tpl->setCurrentBlock("udf_data");
629  $tpl->setVariable("TXT_UDF_DATA", $definition["field_name"]);
630  $tpl->setVariable("UDF_DATA", $user_defined_data["f_".$definition["field_id"]]);
631  $tpl->parseCurrentBlock();
632  }
633  }
634  }
635 
636  // additional information
637  $additional = $this->getAdditional();
638  if (is_array($additional))
639  {
640  foreach($additional as $key => $val)
641  {
642  $tpl->setCurrentBlock("profile_data");
643  $tpl->setVariable("TXT_DATA", $key);
644  $tpl->setVariable("DATA", $val);
645  $tpl->parseCurrentBlock();
646  }
647  }
648 
649  if(
650  $this->getUserId() != $ilUser->getId() &&
651  !$ilUser->isAnonymous() &&
653  )
654  {
655  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
656  $button = ilBuddySystemLinkButton::getInstanceByUserId($user->getId());
657  $tpl->setVariable('BUDDY_HTML', $button->getHtml());
658  }
659 
660  $goto = "";
661  if($a_add_goto)
662  {
663  include_once('Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
664  $goto = new ilPermanentLinkGUI("usr", $user->getId());
665  $goto = $goto->getHTML();
666  }
667 
668  return $tpl->get().$goto;
669  }
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.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
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 $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
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
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:40
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 845 of file class.ilPublicUserProfileGUI.php.

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

Referenced by executeCommand(), and getHTML().

846  {
847  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
848  $portfolio_id = ilObjPortfolio::getDefaultPortfolio($this->getUserId());
849  if($portfolio_id)
850  {
851  include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
852  $access_handler = new ilPortfolioAccessHandler();
853  if($access_handler->checkAccess("read", "", $portfolio_id))
854  {
855  return $portfolio_id;
856  }
857  }
858  }
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:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderTitle()

ilPublicUserProfileGUI::renderTitle ( )

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

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

Referenced by getHTML().

828  {
829  global $tpl;
830 
831  $tpl->resetHeaderBlock();
832 
833  include_once("./Services/User/classes/class.ilUserUtil.php");
834  $tpl->setTitle(ilUserUtil::getNamePresentation($this->getUserId()));
835  $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->getUserId(), "xxsmall"));
836 
837  $this->handleBackUrl();
838  }
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 793 of file class.ilPublicUserProfileGUI.php.

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

794  {
795  global $ilUser, $ilCtrl;
796 
797  if (ilObject::_lookupType($a_user_id) != "usr")
798  {
799  return false;
800  }
801  $user = new ilObjUser($a_user_id);
802  if ($ilUser->getId() == ANONYMOUS_USER_ID && $user->getPref("public_profile") != "g")
803  {
804  // #12151
805  if($user->getPref("public_profile") == "y")
806  {
807  ilUtil::redirect("login.php?cmd=force_login&target=usr_".$a_user_id);
808  }
809  return false;
810  }
811 
812  if($ilUser->isAnonymous())
813  {
814  if(strtolower($ilCtrl->getCmd()) == strtolower('approveContactRequest'))
815  {
816  ilUtil::redirect('login.php?cmd=force_login&target=usr_' . $a_user_id . '_contact_approved');
817  }
818  else if(strtolower($ilCtrl->getCmd()) == strtolower('ignoreContactRequest'))
819  {
820  ilUtil::redirect('login.php?cmd=force_login&target=usr_' . $a_user_id . '_contact_ignored');
821  }
822  }
823 
824  return true;
825  }
global $ilCtrl
Definition: ilias.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
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: