3 require_once(
"./Services/Search/classes/class.ilRepositorySearchGUI.php");
4 require_once(
"class.ilOrgUnitStaffTableGUI.php");
5 require_once(
"class.ilOrgUnitOtherRolesTableGUI.php");
64 $ilTabs = $DIC[
'ilTabs'];
67 $ilToolbar = $DIC[
'ilToolbar'];
73 $this->parent_object = $parent_gui->object;
74 $this->tabs_gui = $this->parent_gui->tabs_gui;
75 $this->toolbar = $ilToolbar;
78 $this->toolbar = $ilToolbar;
81 $this->tabs_gui->setTabActive(
"orgu_staff");
93 $next_class = $this->ctrl->getNextClass($this);
94 $cmd = $this->ctrl->getCmd();
96 switch ($next_class) {
97 case 'ilrepositorysearchgui':
99 case 'addUserFromAutoComplete':
100 if (
$_GET[
'addusertype'] ==
"staff") {
102 } elseif (
$_GET[
'addusertype'] ==
"other") {
108 $this->ctrl->forwardCommand($repo);
115 $this->tabs_gui->activateSubTab(
"show_staff");
118 case 'showOtherRoles':
119 $this->tabs_gui->activateSubTab(
"show_other_roles");
123 $this->tabs_gui->activateSubTab(
"show_staff_rec");
126 case 'confirmRemoveFromRole':
127 case 'confirmRemoveFromEmployees':
128 case 'confirmRemoveFromSuperiors':
132 case 'addOtherRoles':
133 case 'fromSuperiorToEmployee':
134 case 'fromEmployeeToSuperior':
135 case 'removeFromSuperiors':
136 case 'removeFromEmployees':
137 case 'removeFromRole':
141 throw new ilException(
"Unknown command for command class ilOrgUnitStaffGUI: ".
$cmd);
155 $this->ctrl->redirect($this->parent_gui,
"");
157 if ($this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
160 $this->ctrl->setParameter($this,
"recursive",
false);
166 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
168 $this->ctrl->redirect($this->parent_gui,
"");
170 if ($this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
181 $this->ctrl->redirect($this->parent_gui,
"");
183 $this->ctrl->setParameter($this,
"recursive",
true);
190 "employee" => $this->lng->txt(
"employee"),
191 "superior" => $this->lng->txt(
"superior")
193 $this->ctrl->setParameterByClass(
'ilRepositorySearchGUI',
'addusertype',
'staff');
195 'auto_complete_name' => $this->lng->txt(
'user'),
196 'user_type' => $types,
197 'submit_name' => $this->lng->txt(
'add')
203 $arrLocalRoles = $this->rbacreview->getLocalRoles($this->parent_object->getRefId());
205 foreach ($arrLocalRoles as $role_id) {
207 if (! preg_match(
"/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
208 $types[$role_id] = $ilObjRole->getPresentationTitle();
211 $this->ctrl->setParameterByClass(
'ilRepositorySearchGUI',
'addusertype',
'other');
213 'auto_complete_name' => $this->lng->txt(
'user'),
214 'user_type' => $types,
215 'submit_name' => $this->lng->txt(
'add')
221 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
223 $this->ctrl->redirect($this->parent_gui,
"");
226 $users = explode(
',',
$_POST[
'user_login']);
228 foreach ($users as $user) {
231 $user_ids[] = $user_id;
235 if(!count($user_ids)) {
237 $this->ctrl->redirect($this,
"showStaff");
240 $user_type = isset(
$_POST[
'user_type']) ?
$_POST[
'user_type'] : 0;
241 if ($user_type ==
"employee") {
242 $this->parent_object->assignUsersToEmployeeRole($user_ids);
243 } elseif ($user_type ==
"superior") {
244 $this->parent_object->assignUsersToSuperiorRole($user_ids);
246 throw new Exception(
"The post request didn't specify wether the user_ids should be assigned to the employee or the superior role.");
250 $this->ctrl->redirect($this,
"showStaff");
254 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
256 $this->ctrl->redirect($this->parent_gui,
"");
259 $users = explode(
',',
$_POST[
'user_login']);
261 foreach ($users as $user) {
264 $user_ids[] = $user_id;
267 $role_id = isset(
$_POST[
'user_type']) ?
$_POST[
'user_type'] : 0;
268 foreach ($user_ids as $user_id) {
269 $this->parent_object->assignUserToLocalRole($role_id, $user_id);
272 $this->ctrl->redirect($this,
"showOtherRoles");
287 $superior_table->parseData();
288 $superior_table->setTitle(
$lng->txt(
"il_orgu_superior"));
290 $employee_table->parseData();
291 $employee_table->setTitle(
$lng->txt(
"il_orgu_employee"));
293 return $superior_table->getHTML() . $employee_table->getHTML();
301 $arrLocalRoles =
$rbacreview->getLocalRoles($this->parent_object->getRefId());
303 foreach ($arrLocalRoles as $role_id) {
305 if (! preg_match(
"/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
307 $other_roles_table->readData();
308 $html .= $other_roles_table->getHTML() .
"<br/>";
319 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
321 $this->ctrl->redirect($this->parent_gui,
"");
323 $this->parent_object->deassignUserFromSuperiorRole(
$_GET[
"obj_id"]);
324 $this->parent_object->assignUsersToEmployeeRole(
array(
$_GET[
"obj_id"] ));
326 $this->ctrl->redirect($this,
"showStaff");
331 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
333 $this->ctrl->redirect($this->parent_gui,
"");
335 $this->parent_object->deassignUserFromEmployeeRole(
$_GET[
"obj_id"]);
336 $this->parent_object->assignUsersToSuperiorRole(
array(
$_GET[
"obj_id"] ));
338 $this->ctrl->redirect($this,
"showStaff");
342 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
344 $this->ctrl->redirect($this->parent_gui,
"");
347 case "confirmRemoveFromRole":
348 $this->tabs_gui->activateSubTab(
"show_other_roles");
349 $nextcmd =
"removeFromRole";
350 $paramname =
"obj_id-role_id";
351 $param =
$_GET[
"obj_id"] .
'-' .
$_GET[
"role_id"];
353 case "confirmRemoveFromSuperiors":
354 $this->tabs_gui->activateSubTab(
"show_staff");
355 $nextcmd =
"removeFromSuperiors";
356 $paramname =
"obj_id";
357 $param =
$_GET[
"obj_id"];
359 case "confirmRemoveFromEmployees":
360 $this->tabs_gui->activateSubTab(
"show_staff");
361 $nextcmd =
"removeFromEmployees";
362 $paramname =
"obj_id";
363 $param =
$_GET[
"obj_id"];
366 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
368 $confirm->setFormAction($this->ctrl->getFormAction($this, $nextcmd));
369 $confirm->setHeaderText($this->lng->txt(
'orgu_staff_deassign'));
370 $confirm->setConfirm($this->lng->txt(
'confirm'), $nextcmd);
371 $confirm->setCancel($this->lng->txt(
'cancel'),
'showStaff');
373 $confirm->addItem($paramname, $param,
374 $arrUser[
'lastname'] .
', ' . $arrUser[
'firstname'] .
' [' . $arrUser[
'login']
376 $this->tpl->setContent($confirm->getHTML());
381 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
383 $this->ctrl->redirect($this->parent_gui,
"");
385 $this->parent_object->deassignUserFromSuperiorRole(
$_POST[
"obj_id"]);
392 $this->ctrl->redirect($this,
"showStaff");
397 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
399 $this->ctrl->redirect($this->parent_gui,
"");
401 $this->parent_object->deassignUserFromEmployeeRole(
$_POST[
"obj_id"]);
408 $this->ctrl->redirect($this,
"showStaff");
413 if (!$this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
415 $this->ctrl->redirect($this->parent_gui,
"");
417 $arrObjIdRolId = explode(
"-",
$_POST[
"obj_id-role_id"]);
418 $this->parent_object->deassignUserFromLocalRole($arrObjIdRolId[1], $arrObjIdRolId[0]);
420 $this->ctrl->redirect($this,
"showOtherRoles");
425 $this->tabs_gui->addSubTab(
"show_staff", sprintf($this->lng->txt(
"local_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this,
"showStaff"));
426 if ($this->ilAccess->checkAccess(
"view_learning_progress_rec",
"", $this->parent_object->getRefId())) {
427 $this->tabs_gui->addSubTab(
"show_staff_rec", sprintf($this->lng->txt(
"rec_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this,
"showStaffRec"));
429 if ($this->ilAccess->checkAccess(
"write",
"", $this->parent_object->getRefId())) {
430 $this->tabs_gui->addSubTab(
"show_other_roles", sprintf($this->lng->txt(
"local_other_roles"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this,
"showOtherRoles"));
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupName($a_user_id)
lookup user name
Base class for ILIAS Exception handling.
static _checkAccessStaff($ref_id)
static _lookupId($a_user_str)
Lookup id by login.
Class ilObjOrgUnit GUI class.
__construct(ilObjOrgUnitGUI $parent_gui)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilOrgUnitStaffTableGUI.
Create styles array
The data for the language used.
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.