ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilMStShowUserGUI Class Reference

Class ilMStShowUserGUI. More...

+ Collaboration diagram for ilMStShowUserGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 cancel ()
 

Data Fields

const string CMD_INDEX = 'index'
 
const string CMD_SHOW_USER = 'showUser'
 
const string TAB_SHOW_USER = 'show_user'
 
const string TAB_SHOW_COURSES = 'show_courses'
 
const string TAB_SHOW_CERTIFICATES = 'show_certificates'
 
const string TAB_SHOW_COMPETENCES = 'show_competences'
 
const string TAB_SHOW_TALKS = 'show_talks'
 

Protected Member Functions

 setTitleAndIcon ()
 
 checkAccessOrFail ()
 
 index ()
 
 showUser ()
 
 addTabs (string $active_tab_id)
 

Protected Attributes

int $usr_id
 
ilMyStaffAccess $access
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Class ilMStShowUserGUI.

Author
Martin Studer ms@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch @ilCtrl_IsCalledBy ilMStShowUserGUI: ilMyStaffGUI @ilCtrl_Calls ilMStShowUserGUI: ilUserCertificateGUI @ilCtrl_Calls ilMStShowUserGUI: ILIAS\User\Profile\PublicProfileGUI

Definition at line 30 of file class.ilMStShowUserGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMStShowUserGUI::__construct ( )

Definition at line 44 of file class.ilMStShowUserGUI.php.

45 {
46 global $DIC;
47 $this->main_tpl = $DIC->ui()->mainTemplate();
48
49 $this->access = ilMyStaffAccess::getInstance();
50
51 $this->usr_id = $DIC->http()->request()->getQueryParams()['usr_id'];
52 $DIC->ctrl()->setParameter($this, 'usr_id', $this->usr_id);
53
54 $this->setTitleAndIcon();
55 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), and setTitleAndIcon().

+ Here is the call graph for this function:

Member Function Documentation

◆ addTabs()

ilMStShowUserGUI::addTabs ( string  $active_tab_id)
protected

Definition at line 157 of file class.ilMStShowUserGUI.php.

157 : void
158 {
159 global $DIC;
160
161 $DIC->tabs()->setBackTarget($DIC->language()->txt('mst_list_users'), $DIC->ctrl()->getLinkTargetByClass(array(
162 ilMyStaffGUI::class,
163 ilMStListUsersGUI::class,
164 )));
165
166 if ($this->access->hasCurrentUserAccessToCourseMemberships()) {
167 $DIC->tabs()->addTab(
168 self::TAB_SHOW_COURSES,
169 $DIC->language()->txt('mst_list_courses'),
170 $DIC->ctrl()->getLinkTargetByClass(array(
171 ilMyStaffGUI::class,
172 self::class,
173 ilMStShowUserCoursesGUI::class,
174 ))
175 );
176 }
177
178 if ($this->access->hasCurrentUserAccessToCertificates()) {
179 $DIC->tabs()->addTab(
180 self::TAB_SHOW_CERTIFICATES,
181 $DIC->language()->txt('mst_list_certificates'),
182 $DIC->ctrl()->getLinkTargetByClass(array(
183 ilMyStaffGUI::class,
184 self::class,
185 ilUserCertificateGUI::class,
186 ))
187 );
188 }
189
190 if ($this->access->hasCurrentUserAccessToCompetences()) {
191 $DIC->tabs()->addTab(
192 self::TAB_SHOW_COMPETENCES,
193 $DIC->language()->txt('mst_list_competences'),
194 $DIC->ctrl()->getLinkTargetByClass(array(
195 ilMyStaffGUI::class,
196 self::class,
197 ilMStShowUserCompetencesGUI::class,
198 ))
199 );
200 }
201
202 $user = new ilObjUser($this->usr_id);
203 if ($user->hasPublicProfile()) {
204 $DIC->ctrl()->setParameterByClass(self::class, 'usr_id', $this->usr_id);
205 $public_profile_url = $DIC->ctrl()->getLinkTargetByClass(self::class, self::CMD_SHOW_USER);
206 $DIC->tabs()->addTab(self::TAB_SHOW_USER, $DIC->language()->txt('public_profile'), $public_profile_url);
207 }
208
209 if ($this->access->hasCurrentUserAccessToTalks()) {
210 $DIC->ctrl()->setParameterByClass(strtolower(self::class), 'usr_id', $this->usr_id);
211 $DIC->tabs()->addTab(self::TAB_SHOW_TALKS, $DIC->language()->txt('etal_talks'), $DIC->ctrl()->getLinkTargetByClass([
212 strtolower(ilMyStaffGUI::class),
213 strtolower(self::class),
214 strtolower(ilEmployeeTalkMyStaffUserGUI::class)
215 ], ControlFlowCommand::INDEX));
216 }
217
218 if ($active_tab_id) {
219 $DIC->tabs()->activateTab($active_tab_id);
220 }
221 }
User class.

References $DIC, and ILIAS\Repository\access().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMStShowUserGUI::cancel ( )

Definition at line 150 of file class.ilMStShowUserGUI.php.

150 : void
151 {
152 global $DIC;
153
154 $DIC->ctrl()->redirect($this);
155 }

References $DIC.

◆ checkAccessOrFail()

ilMStShowUserGUI::checkAccessOrFail ( )
protected

Definition at line 63 of file class.ilMStShowUserGUI.php.

63 : void
64 {
65 global $DIC;
66
67 if (!$this->usr_id) {
68 $this->main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("permission_denied"), true);
69 $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
70 }
71
72 if ($this->access->hasCurrentUserAccessToUser($this->usr_id)) {
73 return;
74 } else {
75 $this->main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("permission_denied"), true);
76 $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
77 }
78 }

References $DIC, and ILIAS\Repository\access().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMStShowUserGUI::executeCommand ( )
final

Definition at line 80 of file class.ilMStShowUserGUI.php.

80 : void
81 {
82 global $DIC;
83
84 $this->checkAccessOrFail();
85
86 $cmd = $DIC->ctrl()->getCmd();
87 $next_class = $DIC->ctrl()->getNextClass();
88
89 switch ($next_class) {
90 case strtolower(ilMStShowUserCoursesGUI::class):
91 $this->addTabs(self::TAB_SHOW_COURSES);
92 $gui = new ilMStShowUserCoursesGUI();
93 $DIC->ctrl()->forwardCommand($gui);
94 break;
95 case strtolower(ilUserCertificateGUI::class):
96 $this->addTabs(self::TAB_SHOW_CERTIFICATES);
97 $gui = new ilUserCertificateGUI(
98 null,
99 null,
100 null,
101 new ilObjUser($this->usr_id)
102 );
103 $DIC->ctrl()->forwardCommand($gui);
104 $this->setTitleAndIcon();
105 break;
106 case strtolower(ilMStShowUserCompetencesGUI::class):
107 $this->addTabs(self::TAB_SHOW_COMPETENCES);
109 $DIC->ctrl()->forwardCommand($gui);
110 break;
111 case strtolower(ilEmployeeTalkMyStaffUserGUI::class):
112 $this->addTabs(self::TAB_SHOW_TALKS);
113 $gui = new ilEmployeeTalkMyStaffUserGUI();
114 $DIC->ctrl()->forwardCommand($gui);
115 break;
116 default:
117
118 switch ($cmd) {
120 $this->addTabs(self::TAB_SHOW_USER);
121 $this->$cmd();
122 break;
123 default:
124 $this->index();
125 break;
126 }
127 }
128 }
Class ilMStShowUserCompetencesGUI.
addTabs(string $active_tab_id)
const string TAB_SHOW_COMPETENCES
const string TAB_SHOW_CERTIFICATES
@ilCtrl_IsCalledBy ilUserCertificateGUI: ilAchievementsGUI

References $DIC, addTabs(), checkAccessOrFail(), CMD_SHOW_USER, index(), and setTitleAndIcon().

+ Here is the call graph for this function:

◆ index()

ilMStShowUserGUI::index ( )
protected

Definition at line 130 of file class.ilMStShowUserGUI.php.

130 : void
131 {
132 global $DIC;
133 $DIC->ctrl()->redirectByClass(ilMStShowUserCoursesGUI::class);
134 }

References $DIC.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ setTitleAndIcon()

ilMStShowUserGUI::setTitleAndIcon ( )
protected

Definition at line 57 of file class.ilMStShowUserGUI.php.

57 : void
58 {
59 $this->main_tpl->setTitle(ilUserUtil::getNamePresentation($this->usr_id));
60 $this->main_tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->usr_id, "xxsmall"));
61 }
static _getPersonalPicturePath(int $usr_id, string $size='small', bool $force_pic=false)
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:

References ilObjUser\_getPersonalPicturePath(), and ilUserUtil\getNamePresentation().

Referenced by __construct(), and executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUser()

ilMStShowUserGUI::showUser ( )
protected

Definition at line 136 of file class.ilMStShowUserGUI.php.

136 : void
137 {
138 global $DIC;
139
140 //Redirect if Profile is not public
141 $user = new ilObjUser($this->usr_id);
142 if (!$user->hasPublicProfile()) {
143 $DIC->ctrl()->redirectByClass(self::class, self::CMD_INDEX);
144 }
145
146 $pub_profile = new PublicProfileGUI($this->usr_id);
147 $DIC->ui()->mainTemplate()->setContent($pub_profile->getEmbeddable());
148 }
GUI class for public user profile presentation.

References $DIC.

Field Documentation

◆ $access

ilMyStaffAccess ilMStShowUserGUI::$access
protected

Definition at line 41 of file class.ilMStShowUserGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilMStShowUserGUI::$main_tpl
private

Definition at line 42 of file class.ilMStShowUserGUI.php.

◆ $usr_id

int ilMStShowUserGUI::$usr_id
protected

Definition at line 40 of file class.ilMStShowUserGUI.php.

◆ CMD_INDEX

const string ilMStShowUserGUI::CMD_INDEX = 'index'

Definition at line 32 of file class.ilMStShowUserGUI.php.

◆ CMD_SHOW_USER

const string ilMStShowUserGUI::CMD_SHOW_USER = 'showUser'

Definition at line 33 of file class.ilMStShowUserGUI.php.

Referenced by executeCommand().

◆ TAB_SHOW_CERTIFICATES

const string ilMStShowUserGUI::TAB_SHOW_CERTIFICATES = 'show_certificates'

Definition at line 36 of file class.ilMStShowUserGUI.php.

◆ TAB_SHOW_COMPETENCES

const string ilMStShowUserGUI::TAB_SHOW_COMPETENCES = 'show_competences'

Definition at line 37 of file class.ilMStShowUserGUI.php.

◆ TAB_SHOW_COURSES

const string ilMStShowUserGUI::TAB_SHOW_COURSES = 'show_courses'

Definition at line 35 of file class.ilMStShowUserGUI.php.

◆ TAB_SHOW_TALKS

const string ilMStShowUserGUI::TAB_SHOW_TALKS = 'show_talks'

Definition at line 38 of file class.ilMStShowUserGUI.php.

◆ TAB_SHOW_USER

const string ilMStShowUserGUI::TAB_SHOW_USER = 'show_user'

Definition at line 34 of file class.ilMStShowUserGUI.php.


The documentation for this class was generated from the following file: