21use PublicProfileGUILIAS\User\Profile\PublicProfileGUI;
43 bool $a_user_image =
false,
44 bool $a_profile_link =
false,
45 string $a_profile_back_link =
'',
46 bool $a_force_first_lastname =
false,
47 bool $a_omit_login =
false,
48 bool $a_sortable =
true,
49 bool $a_return_data_array =
false,
54 $ilCtrl =
$DIC[
'ilCtrl'];
57 if ($a_ctrl_path ===
null) {
58 $a_ctrl_path = strtolower(PublicProfileGUI::class);
61 if (!is_array($a_ctrl_path)) {
62 $a_ctrl_path = [$a_ctrl_path];
65 if (!($return_as_array = is_array($a_user_id))) {
66 $a_user_id = [$a_user_id];
75 b.value public_profile,
81 (a.usr_id = b.usr_id AND
85 (a.usr_id = c.usr_id AND
87 WHERE ' .
$ilDB->in(
'a.usr_id', $a_user_id,
false,
'integer');
89 $userrow =
$ilDB->queryF($sql, [
'text',
'text'], [
'public_profile',
'public_title']);
94 while ($row =
$ilDB->fetchObject($userrow)) {
97 'id' => (
int) $row->usr_id,
104 $has_public_profile = in_array($row->public_profile, [
'y',
'g']);
105 if ($a_force_first_lastname || $has_public_profile) {
107 if ($row->public_title ==
'y' && $row->title) {
108 $title = $row->title .
' ';
110 $d[
'title'] = $title;
112 $pres = $row->lastname;
113 if (strlen($row->firstname)) {
114 $pres .= (
', ' . $row->firstname .
' ');
118 if (strlen($row->firstname)) {
119 $pres .= $row->firstname .
' ';
121 $pres .= ($row->lastname .
' ');
123 $d[
'firstname'] = $row->firstname;
124 $d[
'lastname'] = $row->lastname;
126 $d[
'login'] = $row->login;
127 $d[
'public_profile'] = $has_public_profile;
130 if (!$a_omit_login) {
131 $pres .=
'[' . $row->login .
']';
134 if ($a_profile_link && $has_public_profile) {
135 $ilCtrl->setParameterByClass(end($a_ctrl_path),
'user_id', $row->usr_id);
136 if ($a_profile_back_link !=
'') {
137 $ilCtrl->setParameterByClass(
140 rawurlencode($a_profile_back_link)
143 $link = $ilCtrl->getLinkTargetByClass($a_ctrl_path,
'getHTML');
144 $pres =
'<a href="' . $link .
'">' . $pres .
'</a>';
150 $pres =
'<img class="ilUserXXSmall" src="' . $img .
'" alt="' .
$lng->txt(
'icon') .
151 ' ' .
$lng->txt(
'user_picture') .
'" /> ' . $pres;
155 $names[$row->usr_id] = $pres;
159 foreach ($a_user_id as
$id) {
160 if (!isset($names[
$id])) {
161 $names[
$id] =
$lng->txt(
'deleted_user');
163 if ($names[
$id] ===
'') {
164 $names[
$id] =
$lng->txt(
'usr_name_undisclosed');
168 if ($a_return_data_array) {
169 if ($return_as_array) {
172 return current(
$data);
175 return $return_as_array ? $names : $names[$a_user_id[0]];
184 'SELECT value FROM usr_pref ' .
185 ' WHERE usr_id = ' .
$ilDB->quote($a_user_id,
'integer') .
186 ' and keyword = ' .
$ilDB->quote(
'public_profile',
'text')
188 $rec =
$ilDB->fetchAssoc($set);
190 return in_array($rec[
'value'] ??
'', [
'y',
'g']);
201 $ctrl =
$DIC[
'ilCtrl'];
204 if ($public_profile !=
'y' and $public_profile !=
'g') {
208 $ctrl->setParameterByClass(PublicProfileGUI::class,
'user', $a_usr_id);
209 return $ctrl->getLinkTargetByClass(PublicProfileGUI::class,
'getHTML');
214 return LocalDIC::dic()[StartingPointRepository::class]->getValidAndAccessibleStartingPointAsUrl();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _lookupPref(int $a_usr_id, string $a_keyword)
static _getPersonalPicturePath(int $a_usr_id, string $a_size='small', bool $a_force_pic=false)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
static hasPublicProfile(int $a_user_id)
static getProfileLink(int $a_usr_id)
Get link to personal profile Return empty string in case of not public profile.
static getStartingPointAsUrl()