ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilMStShowUserGUI Class Reference

Class ilMStShowUserGUI. More...

+ Collaboration diagram for ilMStShowUserGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 cancel ()
 

Data Fields

const CMD_INDEX = 'index'
 
const CMD_SHOW_USER = 'showUser'
 
const TAB_SHOW_USER = 'show_user'
 
const TAB_SHOW_COURSES = 'show_courses'
 
const TAB_SHOW_CERTIFICATES = 'show_certificates'
 
const TAB_SHOW_COMPETENCES = 'show_competences'
 
const 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

Constructor & Destructor Documentation

◆ __construct()

ilMStShowUserGUI::__construct ( )

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

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

44  {
45  global $DIC;
46  $this->main_tpl = $DIC->ui()->mainTemplate();
47 
48  $this->access = ilMyStaffAccess::getInstance();
49 
50  $this->usr_id = $DIC->http()->request()->getQueryParams()['usr_id'];
51  $DIC->ctrl()->setParameter($this, 'usr_id', $this->usr_id);
52 
53  $this->setTitleAndIcon();
54  }
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:

Member Function Documentation

◆ addTabs()

ilMStShowUserGUI::addTabs ( string  $active_tab_id)
protected

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

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

Referenced by executeCommand().

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

◆ cancel()

ilMStShowUserGUI::cancel ( )

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

References $DIC.

149  : void
150  {
151  global $DIC;
152 
153  $DIC->ctrl()->redirect($this);
154  }
global $DIC
Definition: shib_login.php:25

◆ checkAccessOrFail()

ilMStShowUserGUI::checkAccessOrFail ( )
protected

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

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

Referenced by executeCommand().

62  : void
63  {
64  global $DIC;
65 
66  if (!$this->usr_id) {
67  $this->main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("permission_denied"), true);
68  $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
69  }
70 
71  if ($this->access->hasCurrentUserAccessToUser($this->usr_id)) {
72  return;
73  } else {
74  $this->main_tpl->setOnScreenMessage('failure', $DIC->language()->txt("permission_denied"), true);
75  $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
76  }
77  }
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMStShowUserGUI::executeCommand ( )
final

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

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

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

◆ index()

ilMStShowUserGUI::index ( )
protected

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

References $DIC.

Referenced by executeCommand().

129  : void
130  {
131  global $DIC;
132  $DIC->ctrl()->redirectByClass(ilMStShowUserCoursesGUI::class);
133  }
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ setTitleAndIcon()

ilMStShowUserGUI::setTitleAndIcon ( )
protected

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

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

Referenced by __construct(), and executeCommand().

56  : void
57  {
58  $this->main_tpl->setTitle(ilUserUtil::getNamePresentation($this->usr_id));
59  $this->main_tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->usr_id, "xxsmall"));
60  }
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='ilpublicuserprofilegui')
Default behaviour is:
static _getPersonalPicturePath(int $a_usr_id, string $a_size='small', bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUser()

ilMStShowUserGUI::showUser ( )
protected

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

References $DIC.

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

Field Documentation

◆ $access

ilMyStaffAccess ilMStShowUserGUI::$access
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilMStShowUserGUI::$main_tpl
private

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

◆ $usr_id

int ilMStShowUserGUI::$usr_id
protected

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

◆ CMD_INDEX

const ilMStShowUserGUI::CMD_INDEX = 'index'

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

◆ CMD_SHOW_USER

const ilMStShowUserGUI::CMD_SHOW_USER = 'showUser'

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

◆ TAB_SHOW_CERTIFICATES

const ilMStShowUserGUI::TAB_SHOW_CERTIFICATES = 'show_certificates'

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

◆ TAB_SHOW_COMPETENCES

const ilMStShowUserGUI::TAB_SHOW_COMPETENCES = 'show_competences'

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

◆ TAB_SHOW_COURSES

const ilMStShowUserGUI::TAB_SHOW_COURSES = 'show_courses'

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

◆ TAB_SHOW_TALKS

const ilMStShowUserGUI::TAB_SHOW_TALKS = 'show_talks'

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

◆ TAB_SHOW_USER

const ilMStShowUserGUI::TAB_SHOW_USER = 'show_user'

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


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