ILIAS  Release_4_2_x_branch Revision 61807
 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, $a_omit_login=false, $a_sortable=true)
 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 36692 2012-09-02 11:21:19Z smeyer

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,
  $a_omit_login = false,
  $a_sortable = true 
)
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.

...

Parameters
booleansortable should be used in table presentions. output is "Doe, John" title is ommited

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

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

Referenced by ilObjExerciseGUI\confirmDeassignMembersObject(), ilCourseParticipantsGroupsGUI\confirmRemove(), ilObjExerciseGUI\executeCommand(), ilUserForTagTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilWikiPagesTableGUI\fillRow(), ilUsersOnlineBlockGUI\fillRow(), ilCourseParticipantsGroupsTableGUI\getItems(), ilNoteGUI\getNoteListHTML(), ilWorkspaceAccessTableGUI\importData(), ilObjFileGUI\infoScreenForward(), ilWikiPageGUI\preview(), ilPublicUserProfileGUI\renderTitle(), ilObjBlog\sendNotification(), ilWikiUtil\sendNotification(), 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,
b.value public_profile,
c.value public_title
FROM
usr_data a
LEFT JOIN
usr_pref b ON
(a.usr_id = b.usr_id AND
b.keyword = %s)
LEFT JOIN
usr_pref c ON
(a.usr_id = c.usr_id AND
c.keyword = %s)
WHERE ' . $ilDB->in('a.usr_id', $a_user_id, false, 'integer');
$userrow = $ilDB->queryF($sql, array('text', 'text'), array('public_profile', 'public_title'));
$names = array();
while ($row = $ilDB->fetchObject($userrow))
{
if ($a_force_first_lastname ||
$has_public_profile = in_array($row->public_profile, array("y", "g")))
{
$title = "";
if($row->public_title == "y" && $row->title)
{
$title = $row->title . " ";
}
if($a_sortable)
{
$pres = $row->lastname;
if(strlen($row->firstname))
{
$pres .= (', '.$row->firstname.' ');
}
}
else
{
$pres = $title;
if(strlen($row->firstname))
{
$pres .= $row->firstname.' ';
}
$pres .= ($row->lastname.' ');
}
}
if(!$a_omit_login)
{
$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: