5 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
6 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
41 public function __construct($a_data, $a_id, $a_call_by_reference)
47 $lng->loadLanguageModule(
'rbac');
50 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
52 $this->ctrl->saveParameter($this,
"obj_id");
59 $rbacsystem = $DIC[
'rbacsystem'];
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
66 switch ($next_class) {
87 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
90 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) {
97 $form->setTitle($this->lng->txt(
'rolt_new'));
98 $form->addCommandButton(
'save', $this->lng->txt(
'rolt_new'));
100 $form->setTitle($this->lng->txt(
'rolt_edit'));
101 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
103 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
106 if ($a_mode != self::FORM_MODE_CREATE) {
107 if ($this->object->isInternalTemplate()) {
108 $title->setDisabled(
true);
110 $title->setValue($this->object->getTitle());
114 $title->setRequired(
true);
119 if ($a_mode != self::FORM_MODE_CREATE) {
120 $desc->
setValue($this->object->getDescription());
124 $form->addItem($desc);
126 if ($a_mode != self::FORM_MODE_CREATE) {
129 $form->addItem($ilias_id);
132 $pro =
new ilCheckboxInputGUI($this->lng->txt(
'role_protect_permissions'),
'protected');
135 $this->object->getId()
138 $form->addItem($pro);
153 $rbacsystem = $DIC[
'rbacsystem'];
155 if (!$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
156 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"), $this->
ilias->error_obj->MESSAGE);
161 $this->tpl->setContent(
$form->getHTML());
172 $rbacsystem = $DIC[
'rbacsystem'];
174 $this->tabs_gui->activateTab(
'settings');
176 if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id)) {
177 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_write"), $this->
ilias->error_obj->MESSAGE);
195 $rbacsystem = $DIC[
'rbacsystem'];
196 $rbacadmin = $DIC[
'rbacadmin'];
200 if (!$rbacsystem->checkAccess(
"write", $this->rolf_ref_id)) {
201 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_modify_rolt"), $this->
ilias->error_obj->WARNING);
205 if (
$form->checkInput()) {
206 $this->
object->setTitle(
$form->getInput(
'title'));
207 $this->
object->setDescription(
$form->getInput(
'desc'));
208 $rbacadmin->setProtected(
210 $this->object->getId(),
211 $form->getInput(
'protected') ?
'y' :
'n' 213 $this->
object->update();
214 ilUtil::sendSuccess($this->lng->txt(
"saved_successfully"),
true);
215 $this->ctrl->returnToParent($this);
218 $form->setValuesByPost();
233 $rbacsystem = $DIC[
'rbacsystem'];
234 $rbacadmin = $DIC[
'rbacadmin'];
237 if (!$rbacsystem->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
238 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_create_rolt"), $this->
ilias->error_obj->WARNING);
241 if (
$form->checkInput()) {
242 include_once(
"./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
244 $roltObj->setTitle(
$form->getInput(
'title'));
245 $roltObj->setDescription(
$form->getInput(
'desc'));
248 $rbacadmin->setProtected(
251 $form->getInput(
'protected') ?
'y' :
'n' 254 ilUtil::sendSuccess($this->lng->txt(
"rolt_added"),
true);
256 $this->ctrl->setParameter($this,
'obj_id', $roltObj->getId());
257 $this->ctrl->redirect($this,
'perm');
259 $form->setValuesByPost();
267 protected function permObject()
274 $rbacsystem = $DIC->rbac()->system();
286 if (!$rbacsystem->checkAccess(
'edit_permission', $this->ref_id)) {
287 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),
$ilErr->MESSAGE);
290 $this->tabs_gui->activateTab(
'perm');
292 $this->tpl->addBlockFile(
295 'tpl.rbac_template_permissions.html',
296 'Services/AccessControl' 299 $this->tpl->setVariable(
'PERM_ACTION', $this->ctrl->getFormAction($this));
301 include_once
'./Services/Accordion/classes/class.ilAccordionGUI.php';
304 $acc->setId(
'template_perm_' . $this->ref_id);
306 $subs = ilObjRole::getSubObjects(
'root',
false);
308 foreach ($subs as $subtype =>
$def) {
317 $tbl->setShowChangeExistingObjects(
false);
320 $acc->addItem(
$def[
'translation'],
$tbl->getHTML());
323 $this->tpl->setVariable(
'ACCORDION', $acc->getHTML());
326 include_once
'./Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php';
337 $this->lng->txt(
'save')
341 $this->tpl->setVariable(
'OPTIONS_TABLE',
$options->getHTML());
350 protected function permSaveObject()
357 $rbacsystem = $DIC->rbac()->system();
362 $rbacadmin = $DIC->rbac()->admin();
375 if (!$rbacsystem->checkAccess(
'write', $this->rolf_ref_id)) {
376 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_perm'),
$ilErr->MESSAGE);
381 $subs = ilObjRole::getSubObjects(
'root',
false);
383 foreach ($subs as $subtype =>
$def) {
385 $rbacadmin->deleteRolePermission($this->object->getId(),
$this->ref_id, $subtype);
388 foreach (
$_POST[
"template_perm"] as
$key => $ops_array) {
393 $this->
object->update();
395 ilUtil::sendSuccess($this->lng->txt(
"saved_successfully"),
true);
396 $this->ctrl->redirect($this,
"perm");
408 $rbacadmin = $DIC[
'rbacadmin'];
409 $rbacsystem = $DIC[
'rbacsystem'];
412 if (!$rbacsystem->checkAccess(
'write', $this->rolf_ref_id)) {
413 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_perm"), $this->
ilias->error_obj->WARNING);
414 } elseif ($this->obj_id ==
$_POST[
"adopt"]) {
417 $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
418 $parentRoles =
$rbacreview->getParentRoleIds($this->rolf_ref_id,
true);
419 $rbacadmin->copyRoleTemplatePermissions(
421 $parentRoles[
$_POST[
"adopt"]][
"parent"],
426 $this->
object->update();
429 $obj_data = &$this->
ilias->obj_factory->getInstanceByObjId($_POST[
"adopt"]);
430 ilUtil::sendSuccess($this->lng->txt(
"msg_perm_adopted_from1") .
" '" . $obj_data->getTitle() .
"'.<br/>" . $this->lng->txt(
"msg_perm_adopted_from2"),
true);
433 $this->ctrl->redirect($this,
"perm");
451 $rbacsystem = $DIC->rbac()->system();
452 $this->tabs_gui->setBackTarget($this->lng->txt(
'btn_back'), $this->ctrl->getParentReturn($this));
454 if ($rbacsystem->checkAccess(
'write', $this->ref_id)) {
455 $this->tabs_gui->addTab(
457 $this->lng->txt(
'settings'),
458 $this->ctrl->getLinkTarget($this,
'edit')
461 if ($rbacsystem->checkAccess(
'edit_permission', $this->ref_id)) {
462 $this->tabs_gui->addTab(
464 $this->lng->txt(
'default_perm_settings'),
465 $this->ctrl->getLinkTarget($this,
'perm')
476 $this->ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
488 $ilLocator = $DIC[
'ilLocator'];
490 parent::addAdminLocatorItems(
true);
496 $this->ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view")
updateObject()
update role template object
addAdminLocatorItems($a_do_not_add_object=false)
setValue($a_value)
Set Value.
adoptPermSaveObject()
adopting permission setting from other roles/role templates
Table for object role permissions.
__construct($a_data, $a_id, $a_call_by_reference)
Constructor.
setValue($a_value)
Set Value.
static _lookupTitle($a_id)
lookup object title
createObject()
create new object form
Table for object role permissions.
saveObject()
save a new role template object
getAdminTabs()
admin and normal tabs are equal for roles
prepareOutput($a_show_subobjects=true)
prepare output
if(isset($_POST['submit'])) $form
cancelObject()
cancelObject is called when an operation is canceled, method links back public
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 _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
Class ilObjRoleTemplateGUI.
Accordion user interface class.
createObject(ilPropertyFormGUI $form=null)
create new role definition template
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
editObject(ilPropertyFormGUI $form=null)
Create new object.