ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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$

@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 {
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"]
setBackUrl($a_backurl)
Set Back Link URL.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

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 593 of file class.ilPublicUserProfileGUI.php.

594 {
595 // get user object
596 if (!ilObject::_exists($this->getUserId()))
597 {
598 return "";
599 }
600 $user = new ilObjUser($this->getUserId());
601
602 require_once "./Services/User/classes/class.ilvCard.php";
603 $vcard = new ilvCard();
604
605 // ilsharedresourceGUI: embedded in shared portfolio
606 if ($user->getPref("public_profile") != "y" &&
607 $user->getPref("public_profile") != "g" &&
608 $_GET["baseClass"] != "ilsharedresourceGUI")
609 {
610 return;
611 }
612
613 $vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
614 $vcard->setNickname($user->getLogin());
615
616 $webspace_dir = ilUtil::getWebspaceDir("output");
617 $imagefile = $webspace_dir."/usr_images/".$user->getPref("profile_image");
618 if ($user->getPref("public_upload")=="y" && @is_file($imagefile))
619 {
620 $fh = fopen($imagefile, "r");
621 if ($fh)
622 {
623 $image = fread($fh, filesize($imagefile));
624 fclose($fh);
625 require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
626 $mimetype = ilObjMediaObject::getMimeType($imagefile);
627 if (preg_match("/^image/", $mimetype))
628 {
629 $type = $mimetype;
630 }
631 $vcard->setPhoto($image, $type);
632 }
633 }
634
635 $val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
636 "getStreet" => "street",
637 "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country",
638 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
639 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
640 "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip",
641 "dummy" => "location");
642
643 $org = array();
644 $adr = array();
645 foreach ($val_arr as $key => $value)
646 {
647 // if value "y" show information
648 if ($user->getPref("public_".$value) == "y")
649 {
650 switch ($value)
651 {
652 case "institution":
653 $org[0] = $user->$key();
654 break;
655 case "department":
656 $org[1] = $user->$key();
657 break;
658 case "street":
659 $adr[2] = $user->$key();
660 break;
661 case "zipcode":
662 $adr[5] = $user->$key();
663 break;
664 case "city":
665 $adr[3] = $user->$key();
666 break;
667 case "country":
668 $adr[6] = $user->$key();
669 break;
670 case "phone_office":
671 $vcard->setPhone($user->$key(), TEL_TYPE_WORK);
672 break;
673 case "phone_home":
674 $vcard->setPhone($user->$key(), TEL_TYPE_HOME);
675 break;
676 case "phone_mobile":
677 $vcard->setPhone($user->$key(), TEL_TYPE_CELL);
678 break;
679 case "fax":
680 $vcard->setPhone($user->$key(), TEL_TYPE_FAX);
681 break;
682 case "email":
683 $vcard->setEmail($user->$key());
684 break;
685 case "hobby":
686 $vcard->setNote($user->$key());
687 break;
688 case "location":
689 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
690 break;
691 }
692 }
693 }
694
695 if (count($org))
696 {
697 $vcard->setOrganization(join(";", $org));
698 }
699 if (count($adr))
700 {
701 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
702 }
703
704 ilUtil::deliverData($vcard->buildVCard(), $vcard->getFilename(), $vcard->getMimetype());
705 }
const TEL_TYPE_HOME
const TEL_TYPE_FAX
const TEL_TYPE_CELL
const TEL_TYPE_WORK
static getMimeType($a_file)
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.

References $_GET, 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 807 of file class.ilPublicUserProfileGUI.php.

808 {
809 $field_id = (string)$_REQUEST["f"];
810 $term = (string)$_REQUEST["term"];
811
812 $result = self::getAutocompleteResult($field_id, $term);
813
814 include_once 'Services/JSON/classes/class.ilJsonUtil.php';
816
817 exit();
818 }
$result
static encode($mixed, $suppress_native=false)
static getAutocompleteResult($a_field_id, $a_term)
exit
Definition: login.php:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

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

+ Here is the call graph for this function:

◆ executeCommand()

ilPublicUserProfileGUI::executeCommand ( )

Execute Command.

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

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
217 default:
218 $ret = $this->$cmd();
219 $tpl->setContent($ret);
220 break;
221 }
222
223 // only for direct links
224 if (strtolower($_GET["baseClass"]) == "ilpublicuserprofilegui")
225 {
226 $tpl->show();
227 }
228 }
global $tpl
Definition: ilias.php:8
Portfolio view gui class.
getAdditional()
Get Additonal Information.
handleBackUrl($a_is_portfolio=false)
getProfilePortfolio()
Check if current profile portfolio is accessible.
$cmd
Definition: sahs_server.php:35

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

+ 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 766 of file class.ilPublicUserProfileGUI.php.

767 {
768 global $ilUser;
769
770 $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
771 if(in_array($a_field_id, $multi_fields) && $a_term)
772 {
773 // registration has no current user
774 $user_id = null;
775 if($ilUser && $ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID)
776 {
777 $user_id = $ilUser->getId();
778 }
779
780 $result = array();
781 $cnt = 0;
782
783 // term is searched in ALL interest fields, no distinction
784 foreach(ilObjUser::findInterests($a_term, $ilUser->getId()) as $item)
785 {
786 $result[$cnt] = new stdClass();
787 $result[$cnt]->value = $item;
788 $result[$cnt]->label = $item;
789 $cnt++;
790 }
791
792 // :TODO: search in skill data
793 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
794 foreach (ilSkillTreeNode::findSkills($a_term) as $skill)
795 {
796 $result[$cnt] = new stdClass();
797 $result[$cnt]->value = $skill;
798 $result[$cnt]->label = $skill;
799 $cnt++;
800 }
801
802 }
803
804 return $result;
805 }
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
static findSkills($a_term)
Find skills.
global $ilUser
Definition: imgupload.php:15

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 142 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 291 of file class.ilPublicUserProfileGUI.php.

292 {
294
295 // get user object
296 if (!ilObject::_exists($this->getUserId()))
297 {
298 return "";
299 }
300 $user = new ilObjUser($this->getUserId());
301
302 $tpl = new ilTemplate("tpl.usr_public_profile.html", true, true,
303 "Services/User");
304
305 $tpl->setVariable("ROWCOL1", "tblrow1");
306 $tpl->setVariable("ROWCOL2", "tblrow2");
307
308 if(!$this->offline && $ilUser->getId() != ANONYMOUS_USER_ID)
309 {
310 $ref_url = str_replace("&", "&", $this->getBackUrl());
311 if(!$ref_url)
312 {
313 $ref_url = basename($_SERVER['REQUEST_URI']);
314 }
315
316 $tpl->setCurrentBlock("mail");
317 $tpl->setVariable("TXT_MAIL", $lng->txt("send_mail"));
318 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
319 $tpl->setVariable('HREF_MAIL', ilMailFormCall::getLinkTarget($ref_url, '', array(), array('type' => 'new', 'rcp_to' => urlencode($user->getLogin()))));
320 $tpl->parseCurrentBlock();
321 }
322
323 $first_name = "";
324 if($this->getPublicPref($user, "public_title") == "y")
325 {
326 $first_name .= $user->getUTitle()." ";
327 }
328 $first_name .= $user->getFirstName();
329
330 $tpl->setVariable("TXT_NAME", $lng->txt("name"));
331 $tpl->setVariable("FIRSTNAME", $first_name);
332 $tpl->setVariable("LASTNAME", $user->getLastName());
333
334 if(!$this->offline)
335 {
336 // vcard
337 $tpl->setCurrentBlock("vcard");
338 $tpl->setVariable("TXT_VCARD", $lng->txt("vcard"));
339 $tpl->setVariable("TXT_DOWNLOAD_VCARD", $lng->txt("vcard_download"));
340 $ilCtrl->setParameter($this, "user", $this->getUserId());
341 $tpl->setVariable("HREF_VCARD", $ilCtrl->getLinkTarget($this, "deliverVCard"));
342 }
343
344 $webspace_dir = ilUtil::getWebspaceDir("user");
345 $check_dir = ilUtil::getWebspaceDir();
346 $imagefile = $webspace_dir."/usr_images/".$user->getPref("profile_image")."?dummy=".rand(1,999999);
347 $check_file = $check_dir."/usr_images/".$user->getPref("profile_image");
348
349 if (!@is_file($check_file))
350 {
351 $imagefile = $check_file =
352 ilObjUser::_getPersonalPicturePath($user->getId(), "small", false, true);
353 }
354
355 if($this->offline)
356 {
357 $imagefile = basename($imagefile);
358 }
359
360 if ($this->getPublicPref($user, "public_upload")=="y" && $imagefile != "")
361 {
362 //Getting the flexible path of image form ini file
363 //$webspace_dir = ilUtil::getWebspaceDir("output");
364 $tpl->setCurrentBlock("image");
365 $tpl->setVariable("TXT_IMAGE",$lng->txt("image"));
366 $tpl->setVariable("IMAGE_PATH", $imagefile);
367 $tpl->setVariable("IMAGE_ALT", $lng->txt("personal_picture"));
368 $tpl->parseCurrentBlock();
369 }
370
371 // address
372 if ($this->getPublicPref($user, "public_street") == "y" ||
373 $this->getPublicPref($user, "public_zipcode") == "y" ||
374 $this->getPublicPref($user, "public_city") == "y" ||
375 $this->getPublicPref($user, "public_country") == "y")
376 {
377 $address = array();
378 $val_arr = array ("getStreet" => "street",
379 "getZipcode" => "zipcode",
380 "getCity" => "city",
381 "getCountry" => "country",
382 "getSelectedCountry" => "sel_country");
383 foreach ($val_arr as $key => $value)
384 {
385 // if value "y" show information
386 if ($this->getPublicPref($user, "public_".$value) == "y")
387 {
388 $address_value = $user->$key();
389
390 // only if set
391 if (trim($address_value) != "")
392 {
393 switch($value)
394 {
395 case "street":
396 $address[0] = $address_value;
397 break;
398
399 case "zipcode":
400 case "city":
401 $address[1] .= " ".$address_value;
402 break;
403
404 case "sel_country":
405 $lng->loadLanguageModule("meta");
406 $address[2] = $lng->txt("meta_c_".$address_value);
407 break;
408
409 case "country":
410 $address[2] = $address_value;
411 break;
412 }
413 }
414 }
415 }
416 if(sizeof($address))
417 {
418 $tpl->setCurrentBlock("address_line");
419 foreach($address as $line)
420 {
421 if(trim($line))
422 {
423 $tpl->setVariable("TXT_ADDRESS_LINE", trim($line));
424 $tpl->parseCurrentBlock();
425 }
426 }
427 $tpl->setCurrentBlock("address");
428 $tpl->setVariable("TXT_ADDRESS", $lng->txt("address"));
429 $tpl->parseCurrentBlock();
430 }
431 }
432
433 // institution / department
434 if ($this->getPublicPref($user, "public_institution") == "y" ||
435 $this->getPublicPref($user, "public_department") == "y")
436 {
437 $tpl->setCurrentBlock("inst_dep");
438 $sep = "";
439 if ($this->getPublicPref($user, "public_institution") == "y")
440 {
441 $h = $lng->txt("institution");
442 $v = $user->getInstitution();
443 $sep = " / ";
444 }
445 if ($this->getPublicPref($user, "public_department") == "y")
446 {
447 $h.= $sep.$lng->txt("department");
448 $v.= $sep.$user->getDepartment();
449 }
450 $tpl->setVariable("TXT_INST_DEP", $h);
451 $tpl->setVariable("INST_DEP", $v);
452 $tpl->parseCurrentBlock();
453 }
454
455 // contact
456 $val_arr = array(
457 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
458 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email");
459 $v = $sep = "";
460 foreach ($val_arr as $key => $value)
461 {
462 // if value "y" show information
463 if ($this->getPublicPref($user, "public_".$value) == "y")
464 {
465 $v.= $sep.$lng->txt($value).": ".$user->$key();
466 $sep = "<br />";
467 }
468 }
469 if ($ilSetting->get("usr_settings_hide_instant_messengers") != 1)
470 {
471 $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
472
473 foreach ($im_arr as $im_name)
474 {
475 if ($im_id = $user->getInstantMessengerId($im_name))
476 {
477 if ($this->getPublicPref($user, "public_im_".$im_name) != "n")
478 {
479 $v.= $sep.$lng->txt('im_'.$im_name).": ".$im_id;
480 $sep = "<br />";
481 }
482 }
483 }
484 }
485 if ($v != "")
486 {
487 $tpl->parseCurrentBlock("contact");
488 $tpl->setVariable("TXT_CONTACT", $lng->txt("contact"));
489 $tpl->setVariable("CONTACT", $v);
490 $tpl->parseCurrentBlock();
491 }
492
493
494 $val_arr = array(
495 "getHobby" => "hobby",
496 "getGeneralInterestsAsText" => "interests_general",
497 "getOfferingHelpAsText" => "interests_help_offered",
498 "getLookingForHelpAsText" => "interests_help_looking",
499 "getMatriculation" => "matriculation",
500 "getClientIP" => "client_ip");
501
502 foreach ($val_arr as $key => $value)
503 {
504 // if value "y" show information
505 if ($this->getPublicPref($user, "public_".$value) == "y")
506 {
507 $tpl->setCurrentBlock("profile_data");
508 $tpl->setVariable("TXT_DATA", $lng->txt($value));
509 $tpl->setVariable("DATA", $user->$key());
510 $tpl->parseCurrentBlock();
511 }
512 }
513
514 // delicious row
515 //$d_set = new ilSetting("delicious");
516 if ($this->getPublicPref($user, "public_delicious") == "y")
517 {
518 $tpl->setCurrentBlock("delicious_row");
519 $tpl->setVariable("TXT_DELICIOUS", $lng->txt("delicious"));
520 $tpl->setVariable("TXT_DEL_ICON", $lng->txt("delicious"));
521 $tpl->setVariable("SRC_DEL_ICON", ilUtil::getImagePath("icon_delicious.png"));
522 $tpl->setVariable("DEL_ACCOUNT", $user->getDelicious());
523 $tpl->parseCurrentBlock();
524 }
525
526 // map
527 include_once("./Services/Maps/classes/class.ilMapUtil.php");
528 if (ilMapUtil::isActivated() &&
529 $this->getPublicPref($user, "public_location") == "y" &&
530 $user->getLatitude() != "")
531 {
532 $tpl->setVariable("TXT_LOCATION", $lng->txt("location"));
533
534 $map_gui = ilMapUtil::getMapGUI();
535 $map_gui->setMapId("user_map")
536 ->setWidth("350px")
537 ->setHeight("230px")
538 ->setLatitude($user->getLatitude())
539 ->setLongitude($user->getLongitude())
540 ->setZoom($user->getLocationZoom())
541 ->setEnableNavigationControl(true)
542 ->addUserMarker($user->getId());
543
544 $tpl->setVariable("MAP_CONTENT", $map_gui->getHTML());
545 }
546
547 // additional defined user data fields
548 include_once './Services/User/classes/class.ilUserDefinedFields.php';
549 $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
550 $user_defined_data = $user->getUserDefinedData();
551 foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
552 {
553 // public setting
554 if ($this->getPublicPref($user, "public_udf_".$definition["field_id"]) == "y")
555 {
556 if ($user_defined_data["f_".$definition["field_id"]] != "")
557 {
558 $tpl->setCurrentBlock("udf_data");
559 $tpl->setVariable("TXT_UDF_DATA", $definition["field_name"]);
560 $tpl->setVariable("UDF_DATA", $user_defined_data["f_".$definition["field_id"]]);
561 $tpl->parseCurrentBlock();
562 }
563 }
564 }
565
566 // additional information
567 $additional = $this->getAdditional();
568 if (is_array($additional))
569 {
570 foreach($additional as $key => $val)
571 {
572 $tpl->setCurrentBlock("profile_data");
573 $tpl->setVariable("TXT_DATA", $key);
574 $tpl->setVariable("DATA", $val);
575 $tpl->parseCurrentBlock();
576 }
577 }
578
579 $goto = "";
580 if($a_add_goto)
581 {
582 include_once('Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
583 $goto = new ilPermanentLinkGUI("usr", $user->getId());
584 $goto = $goto->getHTML();
585 }
586
587 return $tpl->get().$goto;
588 }
static getLinkTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array())
static isActivated()
Checks whether Map feature is activated.
static getMapGUI()
Get an instance of the GUI class.
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
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.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilSetting
Definition: privfeed.php:40

References $additional, $ilCtrl, $ilSetting, $ilUser, $lng, $tpl, ilObject\_exists(), ilUserDefinedFields\_getInstance(), ilObjUser\_getPersonalPicturePath(), getAdditional(), getBackUrl(), ilUtil\getImagePath(), ilMailFormCall\getLinkTarget(), ilMapUtil\getMapGUI(), getPublicPref(), getUserId(), ilUtil\getWebspaceDir(), 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 241 of file class.ilPublicUserProfileGUI.php.

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

References $ilCtrl, $ilSetting, getEmbeddable(), getProfilePortfolio(), getUserId(), 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 751 of file class.ilPublicUserProfileGUI.php.

752 {
753 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
754 $portfolio_id = ilObjPortfolio::getDefaultPortfolio($this->getUserId());
755 if($portfolio_id)
756 {
757 include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
758 $access_handler = new ilPortfolioAccessHandler();
759 if($access_handler->checkAccess("read", "", $portfolio_id))
760 {
761 return $portfolio_id;
762 }
763 }
764 }
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 166 of file class.ilPublicUserProfileGUI.php.

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

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 65 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 110 of file class.ilPublicUserProfileGUI.php.

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

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 733 of file class.ilPublicUserProfileGUI.php.

734 {
735 global $tpl;
736
737 $tpl->resetHeaderBlock();
738
739 include_once("./Services/User/classes/class.ilUserUtil.php");
741 $tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->getUserId(), "xxsmall"));
742
743 $this->handleBackUrl();
744 }
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)
Default behaviour is:

References $tpl, ilObjUser\_getPersonalPicturePath(), 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 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.

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 }

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 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.

56 {
57 $this->userid = $a_userid;
58 }

Referenced by __construct().

+ 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 712 of file class.ilPublicUserProfileGUI.php.

713 {
714 global $ilUser;
715
716 if (ilObject::_lookupType($a_user_id) != "usr")
717 {
718 return false;
719 }
720 $user = new ilObjUser($a_user_id);
721 if ($ilUser->getId() == ANONYMOUS_USER_ID && $user->getPref("public_profile") != "g")
722 {
723 // #12151
724 if($user->getPref("public_profile") == "y")
725 {
726 ilUtil::redirect("login.php?cmd=force_login&target=usr_".$a_user_id);
727 }
728 return false;
729 }
730 return true;
731 }
static _lookupType($a_id, $a_reference=false)
lookup object type
static redirect($a_script)
http redirect to other script

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

+ 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 233 of file class.ilPublicUserProfileGUI.php.

234 {
235 return $this->getHTML();
236 }

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: