ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserUtil Class Reference

Class ilUserUtil. More...

+ Collaboration diagram for ilUserUtil:

Static Public Member Functions

static getNamePresentation ($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false)
 Default behaviour is:

Detailed Description

Class ilUserUtil.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilUserUtil.php 22624 2010-01-04 16:27:02Z jposselt

Definition at line 12 of file class.ilUserUtil.php.

Member Function Documentation

static ilUserUtil::getNamePresentation (   $a_user_id,
  $a_user_image = false,
  $a_profile_link = false,
  $a_profile_back_link = "",
  $a_force_first_lastname = false 
)
static

Default behaviour is:

  • lastname, firstname if public profile enabled
  • [loginname] (always) modifications by jposselt at databay . de : if $a_user_id is an array of user ids the method returns an array of "id" => "NamePresentation" pairs.

Definition at line 22 of file class.ilUserUtil.php.

References $ilCtrl, $ilDB, $img, $lng, $row, $t, and ilObjUser\_getPersonalPicturePath().

Referenced by ilUserForTagTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilWikiPagesTableGUI\fillRow(), and ilPageObjectGUI\showPage().

{
global $lng, $ilCtrl, $ilDB;
if (!($return_as_array = is_array($a_user_id)))
$a_user_id = array($a_user_id);
$sql = 'SELECT
a.usr_id,
firstname,
lastname,
title,
login,
value public_profile
FROM
usr_data a
LEFT JOIN
usr_pref b ON
a.usr_id = b.usr_id AND
keyword = %s
WHERE ' . $ilDB->in('a.usr_id', $a_user_id, false, 'integer');
$userrow = $ilDB->queryF($sql, array('text'), array('public_profile'));
$names = array();
while ($row = $ilDB->fetchObject($userrow))
{
if ($a_force_first_lastname ||
$has_public_profile = in_array($row->public_profile, array("y", "g")))
{
$pres = $row->lastname.", ".($t = $row->title ? $t . " " : "").$row->firstname." ";
}
$pres.= "[".$row->login."]";
if ($a_profile_link && $has_public_profile)
{
$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $row->usr_id);
if ($a_profile_back_link != "")
{
$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
rawurlencode($a_profile_back_link));
}
$pres = '<a href="'.$ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML").'">'.$pres.'</a>';
}
if ($a_user_image)
{
$pres = '<img border="0" src="'.$img.'" alt="'.$lng->txt("icon").
" ".$lng->txt("user_picture").'" /> '.$pres;
}
$names[$row->usr_id] = $pres;
}
foreach($a_user_id as $id)
{
if (!$names[$id])
$names[$id] = "unknown";
}
return $return_as_array ? $names : $names[$a_user_id[0]];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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