ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMStListCertificatesGUI.php
Go to the documentation of this file.
1<?php
2
5
16{
17 const CMD_APPLY_FILTER = 'applyFilter';
18 const CMD_INDEX = 'index';
19 const CMD_GET_ACTIONS = "getActions";
20 const CMD_RESET_FILTER = 'resetFilter';
24 protected $table;
28 protected $access;
29
30
34 public function __construct()
35 {
36 $this->access = ilMyStaffAccess::getInstance();
37 }
38
39
43 protected function checkAccessOrFail()
44 {
45 global $DIC;
46
47 if ($this->access->hasCurrentUserAccessToMyStaff()) {
48 return;
49 } else {
50 ilUtil::sendFailure($DIC->language()->txt("permission_denied"), true);
51 $DIC->ctrl()->redirectByClass(ilDashboardGUI::class, "");
52 }
53 }
54
55
59 public function executeCommand()
60 {
61 global $DIC;
62
63 $cmd = $DIC->ctrl()->getCmd();
64 $next_class = $DIC->ctrl()->getNextClass();
65
66 switch ($next_class) {
67 case strtolower(ilFormPropertyDispatchGUI::class):
68 $this->checkAccessOrFail();
69
70 $DIC->ctrl()->setReturn($this, self::CMD_INDEX);
71 $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
72 $this->table->executeCommand();
73 break;
74 case strtolower(ilUserCertificateApiGUI::class):
75 $this->checkAccessOrFail();
76 $DIC->ctrl()->forwardCommand(new ilUserCertificateApiGUI());
77 break;
78 default:
79 switch ($cmd) {
80
83 case self::CMD_INDEX:
85 $this->$cmd();
86 break;
87 default:
88 $this->index();
89 break;
90 }
91 break;
92 }
93 }
94
95
99 public function index()
100 {
101 $this->listUsers();
102 }
103
104
108 public function listUsers()
109 {
110 global $DIC;
111
112 $this->checkAccessOrFail();
113
114 $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
115 $DIC->ui()->mainTemplate()->setTitle($DIC->language()->txt('mst_list_certificates'));
116 $DIC->ui()->mainTemplate()->setContent($this->table->getHTML());
117 }
118
119
123 public function applyFilter()
124 {
125 $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_APPLY_FILTER);
126 $this->table->writeFilterToSession();
127 $this->table->resetOffset();
128 $this->index();
129 }
130
131
135 public function resetFilter()
136 {
137 $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_RESET_FILTER);
138 $this->table->resetOffset();
139 $this->table->resetFilter();
140 $this->index();
141 }
142
143
147 public function getId()
148 {
149 $this->table = new ilMStListCertificatesTableGUI($this, self::CMD_INDEX);
150
151 return $this->table->getId();
152 }
153
154
158 public function cancel()
159 {
160 global $DIC;
161
162 $DIC->ctrl()->redirect($this);
163 }
164
165
169 public function getActions()
170 {
171 global $DIC;
172
173 $mst_co_usr_id = $DIC->http()->request()->getQueryParams()['mst_lco_usr_id'];
174 $mst_lco_crs_ref_id = $DIC->http()->request()->getQueryParams()['mst_lco_crs_ref_id'];
175
176 if ($mst_co_usr_id > 0 && $mst_lco_crs_ref_id > 0) {
177 $selection = new ilAdvancedSelectionListGUI();
178
179 if ($DIC->access()->checkAccess("visible", "", $mst_lco_crs_ref_id)) {
180 $link = ilLink::_getStaticLink($mst_lco_crs_ref_id, ilMyStaffAccess::DEFAULT_CONTEXT);
181 $selection->addItem(ilObject2::_lookupTitle(ilObject2::_lookupObjectId($mst_lco_crs_ref_id)), '', $link);
182 };
183
185 foreach (ilOrgUnitUserAssignment::innerjoin('object_reference', 'orgu_id', 'ref_id')->where(array(
186 'user_id' => $mst_co_usr_id,
187 'object_reference.deleted' => null
188 ), array( 'user_id' => '=', 'object_reference.deleted' => '!=' ))->get() as $org_unit_assignment) {
189 if ($DIC->access()->checkAccess("read", "", $org_unit_assignment->getOrguId())) {
190 $link = ilLink::_getStaticLink($org_unit_assignment->getOrguId(), 'orgu');
191 $selection->addItem($org_units[$org_unit_assignment->getOrguId()], '', $link);
192 }
193 }
194
195 $selection = ilMyStaffGUI::extendActionMenuWithUserActions($selection, $mst_co_usr_id, rawurlencode($DIC->ctrl()
196 ->getLinkTarget($this, self::CMD_INDEX)));
197
198 echo $selection->getHTML(true);
199 }
200 exit;
201 }
202}
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 ilMStListCertificatesGUI.
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