ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMyStaffGUI.php
Go to the documentation of this file.
1 <?php
2 
5 
12 {
13  const CMD_INDEX = 'index';
14  const TAB_LIST_USERS = 'list_users';
15  const TAB_LIST_COURSES = 'list_courses';
16  const TAB_LIST_CERTIFICATES = 'list_certificates';
17  const TAB_LIST_COMPETENCES = 'list_competences';
18  const TAB_LIST_STUDY_PROGRAMME = 'list_study_programme';
19 
20 
24  public function __construct()
25  {
26  global $DIC;
27 
28  $DIC->language()->loadLanguageModule('mst');
29  $DIC->language()->loadLanguageModule('trac');
30 
31  // get the standard template
32  $DIC->ui()->mainTemplate()->loadStandardTemplate();
33  $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_my_staff'));
34  }
35 
36 
40  public function executeCommand()
41  {
42  global $DIC;
43 
44  // determine next class in the call structure
45  $next_class = $DIC->ctrl()->getNextClass($this);
46 
47  switch ($next_class) {
48  case strtolower(ilMStListCoursesGUI::class):
49  $list_gui = new ilMStListCoursesGUI();
50  $DIC->ctrl()->forwardCommand($list_gui);
51  break;
52  case strtolower(ilMStListCertificatesGUI::class):
53  $list_gui = new ilMStListCertificatesGUI();
54  $DIC->ctrl()->forwardCommand($list_gui);
55  break;
56  case strtolower(ilMStListCompetencesGUI::class):
57  $list_gui = new ilMStListCompetencesGUI($DIC);
58  $DIC->ctrl()->forwardCommand($list_gui);
59  break;
60 // case strtolower(ilMStListStudyProgrammesGUI::class):
61 // $list_gui = new ilMStListStudyProgrammesGUI();
62 // $DIC->ctrl()->forwardCommand($list_gui);
63 // break;
64  case strtolower(ilMStShowUserGUI::class):
65  $user_gui = new ilMStShowUserGUI();
66  $DIC->ctrl()->forwardCommand($user_gui);
67  break;
68  default:
69  $list_gui = new ilMStListUsersGUI();
70  $DIC->ctrl()->forwardCommand($list_gui);
71  break;
72  }
73 
74  $DIC->ui()->mainTemplate()->printToStdout();
75  }
76 
77 
85  public static function extendActionMenuWithUserActions(ilAdvancedSelectionListGUI $selection, $usr_id = 0, $return_url = "")
86  {
87  global $DIC;
88 
89  $user_action_collector = ilUserActionCollector::getInstance($DIC->user()->getId(), new ilAwarenessUserActionContext());
90  $action_collection = $user_action_collector->getActionsForTargetUser($usr_id);
91  if (count($action_collection->getActions()) > 0) {
92  foreach ($action_collection->getActions() as $action) {
96  switch ($action->getType()) {
97  case "profile": //personal profile
98  $selection->addItem($action->getText(), '', $action->getHref() . "&back_url=" . $return_url);
99  break;
100  case "compose": //mail
101  case "invite": //public chat
102  case "invite_osd": //direct chat (start conversation)
103  //do only display those actions if the displayed user is not the current user
104  if ($usr_id != $DIC->user()->getId()) {
105  $selection->addItem($action->getText(), "", $action->getHref(), "", "", "", "", false, "", "", "", "", true, $action->getData());
106  }
107  break;
108  default:
109  $selection->addItem($action->getText(), "", $action->getHref(), "", "", "", "", false, "", "", "", "", true, $action->getData());
110  break;
111  }
112  }
113  }
114 
115  return $selection;
116  }
117 
118 
124  public static function getUserLpStatusAsHtml(ilMStListCourse $my_staff_course)
125  {
126  global $DIC;
127 
128  if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
130  $lp_icon = $DIC->ui()->factory()->symbol()->icon()
131  ->custom(
132  $lp_icons->getImagePathForStatus((int) $my_staff_course->getUsrLpStatus()),
133  ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()))
134  );
135 
136  return $DIC->ui()->renderer()->render($lp_icon) . ' '
137  . ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
138  }
139 
140  return '&nbsp';
141  }
142 
143 
149  public static function getUserLpStatusAsText(ilMStListCourse $my_staff_course)
150  {
151  if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
152  return ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
153  }
154 
155  return '';
156  }
157 }
const TAB_LIST_STUDY_PROGRAMME
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
static getInstance($a_user_id, ilUserActionContext $a_context)
Get instance (for a user)
Class ilMStShowUserGUI.
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
static getUserLpStatusAsHtml(ilMStListCourse $my_staff_course)
global $DIC
Definition: goto.php:24
addItem( $a_title, $a_value="", $a_link="", $a_img="", $a_alt="", $a_frame="", $a_html="", $a_prevent_background_click=false, $a_onclick="", $a_ttip="", $a_tt_my="right center", $a_tt_at="left center", $a_tt_use_htmlspecialchars=true, $a_data=array())
Add an item.
static getUserLpStatusAsText(ilMStListCourse $my_staff_course)
Awareness context for user actions.