Class ilUserAvatarResolver.
More...
◆ __construct()
ilUserAvatarResolver::__construct |
( |
int |
$user_id | ) |
|
◆ getAvatar()
ilUserAvatarResolver::getAvatar |
( |
bool |
$name_as_set_as_text_closely = false | ) |
|
- Parameters
-
bool | $name_as_set_as_text_closely | if the name is set as text close to the Avatar, the alternative text for screenreaders will be set differently, to reduce redundancy for screenreaders. See rules on the Avatar Symbol in the UI Components |
Definition at line 111 of file class.ilUserAvatarResolver.php.
References $DIC, $login, ilObjUser\_lookupLogin(), ilUtil\getImagePath(), ILIAS\Repository\lng(), ILIAS\UI\examples\Symbol\Glyph\Login\login(), ilWACSignedPath\signFile(), ILIAS\Repository\ui(), ILIAS\Repository\user(), and useUploadedFile().
113 if ($name_as_set_as_text_closely) {
114 $alternative_text = $this->
lng->txt(
"user_avatar");
115 } elseif ($this->user_id == $this->
user->getId() && !$this->user::_isAnonymous($this->user_id)) {
116 $alternative_text = $this->
lng->txt(
"current_user_avatar");
118 $alternative_text = $this->
lng->txt(
"user_avatar_of") .
" " .
$this->login;
123 return $this->
ui->symbol()->avatar()->picture($picture, $this->
login)
124 ->withLabel($alternative_text);
127 if ($this->letter_avatars_activated ===
false) {
128 return $this->
ui->symbol()->avatar()->picture(
134 return $this->
ui->symbol()->avatar()->letter($this->abbreviation)->withLabel($alternative_text);
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This describes how a letter or a picture avatar could be modified during construction of UI...
static signFile(string $path_to_file)
static _lookupLogin(int $a_user_id)
◆ init()
ilUserAvatarResolver::init |
( |
| ) |
|
|
private |
Definition at line 57 of file class.ilUserAvatarResolver.php.
References $res, ilFileUtils\getWebspaceDir(), ILIAS\UI\examples\Symbol\Glyph\Login\login(), and ilStr\subStr().
Referenced by __construct().
59 $in = $this->db->in(
'usr_pref.keyword', array(
'public_upload',
'public_profile'),
false,
'text');
60 $res = $this->db->queryF(
62 SELECT usr_pref.*, ud.login, ud.firstname, ud.lastname 63 FROM usr_data ud LEFT JOIN usr_pref ON usr_pref.usr_id = ud.usr_id AND $in 64 WHERE ud.usr_id = %s",
69 while ($row = $this->db->fetchAssoc(
$res)) {
70 $this->
login = $row[
'login'] ??
'';
71 $this->firstname = $row[
'firstname'] ??
'';
72 $this->lastname = $row[
'lastname'] ??
'';
74 switch ($row[
'keyword']) {
76 $this->has_public_upload = $row[
'value'] ===
'y';
78 case 'public_profile':
79 $this->has_public_profile = ($row[
'value'] ===
'y' || $row[
'value'] ===
'g');
86 if (defined(
'ILIAS_MODULE')) {
87 $webspace_dir = (
'.' . $webspace_dir);
91 $image_dir = $webspace_dir .
'/usr_images';
92 $this->uploaded_file = $image_dir .
'/usr_' . $this->user_id .
'.jpg';
94 if ($this->has_public_profile) {
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static subStr(string $a_str, int $a_start, ?int $a_length=null)
◆ setForcePicture()
ilUserAvatarResolver::setForcePicture |
( |
bool |
$force_image | ) |
|
◆ setSize()
ilUserAvatarResolver::setSize |
( |
string |
$size | ) |
|
◆ useUploadedFile()
ilUserAvatarResolver::useUploadedFile |
( |
| ) |
|
|
private |
◆ $abbreviation
string ilUserAvatarResolver::$abbreviation = "" |
|
private |
◆ $db
◆ $firstname
string ilUserAvatarResolver::$firstname = "" |
|
private |
◆ $force_image
bool ilUserAvatarResolver::$force_image = false |
|
private |
◆ $has_public_profile
bool ilUserAvatarResolver::$has_public_profile = false |
|
private |
◆ $has_public_upload
bool ilUserAvatarResolver::$has_public_upload = false |
|
private |
◆ $lastname
string ilUserAvatarResolver::$lastname = "" |
|
private |
◆ $letter_avatars_activated
bool ilUserAvatarResolver::$letter_avatars_activated |
|
protected |
◆ $lng
◆ $login
string ilUserAvatarResolver::$login = "" |
|
private |
◆ $size
string ilUserAvatarResolver::$size = 'small' |
|
private |
◆ $ui
◆ $uploaded_file
string ilUserAvatarResolver::$uploaded_file = "" |
|
private |
◆ $user
◆ $user_id
int ilUserAvatarResolver::$user_id = 0 |
|
private |
The documentation for this class was generated from the following file: