ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilOrgUnitStaffGUI Class Reference

Class ilOrgUnitStaffGUI. More...

+ Collaboration diagram for ilOrgUnitStaffGUI:

Public Member Functions

 __construct (ilObjOrgUnitGUI $parent_gui)
 
 executeCommand ()
 
 showStaff ()
 
 showOtherRoles ()
 
 showStaffRec ()
 
 addStaff ()
 
 addOtherRoles ()
 
 getStaffTableHTML ($recursive=false, $table_cmd="showStaff")
 
 getOtherRolesTableHTML ()
 
 fromSuperiorToEmployee ()
 
 fromEmployeeToSuperior ()
 
 confirmRemoveUser ($cmd)
 
 removeFromSuperiors ()
 
 removeFromEmployees ()
 
 removeFromRole ()
 
 setTabs ()
 

Protected Member Functions

 addStaffToolbar ()
 
 addOtherRolesToolbar ()
 

Protected Attributes

 $tabs_gui
 
 $toolbar
 
 $ctrl
 
 $tpl
 
 $parent_gui
 
 $parent_obj
 
 $lng
 
 $ilAccess
 
 $rbacreview
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitStaffGUI::__construct ( ilObjOrgUnitGUI  $parent_gui)
Parameters
ilObjOrgUnitGUI$parent_gui

Definition at line 60 of file class.ilOrgUnitStaffGUI.php.

60 {
61 global $tpl, $ilCtrl, $ilTabs, $lng, $ilAccess, $ilToolbar, $rbacreview;
62
63 $this->tpl = $tpl;
64 $this->ctrl = $ilCtrl;
65 $this->parent_gui = $parent_gui;
66 $this->parent_object = $parent_gui->object;
67 $this->tabs_gui = $this->parent_gui->tabs_gui;
68 $this->toolbar = $ilToolbar;
69 $this->lng = $lng;
70 $this->ilAccess = $ilAccess;
71 $this->toolbar = $ilToolbar;
72 $this->rbacreview = $rbacreview;
73
74 $this->tabs_gui->setTabActive("orgu_staff");
75 $this->setTabs();
76 }
global $ilCtrl
Definition: ilias.php:18

References $ilAccess, $ilCtrl, $lng, $parent_gui, $rbacreview, $tpl, and setTabs().

+ Here is the call graph for this function:

Member Function Documentation

◆ addOtherRoles()

ilOrgUnitStaffGUI::addOtherRoles ( )

Definition at line 246 of file class.ilOrgUnitStaffGUI.php.

246 {
247 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
248 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
249 $this->ctrl->redirect($this->parent_gui, "");
250 }
251
252 $users = explode(',', $_POST['user_login']);
253 $user_ids = array();
254 foreach ($users as $user) {
255 $user_id = ilObjUser::_lookupId($user);
256 if ($user_id) {
257 $user_ids[] = $user_id;
258 }
259 }
260 $role_id = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
261 foreach ($user_ids as $user_id) {
262 $this->parent_object->assignUserToLocalRole($role_id, $user_id);
263 }
264 ilUtil::sendSuccess($this->lng->txt("users_successfuly_added"), true);
265 $this->ctrl->redirect($this,"showOtherRoles");
266 }
static _lookupId($a_user_str)
Lookup id by login.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, ilObjUser\_lookupId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addOtherRolesToolbar()

ilOrgUnitStaffGUI::addOtherRolesToolbar ( )
protected

Definition at line 195 of file class.ilOrgUnitStaffGUI.php.

195 {
196 $arrLocalRoles = $this->rbacreview->getLocalRoles($this->parent_object->getRefId());
197 $types = array();
198 foreach ($arrLocalRoles as $role_id) {
199 $ilObjRole = new ilObjRole($role_id);
200 if (! preg_match("/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
201 $types[$role_id] = $ilObjRole->getPresentationTitle();
202 }
203 }
204 $this->ctrl->setParameterByClass('ilRepositorySearchGUI', 'addusertype', 'other');
205 ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $this->toolbar, array(
206 'auto_complete_name' => $this->lng->txt('user'),
207 'user_type' => $types,
208 'submit_name' => $this->lng->txt('add')
209 ));
210 }
Class ilObjRole.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with

References ilRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by showOtherRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStaff()

ilOrgUnitStaffGUI::addStaff ( )

Definition at line 213 of file class.ilOrgUnitStaffGUI.php.

213 {
214 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
215 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
216 $this->ctrl->redirect($this->parent_gui, "");
217 }
218
219 $users = explode(',', $_POST['user_login']);
220 $user_ids = array();
221 foreach ($users as $user) {
222 $user_id = ilObjUser::_lookupId($user);
223 if ($user_id) {
224 $user_ids[] = $user_id;
225 }
226 }
227
228 if(!count($user_ids)) {
229 ilUtil::sendFailure($this->lng->txt("user_not_found"), true);
230 $this->ctrl->redirect($this,"showStaff");
231 }
232
233 $user_type = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
234 if ($user_type == "employee") {
235 $this->parent_object->assignUsersToEmployeeRole($user_ids);
236 } elseif ($user_type == "superior") {
237 $this->parent_object->assignUsersToSuperiorRole($user_ids);
238 } else {
239 throw new Exception("The post request didn't specify wether the user_ids should be assigned to the employee or the superior role.");
240 }
241 ilUtil::sendSuccess($this->lng->txt("users_successfuly_added"), true);
242 $this->ctrl->redirect($this,"showStaff");
243 }

References $_POST, ilObjUser\_lookupId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStaffToolbar()

ilOrgUnitStaffGUI::addStaffToolbar ( )
protected

Definition at line 181 of file class.ilOrgUnitStaffGUI.php.

181 {
182 $types = array(
183 "employee" => $this->lng->txt("employee"),
184 "superior" => $this->lng->txt("superior")
185 );
186 $this->ctrl->setParameterByClass('ilRepositorySearchGUI', 'addusertype', 'staff');
187 ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $this->toolbar, array(
188 'auto_complete_name' => $this->lng->txt('user'),
189 'user_type' => $types,
190 'submit_name' => $this->lng->txt('add')
191 ));
192 }

References ilRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by showStaff().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmRemoveUser()

ilOrgUnitStaffGUI::confirmRemoveUser (   $cmd)

Definition at line 330 of file class.ilOrgUnitStaffGUI.php.

330 {
331 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
332 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
333 $this->ctrl->redirect($this->parent_gui, "");
334 }
335 switch ($cmd) {
336 case "confirmRemoveFromRole":
337 $this->tabs_gui->activateSubTab("show_other_roles");
338 $nextcmd = "removeFromRole";
339 $paramname = "obj_id-role_id";
340 $param = $_GET["obj_id"] . '-' . $_GET["role_id"];
341 break;
342 case "confirmRemoveFromSuperiors":
343 $this->tabs_gui->activateSubTab("show_staff");
344 $nextcmd = "removeFromSuperiors";
345 $paramname = "obj_id";
346 $param = $_GET["obj_id"];
347 break;
348 case "confirmRemoveFromEmployees":
349 $this->tabs_gui->activateSubTab("show_staff");
350 $nextcmd = "removeFromEmployees";
351 $paramname = "obj_id";
352 $param = $_GET["obj_id"];
353 break;
354 }
355 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
356 $confirm = new ilConfirmationGUI();
357 $confirm->setFormAction($this->ctrl->getFormAction($this, $nextcmd));
358 $confirm->setHeaderText($this->lng->txt('orgu_staff_deassign'));
359 $confirm->setConfirm($this->lng->txt('confirm'), $nextcmd);
360 $confirm->setCancel($this->lng->txt('cancel'), 'showStaff');
361 $arrUser = ilObjUser::_lookupName($_GET["obj_id"]);
362 $confirm->addItem($paramname, $param,
363 $arrUser['lastname'] . ', ' . $arrUser['firstname'] . ' [' . $arrUser['login']
364 . ']', ilUtil::getImagePath('icon_usr.svg'));
365 $this->tpl->setContent($confirm->getHTML());
366 }
$_GET["client_id"]
Confirmation screen class.
static _lookupName($a_user_id)
lookup user name
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$cmd
Definition: sahs_server.php:35

References $_GET, $cmd, ilObjUser\_lookupName(), ilUtil\getImagePath(), and ilUtil\sendFailure().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilOrgUnitStaffGUI::executeCommand ( )
Returns
bool
Exceptions
Exception
ilCtrlException
ilException

Definition at line 84 of file class.ilOrgUnitStaffGUI.php.

85 {
86 $next_class = $this->ctrl->getNextClass($this);
87 $cmd = $this->ctrl->getCmd();
88
89 switch ($next_class) {
90 case 'ilrepositorysearchgui':
91 switch ($cmd) {
92 case 'addUserFromAutoComplete':
93 if ($_GET['addusertype'] == "staff") {
94 $this->addStaff();
95 } elseif ($_GET['addusertype'] == "other") {
96 $this->addOtherRoles();
97 }
98 break;
99 default:
100 $repo = new ilRepositorySearchGUI();
101 $this->ctrl->forwardCommand($repo);
102 break;
103 }
104 break;
105 default:
106 switch ($cmd) {
107 case 'showStaff':
108 $this->tabs_gui->activateSubTab("show_staff");
109 $this->showStaff();
110 break;
111 case 'showOtherRoles':
112 $this->tabs_gui->activateSubTab("show_other_roles");
113 $this->showOtherRoles();
114 break;
115 case 'showStaffRec':
116 $this->tabs_gui->activateSubTab("show_staff_rec");
117 $this->showStaffRec();
118 break;
119 case 'confirmRemoveFromRole':
120 case 'confirmRemoveFromEmployees':
121 case 'confirmRemoveFromSuperiors':
122 $this->confirmRemoveUser($cmd);
123 break;
124 case 'addStaff':
125 case 'addOtherRoles':
126 case 'fromSuperiorToEmployee':
127 case 'fromEmployeeToSuperior':
128 case 'removeFromSuperiors':
129 case 'removeFromEmployees':
130 case 'removeFromRole':
131 $this->$cmd();
132 break;
133 default:
134 throw new ilException("Unknown command for command class ilOrgUnitStaffGUI: ".$cmd);
135 break;
136 }
137 break;
138 }
139
140
141 return true;
142 }
Base class for ILIAS Exception handling.

References $_GET, $cmd, addOtherRoles(), addStaff(), confirmRemoveUser(), showOtherRoles(), showStaff(), and showStaffRec().

+ Here is the call graph for this function:

◆ fromEmployeeToSuperior()

ilOrgUnitStaffGUI::fromEmployeeToSuperior ( )

Definition at line 319 of file class.ilOrgUnitStaffGUI.php.

319 {
320 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
321 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
322 $this->ctrl->redirect($this->parent_gui, "");
323 }
324 $this->parent_object->deassignUserFromEmployeeRole($_GET["obj_id"]);
325 $this->parent_object->assignUsersToSuperiorRole(array( $_GET["obj_id"] ));
326 ilUtil::sendSuccess($this->lng->txt("user_changed_successful"), true);
327 $this->ctrl->redirect($this, "showStaff");
328 }

References $_GET, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ fromSuperiorToEmployee()

ilOrgUnitStaffGUI::fromSuperiorToEmployee ( )

Definition at line 307 of file class.ilOrgUnitStaffGUI.php.

307 {
308 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
309 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
310 $this->ctrl->redirect($this->parent_gui, "");
311 }
312 $this->parent_object->deassignUserFromSuperiorRole($_GET["obj_id"]);
313 $this->parent_object->assignUsersToEmployeeRole(array( $_GET["obj_id"] ));
314 ilUtil::sendSuccess($this->lng->txt("user_changed_successful"), true);
315 $this->ctrl->redirect($this, "showStaff");
316 }

References $_GET, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ getOtherRolesTableHTML()

ilOrgUnitStaffGUI::getOtherRolesTableHTML ( )

Definition at line 288 of file class.ilOrgUnitStaffGUI.php.

288 {
289 global $lng, $rbacreview;
290 $arrLocalRoles = $rbacreview->getLocalRoles($this->parent_object->getRefId());
291 $html = "";
292 foreach ($arrLocalRoles as $role_id) {
293 $ilObjRole = new ilObjRole($role_id);
294 if (! preg_match("/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
295 $other_roles_table = new ilOrgUnitOtherRolesTableGUI($this, 'other_role_' . $role_id, $role_id);
296 $other_roles_table->readData();
297 $html .= $other_roles_table->getHTML() . "<br/>";
298 }
299 }
300 if (! $html) {
301 $html = $lng->txt("no_roles");
302 }
303
304 return $html;
305 }
Class ilOrgUnitOtherRolesTableGUI.
$html
Definition: example_001.php:87

References $html, $lng, and $rbacreview.

Referenced by showOtherRoles().

+ Here is the caller graph for this function:

◆ getStaffTableHTML()

ilOrgUnitStaffGUI::getStaffTableHTML (   $recursive = false,
  $table_cmd = "showStaff" 
)
Parameters
bool$recursive
string$table_cmd
Returns
string the tables html.

Definition at line 275 of file class.ilOrgUnitStaffGUI.php.

275 {
276 global $lng, $rbacreview;
277 $superior_table = new ilOrgUnitStaffTableGUI($this, $table_cmd, "superior", $recursive);
278 $superior_table->parseData();
279 $superior_table->setTitle($lng->txt("il_orgu_superior"));
280 $employee_table = new ilOrgUnitStaffTableGUI($this, $table_cmd, "employee", $recursive);
281 $employee_table->parseData();
282 $employee_table->setTitle($lng->txt("il_orgu_employee"));
283
284 return $superior_table->getHTML() . $employee_table->getHTML();
285 }
Class ilOrgUnitStaffTableGUI.

References $lng, and $rbacreview.

Referenced by showStaff(), and showStaffRec().

+ Here is the caller graph for this function:

◆ removeFromEmployees()

ilOrgUnitStaffGUI::removeFromEmployees ( )

Definition at line 379 of file class.ilOrgUnitStaffGUI.php.

379 {
380 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
381 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
382 $this->ctrl->redirect($this->parent_gui, "");
383 }
384 $this->parent_object->deassignUserFromEmployeeRole($_POST["obj_id"]);
385 ilUtil::sendSuccess($this->lng->txt("deassign_user_successful"), true);
386 $this->ctrl->redirect($this, "showStaff");
387 }

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ removeFromRole()

ilOrgUnitStaffGUI::removeFromRole ( )

Definition at line 390 of file class.ilOrgUnitStaffGUI.php.

390 {
391 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
392 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
393 $this->ctrl->redirect($this->parent_gui, "");
394 }
395 $arrObjIdRolId = explode("-", $_POST["obj_id-role_id"]);
396 $this->parent_object->deassignUserFromLocalRole($arrObjIdRolId[1], $arrObjIdRolId[0]);
397 ilUtil::sendSuccess($this->lng->txt("deassign_user_successful"), true);
398 $this->ctrl->redirect($this, "showOtherRoles");
399 }

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ removeFromSuperiors()

ilOrgUnitStaffGUI::removeFromSuperiors ( )

Definition at line 368 of file class.ilOrgUnitStaffGUI.php.

368 {
369 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
370 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
371 $this->ctrl->redirect($this->parent_gui, "");
372 }
373 $this->parent_object->deassignUserFromSuperiorRole($_POST["obj_id"]);
374 ilUtil::sendSuccess($this->lng->txt("deassign_user_successful"), true);
375 $this->ctrl->redirect($this, "showStaff");
376 }

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setTabs()

ilOrgUnitStaffGUI::setTabs ( )

Definition at line 402 of file class.ilOrgUnitStaffGUI.php.

402 {
403 $this->tabs_gui->addSubTab("show_staff", sprintf($this->lng->txt("local_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this, "showStaff"));
404 if ($this->ilAccess->checkAccess("view_learning_progress_rec", "", $this->parent_object->getRefId())) {
405 $this->tabs_gui->addSubTab("show_staff_rec", sprintf($this->lng->txt("rec_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this, "showStaffRec"));
406 }
407 if ($this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
408 $this->tabs_gui->addSubTab("show_other_roles", sprintf($this->lng->txt("local_other_roles"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this, "showOtherRoles"));
409 }
410 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ showOtherRoles()

ilOrgUnitStaffGUI::showOtherRoles ( )

Definition at line 158 of file class.ilOrgUnitStaffGUI.php.

158 {
159 if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
160 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
161 $this->ctrl->redirect($this->parent_gui, "");
162 }
163 if ($this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
164 $this->addOtherRolesToolbar();
165 }
166 $this->tpl->setContent($this->getOtherRolesTableHTML());
167 }

References addOtherRolesToolbar(), getOtherRolesTableHTML(), and ilUtil\sendFailure().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showStaff()

ilOrgUnitStaffGUI::showStaff ( )

Definition at line 144 of file class.ilOrgUnitStaffGUI.php.

144 {
145 if(!ilObjOrgUnitAccess::_checkAccessStaff($this->parent_object->getRefId()))
146 {
147 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
148 $this->ctrl->redirect($this->parent_gui, "");
149 }
150 if ($this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
151 $this->addStaffToolbar();
152 }
153 $this->ctrl->setParameter($this, "recursive", false);
154 $this->tpl->setContent($this->getStaffTableHTML(false, "showStaff"));
155 }
static _checkAccessStaff($ref_id)
getStaffTableHTML($recursive=false, $table_cmd="showStaff")

References ilObjOrgUnitAccess\_checkAccessStaff(), addStaffToolbar(), getStaffTableHTML(), and ilUtil\sendFailure().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showStaffRec()

ilOrgUnitStaffGUI::showStaffRec ( )

Definition at line 170 of file class.ilOrgUnitStaffGUI.php.

170 {
171 if(!ilObjOrgUnitAccess::_checkAccessStaffRec($this->parent_object->getRefId()))
172 {
173 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
174 $this->ctrl->redirect($this->parent_gui, "");
175 }
176 $this->ctrl->setParameter($this, "recursive", true);
177 $this->tpl->setContent($this->getStaffTableHTML(true, "showStaffRec"));
178 }
static _checkAccessStaffRec($ref_id)

References ilObjOrgUnitAccess\_checkAccessStaffRec(), getStaffTableHTML(), and ilUtil\sendFailure().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilOrgUnitStaffGUI::$ctrl
protected

Definition at line 29 of file class.ilOrgUnitStaffGUI.php.

◆ $ilAccess

ilOrgUnitStaffGUI::$ilAccess
protected

Definition at line 49 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().

◆ $lng

ilOrgUnitStaffGUI::$lng
protected

◆ $parent_gui

ilOrgUnitStaffGUI::$parent_gui
protected

Definition at line 37 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().

◆ $parent_obj

ilOrgUnitStaffGUI::$parent_obj
protected

Definition at line 41 of file class.ilOrgUnitStaffGUI.php.

◆ $rbacreview

ilOrgUnitStaffGUI::$rbacreview
protected

◆ $tabs_gui

ilOrgUnitStaffGUI::$tabs_gui
protected

Definition at line 21 of file class.ilOrgUnitStaffGUI.php.

◆ $toolbar

ilOrgUnitStaffGUI::$toolbar
protected

Definition at line 25 of file class.ilOrgUnitStaffGUI.php.

◆ $tpl

ilOrgUnitStaffGUI::$tpl
protected

Definition at line 33 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: