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) {
59 strtolower(ilPublicProfileBaseClassGUI::class),
60 strtolower(PublicProfileGUI::class)
64 if (!is_array($a_ctrl_path)) {
65 $a_ctrl_path = [$a_ctrl_path];
68 if (!($return_as_array = is_array($a_user_id))) {
69 $a_user_id = [$a_user_id];
78 b.value public_profile,
84 (a.usr_id = b.usr_id AND
88 (a.usr_id = c.usr_id AND
90 WHERE ' .
$ilDB->in(
'a.usr_id', $a_user_id,
false,
'integer');
92 $userrow =
$ilDB->queryF($sql, [
'text',
'text'], [
'public_profile',
'public_title']);
97 while ($row =
$ilDB->fetchObject($userrow)) {
100 'id' => (
int) $row->usr_id,
107 $has_public_profile = in_array($row->public_profile, [
'y',
'g']);
108 if ($a_force_first_lastname || $has_public_profile) {
110 if ($row->public_title ==
'y' && $row->title) {
111 $title = $row->title .
' ';
113 $d[
'title'] = $title;
115 $pres = $row->lastname;
116 if (strlen($row->firstname)) {
117 $pres .= (
', ' . $row->firstname .
' ');
121 if (strlen($row->firstname)) {
122 $pres .= $row->firstname .
' ';
124 $pres .= ($row->lastname .
' ');
126 $d[
'firstname'] = $row->firstname;
127 $d[
'lastname'] = $row->lastname;
129 $d[
'login'] = $row->login;
130 $d[
'public_profile'] = $has_public_profile;
133 if (!$a_omit_login) {
134 $pres .=
'[' . $row->login .
']';
137 if ($a_profile_link && $has_public_profile) {
138 $ilCtrl->setParameterByClass(end($a_ctrl_path),
'user_id', $row->usr_id);
139 if ($a_profile_back_link !=
'') {
140 $ilCtrl->setParameterByClass(
143 rawurlencode($a_profile_back_link)
146 $link = $ilCtrl->getLinkTargetByClass($a_ctrl_path,
'getHTML');
147 $pres =
'<a href="' . $link .
'">' . $pres .
'</a>';
153 $pres =
'<img class="ilUserXXSmall" src="' . $img .
'" alt="' .
$lng->txt(
'icon') .
154 ' ' .
$lng->txt(
'user_picture') .
'" /> ' . $pres;
158 $names[$row->usr_id] = $pres;
162 foreach ($a_user_id as
$id) {
163 if (!isset($names[
$id])) {
164 $names[
$id] =
$lng->txt(
'deleted_user');
166 if ($names[
$id] ===
'') {
167 $names[
$id] =
$lng->txt(
'usr_name_undisclosed');
171 if ($a_return_data_array) {
172 if ($return_as_array) {
175 return current(
$data);
178 return $return_as_array ? $names : $names[$a_user_id[0]];
187 'SELECT value FROM usr_pref ' .
188 ' WHERE usr_id = ' .
$ilDB->quote($a_user_id,
'integer') .
189 ' and keyword = ' .
$ilDB->quote(
'public_profile',
'text')
191 $rec =
$ilDB->fetchAssoc($set);
193 return in_array($rec[
'value'] ??
'', [
'y',
'g']);
204 $ctrl =
$DIC[
'ilCtrl'];
207 if ($public_profile !=
'y' and $public_profile !=
'g') {
211 $ctrl->setParameterByClass(PublicProfileGUI::class,
'user', $a_usr_id);
212 return $ctrl->getLinkTargetByClass(
213 [ilPublicProfileBaseClassGUI::class, PublicProfileGUI::class],
220 return LocalDIC::dic()[StartingPointRepository::class]->getValidAndAccessibleStartingPointAsUrl();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
GUI class for public user profile presentation.
static _getPersonalPicturePath(int $usr_id, string $size='small', bool $force_pic=false)
static _lookupPref(int $a_usr_id, string $a_keyword)
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()