ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMyStaffGUI.php
Go to the documentation of this file.
1 <?php
21 
27 {
28  public const CMD_INDEX = 'index';
29  public const TAB_LIST_USERS = 'list_users';
30  public const TAB_LIST_COURSES = 'list_courses';
31  public const TAB_LIST_CERTIFICATES = 'list_certificates';
32  public const TAB_LIST_COMPETENCES = 'list_competences';
33  public const TAB_LIST_STUDY_PROGRAMME = 'list_study_programme';
34 
35  public function __construct()
36  {
37  global $DIC;
38 
39  $DIC->language()->loadLanguageModule('mst');
40  $DIC->language()->loadLanguageModule('trac');
41 
42  // get the standard template
43  $DIC->ui()->mainTemplate()->loadStandardTemplate();
44  }
45 
46  final public function executeCommand(): void
47  {
48  global $DIC;
49 
50  // determine next class in the call structure
51  $next_class = $DIC->ctrl()->getNextClass($this);
52  switch ($next_class) {
53  case "ilmstlistcoursesgui":
54  $list_gui = new \ilMStListCoursesGUI();
55  $DIC->ctrl()->forwardCommand($list_gui);
56  break;
57  case strtolower(ilMStListCertificatesGUI::class):
58  $list_gui = new ilMStListCertificatesGUI();
59  $DIC->ctrl()->forwardCommand($list_gui);
60  break;
61  case strtolower(ilMStListCompetencesGUI::class):
62  $list_gui = new ilMStListCompetencesGUI($DIC);
63  $DIC->ctrl()->forwardCommand($list_gui);
64  break;
65  // case strtolower(ilMStListStudyProgrammesGUI::class):
66  // $list_gui = new ilMStListStudyProgrammesGUI();
67  // $DIC->ctrl()->forwardCommand($list_gui);
68  // break;
69  case strtolower(ilMStShowUserGUI::class):
70  $user_gui = new ilMStShowUserGUI();
71  $DIC->ctrl()->forwardCommand($user_gui);
72  break;
73  case strtolower(ilEmployeeTalkMyStaffListGUI::class):
74  $user_gui = new ilEmployeeTalkMyStaffListGUI();
75  $DIC->ctrl()->forwardCommand($user_gui);
76  break;
77  default:
78  $list_gui = new ilMStListUsersGUI();
79  $DIC->ctrl()->forwardCommand($list_gui);
80  break;
81  }
82 
83  $DIC->ui()->mainTemplate()->printToStdout();
84  }
85 
86  final public static function extendActionMenuWithUserActions(
87  ilAdvancedSelectionListGUI $selection,
88  int $usr_id = 0,
89  string $return_url = ""
91  global $DIC;
92 
93  $user_action_collector = ilUserActionCollector::getInstance(
94  $DIC->user()->getId(),
96  );
97  $action_collection = $user_action_collector->getActionsForTargetUser($usr_id);
98  if (count($action_collection->getActions()) > 0) {
99  foreach ($action_collection->getActions() as $action) {
103  switch ($action->getType()) {
104  case "profile": //personal profile
105  $selection->addItem($action->getText(), '', $action->getHref() . "&back_url=" . $return_url);
106  break;
107  case "compose": //mail
108  case "invite": //public chat
109  case "invite_osd": //direct chat (start conversation)
110  //do only display those actions if the displayed user is not the current user
111  if ($usr_id != $DIC->user()->getId()) {
112  $selection->addItem(
113  $action->getText(),
114  "",
115  $action->getHref(),
116  "",
117  "",
118  "",
119  "",
120  false,
121  "",
122  "",
123  "",
124  "",
125  true,
126  $action->getData()
127  );
128  }
129  break;
130  default:
131  $selection->addItem(
132  $action->getText(),
133  "",
134  $action->getHref(),
135  "",
136  "",
137  "",
138  "",
139  false,
140  "",
141  "",
142  "",
143  "",
144  true,
145  $action->getData()
146  );
147  break;
148  }
149  }
150  }
151 
152  return $selection;
153  }
154 
155  final public static function getUserLpStatusAsHtml(ilMStListCourse $my_staff_course): string
156  {
157  global $DIC;
158 
159  if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
161  $lp_icon = $DIC->ui()->factory()->symbol()->icon()
162  ->custom(
163  $lp_icons->getImagePathForStatus($my_staff_course->getUsrLpStatus()),
164  ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()))
165  );
166 
167  return $DIC->ui()->renderer()->render($lp_icon) . ' '
168  . ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
169  }
170 
171  return '&nbsp';
172  }
173 
174  final public static function getUserLpStatusAsText(ilMStListCourse $my_staff_course): string
175  {
176  if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
177  return ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
178  }
179 
180  return '';
181  }
182 }
const TAB_LIST_STUDY_PROGRAMME
Class ilMStShowUserGUI.
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
static getInstance(int $a_user_id, ilUserActionContext $a_context)
Get instance (for a user)
static getUserLpStatusAsHtml(ilMStListCourse $my_staff_course)
addItem(string $a_title, string $a_value="", string $a_link="", string $a_img="", string $a_alt="", string $a_frame="", string $a_html="", bool $a_prevent_background_click=false, string $a_onclick="", string $a_ttip="", string $a_tt_my="right center", string $a_tt_at="left center", bool $a_tt_use_htmlspecialchars=true, array $a_data=array())
global $DIC
Definition: feed.php:28
static getUserLpStatusAsText(ilMStListCourse $my_staff_course)
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...