ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMyStaffGUI.php
Go to the documentation of this file.
1<?php
2
21
27{
28 public const string CMD_INDEX = 'index';
29 public const string TAB_LIST_USERS = 'list_users';
30 public const string TAB_LIST_COURSES = 'list_courses';
31 public const string TAB_LIST_CERTIFICATES = 'list_certificates';
32 public const string TAB_LIST_COMPETENCES = 'list_competences';
33 public const string 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
89 final public static function extendActionMenuWithUserActions(
90 int $usr_id = 0,
91 string $return_url = ""
92 ): array {
93 global $DIC;
94 $ui_fac = $DIC->ui()->factory();
95
96 $user_action_collector = new ilUserActionCollector(
97 $DIC->user()->getId(),
100 new ilUserActionAdmin($DIC['ilDB'])
101 );
102 $action_collection = $user_action_collector->getActionsForTargetUser($usr_id);
103 $actions = [];
104 if (count($action_collection->getActions()) > 0) {
105 foreach ($action_collection->getActions() as $action) {
109 switch ($action->getType()) {
110 case "profile": //personal profile
111 $actions[] = $ui_fac->link()->standard(
112 $action->getText(),
113 $action->getHref() . "&back_url=" . $return_url
114 );
115 break;
116 case "compose": //mail
117 case "invite": //public chat
118 case "invite_osd": //direct chat (start conversation)
119 //do only display those actions if the displayed user is not the current user
120 if ($usr_id != $DIC->user()->getId()) {
121 $actions[] = self::addLinkWithActionData($action);
122 }
123 break;
124 default:
125 $actions[] = self::addLinkWithActionData($action);
126 break;
127 }
128 }
129 }
130
131 return $actions;
132 }
133
134 protected static function addLinkWithActionData(ilUserAction $action): \ILIAS\UI\Component\Link\Standard
135 {
136 global $DIC;
137
138 $ui_fac = $DIC->ui()->factory();
139
140 $action_data = $action->getData();
141 $link = $ui_fac->link()->standard(
142 $action->getText(),
143 $action->getHref()
144 )->withAdditionalOnLoadCode(function ($id) use ($action_data) {
145 $r = "var button = document.getElementById('$id');";
146 foreach ($action_data as $k => $v) {
147 $r .= "button.setAttribute('data-" . $k . "', '" . $v . "');";
148 }
149 return $r;
150 });
151
152 return $link;
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()),
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}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@ilCtrl_IsCalledBy ilEmployeeTalkMyStaffListGUI: ilMyStaffGUI @ilCtrl_IsCalledBy ilEmployeeTalkMyStaf...
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
Class ilMStListCertificatesGUI.
Class ilMStListCompetencesGUI.
Class ilMStListUsersGUI.
Class ilMStShowUserGUI.
Class ilMyStaffGUI.
static getUserLpStatusAsText(ilMStListCourse $my_staff_course)
const string TAB_LIST_USERS
const string TAB_LIST_COMPETENCES
const string TAB_LIST_STUDY_PROGRAMME
const string CMD_INDEX
static addLinkWithActionData(ilUserAction $action)
const string TAB_LIST_COURSES
const string TAB_LIST_CERTIFICATES
static getUserLpStatusAsHtml(ilMStListCourse $my_staff_course)
User action administration.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26