Class ilUserAvatarResolver.
More...
◆ __construct()
ilUserAvatarResolver::__construct |
( |
int |
$user_id | ) |
|
constructor.
- Parameters
-
Definition at line 78 of file class.ilUserAvatarResolver.php.
References $DIC, $user_id, init(), ui(), and user().
82 $this->db = $DIC->database();
83 $this->
ui = $DIC->ui()->factory();
84 $this->lng = $DIC->language();
85 $this->
user = $DIC->user();
87 $this->letter_avatars_activated = (bool) $DIC->settings()->get(
'letter_avatars');
◆ getAvatar()
ilUserAvatarResolver::getAvatar |
( |
bool |
$name_as_set_as_text_closely = false | ) |
|
- Parameters
-
bool | $name_as_text_visible_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 |
- Returns
- Avatar
Definition at line 146 of file class.ilUserAvatarResolver.php.
References $DIC, $login, ilObjUser\_lookupLogin(), ilUtil\getImagePath(), login(), ui(), user(), and useUploadedFile().
148 if ($name_as_set_as_text_closely) {
149 $alternative_text = $this->lng->txt(
"user_avatar");
150 } elseif ($this->user_id == $this->
user->getId() && !$this->user::_isAnonymous($this->user_id)) {
151 $alternative_text = $this->lng->txt(
"current_user_avatar");
153 $alternative_text = $this->lng->txt(
"user_avatar_of") .
" " .
$this->login;
157 return $this->
ui->symbol()->avatar()->picture($this->uploaded_file, $this->
login)
158 ->withAlternativeText($alternative_text);
161 if ($this->letter_avatars_activated ===
false) {
162 return $this->
ui->symbol()->avatar()->picture(
168 return $this->
ui->symbol()->avatar()->letter($this->abbreviation)->withAlternativeText($alternative_text);
static _lookupLogin($a_user_id)
lookup login
This describes how a letter or a picture avatar could be modified during construction of UI...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
◆ init()
ilUserAvatarResolver::init |
( |
| ) |
|
|
private |
Definition at line 91 of file class.ilUserAvatarResolver.php.
References $in, $res, ilUtil\getWebspaceDir(), login(), and ilStr\subStr().
Referenced by __construct().
93 $in = $this->db->in(
'usr_pref.keyword', array(
'public_upload',
'public_profile'),
false,
'text');
94 $res = $this->db->queryF(
96 SELECT usr_pref.*, ud.login, ud.firstname, ud.lastname 97 FROM usr_data ud LEFT JOIN usr_pref ON usr_pref.usr_id = ud.usr_id AND $in 98 WHERE ud.usr_id = %s",
100 array($this->user_id)
103 while ($row = $this->db->fetchAssoc(
$res)) {
104 $this->
login = $row[
'login'];
105 $this->firstname = $row[
'firstname'];
106 $this->lastname = $row[
'lastname'];
108 switch ($row[
'keyword']) {
109 case 'public_upload':
110 $this->has_public_upload = $row[
'value'] ===
'y';
112 case 'public_profile':
113 $this->has_public_profile = ($row[
'value'] ===
'y' || $row[
'value'] ===
'g');
120 if (defined(
'ILIAS_MODULE')) {
121 $webspace_dir = (
'.' . $webspace_dir);
125 $image_dir = $webspace_dir .
'/usr_images';
126 $this->uploaded_file = $image_dir .
'/usr_' . $this->user_id .
'.jpg';
128 if ($this->has_public_profile) {
static subStr($a_str, $a_start, $a_length=null)
foreach($_POST as $key=> $value) $res
if(php_sapi_name() !='cli') $in
static getWebspaceDir($mode="filesystem")
get webspace directory
◆ setForcePicture()
ilUserAvatarResolver::setForcePicture |
( |
bool |
$force_image | ) |
|
◆ setSize()
ilUserAvatarResolver::setSize |
( |
string |
$size | ) |
|
◆ useUploadedFile()
ilUserAvatarResolver::useUploadedFile |
( |
| ) |
|
|
private |
◆ $abbreviation
ilUserAvatarResolver::$abbreviation |
|
private |
◆ $db
ilUserAvatarResolver::$db |
|
private |
◆ $firstname
ilUserAvatarResolver::$firstname |
|
private |
◆ $force_image
ilUserAvatarResolver::$force_image = false |
|
private |
◆ $has_public_profile
ilUserAvatarResolver::$has_public_profile = false |
|
private |
◆ $has_public_upload
ilUserAvatarResolver::$has_public_upload = false |
|
private |
◆ $lastname
ilUserAvatarResolver::$lastname |
|
private |
◆ $letter_avatars_activated
ilUserAvatarResolver::$letter_avatars_activated |
|
protected |
◆ $lng
ilUserAvatarResolver::$lng |
|
private |
◆ $login
ilUserAvatarResolver::$login |
|
private |
◆ $size
ilUserAvatarResolver::$size = 'small' |
|
private |
◆ $ui
ilUserAvatarResolver::$ui |
|
protected |
◆ $uploaded_file
ilUserAvatarResolver::$uploaded_file |
|
private |
◆ $user
ilUserAvatarResolver::$user |
|
private |
◆ $user_id
ilUserAvatarResolver::$user_id |
|
private |
The documentation for this class was generated from the following file: