63 $this->db = $DIC->database();
64 $this->
ui = $DIC->ui()->factory();
66 $this->letter_avatars_activated = (bool) $DIC->settings()->get(
'letter_avatars');
70 private function init() : void
72 $in = $this->db->in(
'usr_pref.keyword', array(
'public_upload',
'public_profile'),
false,
'text');
73 $res = $this->db->queryF(
75 SELECT usr_pref.*, ud.login, ud.firstname, ud.lastname 76 FROM usr_data ud LEFT JOIN usr_pref ON usr_pref.usr_id = ud.usr_id AND $in 77 WHERE ud.usr_id = %s",
82 while ($row = $this->db->fetchAssoc(
$res)) {
83 $this->
login = $row[
'login'];
84 $this->firstname = $row[
'firstname'];
85 $this->lastname = $row[
'lastname'];
87 switch ($row[
'keyword']) {
89 $this->has_public_upload = $row[
'value'] ===
'y';
91 case 'public_profile':
92 $this->has_public_profile = ($row[
'value'] ===
'y' || $row[
'value'] ===
'g');
99 if (defined(
'ILIAS_MODULE')) {
100 $webspace_dir = (
'.' . $webspace_dir);
104 $image_dir = $webspace_dir .
'/usr_images';
105 $this->uploaded_file = $image_dir .
'/usr_' . $this->user_id .
'.jpg';
107 if ($this->has_public_profile) {
116 return (($this->has_public_upload && $this->has_public_profile) || $this->force_image) && is_file($this->uploaded_file);
122 return $this->
ui->symbol()->avatar()->picture($this->uploaded_file, $this->abbreviation);
125 if ($this->letter_avatars_activated ===
false) {
126 return $this->
ui->symbol()->avatar()->picture(
131 return $this->
ui->symbol()->avatar()->letter($this->abbreviation);
134 public function getLegacyPictureURL() :
string 138 return $this->uploaded_file .
'?t=' . rand(1, 99999);
143 $avatar = $DIC[
"user.avatar.factory"]->avatar($this->size);
144 $avatar->setName($this->abbreviation);
145 $avatar->setUsrId($this->user_id);
147 return $avatar->getUrl();
163 if ($size ===
'small' || $size ===
'big') {
static _lookupLogin($a_user_id)
lookup login
$letter_avatars_activated
__construct(int $user_id)
constructor.
static subStr($a_str, $a_start, $a_length=null)
foreach($_POST as $key=> $value) $res
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)
Class ilUserAvatarResolver.
if(php_sapi_name() !='cli') $in
static getWebspaceDir($mode="filesystem")
get webspace directory
setForcePicture(bool $force_image)