ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPublicUserProfileGUI Class Reference

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

+ Collaboration diagram for ilPublicUserProfileGUI:

Public Member Functions

 __construct ($a_user_id)
 Constructor.
 setUserId ($a_userid)
 Set User ID.
 getUserId ()
 Get User ID.
 setAsRows ($a_asrows)
 Set Output as Table Rows.
 getAsRows ()
 Get Output as Table Rows.
 setAdditional ($a_additional)
 Set Additonal Information.
 getAdditional ()
 Get Additonal Information.
 setBackUrl ($a_backurl)
 Set Back Link URL.
 getBackUrl ()
 Get Back Link URL.
 executeCommand ()
 Execute Command.
 getHTML ()
 get public profile html code
 deliverVCard ()
 Deliver vcard information.

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$

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

Constructor & Destructor Documentation

ilPublicUserProfileGUI::__construct (   $a_user_id)

Constructor.

Parameters
intUser ID.

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

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

{
global $ilCtrl;
$this->setUserId($a_user_id);
$ilCtrl->saveParameter($this, "user_id");
if ($_GET["back_url"] != "")
{
$this->setBackUrl($_GET["back_url"]);
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilPublicUserProfileGUI::deliverVCard ( )

Deliver vcard information.

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

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

{
// get user object
if (!ilObject::_exists($this->getUserId()))
{
return "";
}
$user = new ilObjUser($this->getUserId());
require_once "./Services/User/classes/class.ilvCard.php";
$vcard = new ilvCard();
if ($user->getPref("public_profile")!="y")
{
return;
}
$vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
$vcard->setNickname($user->getLogin());
$webspace_dir = ilUtil::getWebspaceDir("output");
$imagefile = $webspace_dir."/usr_images/".$user->getPref("profile_image");
if ($user->getPref("public_upload")=="y" && @is_file($imagefile))
{
$fh = fopen($imagefile, "r");
if ($fh)
{
$image = fread($fh, filesize($imagefile));
fclose($fh);
require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mimetype = ilObjMediaObject::getMimeType($imagefile);
if (preg_match("/^image/", $mimetype))
{
$type = $mimetype;
}
$vcard->setPhoto($image, $type);
}
}
$val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
"getStreet" => "street",
"getZipcode" => "zip", "getCity" => "city", "getCountry" => "country",
"getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
"getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
"getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
$org = array();
$adr = array();
foreach ($val_arr as $key => $value)
{
// if value "y" show information
if ($user->getPref("public_".$value) == "y")
{
switch ($value)
{
case "institution":
$org[0] = $user->$key();
break;
case "department":
$org[1] = $user->$key();
break;
case "street":
$adr[2] = $user->$key();
break;
case "zip":
$adr[5] = $user->$key();
break;
case "city":
$adr[3] = $user->$key();
break;
case "country":
$adr[6] = $user->$key();
break;
case "phone_office":
$vcard->setPhone($user->$key(), TEL_TYPE_WORK);
break;
case "phone_home":
$vcard->setPhone($user->$key(), TEL_TYPE_HOME);
break;
case "phone_mobile":
$vcard->setPhone($user->$key(), TEL_TYPE_CELL);
break;
case "fax":
$vcard->setPhone($user->$key(), TEL_TYPE_FAX);
break;
case "email":
$vcard->setEmail($user->$key());
break;
case "hobby":
$vcard->setNote($user->$key());
break;
}
}
}
if (count($org))
{
$vcard->setOrganization(join(";", $org));
}
if (count($adr))
{
$vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
}
ilUtil::deliverData(utf8_decode($vcard->buildVCard()), $vcard->getFilename(), $vcard->getMimetype());
}

+ Here is the call graph for this function:

ilPublicUserProfileGUI::executeCommand ( )

Execute Command.

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

References $cmd, and $ilCtrl.

{
global $ilCtrl;
$cmd = $ilCtrl->getCmd();
return $this->$cmd();
}
ilPublicUserProfileGUI::getAdditional ( )

Get Additonal Information.

Returns
array Additonal Information

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

Referenced by getHTML().

{
return $this->additional;
}

+ Here is the caller graph for this function:

ilPublicUserProfileGUI::getAsRows ( )

Get Output as Table Rows.

Returns
boolean Output as Table Rows

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

Referenced by getHTML().

{
return $this->asrows;
}

+ Here is the caller graph for this function:

ilPublicUserProfileGUI::getBackUrl ( )

Get Back Link URL.

Returns
string Back Link URL

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

Referenced by getHTML().

{
return $this->backurl;
}

+ Here is the caller graph for this function:

ilPublicUserProfileGUI::getHTML ( )

get public profile html code

Parameters
boolean$no_ctrlworkaround for old insert public profile implementation

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

References $ilCtrl, $ilSetting, $lng, $tpl, $user, ilObject\_exists(), getAdditional(), getAsRows(), getBackUrl(), ilUtil\getImagePath(), getUserId(), ilUtil\getWebspaceDir(), and ilGoogleMapUtil\isActivated().

{
// get user object
if (!ilObject::_exists($this->getUserId()))
{
return "";
}
$user = new ilObjUser($this->getUserId());
$tpl = new ilTemplate("tpl.usr_public_profile.html", true, true,
"Services/User");
// Back Link
if ($this->getBackUrl() != "")
{
$tpl->setCurrentBlock("back_url");
$tpl->setVariable("TXT_BACK", $lng->txt("back"));
$tpl->setVariable("HREF_BACK", $this->getBackUrl());
$tpl->parseCurrentBlock();
}
if (!$this->getAsRows())
{
$tpl->touchBlock("table_end");
$tpl->setCurrentBlock("table_start");
$tpl->setVariable("USR_PROFILE", $lng->txt("profile_of")." ".$user->getLogin());
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ROWCOL1", "tblrow1");
$tpl->setVariable("ROWCOL2", "tblrow2");
// Check from Database if value
// of public_profile = "y" show user infomation
if ($user->getPref("public_profile") != "y")
{
return;
}
$tpl->setVariable("TXT_MAIL", $lng->txt("send_mail"));
// Disabled (smeyer), since tags are not allowed for GET parameters
/*
$mail_to = ilMail::_getUserInternalMailboxAddress(
$user->getId(),
$user->getLogin(),
$user->getFirstname(),
$user->getLastname()
);
$tpl->setVariable("MAIL_USR_LOGIN", urlencode(
$mail_to)
);
*/
$tpl->setVariable('MAIL_USR_LOGIN',urlencode($user->getLogin()));
$tpl->setVariable("TXT_NAME", $lng->txt("name"));
$tpl->setVariable("FIRSTNAME", $user->getFirstName());
$tpl->setVariable("LASTNAME", $user->getLastName());
$tpl->setCurrentBlock("vcard");
$tpl->setVariable("TXT_VCARD", $lng->txt("vcard"));
$tpl->setVariable("TXT_DOWNLOAD_VCARD", $lng->txt("vcard_download"));
$ilCtrl->setParameter($this, "user", $this->getUserId());
$tpl->setVariable("HREF_VCARD", $ilCtrl->getLinkTarget($this, "deliverVCard"));
$tpl->setVariable("IMG_VCARD", ilUtil::getImagePath("vcard.png"));
$webspace_dir = ilUtil::getWebspaceDir("user");
$check_dir = ilUtil::getWebspaceDir();
$imagefile = $webspace_dir."/usr_images/".$user->getPref("profile_image");
$check_file = $check_dir."/usr_images/".$user->getPref("profile_image");
if ($user->getPref("public_upload")=="y" && @is_file($check_file))
{
//Getting the flexible path of image form ini file
//$webspace_dir = ilUtil::getWebspaceDir("output");
$tpl->setCurrentBlock("image");
$tpl->setVariable("TXT_IMAGE",$lng->txt("image"));
$tpl->setVariable("IMAGE_PATH", $webspace_dir."/usr_images/".$user->getPref("profile_image")."?dummy=".rand(1,999999));
$tpl->parseCurrentBlock();
}
$val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
"getStreet" => "street",
"getZipcode" => "zip", "getCity" => "city", "getCountry" => "country",
"getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
"getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
"getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
foreach ($val_arr as $key => $value)
{
// if value "y" show information
if ($user->getPref("public_".$value) == "y")
{
$tpl->setCurrentBlock("profile_data");
$tpl->setVariable("TXT_DATA", $lng->txt($value));
$tpl->setVariable("DATA", $user->$key());
$tpl->parseCurrentBlock();
}
}
// delicious row
$d_set = new ilSetting("delicious");
if ($d_set->get("user_profile") == "1" && $user->getPref("public_delicious") == "y")
{
$tpl->setCurrentBlock("delicious_row");
$tpl->setVariable("TXT_DELICIOUS", $lng->txt("delicious"));
$tpl->setVariable("TXT_DEL_ICON", $lng->txt("delicious"));
$tpl->setVariable("SRC_DEL_ICON", ilUtil::getImagePath("icon_delicious.gif"));
$tpl->setVariable("DEL_ACCOUNT", $user->getDelicious());
$tpl->parseCurrentBlock();
}
// map
include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
if (ilGoogleMapUtil::isActivated() && $user->getPref("public_location")
&& $user->getLatitude() != "")
{
$tpl->setVariable("TXT_LOCATION", $lng->txt("location"));
include_once("./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php");
$map_gui = new ilGoogleMapGUI();
$map_gui->setMapId("user_map");
$map_gui->setWidth("350px");
$map_gui->setHeight("230px");
$map_gui->setLatitude($user->getLatitude());
$map_gui->setLongitude($user->getLongitude());
$map_gui->setZoom($user->getLocationZoom());
$map_gui->setEnableNavigationControl(true);
$map_gui->addUserMarker($user->getId());
$tpl->setVariable("MAP_CONTENT", $map_gui->getHTML());
}
// display available IM contacts
if ($ilSetting->get("usr_settings_hide_instant_messengers") != 1)
{
$im_arr = array("icq","yahoo","msn","aim","skype");
foreach ($im_arr as $im_name)
{
if ($im_id = $user->getInstantMessengerId($im_name))
{
$tpl->setCurrentBlock("profile_data");
$tpl->setVariable("TXT_DATA", $lng->txt('im_'.$im_name));
$tpl->setVariable("IMG_ICON", ilUtil::getImagePath($im_name.'online.gif'));
$tpl->setVariable("TXT_ICON", $lng->txt("im_".$im_name."_icon"));
$tpl->setVariable("DATA", $im_id);
$tpl->parseCurrentBlock();
}
}
}
// additional information
$additional = $this->getAdditional();
if (is_array($additional))
{
foreach($additional as $key => $val)
{
$tpl->setCurrentBlock("profile_data");
$tpl->setVariable("TXT_DATA", $key);
$tpl->setVariable("DATA", $val);
$tpl->parseCurrentBlock();
}
}
return $tpl->get();
}

+ Here is the call graph for this function:

ilPublicUserProfileGUI::getUserId ( )

Get User ID.

Returns
int User ID

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

Referenced by deliverVCard(), and getHTML().

{
return $this->userid;
}

+ Here is the caller graph for this function:

ilPublicUserProfileGUI::setAdditional (   $a_additional)

Set Additonal Information.

Parameters
array$a_additionalAdditonal Information

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

{
$this->additional = $a_additional;
}
ilPublicUserProfileGUI::setAsRows (   $a_asrows)

Set Output as Table Rows.

Parameters
boolean$a_asrowsOutput as Table Rows

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

{
$this->asrows = $a_asrows;
}
ilPublicUserProfileGUI::setBackUrl (   $a_backurl)

Set Back Link URL.

Parameters
string$a_backurlBack Link URL

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

References $ilCtrl.

Referenced by __construct().

{
global $ilCtrl;
$this->backurl = $a_backurl;
$ilCtrl->setParameter($this, "back_url", rawurlencode($a_backurl));
}

+ Here is the caller graph for this function:

ilPublicUserProfileGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

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

Referenced by __construct().

{
$this->userid = $a_userid;
}

+ Here is the caller graph for this function:


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