ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMyStaffGUI.php
Go to the documentation of this file.
1 <?php
2 
9 {
10  const CMD_INDEX = 'index';
11  const TAB_LIST_USERS = 'list_users';
12  const TAB_LIST_COURSES = 'list_courses';
13 
14 
18  public function __construct()
19  {
20  global $DIC;
21 
22  $DIC->language()->loadLanguageModule('mst');
23  $DIC->language()->loadLanguageModule('trac');
24 
25  // get the standard template
26  $DIC->ui()->mainTemplate()->getStandardTemplate();
27  $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_my_staff'));
28  }
29 
30 
34  public function executeCommand()
35  {
36  global $DIC;
37 
38  // determine next class in the call structure
39  $next_class = $DIC->ctrl()->getNextClass($this);
40 
41  switch ($next_class) {
42  case strtolower(ilMStListCoursesGUI::class):
43  $this->addTabs(self::TAB_LIST_COURSES);
44  $list_course_gui = new ilMStListCoursesGUI();
45  $DIC->ctrl()->forwardCommand($list_course_gui);
46  break;
47  case strtolower(ilMStShowUserGUI::class):
48  $list_course_gui = new ilMStShowUserGUI();
49  $DIC->ctrl()->forwardCommand($list_course_gui);
50  break;
51  default:
52  $this->addTabs(self::TAB_LIST_USERS);
53  $list_user_gui = new ilMStListUsersGUI();
54  $DIC->ctrl()->forwardCommand($list_user_gui);
55  break;
56  }
57 
58  $DIC->ui()->mainTemplate()->show();
59  }
60 
61 
65  protected function addTabs($active_tab_id)
66  {
67  global $DIC;
68 
69  $DIC->tabs()->addTab(self::TAB_LIST_USERS, $DIC->language()->txt('mst_list_users'), $DIC->ctrl()->getLinkTargetByClass(array(
70  self::class,
71  ilMStListUsersGUI::class,
72  ), self::CMD_INDEX));
73  $DIC->tabs()->addTab(self::TAB_LIST_COURSES, $DIC->language()->txt('mst_list_courses'), $DIC->ctrl()->getLinkTargetByClass(array(
74  self::class,
75  ilMStListCoursesGUI::class,
76  ), self::CMD_INDEX));
77 
78  if ($active_tab_id) {
79  $DIC->tabs()->activateTab($active_tab_id);
80  }
81  }
82 
83 
91  public static function extendActionMenuWithUserActions(ilAdvancedSelectionListGUI $selection, $usr_id = 0, $return_url = "")
92  {
93  global $DIC;
94 
95  $user_action_collector = ilUserActionCollector::getInstance($DIC->user()->getId(), new ilAwarenessUserActionContext());
96  $action_collection = $user_action_collector->getActionsForTargetUser($usr_id);
97  if (count($action_collection->getActions()) > 0) {
98  foreach ($action_collection->getActions() as $action) {
102  switch ($action->getType()) {
103  case "profile": //personal profile
104  $selection->addItem($action->getText(), '', $action->getHref() . "&back_url=" . $return_url);
105  break;
106  case "compose": //mail
107  case "invite": //public chat
108  case "invite_osd": //direct chat (start conversation)
109  //do only display those actions if the displayed user is not the current user
110  if ($usr_id != $DIC->user()->getId()) {
111  $selection->addItem($action->getText(), "", $action->getHref(), "", "", "", "", false, "", "", "", "", true, $action->getData());
112  }
113  break;
114  default:
115  $selection->addItem($action->getText(), "", $action->getHref(), "", "", "", "", false, "", "", "", "", true, $action->getData());
116  break;
117  }
118  }
119  }
120 
121  return $selection;
122  }
123 
124 
130  public static function getUserLpStatusAsHtml(ilMStListCourse $my_staff_course)
131  {
132  global $DIC;
133 
134  if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
135  $lp_icon = $DIC->ui()->factory()->image()
137 
138  return $DIC->ui()->renderer()->render($lp_icon) . ' '
139  . ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
140  }
141 
142  return '&nbsp';
143  }
144 
145 
151  public static function getUserLpStatusAsText(ilMStListCourse $my_staff_course)
152  {
153  if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
154  return ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
155  }
156 
157  return '';
158  }
159 }
Class ilMStListCourse.
static _getImagePathForStatus($a_status)
Get image path for status.
$action
global $DIC
Definition: saml.php:7
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 getUserLpStatusAsHtml(ilMStListCourse $my_staff_course)
addTabs($active_tab_id)
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)
Class ilMStListCoursesGUI.
Awareness context for user actions.
User interface class for advanced drop-down selection lists.
Class ilMStListUsersGUI.
Class ilMyStaffGUI.