63 $ilTabs = $DIC[
'ilTabs'];
66 $ilToolbar = $DIC[
'ilToolbar'];
72 $this->parent_object = $parent_gui->object;
73 $this->tabs_gui = $this->parent_gui->tabs_gui;
74 $this->toolbar = $ilToolbar;
77 $this->toolbar = $ilToolbar;
80 $this->tabs_gui->setTabActive(
"orgu_staff");
92 $next_class = $this->ctrl->getNextClass($this);
93 $cmd = $this->ctrl->getCmd();
95 switch ($next_class) {
96 case 'ilrepositorysearchgui':
98 $this->ctrl->forwardCommand($repo);
103 $this->tabs_gui->activateSubTab(
"show_staff");
106 case 'showOtherRoles':
107 $this->tabs_gui->activateSubTab(
"show_other_roles");
111 $this->tabs_gui->activateSubTab(
"show_staff_rec");
114 case 'confirmRemoveFromRole':
115 case 'confirmRemoveFromEmployees':
116 case 'confirmRemoveFromSuperiors':
120 case 'addOtherRoles':
121 case 'fromSuperiorToEmployee':
122 case 'fromEmployeeToSuperior':
123 case 'removeFromSuperiors':
124 case 'removeFromEmployees':
125 case 'removeFromRole':
129 throw new ilException(
"Unknown command for command class ilOrgUnitStaffGUI: " . $cmd);
143 $this->ctrl->redirect($this->parent_gui,
"");
148 $this->ctrl->setParameter($this,
"recursive",
false);
157 $this->ctrl->redirect($this->parent_gui,
"");
170 $this->ctrl->redirect($this->parent_gui,
"");
172 $this->ctrl->setParameter($this,
"recursive",
true);
180 "employee" => $this->lng->txt(
"employee"),
181 "superior" => $this->lng->txt(
"superior")
183 $this->ctrl->setParameterByClass(
'ilRepositorySearchGUI',
'addusertype',
'staff');
185 'auto_complete_name' => $this->lng->txt(
'user'),
186 'user_type' => $types,
187 'submit_name' => $this->lng->txt(
'add')
194 $arrLocalRoles = $this->rbacreview->getLocalRoles($this->parent_object->getRefId());
196 foreach ($arrLocalRoles as $role_id) {
198 if (!preg_match(
"/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
199 $types[$role_id] = $ilObjRole->getPresentationTitle();
202 $this->ctrl->setParameterByClass(
'ilRepositorySearchGUI',
'addusertype',
'other');
204 'auto_complete_name' => $this->lng->txt(
'user'),
205 'user_type' => $types,
206 'submit_name' => $this->lng->txt(
'add')
215 $this->ctrl->redirect($this->parent_gui,
"");
223 $user_ids[] = $user_id;
227 if (!count($user_ids)) {
229 $this->ctrl->redirect($this,
"showStaff");
232 $user_type = isset(
$_POST[
'user_type']) ?
$_POST[
'user_type'] : 0;
233 if ($user_type ==
"employee") {
234 $this->parent_object->assignUsersToEmployeeRole($user_ids);
235 } elseif ($user_type ==
"superior") {
236 $this->parent_object->assignUsersToSuperiorRole($user_ids);
238 throw new Exception(
"The post request didn't specify wether the user_ids should be assigned to the employee or the superior role.");
241 ilUtil::sendSuccess($this->lng->txt(
"users_successfuly_added"),
true);
242 $this->ctrl->redirect($this,
"showStaff");
249 $this->ctrl->redirect($this->parent_gui,
"");
257 $user_ids[] = $user_id;
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);
264 ilUtil::sendSuccess($this->lng->txt(
"users_successfuly_added"),
true);
265 $this->ctrl->redirect($this,
"showOtherRoles");
281 $superior_table->parseData();
282 $superior_table->setTitle(
$lng->txt(
"il_orgu_superior"));
284 $employee_table->parseData();
285 $employee_table->setTitle(
$lng->txt(
"il_orgu_employee"));
287 return $superior_table->getHTML() . $employee_table->getHTML();
296 $arrLocalRoles =
$rbacreview->getLocalRoles($this->parent_object->getRefId());
298 foreach ($arrLocalRoles as $role_id) {
300 if (!preg_match(
"/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
302 $other_roles_table->readData();
303 $html .= $other_roles_table->getHTML() .
"<br/>";
317 $this->ctrl->redirect($this->parent_gui,
"");
319 $this->parent_object->deassignUserFromSuperiorRole(
$_GET[
"obj_id"]);
320 $this->parent_object->assignUsersToEmployeeRole(array(
$_GET[
"obj_id"] ));
321 ilUtil::sendSuccess($this->lng->txt(
"user_changed_successful"),
true);
322 $this->ctrl->redirect($this,
"showStaff");
330 $this->ctrl->redirect($this->parent_gui,
"");
332 $this->parent_object->deassignUserFromEmployeeRole(
$_GET[
"obj_id"]);
333 $this->parent_object->assignUsersToSuperiorRole(array(
$_GET[
"obj_id"] ));
334 ilUtil::sendSuccess($this->lng->txt(
"user_changed_successful"),
true);
335 $this->ctrl->redirect($this,
"showStaff");
342 $this->ctrl->redirect($this->parent_gui,
"");
345 case "confirmRemoveFromRole":
346 $this->tabs_gui->activateSubTab(
"show_other_roles");
347 $nextcmd =
"removeFromRole";
348 $paramname =
"obj_id-role_id";
349 $param =
$_GET[
"obj_id"] .
'-' .
$_GET[
"role_id"];
351 case "confirmRemoveFromSuperiors":
352 $this->tabs_gui->activateSubTab(
"show_staff");
353 $nextcmd =
"removeFromSuperiors";
354 $paramname =
"obj_id";
355 $param =
$_GET[
"obj_id"];
357 case "confirmRemoveFromEmployees":
358 $this->tabs_gui->activateSubTab(
"show_staff");
359 $nextcmd =
"removeFromEmployees";
360 $paramname =
"obj_id";
361 $param =
$_GET[
"obj_id"];
364 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
366 $confirm->setFormAction($this->ctrl->getFormAction($this, $nextcmd));
367 $confirm->setHeaderText($this->lng->txt(
'orgu_staff_deassign'));
368 $confirm->setConfirm($this->lng->txt(
'confirm'), $nextcmd);
369 $confirm->setCancel($this->lng->txt(
'cancel'),
'showStaff');
374 $arrUser[
'lastname'] .
', ' . $arrUser[
'firstname'] .
' [' . $arrUser[
'login']
378 $this->tpl->setContent($confirm->getHTML());
385 $this->ctrl->redirect($this->parent_gui,
"");
387 $this->parent_object->deassignUserFromSuperiorRole(
$_POST[
"obj_id"]);
389 if (!$this->rbacreview->isAssigned(
$_POST[
"obj_id"], $this->parent_object->getEmployeeRole())) {
390 ilObjUser::_removeOrgUnit(
$_POST[
"obj_id"], $this->parent_object->getRefId());
392 ilUtil::sendSuccess($this->lng->txt(
"deassign_user_successful"),
true);
393 $this->ctrl->redirect($this,
"showStaff");
401 $this->ctrl->redirect($this->parent_gui,
"");
403 $this->parent_object->deassignUserFromEmployeeRole(
$_POST[
"obj_id"]);
405 if (!$this->rbacreview->isAssigned(
$_POST[
"obj_id"], $this->parent_object->getSuperiorRole())) {
406 ilObjUser::_removeOrgUnit(
$_POST[
"obj_id"], $this->parent_object->getRefId());
408 ilUtil::sendSuccess($this->lng->txt(
"deassign_user_successful"),
true);
409 $this->ctrl->redirect($this,
"showStaff");
417 $this->ctrl->redirect($this->parent_gui,
"");
419 $arrObjIdRolId = explode(
"-",
$_POST[
"obj_id-role_id"]);
420 $this->parent_object->deassignUserFromLocalRole($arrObjIdRolId[1], $arrObjIdRolId[0]);
421 ilUtil::sendSuccess($this->lng->txt(
"deassign_user_successful"),
true);
422 $this->ctrl->redirect($this,
"showOtherRoles");
428 $this->tabs_gui->addSubTab(
"show_staff", sprintf($this->lng->txt(
"local_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this,
"showStaff"));
429 if ($this->
ilAccess->
checkAccess(
"view_learning_progress_rec",
"", $this->parent_object->getRefId())) {
430 $this->tabs_gui->addSubTab(
"show_staff_rec", sprintf($this->lng->txt(
"rec_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this,
"showStaffRec"));
433 $this->tabs_gui->addSubTab(
"show_other_roles", sprintf($this->lng->txt(
"local_other_roles"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this,
"showOtherRoles"));
static _lookupName($a_user_id)
lookup user name
static _checkAccessStaff($ref_id)
static _lookupId($a_user_str)
Lookup id by login.
Class ilObjOrgUnit GUI class.
__construct(ilObjOrgUnitGUI $parent_gui)
checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type="", $a_obj_id="", $a_tree_id="")
check access for an object (provide $a_type and $a_obj_id if available for better performance)(option...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilOrgUnitStaffTableGUI.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilOrgUnitOtherRolesTableGUI.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
getStaffTableHTML($recursive=false, $table_cmd="showStaff")
static _checkAccessStaffRec($ref_id)
Confirmation screen class.