ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMStListCoursesGUI.php
Go to the documentation of this file.
1<?php
2
5
15{
16 const CMD_APPLY_FILTER = 'applyFilter';
17 const CMD_INDEX = 'index';
18 const CMD_GET_ACTIONS = "getActions";
19 const CMD_RESET_FILTER = 'resetFilter';
23 protected $table;
27 protected $access;
28
29
33 public function __construct()
34 {
35 $this->access = ilMyStaffAccess::getInstance();
36 }
37
38
42 protected function checkAccessOrFail()
43 {
44 global $DIC;
45
46 if ($this->access->hasCurrentUserAccessToMyStaff()) {
47 return;
48 } else {
49 ilUtil::sendFailure($DIC->language()->txt("permission_denied"), true);
50 $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
51 }
52 }
53
54
58 public function executeCommand()
59 {
60 global $DIC;
61
62 $cmd = $DIC->ctrl()->getCmd();
63 $next_class = $DIC->ctrl()->getNextClass();
64
65 switch ($next_class) {
66 case strtolower(ilFormPropertyDispatchGUI::class):
67 $this->checkAccessOrFail();
68
69 $DIC->ctrl()->setReturn($this, self::CMD_INDEX);
70 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
71 $this->table->executeCommand();
72 break;
73 default:
74 switch ($cmd) {
75
78 case self::CMD_INDEX:
80 $this->$cmd();
81 break;
82 default:
83 $this->index();
84 break;
85 }
86 break;
87 }
88 }
89
90
94 public function index()
95 {
96 $this->listUsers();
97 }
98
99
103 public function listUsers()
104 {
105 global $DIC;
106
107 $this->checkAccessOrFail();
108
109 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
110 $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_courses'));
111 $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
112 }
113
114
118 public function applyFilter()
119 {
120 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_APPLY_FILTER);
121 $this->table->writeFilterToSession();
122 $this->table->resetOffset();
123 $this->index();
124 }
125
126
130 public function resetFilter()
131 {
132 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_RESET_FILTER);
133 $this->table->resetOffset();
134 $this->table->resetFilter();
135 $this->index();
136 }
137
138
142 public function getId()
143 {
144 $this->table = new ilMStListCoursesTableGUI($this, self::CMD_INDEX);
145
146 return $this->table->getId();
147 }
148
149
153 public function cancel()
154 {
155 global $DIC;
156
157 $DIC->ctrl()->redirect($this);
158 }
159
160
164 public function getActions()
165 {
166 global $DIC;
167
168 $mst_co_usr_id = $DIC->http()->request()->getQueryParams()['mst_lco_usr_id'];
169 $mst_lco_crs_ref_id = $DIC->http()->request()->getQueryParams()['mst_lco_crs_ref_id'];
170
171 if ($mst_co_usr_id > 0 && $mst_lco_crs_ref_id > 0) {
172 $selection = new ilAdvancedSelectionListGUI();
173
174 if ($DIC->access()->checkAccess("visible", "", $mst_lco_crs_ref_id)) {
175 $link = ilLink::_getStaticLink($mst_lco_crs_ref_id, ilMyStaffAccess::DEFAULT_CONTEXT);
176 $selection->addItem(ilObject2::_lookupTitle(ilObject2::_lookupObjectId($mst_lco_crs_ref_id)), '', $link);
177 };
178
180 foreach (ilOrgUnitUserAssignment::innerjoin('object_reference', 'orgu_id', 'ref_id')->where(array(
181 'user_id' => $mst_co_usr_id,
182 'object_reference.deleted' => null
183 ), array( 'user_id' => '=', 'object_reference.deleted' => '!=' ))->get() as $org_unit_assignment) {
184 if ($DIC->access()->checkAccess("read", "", $org_unit_assignment->getOrguId())) {
185 $link = ilLink::_getStaticLink($org_unit_assignment->getOrguId(), 'orgu');
186 $selection->addItem($org_units[$org_unit_assignment->getOrguId()], '', $link);
187 }
188 }
189
190 $selection = ilMyStaffGUI::extendActionMenuWithUserActions($selection, $mst_co_usr_id, rawurlencode($DIC->ctrl()
191 ->getLinkTarget($this, self::CMD_INDEX)));
192
193 echo $selection->getHTML(true);
194 }
195 exit;
196 }
197}
static innerjoin($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
Class ilMStListCoursesGUI.
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
exit
Definition: login.php:29
$DIC
Definition: xapitoken.php:46