ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilMyStaffGUI.php
Go to the documentation of this file.
1<?php
2
22
28{
29 public const string CMD_INDEX = 'index';
30 public const string TAB_LIST_USERS = 'list_users';
31 public const string TAB_LIST_COURSES = 'list_courses';
32 public const string TAB_LIST_CERTIFICATES = 'list_certificates';
33 public const string TAB_LIST_COMPETENCES = 'list_competences';
34 public const string TAB_LIST_STUDY_PROGRAMME = 'list_study_programme';
35
36 public function __construct()
37 {
38 global $DIC;
39
40 $DIC->language()->loadLanguageModule('mst');
41 $DIC->language()->loadLanguageModule('trac');
42
43 // get the standard template
44 $DIC->ui()->mainTemplate()->loadStandardTemplate();
45 }
46
47 final public function executeCommand(): void
48 {
49 global $DIC;
50
51 // determine next class in the call structure
52 $next_class = $DIC->ctrl()->getNextClass($this);
53 switch ($next_class) {
54 case "ilmstlistcoursesgui":
55 $list_gui = new \ilMStListCoursesGUI();
56 $DIC->ctrl()->forwardCommand($list_gui);
57 break;
58 case strtolower(ilMStListCertificatesGUI::class):
59 $list_gui = new ilMStListCertificatesGUI();
60 $DIC->ctrl()->forwardCommand($list_gui);
61 break;
62 case strtolower(ilMStListCompetencesGUI::class):
63 $list_gui = new ilMStListCompetencesGUI($DIC);
64 $DIC->ctrl()->forwardCommand($list_gui);
65 break;
66 // case strtolower(ilMStListStudyProgrammesGUI::class):
67 // $list_gui = new ilMStListStudyProgrammesGUI();
68 // $DIC->ctrl()->forwardCommand($list_gui);
69 // break;
70 case strtolower(ilMStShowUserGUI::class):
71 $user_gui = new ilMStShowUserGUI();
72 $DIC->ctrl()->forwardCommand($user_gui);
73 break;
74 case strtolower(ilEmployeeTalkMyStaffListGUI::class):
75 $user_gui = new ilEmployeeTalkMyStaffListGUI();
76 $DIC->ctrl()->forwardCommand($user_gui);
77 break;
78 default:
79 $list_gui = new ilMStListUsersGUI();
80 $DIC->ctrl()->forwardCommand($list_gui);
81 break;
82 }
83
84 $DIC->ui()->mainTemplate()->printToStdout();
85 }
86
90 final public static function extendActionMenuWithUserActions(
91 int $usr_id = 0,
92 string $return_url = ""
93 ): array {
94 global $DIC;
95 $ui_fac = $DIC->ui()->factory();
96
97 $user_action_collector = new ilUserActionCollector(
98 $DIC->user()->getId(),
101 new ilUserActionAdmin($DIC['ilDB'])
102 );
103 $action_collection = $user_action_collector->getActionsForTargetUser($usr_id);
104 $actions = [];
105 if (count($action_collection->getActions()) > 0) {
106 foreach ($action_collection->getActions() as $action) {
110 switch ($action->getType()) {
111 case "profile": //personal profile
112 case "compose": //mail
113 case "invite": //public chat
114 case "invite_osd": //direct chat (start conversation)
115 //do only display those actions if the displayed user is not the current user
116 if ($usr_id != $DIC->user()->getId()) {
117 $actions[] = self::addLinkWithActionData($action);
118 }
119 break;
120 default:
121 $actions[] = self::addLinkWithActionData($action);
122 break;
123 }
124 }
125 }
126
127 return $actions;
128 }
129
130 protected static function addLinkWithActionData(ilUserAction $action): \ILIAS\UI\Component\Link\Standard
131 {
132 global $DIC;
133
134 $ui_fac = $DIC->ui()->factory();
135
136 $action_data = $action->getData();
137 $link = $ui_fac->link()->standard(
138 $action->getText(),
139 $action->getHref()
140 )->withAdditionalOnLoadCode(function ($id) use ($action_data) {
141 $r = "var button = document.getElementById('$id');";
142 foreach ($action_data as $k => $v) {
143 $r .= "button.setAttribute('data-" . $k . "', '" . $v . "');";
144 }
145 return $r;
146 });
147
148 return $link;
149 }
150
151 final public static function getUserLpStatusAsHtml(ilMStListCourse $my_staff_course): string
152 {
153 global $DIC;
154
155 if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
157 $lp_icon = $DIC->ui()->factory()->symbol()->icon()
158 ->custom(
159 $lp_icons->getImagePathForStatus($my_staff_course->getUsrLpStatus()),
161 );
162
163 return $DIC->ui()->renderer()->render($lp_icon) . ' '
164 . ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
165 }
166
167 return '&nbsp';
168 }
169
170 final public static function getUserLpStatusAsText(ilMStListCourse $my_staff_course): string
171 {
172 if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToLearningProgressInObject($my_staff_course->getCrsRefId())) {
173 return ilLearningProgressBaseGUI::_getStatusText(intval($my_staff_course->getUsrLpStatus()));
174 }
175
176 return '';
177 }
178}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
GUI class for public user profile presentation.
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