5 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
6 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
46 $lng->loadLanguageModule(
'rbac');
49 parent::__construct($a_data,$a_id,$a_call_by_reference,
false);
51 $this->ctrl->saveParameter($this,
"obj_id");
60 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd();
86 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
89 if($this->creation_mode)
91 $this->ctrl->setParameter($this,
"new_type",
'rolt');
94 $form->setFormAction($this->ctrl->getFormAction($this));
96 if($a_mode == self::FORM_MODE_CREATE)
98 $form->setTitle($this->lng->txt(
'rolt_new'));
99 $form->addCommandButton(
'save', $this->lng->txt(
'rolt_new'));
103 $form->setTitle($this->lng->txt(
'rolt_edit'));
104 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
107 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
110 if($a_mode != self::FORM_MODE_CREATE)
112 if($this->
object->isInternalTemplate())
114 $title->setDisabled(
true);
120 $title->setRequired(
true);
125 if($a_mode != self::FORM_MODE_CREATE)
131 $form->addItem($desc);
133 if($a_mode != self::FORM_MODE_CREATE)
137 $form->addItem($ilias_id);
140 $pro =
new ilCheckboxInputGUI($this->lng->txt(
'role_protect_permissions'),
'protected');
146 $form->addItem($pro);
161 if (!$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id))
163 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->
ilias->error_obj->MESSAGE);
169 $this->tpl->setContent($form->getHTML());
180 if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id))
182 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->
ilias->error_obj->MESSAGE);
189 $GLOBALS[
'tpl']->setContent($form->getHTML());
199 global $rbacsystem, $rbacadmin, $rbacreview;
202 if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id))
204 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_rolt"),$this->
ilias->error_obj->WARNING);
208 if($form->checkInput())
210 $this->
object->setTitle($form->getInput(
'title'));
211 $this->
object->setDescription($form->getInput(
'desc'));
212 $rbacadmin->setProtected(
215 $form->getInput(
'protected') ?
'y' :
'n' 217 $this->
object->update();
219 $this->ctrl->returnToParent($this);
222 $form->setValuesByPost();
235 global $rbacsystem,$rbacadmin, $rbacreview;
237 if (!$rbacsystem->checkAccess(
"create_rolt",$this->rolf_ref_id))
239 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_create_rolt"),$this->
ilias->error_obj->WARNING);
242 if($form->checkInput())
244 include_once(
"./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
246 $roltObj->setTitle($form->getInput(
'title'));
247 $roltObj->setDescription($form->getInput(
'desc'));
250 $rbacadmin->setProtected(
253 $form->getInput(
'protected') ?
'y' :
'n' 258 $this->ctrl->setParameter($this,
'obj_id',$roltObj->getId());
259 $this->ctrl->redirect($this,
'perm');
261 $form->setValuesByPost();
274 if (!$rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
276 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->
ilias->error_obj->WARNING);
280 $to_filter = $objDefinition->getSubobjectsToFilter();
282 $tpl_filter =
array();
283 $internal_tpl =
false;
285 if (($internal_tpl = $this->
object->isInternalTemplate()))
287 $tpl_filter = $this->
object->getFilterOfInternalTemplate();
293 $op_order[$op[
"ops_id"]] = $op[
"order"];
296 $operation_info = $rbacreview->getOperationAssignment();
298 foreach($operation_info as
$info)
300 if($objDefinition->getDevMode($info[
'type']))
305 if(in_array($info[
'type'],$to_filter))
309 if ($internal_tpl
and $tpl_filter
and !in_array($info[
'type'],$tpl_filter))
313 $rbac_objects[$info[
'typ_id']] =
array(
"obj_id" => $info[
'typ_id'],
314 "type" => $info[
'type']);
316 $txt = $objDefinition->isPlugin($info[
'type'])
318 : $this->lng->txt($info[
'type'].
"_".$info[
'operation']);
319 if (substr($info[
'operation'], 0, 7) ==
"create_" &&
320 $objDefinition->isPlugin(substr($info[
'operation'], 7)))
324 elseif(substr($info[
'operation'],0,6) ==
'create')
326 $txt = $this->lng->txt(
'rbac_'.$info[
'operation']);
329 $order = $op_order[$info[
'ops_id']];
330 if(substr($info[
'operation'],0,6) ==
'create')
332 $order = $objDefinition->getPositionByType($info[
'type']);
335 $rbac_operations[$info[
'typ_id']][$info[
'ops_id']] =
array(
336 "ops_id" => $info[
'ops_id'],
337 "title" => $info[
'operation'],
342 foreach ($rbac_objects as $key => $obj_data)
344 if ($objDefinition->isPlugin($obj_data[
"type"]))
347 "obj_".$obj_data[
"type"]);
351 $rbac_objects[$key][
"name"] = $this->lng->txt(
"obj_".$obj_data[
"type"]);
354 $rbac_objects[$key][
"ops"] = $rbac_operations[$key];
359 foreach ($rbac_objects as $key => $obj_data)
361 sort($rbac_objects[$key][
"ops"]);
368 foreach ($rbac_objects as $key => $obj_data)
371 $arr_checked = array_intersect($arr_selected,array_keys($rbac_operations[$obj_data[
"obj_id"]]));
373 foreach ($rbac_operations[$obj_data[
"obj_id"]] as $operation)
375 $checked = in_array($operation[
"ops_id"],$arr_checked);
379 $box = ilUtil::formCheckBox($checked,
"template_perm[".$obj_data[
"type"].
"][]",$operation[
"ops_id"],$disabled);
380 $output[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]] = $box;
385 $output[
"col_anz"] = count($rbac_objects);
386 $output[
"txt_save"] = $this->lng->txt(
"save");
387 $output[
"check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()),
"protected",1);
388 $output[
"text_protected"] = $this->lng->txt(
"role_protect_permissions");
394 $output[
"message_middle"] = $this->lng->txt(
"adopt_perm_from_template");
397 if ($this->
object->getId() == SYSTEM_ROLE_ID)
405 $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
408 ksort($parent_role_ids);
410 foreach ($parent_role_ids as $key => $par)
412 if ($par[
"obj_id"] != SYSTEM_ROLE_ID)
416 $output[
"adopt"][$key][
"check_adopt"] = $radio;
417 $output[
"adopt"][$key][
"type"] = ($par[
"type"] ==
'role' ?
'Role' :
'Template');
418 $output[
"adopt"][$key][
"role_name"] = $par[
"title"];
422 $output[
"formaction_adopt"] = $this->ctrl->getFormAction($this);
427 $this->ctrl->getFormAction($this);
436 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.adm_perm_role.html",
437 "Services/AccessControl");
439 foreach ($rbac_objects as $obj_data)
442 $this->tpl->setCurrentBlock(
"object_operations");
446 foreach ($obj_data[
"ops"] as $operation)
448 $ops_ids[] = $operation[
"ops_id"];
451 $this->tpl->setVariable(
"CSS_ROW",$css_row);
452 $this->tpl->setVariable(
"PERMISSION",$operation[
"name"]);
453 $this->tpl->setVariable(
"CHECK_PERMISSION",$this->
data[
"perm"][$obj_data[
"obj_id"]][$operation[
"ops_id"]]);
454 $this->tpl->parseCurrentBlock();
458 $this->tpl->setCurrentBlock(
"object_type");
459 $this->tpl->setVariable(
"TXT_OBJ_TYPE",$obj_data[
"name"]);
462 if ($this->objDefinition->getDevMode($obj_data[
"type"]))
464 $this->tpl->setVariable(
"TXT_NOT_IMPL",
"(".$this->lng->txt(
"not_implemented_yet").
")");
468 $this->tpl->setVariable(
"JS_VARNAME",
"template_perm_".$obj_data[
"type"]);
470 $this->tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
471 $this->tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
474 $this->tpl->parseCurrentBlock();
498 $this->tpl->setCurrentBlock(
"tblfooter_protected");
499 $this->tpl->setVariable(
"COL_ANZ",3);
500 $this->tpl->setVariable(
"CHECK_BOTTOM",$this->
data[
"check_protected"]);
501 $this->tpl->setVariable(
"MESSAGE_TABLE",$this->
data[
"text_protected"]);
502 $this->tpl->parseCurrentBlock();
504 $this->tpl->setVariable(
"COL_ANZ_PLUS",4);
505 $this->tpl->setVariable(
"TXT_SAVE",$this->
data[
"txt_save"]);
506 $this->tpl->setCurrentBlock(
"adm_content");
508 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT",$this->lng->txt($this->object->getType()));
511 if (substr($this->
object->getTitle(),0,3) ==
"il_")
513 $desc = $this->lng->txt(
"predefined_template");
516 $description =
"<br/> <span class=\"small\">".$desc.
"</span>";
519 if (substr($this->
object->getTitle(),0,3) ==
"il_")
521 include_once(
'./Services/AccessControl/classes/class.ilObjRole.php');
527 $title = $this->
object->getTitle();
530 $this->tpl->setVariable(
"TBL_TITLE",
$title.$description);
532 $this->tpl->setVariable(
"TXT_PERMISSION",$this->
data[
"txt_permission"]);
533 $this->tpl->setVariable(
"FORMACTION",$this->
data[
"formaction"]);
534 $this->tpl->parseCurrentBlock();
547 if (!$rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
549 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->
ilias->error_obj->WARNING);
556 foreach (
$_POST[
"template_perm"] as $key => $ops_array)
564 $this->
object->update();
568 #$rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),ilUtil::tf2yn($_POST['protected'])); 572 $this->ctrl->redirect($this,
"perm");
582 global $rbacadmin, $rbacsystem, $rbacreview;
584 if (!$rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
586 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"),$this->
ilias->error_obj->WARNING);
588 elseif ($this->obj_id ==
$_POST[
"adopt"])
594 $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
595 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
596 $rbacadmin->copyRoleTemplatePermissions(
$_POST[
"adopt"],$parentRoles[
$_POST[
"adopt"]][
"parent"],
597 $this->rolf_ref_id,$this->obj_id);
599 $this->
object->update();
602 $obj_data =& $this->
ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
603 ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1").
" '".$obj_data->getTitle().
"'.<br/>".$this->lng->txt(
"msg_perm_adopted_from2"),
true);
606 $this->ctrl->redirect($this,
"perm");
621 if ($rbacsystem->checkAccess(
'write',$this->rolf_ref_id))
623 $this->tabs_gui->addTarget(
"settings",
624 $this->ctrl->getLinkTarget($this,
"edit"),
625 array(
"edit",
"update"), get_class($this));
627 $this->tabs_gui->addTarget(
"default_perm_settings",
628 $this->ctrl->getLinkTarget($this,
"perm"),
629 array(
"perm"), get_class($this));
640 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
654 parent::addAdminLocatorItems(
true);
658 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view"));
updateObject()
update role template object
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded) ...
setValue($a_value)
Set Value.
static lookupTxtById($plugin_id, $lang_var)
adoptPermSaveObject()
adopting permission setting from other roles/role templates
__construct($a_data, $a_id, $a_call_by_reference)
Constructor.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setValue($a_value)
Set Value.
static _getOperationList($a_type=null)
get operation list by object type public static
static _lookupTitle($a_id)
lookup object title
createObject()
create new object form
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
saveObject()
save a new role template object
getAdminTabs()
admin and normal tabs are equal for roles
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
prepareOutput($a_show_subobjects=true)
prepare output
permObject()
display permissions
cancelObject()
cancelObject is called when an operation is canceled, method links back public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static array_php2js($data)
convert php arrays to javascript arrays
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a non editable value in a property form.
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
permSaveObject()
save permission templates of role
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
Class ilObjRoleTemplateGUI.
createObject(ilPropertyFormGUI $form=null)
create new role definition template
editObject(ilPropertyFormGUI $form=null)
Create new object.