ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ProfileGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
26{
28 protected \ILIAS\UI\Factory $ui_factory;
29
30 public function __construct(
33 ) {
34 $this->ui_factory = $ui_factory;
35 $this->profile = $profile;
36 }
37
38 public function getAvatar(int $user_id): Avatar
39 {
40 if ($this->profile->exists($user_id)) {
42 } else {
43 $avatar = $this->ui_factory->symbol()->avatar()->letter($this->profile->getDeletedUserAvatarText());
44 }
45 return $avatar;
46 }
47
48 public function getPicturePath(int $user_id): string
49 {
50 global $DIC;
51
52 if ($this->profile->exists($user_id)) {
53 return \ilObjUser::_getPersonalPicturePath($user_id, "xsmall", true, true);
54 }
55 $fac = new \ilUserAvatarFactory($DIC);
56 $avatar = $fac->avatar("xsmall");
57 $avatar->setName(substr($this->profile->getDeletedUserAvatarText(), 0, 2));
58 $avatar->setUsrId($user_id);
59 return $avatar->getUrl();
60 }
61
62 public function getNamePresentation(int $user_id, bool $link_profile = false, string $back = "", $force_first_last = false): string
63 {
64 if ($this->profile->exists($user_id)) {
65 $name = \ilUserUtil::getNamePresentation($user_id, false, $link_profile, $back, $force_first_last);
66 } else {
67 $name = $this->profile->getDeletedUserNamePresentation();
68 }
69 return $name;
70 }
71}
Builds data types.
Definition: Factory.php:36
__construct(ProfileAdapter $profile, \ILIAS\UI\Factory $ui_factory)
Definition: ProfileGUI.php:30
getNamePresentation(int $user_id, bool $link_profile=false, string $back="", $force_first_last=false)
Definition: ProfileGUI.php:62
Definition: UI.php:24
static _getAvatar(int $a_usr_id)
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:
This describes how a letter or a picture avatar could be modified during construction of UI.
Definition: Avatar.php:29
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26