24 require_once
"./classes/class.ilObjectGUI.php";
56 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
57 $lng->loadLanguageModule(
'rbac');
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
71 case 'ilpermissiongui':
72 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
74 $ret =& $this->ctrl->forwardCommand($perm_gui);
98 global
$ilErr, $rbacsystem, $ilToolbar,$rbacreview,$ilTabs;
100 $ilTabs->activateTab(
'view');
102 if(!$rbacsystem->checkAccess(
'visible,read',$this->object->getRefId()))
104 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
107 $this->ctrl->setParameter($this,
'new_type',
'role');
108 $ilToolbar->addButton(
109 $this->lng->txt(
'rolf_create_role'),
110 $this->ctrl->getLinkTarget($this,
'create')
112 $this->ctrl->setParameter($this,
'new_type',
'rolt');
113 $ilToolbar->addButton(
114 $this->lng->txt(
'rolf_create_rolt'),
115 $this->ctrl->getLinkTarget($this,
'create')
117 $this->ctrl->clearParameters($this);
119 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
122 $table->parse($this->object->getId());
124 $this->tpl->setContent($table->getHTML());
132 global $rbacsystem,
$ilCtrl, $ilTabs;
134 $ilTabs->clearTargets();
135 $ilTabs->setBackTarget(
136 $this->lng->txt(
'rbac_back_to_overview'),
137 $this->ctrl->getLinkTarget($this,
'view')
140 if(!$rbacsystem->checkAccess(
'visible,read',$this->object->getRefId()))
142 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
145 $ilCtrl->setParameter($this,
'copy_source',(
int)
$_REQUEST[
'copy_source']);
149 $this->tpl->setContent($form->getHTML());
159 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
161 $form->setTitle($this->lng->txt(
'rbac_role_title'));
162 $form->setFormAction($ilCtrl->getFormAction($this,
'view'));
166 $search->setSize(30);
167 $search->setMaxLength(255);
168 $form->addItem($search);
170 $form->addCommandButton(
'roleSearchList', $this->lng->txt(
'search'));
181 $ilTabs->clearTargets();
182 $ilTabs->setBackTarget(
183 $this->lng->txt(
'rbac_back_to_overview'),
184 $this->ctrl->getLinkTarget($this,
'roleSearchList')
187 $ilCtrl->setParameter($this,
'copy_source',(
int)
$_REQUEST[
'copy_source']);
190 if($form->checkInput())
194 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
197 $table->setRoleTitleFilter($form->getInput(
'title'));
199 $table->parse($this->object->getId());
200 return $this->tpl->setContent($table->getHTML());
204 $form->setValuesByPost();
205 $ilCtrl->redirect($this,
'roleSearch');
216 $ilTabs->clearTargets();
217 $ilTabs->setBackTarget(
218 $this->lng->txt(
'rbac_back_to_overview'),
219 $this->ctrl->getLinkTarget($this,
'roleSearchList')
222 $ilCtrl->setParameter($this,
'copy_source',(
int)
$_REQUEST[
'copy_source']);
225 $this->tpl->setContent($form->getHTML());
235 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
237 $form->setTitle($this->lng->txt(
'rbac_copy_behaviour'));
238 $form->setFormAction($ilCtrl->getFormAction($this,
'chooseCopyBehaviour'));
245 $ceo =
new ilRadioOption($this->lng->txt(
'change_existing_objects'),1);
246 $ce->addOption($ceo);
248 $cne =
new ilRadioOption($this->lng->txt(
'rbac_not_change_existing_objects'), 0);
249 $ce->addOption($cne);
252 $roles->setValue(implode(
',',(array)
$_POST[
'roles']));
253 $form->addItem($roles);
255 $form->addCommandButton(
'copyRole', $this->lng->txt(
'rbac_copy_role'));
267 $roles = explode(
',',
$_POST[
'roles']);
268 $source = (int)
$_REQUEST[
'copy_source'];
271 if($form->checkInput())
273 foreach((array) $roles as $role_id)
275 if($role_id != $source)
277 $this->
doCopyRole($source,$role_id,$form->getInput(
'change_existing'));
282 $ilCtrl->redirect($this,
'view');
296 protected function doCopyRole($source, $target, $change_existing)
298 global
$tree, $rbacadmin, $rbacreview;
303 $rbacadmin->copyRoleTemplatePermissions(
305 $this->object->getRefId(),
306 $rbacreview->getRoleFolderOfRole($target),
310 if(!$change_existing)
315 $start = ($this->
object->getRefId() == ROLE_FOLDER_ID) ?
317 $tree->getParentId($this->object->getRefId());
321 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
322 if($rbacreview->isProtected($this->object->getRefId(),$source))
332 $role->changeExistingObjects(
344 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
347 $table->resetOffset();
348 $table->writeFilterToSession();
358 include_once
'./Services/AccessControl/classes/class.ilRoleTableGUI.php';
361 $table->resetOffset();
362 $table->resetFilter();
374 if(!count(
$_POST[
'roles']))
377 $ilCtrl->redirect($this,
'view');
380 $question = $this->lng->txt(
'rbac_role_delete_qst');
382 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
384 $confirm->setHeaderText($question);
385 $confirm->setFormAction($ilCtrl->getFormAction($this));
386 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteRole');
387 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
390 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
391 foreach(
$_POST[
'roles'] as $role_id)
399 $this->tpl->setContent($confirm->getHTML());
409 if(!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
412 $this->lng->txt(
'msg_no_perm_delete'),
417 foreach((array)
$_POST[
'roles'] as $id)
422 if ($obj->getType() ==
"role")
424 $rolf_arr = $rbacreview->getFoldersAssignedToRole($obj->getId(),
true);
425 $obj->setParent($rolf_arr[0]);
433 $ilCtrl->redirect($this,
'view');
447 $this->
object->setTitle($this->lng->txt(
"obj_".$this->object->getType().
"_local"));
448 $this->
object->setDescription(
"obj_".$this->object->getType().
"_local_desc");
460 if (!isset(
$_POST[
"role_id"]))
462 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
469 $this->data[
"cols"] = array(
"type",
"title",
"description",
"last_change");
471 foreach(
$_POST[
"role_id"] as $id)
473 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($id);
475 $this->data[
"data"][
"$id"] = array(
476 "type" => $obj_data->getType(),
477 "title" => $obj_data->getTitle(),
478 "desc" => $obj_data->getDescription(),
479 "last_update" => $obj_data->getLastUpdateDate());
482 $this->data[
"buttons"] = array(
"cancelDelete" => $this->lng->txt(
"cancel"),
483 "confirmedDelete" => $this->lng->txt(
"confirm"));
489 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
492 foreach ($this->data[
"cols"] as $key)
494 $this->tpl->setCurrentBlock(
"table_header");
495 $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
496 $this->tpl->parseCurrentBlock();
503 foreach ($this->data[
"data"] as $key => $value)
506 foreach ($value as $key => $cell_data)
508 $this->tpl->setCurrentBlock(
"table_cell");
517 $this->tpl->setVariable(
"TEXT_CONTENT",$cell_data);
520 $this->tpl->parseCurrentBlock();
523 $this->tpl->setCurrentBlock(
"table_row");
525 $this->tpl->parseCurrentBlock();
531 foreach ($this->data[
"buttons"] as $name => $value)
533 $this->tpl->setCurrentBlock(
"operation_btn");
534 $this->tpl->setVariable(
"BTN_NAME",$name);
535 $this->tpl->setVariable(
"BTN_VALUE",$value);
536 $this->tpl->parseCurrentBlock();
549 $this->ctrl->redirect($this,
"view");
562 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
564 if ($this->object->getRefId() != ROLE_FOLDER_ID or !$rbacsystem->checkAccess(
'create_rolt',ROLE_FOLDER_ID))
569 if (!$rbacsystem->checkAccess(
'create_role',$this->object->getRefId()))
582 for ($i=0; $i<count($this->data[
"ctrl"]); $i++)
584 if ($this->data[
"ctrl"][$i][
"type"] == $row[
"name"])
590 if ($row[
"max"] ==
"" || $count < $row[
"max"])
592 $subobj[] = $row[
"name"];
597 if (is_array($subobj))
601 $a_tpl->setCurrentBlock(
"add_object");
602 $a_tpl->setVariable(
"SELECT_OBJTYPE", $opts);
603 $a_tpl->setVariable(
"BTN_NAME",
"create");
604 $a_tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
605 $a_tpl->parseCurrentBlock();
620 $_GET[
"new_type"] = $this->
object->getType();
621 $_POST[
"Fobject"][
"title"] = $this->
object->getTitle();
622 $_POST[
"Fobject"][
"desc"] = $this->
object->getDescription();
632 $this->ctrl->redirect($this,
"view");
647 $tabs_gui->addTarget(
649 $this->ctrl->getLinkTarget($this,
"view"),
658 $tabs_gui->addTarget(
"perm_settings",
659 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),