ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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

Constructor & Destructor Documentation

◆ __construct()

ilMStShowUserGUI::__construct ( )

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

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

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

Member Function Documentation

◆ addTabs()

ilMStShowUserGUI::addTabs ( string  $active_tab_id)
protected

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

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

Referenced by executeCommand().

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

◆ cancel()

ilMStShowUserGUI::cancel ( )

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

References $DIC.

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

◆ checkAccessOrFail()

ilMStShowUserGUI::checkAccessOrFail ( )
protected

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

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

Referenced by executeCommand().

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

◆ executeCommand()

ilMStShowUserGUI::executeCommand ( )
final

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

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

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

◆ index()

ilMStShowUserGUI::index ( )
protected

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

References $DIC.

Referenced by executeCommand().

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

◆ setTitleAndIcon()

ilMStShowUserGUI::setTitleAndIcon ( )
protected

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

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

Referenced by __construct(), and executeCommand().

55  : void
56  {
57  $this->main_tpl->setTitle(ilUserUtil::getNamePresentation($this->usr_id));
58  $this->main_tpl->setTitleIcon(ilObjUser::_getPersonalPicturePath($this->usr_id, "xxsmall"));
59  }
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 134 of file class.ilMStShowUserGUI.php.

References $DIC.

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

Field Documentation

◆ $access

ilMyStaffAccess ilMStShowUserGUI::$access
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilMStShowUserGUI::$main_tpl
private

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

◆ $usr_id

int ilMStShowUserGUI::$usr_id
protected

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

◆ CMD_INDEX

const string ilMStShowUserGUI::CMD_INDEX = 'index'

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

◆ CMD_SHOW_USER

const string ilMStShowUserGUI::CMD_SHOW_USER = 'showUser'

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

◆ TAB_SHOW_CERTIFICATES

const string ilMStShowUserGUI::TAB_SHOW_CERTIFICATES = 'show_certificates'

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

◆ TAB_SHOW_COMPETENCES

const string ilMStShowUserGUI::TAB_SHOW_COMPETENCES = 'show_competences'

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

◆ TAB_SHOW_COURSES

const string ilMStShowUserGUI::TAB_SHOW_COURSES = 'show_courses'

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

◆ TAB_SHOW_TALKS

const string ilMStShowUserGUI::TAB_SHOW_TALKS = 'show_talks'

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

◆ TAB_SHOW_USER

const string ilMStShowUserGUI::TAB_SHOW_USER = 'show_user'

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


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