19 declare(strict_types=1);
51 array $public_profile_link_attributes = [],
56 $this->globalUser = $DIC->user();
57 $this->globalLng = $DIC->language();
71 if ($this->display_id > 0) {
80 if (!$this->author instanceof
ilObjUser) {
81 $this->author =
new ilObjUser();
82 $this->author->setId(0);
83 $this->author->setPref(
'public_profile',
'n');
84 $this->author->setGender(
'n');
100 return !$this->globalUser->isAnonymous();
107 if ($with_profile_link && $this->public_profile_link_attributes) {
110 foreach ($this->public_profile_link_attributes as $attr => $value) {
111 $link .=
' ' . $attr .
'="' . $value .
'"';
120 if ($with_profile_link && $this->public_profile_link_attributes) {
122 $linked_login .=
'</a>';
125 $this->linked_public_name = $link;
126 $this->linked_short_name = $linked_login;
129 protected function init(): void
141 && $this->
getAuthor()->getPref(
'public_profile') ===
'y')
142 || $this->
getAuthor()->getPref(
'public_profile') ===
'g')
145 $this->author_name = $this->
getAuthor()->getPublicName();
146 $this->author_short_name = $this->
getAuthor()->getLogin();
148 if ($this->
getAuthor()->getPref(
'public_upload') ===
'y') {
151 $this->profilePicture = $this->getAvatarImageSource(
161 if ($this->
getAuthor()->getPref(
'public_gender') !==
'y') {
168 $this->author_short_name = $this->author_name = $this->
getAuthor()->getLogin();
170 $this->profilePicture = $this->getAvatarImageSource(
171 $this->author_short_name,
177 $this->author_short_name = $this->author_name = $translationLanguage->txt(
'deleted');
178 $this->is_deleted =
true;
179 $this->suffix = $translationLanguage->txt(
'deleted');
181 $this->profilePicture = $this->getAvatarImageSource($this->author_short_name);
182 } elseif ($this->import_name !==
'') {
184 $this->author_short_name = $this->author_name = $this->import_name .
' (' . $translationLanguage->txt(
'imported') .
')';
185 $this->suffix = $translationLanguage->txt(
'imported');
187 $this->profilePicture = $this->getAvatarImageSource($this->author_short_name);
188 } elseif ($this->alias !==
'') {
190 $this->author_short_name = $this->author_name = $this->alias .
' (' . $translationLanguage->txt(
'frm_pseudonym') .
')';
191 $this->suffix = $translationLanguage->txt(
'frm_pseudonym');
193 $this->profilePicture = $this->getAvatarImageSource($this->author_short_name);
196 $this->author_short_name = $this->author_name = $translationLanguage->txt(
'forums_anonymous');
198 $this->profilePicture = $this->getAvatarImageSource($this->author_short_name);
220 $avatar = $DIC[
"user.avatar.factory"]->avatar(
'xsmall');
221 $avatar->setUsrId($usrId);
224 return $avatar->getUrl();
239 if (!$without_short_name) {
243 return trim(preg_replace(
'/\(' . preg_quote($this->
getAuthorShortName(),
'/') .
'\)/',
'', $this->author_name));
263 return $this->suffix !==
'';
static subStr(string $a_str, int $a_start, ?int $a_length=null)
static hasHTML()
Has HTML output.
static getCachedUserInstance(int $usr_id)
getPersonalPicturePath(string $a_size="small", bool $a_force_pic=false)