24 require_once
"./classes/class.ilObjectGUI.php";
54 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
65 case 'ilpermissiongui':
66 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
68 $ret =& $this->ctrl->forwardCommand($perm_gui);
91 global $rbacreview,$rbacsystem;
93 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
95 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
98 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.usr_role_assignment.html');
102 if ($this->object->getId() == ROLE_FOLDER_ID)
113 $this->tpl->setCurrentBlock(
"filter");
114 $this->tpl->setVariable(
"FILTER_TXT_FILTER",$this->lng->txt(
'filter'));
116 $this->tpl->setVariable(
"FILTER_ACTION",$this->ctrl->getFormAction($this));
117 $this->tpl->setVariable(
"FILTER_NAME",
'view');
118 $this->tpl->setVariable(
"FILTER_VALUE",$this->lng->txt(
'apply_filter'));
119 $this->tpl->parseCurrentBlock();
123 $role_list = $rbacreview->getRolesByFilter(
$_SESSION[
"filtered_roles"],$this->object->getId());
127 $role_list = $rbacreview->getRoleListByObject(
$_GET[
"ref_id"],
true);
132 include_once (
'./Services/AccessControl/classes/class.ilObjRole.php');
134 foreach ($role_list as $role)
137 if ($role[
"type"] ==
"rolt")
139 $path = $this->lng->txt(
"obj_rolt");
140 $rolf = ROLE_FOLDER_ID;
145 $rolf_list = $rbacreview->getFoldersAssignedToRole($role[
"obj_id"],$assignable);
147 if ($this->object->getId() != ROLE_FOLDER_ID)
149 $rolf = $this->
object->getRefId();
153 $rolf = $rolf_list[0];
157 if ($rbacreview->isDeleted($rolf))
165 if ($this->tree->isInTree($rolf))
167 if ($rolf[0] == ROLE_FOLDER_ID)
169 $path = $this->lng->txt(
"global");
173 $tmpPath = $this->tree->getPathFull($rolf);
174 $path = $tmpPath[count($tmpPath)-2][
"title"];
179 $path =
"<b>Rolefolder ".$rolf.
" not found in tree! (Role ".$role[
"obj_id"].
")</b>";
184 $checkbox = ilUtil::formCheckBox(0,
"role_id[]",$role[
"obj_id"],$disabled);
187 if ($role[
"role_type"] !=
'linked'
188 && ($role[
"obj_id"] == SYSTEM_ROLE_ID
189 or $role[
"obj_id"] == ANONYMOUS_ROLE_ID
190 or substr($role[
"title"],0,3) ==
"il_"))
198 $result_set[$counter][] = $checkbox ? $checkbox :
'';
199 $role_ids[$counter] = $role[
"obj_id"];
202 if (substr($role[
"title"],0,3) ==
"il_" and $role[
'type'] !=
"rolt")
206 $rolf_arr = $rbacreview->getFoldersAssignedToRole($role[
"obj_id"],
true);
207 $rolf2 = $rolf_arr[0];
214 $parent_node = $this->tree->getParentNodeData($rolf2);
216 $role[
"description"] = $this->lng->txt(
"obj_".$parent_node[
"type"]).
" (#".$parent_node[
"obj_id"].
")";
219 if ($role[
"type"] ==
"rolt" and (substr($role[
"title"],0,3) ==
"il_"))
221 $role[
"description"] .=
"<br/><i>".$this->lng->txt(
"predefined_template").
" (".$role[
"title"].
")</i>";
224 $result_set[$counter][] =
"<img src=\"".ilUtil::getImagePath(
"icon_".$role[
"type"].
".gif").
"\" alt=\"".$this->lng->txt(
"obj_".$role[
"type"]).
"\" title=\"".$this->lng->txt(
"obj_".$role[
"type"]).
"\" border=\"0\" vspace=\"0\"/>";
225 if ($role[
"type"] ==
"role")
227 if (($this->object->getId() == ROLE_FOLDER_ID) &&
228 ($role[
"role_type"] ==
"local"))
230 $this->ctrl->setParameterByClass(
"ilobjrolegui",
"rolf_ref_id", $rolf);
232 $this->ctrl->setParameterByClass(
"ilobjrolegui",
"obj_id", $role[
"obj_id"]);
233 $link = $this->ctrl->getLinkTargetByClass(
"ilobjrolegui",
"perm");
234 $this->ctrl->setParameterByClass(
"ilobjrolegui",
"rolf_ref_id",
"");
238 $this->ctrl->setParameterByClass(
"ilobjroletemplategui",
"obj_id", $role[
"obj_id"]);
239 $link = $this->ctrl->getLinkTargetByClass(
"ilobjroletemplategui",
"perm");
241 $result_set[$counter][] =
"<a title=\"".ilObjRole::_getTranslation($role[
"title"]).
"\" href=\"$link\">".
ilObjRole::_getTranslation($role[
"title"]).
"</a>";
242 $result_set[$counter][] = $role[
"description"] ? $role[
'description'] :
'';
243 $result_set[$counter][] = $path.
" (".$role[
"role_type"].
")";;
260 global $rbacsystem,$rbacreview;
263 if (!$rbacsystem->checkAccess(
'delete',$this->object->getRefId()))
265 $perform_delete =
false;
266 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_delete").
" ".
267 $not_deletable,$this->ilias->error_obj->MESSAGE);
270 $return_loc = $this->tree->getParentId($this->object->getRefId());
272 $feedback[
"count"] = count(
$_SESSION[
"saved_post"]);
278 $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
280 if ($obj->getType() ==
"role")
282 $rolf_arr = $rbacreview->getFoldersAssignedToRole($obj->getId(),
true);
283 $obj->setParent($rolf_arr[0]);
285 $feedback[
"role"] =
true;
289 $feedback[
"rolt"] =
true;
300 if ($feedback[
"count"] > 1)
302 if ($feedback[
"role"] ===
true)
304 if ($feedback[
"rolt"] ===
true)
320 if ($feedback[
"role"] ===
true)
334 #$this->redirectToRefId($return_loc, "view");
336 $class_name = $this->objDefinition->getClassName($obj_type);
337 $class = strtolower(
"ilObj".$class_name.
"GUI");
338 $this->ctrl->setParameterByClass($class,
'ref_id',$return_loc);
339 $this->ctrl->redirectByClass($class,
'view');
349 $this->
object->setTitle($this->lng->txt(
"obj_".$this->object->getType().
"_local"));
350 $this->
object->setDescription(
"obj_".$this->object->getType().
"_local_desc");
362 if (!isset(
$_POST[
"role_id"]))
364 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
371 $this->data[
"cols"] = array(
"type",
"title",
"description",
"last_change");
373 foreach(
$_POST[
"role_id"] as $id)
375 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($id);
377 $this->data[
"data"][
"$id"] = array(
378 "type" => $obj_data->getType(),
379 "title" => $obj_data->getTitle(),
380 "desc" => $obj_data->getDescription(),
381 "last_update" => $obj_data->getLastUpdateDate());
384 $this->data[
"buttons"] = array(
"cancelDelete" => $this->lng->txt(
"cancel"),
385 "confirmedDelete" => $this->lng->txt(
"confirm"));
391 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
394 foreach ($this->data[
"cols"] as
$key)
396 $this->tpl->setCurrentBlock(
"table_header");
397 $this->tpl->setVariable(
"TEXT",$this->lng->txt($key));
398 $this->tpl->parseCurrentBlock();
405 foreach ($this->data[
"data"] as $key => $value)
408 foreach ($value as $key => $cell_data)
410 $this->tpl->setCurrentBlock(
"table_cell");
419 $this->tpl->setVariable(
"TEXT_CONTENT",$cell_data);
422 $this->tpl->parseCurrentBlock();
425 $this->tpl->setCurrentBlock(
"table_row");
427 $this->tpl->parseCurrentBlock();
433 foreach ($this->data[
"buttons"] as
$name => $value)
435 $this->tpl->setCurrentBlock(
"operation_btn");
436 $this->tpl->setVariable(
"BTN_NAME",
$name);
437 $this->tpl->setVariable(
"BTN_VALUE",$value);
438 $this->tpl->parseCurrentBlock();
451 $this->ctrl->redirect($this,
"view");
464 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
466 if ($this->object->getRefId() != ROLE_FOLDER_ID or !$rbacsystem->checkAccess(
'create_rolt',ROLE_FOLDER_ID))
471 if (!$rbacsystem->checkAccess(
'create_role',$this->object->getRefId()))
484 for ($i=0; $i<count($this->data[
"ctrl"]); $i++)
486 if ($this->data[
"ctrl"][$i][
"type"] == $row[
"name"])
492 if ($row[
"max"] ==
"" || $count < $row[
"max"])
494 $subobj[] = $row[
"name"];
499 if (is_array($subobj))
503 $a_tpl->setCurrentBlock(
"add_object");
504 $a_tpl->setVariable(
"SELECT_OBJTYPE", $opts);
505 $a_tpl->setVariable(
"BTN_NAME",
"create");
506 $a_tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
507 $a_tpl->parseCurrentBlock();
522 $_GET[
"new_type"] = $this->
object->getType();
523 $_POST[
"Fobject"][
"title"] = $this->
object->getTitle();
524 $_POST[
"Fobject"][
"desc"] = $this->
object->getDescription();
534 $this->ctrl->redirect($this,
"view");
541 $actions = array(
"delete" => $this->lng->txt(
"delete"));
544 $tpl =& $tbl->getTemplateObject();
546 $tpl->setCurrentBlock(
"tbl_form_header");
547 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
548 $tpl->parseCurrentBlock();
552 $tpl->setCurrentBlock(
"tbl_action_row");
554 $tpl->setVariable(
"COLUMN_COUNTS",(
$_SESSION[
"filtered_roles"] == 4) ? 4 : 5);
562 $tpl->setCurrentBlock(
"tbl_action_btn");
564 $tpl->setVariable(
"BTN_VALUE",$value);
565 $tpl->parseCurrentBlock();
568 if (!empty($a_role_ids))
572 $tpl->setCurrentBlock(
"tbl_action_toggle_checkboxes");
573 $tpl->setVariable(
"JS_VARNAME",
"role_id");
575 $tpl->setVariable(
"TXT_CHECKALL", $this->lng->txt(
"check_all"));
576 $tpl->setVariable(
"TXT_UNCHECKALL", $this->lng->txt(
"uncheck_all"));
577 $tpl->parseCurrentBlock();
581 $tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
584 $this->ctrl->setParameter($this,
"cmd",
"view");
587 $tbl->setTitle($this->lng->txt(
"roles"),
"icon_role.gif",$this->lng->txt(
"roles"));
591 $tbl->setHeaderNames(array($this->lng->txt(
"type"),$this->lng->txt(
"role"),
592 $this->lng->txt(
"description"),$this->lng->txt(
"context")));
593 $tbl->setHeaderVars(array(
"type",
"title",
"description",
"context"),$this->ctrl->getParameterArray($this,
"",
false));
594 $tbl->setColumnWidth(array(
"",
"30%",
"40%",
"30%"));
598 $tbl->setHeaderNames(array(
"",$this->lng->txt(
"type"),
599 $this->lng->txt(
"role"),
600 $this->lng->txt(
"description"),
601 $this->lng->txt(
"context")));
602 $tbl->setHeaderVars(array(
"",
"type",
"title",
"description",
"context"),$this->ctrl->getParameterArray($this,
"",
false));
603 $tbl->setColumnWidth(array(
"",
"",
"30%",
"40%",
"30%"));
607 $this->tpl->setVariable(
"ROLES_TABLE",$tbl->tpl->get());
614 include_once
"./Services/Table/classes/class.ilTableGUI.php";
624 if (!
$_GET[
"sort_by"] or
$_GET[
"sort_by"] ==
"name")
626 $_GET[
"sort_by"] =
"title";
629 $order =
$_GET[
"sort_by"];
634 $tbl->setOrderColumn($order);
635 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
636 $tbl->setOffset(
$_GET[
"offset"]);
637 $tbl->setLimit(
$_GET[
"limit"]);
638 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
639 $tbl->setData($result_set);
649 $action[1] = $this->lng->txt(
'all_roles');
650 $action[2] = $this->lng->txt(
'all_global_roles');
651 $action[3] = $this->lng->txt(
'all_local_roles');
652 $action[4] = $this->lng->txt(
'internal_local_roles_only');
653 $action[5] = $this->lng->txt(
'non_internal_local_roles_only');
654 $action[6] = $this->lng->txt(
'role_templates_only');
675 global $rbacsystem,
$tree;
678 if ($this->object->getRefId() == ROLE_FOLDER_ID)
680 $access = $rbacsystem->checkAccess(
'visible,write',$this->object->getRefId());
684 $access = $rbacsystem->checkAccess(
'edit_permission',$tree->getParentId($this->object->getRefId()));
689 $tabs_gui->addTarget(
"obj_rolf",
690 $this->ctrl->getLinkTarget($this,
"view"), array(
"view",
"delete",
""),
"",
"");
693 if ($this->object->getRefId() == ROLE_FOLDER_ID and $rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
695 $tabs_gui->addTarget(
"perm_settings",
696 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');