ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjRoleTemplateGUI Class Reference

Class ilObjRoleTemplateGUI. More...

+ Inheritance diagram for ilObjRoleTemplateGUI:
+ Collaboration diagram for ilObjRoleTemplateGUI:

Public Member Functions

 ilObjRoleTemplateGUI ($a_data, $a_id, $a_call_by_reference)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 createObject (ilPropertyFormGUI $form=null)
 create new role definition template More...
 
 editObject (ilPropertyFormGUI $form=null)
 Create new object. More...
 
 updateObject ()
 update role template object More...
 
 saveObject ()
 save a new role template object More...
 
 permObject ()
 display permissions More...
 
 permSaveObject ()
 save permission templates of role More...
 
 adoptPermSaveObject ()
 adopting permission setting from other roles/role templates More...
 
 getAdminTabs (&$tabs_gui)
 admin and normal tabs are equal for roles More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 cancelObject ()
 cancelObject is called when an operation is canceled, method links back @access public More...
 
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Data Fields

const FORM_MODE_EDIT = 1
 
const FORM_MODE_CREATE = 2
 
 $type
 
 $rolf_ref_id
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 initFormRoleTemplate ($a_mode=self::FORM_MODE_CREATE)
 Init create form. More...
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 

Detailed Description

Class ilObjRoleTemplateGUI.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls ilObjRoleTemplateGUI:

Definition at line 17 of file class.ilObjRoleTemplateGUI.php.

Member Function Documentation

◆ addAdminLocatorItems()

ilObjRoleTemplateGUI::addAdminLocatorItems ( )

should be overwritten to add object specific items (repository items are preloaded)

Definition at line 649 of file class.ilObjRoleTemplateGUI.php.

650 {
651 global $ilLocator;
652
653 parent::addAdminLocatorItems(true);
654
655 $ilLocator->addItem(ilObject::_lookupTitle(
656 ilObject::_lookupObjId($_GET["ref_id"])),
657 $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view"));
658 }
$_GET["client_id"]
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title

References $_GET, ilObject\_lookupObjId(), and ilObject\_lookupTitle().

+ Here is the call graph for this function:

◆ adoptPermSaveObject()

ilObjRoleTemplateGUI::adoptPermSaveObject ( )

adopting permission setting from other roles/role templates

@access public

Definition at line 579 of file class.ilObjRoleTemplateGUI.php.

580 {
581 global $rbacadmin, $rbacsystem, $rbacreview;
582
583 if (!$rbacsystem->checkAccess('write',$this->rolf_ref_id))
584 {
585 $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
586 }
587 elseif ($this->obj_id == $_POST["adopt"])
588 {
589 ilUtil::sendFailure($this->lng->txt("msg_perm_adopted_from_itself"),true);
590 }
591 else
592 {
593 $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
594 $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,true);
595 $rbacadmin->copyRoleTemplatePermissions($_POST["adopt"],$parentRoles[$_POST["adopt"]]["parent"],
596 $this->rolf_ref_id,$this->obj_id);
597 // update object data entry (to update last modification date)
598 $this->object->update();
599
600 // send info
601 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_POST["adopt"]);
602 ilUtil::sendSuccess($this->lng->txt("msg_perm_adopted_from1")." '".$obj_data->getTitle()."'.<br/>".$this->lng->txt("msg_perm_adopted_from2"),true);
603 }
604
605 $this->ctrl->redirect($this, "perm");
606 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12
redirection script todo: (a better solution should control the processing via a xml file)

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ cancelObject()

ilObjRoleTemplateGUI::cancelObject ( )

cancelObject is called when an operation is canceled, method links back @access public

Definition at line 637 of file class.ilObjRoleTemplateGUI.php.

638 {
639 $this->ctrl->redirectByClass("ilobjrolefoldergui","view");
640 }

◆ createObject()

ilObjRoleTemplateGUI::createObject ( ilPropertyFormGUI  $form = null)

create new role definition template

@access public

Definition at line 156 of file class.ilObjRoleTemplateGUI.php.

157 {
158 global $rbacsystem;
159
160 if (!$rbacsystem->checkAccess("create_rolt", $this->rolf_ref_id))
161 {
162 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
163 }
164 if(!$form)
165 {
166 $form = $this->initFormRoleTemplate(self::FORM_MODE_CREATE);
167 }
168 $this->tpl->setContent($form->getHTML());
169 return true;
170 }
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.

References initFormRoleTemplate().

+ Here is the call graph for this function:

◆ editObject()

ilObjRoleTemplateGUI::editObject ( ilPropertyFormGUI  $form = null)

Create new object.

Definition at line 175 of file class.ilObjRoleTemplateGUI.php.

176 {
177 global $rbacsystem;
178
179 if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id))
180 {
181 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
182 }
183
184 if(!$form)
185 {
186 $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
187 }
188 $GLOBALS['tpl']->setContent($form->getHTML());
189 }
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, and initFormRoleTemplate().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjRoleTemplateGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

Definition at line 53 of file class.ilObjRoleTemplateGUI.php.

54 {
55 global $rbacsystem;
56
57 $this->prepareOutput();
58
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61
62 switch($next_class)
63 {
64 default:
65 if(!$cmd)
66 {
67 $cmd = "perm";
68 }
69 $cmd .= "Object";
70 $this->$cmd();
71
72 break;
73 }
74
75 return true;
76 }
prepareOutput()
prepare output
$cmd
Definition: sahs_server.php:35

References $cmd, and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjRoleTemplateGUI::getAdminTabs ( $tabs_gui)

admin and normal tabs are equal for roles

Reimplemented from ilObjectGUI.

Definition at line 611 of file class.ilObjRoleTemplateGUI.php.

612 {
613 $this->getTabs($tabs_gui);
614 }
getTabs(&$tabs_gui)
get tabs abstract method.

References getTabs().

+ Here is the call graph for this function:

◆ getTabs()

ilObjRoleTemplateGUI::getTabs ( $tabs_gui)

get tabs abstract method.

@abstract overwrite in derived GUI class of your object type @access public

Parameters
objectinstance of ilTabsGUI

Reimplemented from ilObjectGUI.

Definition at line 616 of file class.ilObjRoleTemplateGUI.php.

617 {
618 global $rbacsystem,$rbacreview;
619
620 if ($rbacsystem->checkAccess('write',$this->rolf_ref_id))
621 {
622 $tabs_gui->addTarget("settings",
623 $this->ctrl->getLinkTarget($this, "edit"),
624 array("edit","update"), get_class($this));
625
626 $tabs_gui->addTarget("default_perm_settings",
627 $this->ctrl->getLinkTarget($this, "perm"),
628 array("perm"), get_class($this));
629 }
630 }

Referenced by getAdminTabs().

+ Here is the caller graph for this function:

◆ ilObjRoleTemplateGUI()

ilObjRoleTemplateGUI::ilObjRoleTemplateGUI (   $a_data,
  $a_id,
  $a_call_by_reference 
)

Constructor.

@access public

Definition at line 41 of file class.ilObjRoleTemplateGUI.php.

42 {
43 global $lng;
44
45 $lng->loadLanguageModule('rbac');
46
47 $this->type = "rolt";
48 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
49 $this->rolf_ref_id =& $this->ref_id;
50 $this->ctrl->saveParameter($this, "obj_id");
51 }
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.

References ilObjectGUI\$lng, ilObjectGUI\$ref_id, and ilObjectGUI\ilObjectGUI().

+ Here is the call graph for this function:

◆ initFormRoleTemplate()

ilObjRoleTemplateGUI::initFormRoleTemplate (   $a_mode = self::FORM_MODE_CREATE)
protected

Init create form.

Parameters
boolcreation mode
Returns
ilPropertyFormGUI $form

Definition at line 83 of file class.ilObjRoleTemplateGUI.php.

84 {
85 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
86 $form = new ilPropertyFormGUI();
87
88 if($this->creation_mode)
89 {
90 $this->ctrl->setParameter($this, "new_type", 'rolt');
91 }
92
93 $form->setFormAction($this->ctrl->getFormAction($this));
94
95 if($a_mode == self::FORM_MODE_CREATE)
96 {
97 $form->setTitle($this->lng->txt('rolt_new'));
98 $form->addCommandButton('save', $this->lng->txt('rolt_new'));
99 }
100 else
101 {
102 $form->setTitle($this->lng->txt('rolt_edit'));
103 $form->addCommandButton('update', $this->lng->txt('save'));
104
105 }
106 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
107
108 $title = new ilTextInputGUI($this->lng->txt('title'),'title');
109 if($a_mode != self::FORM_MODE_CREATE)
110 {
111 if($this->object->isInternalTemplate())
112 {
113 $title->setDisabled(true);
114 }
115 $title->setValue($this->object->getTitle());
116 }
117 $title->setSize(40);
118 $title->setMaxLength(70);
119 $title->setRequired(true);
120 $form->addItem($title);
121
122 $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
123
124 if($a_mode != self::FORM_MODE_CREATE)
125 {
126 $desc->setValue($this->object->getDescription());
127 }
128 $desc->setCols(40);
129 $desc->setRows(3);
130 $form->addItem($desc);
131
132 if($a_mode != self::FORM_MODE_CREATE)
133 {
134 $ilias_id = new ilNonEditableValueGUI($this->lng->txt("ilias_id"), "ilias_id");
135 $ilias_id->setValue('il_'.IL_INST_ID.'_'.ilObject::_lookupType($this->object->getId()).'_'.$this->object->getId());
136 $form->addItem($ilias_id);
137 }
138
139 $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'),'protected');
140 $pro->setChecked($GLOBALS['rbacreview']->isProtected(
141 $this->rolf_ref_id,
142 $this->object->getId()
143 ));
144 $pro->setValue(1);
145 $form->addItem($pro);
146
147 return $form;
148 }
This class represents a checkbox property in a property form.
This class represents a non editable value in a property form.
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $GLOBALS, and ilObject\_lookupType().

Referenced by createObject(), editObject(), saveObject(), and updateObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permObject()

ilObjRoleTemplateGUI::permObject ( )

display permissions

@access public

Definition at line 269 of file class.ilObjRoleTemplateGUI.php.

270 {
271 global $rbacadmin, $rbacreview, $rbacsystem,$objDefinition,$ilSetting;
272
273 if (!$rbacsystem->checkAccess('write',$this->rolf_ref_id))
274 {
275 $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
276 exit();
277 }
278
279 $to_filter = $objDefinition->getSubobjectsToFilter();
280
281 $tpl_filter = array();
282 $internal_tpl = false;
283
284 if (($internal_tpl = $this->object->isInternalTemplate()))
285 {
286 $tpl_filter = $this->object->getFilterOfInternalTemplate();
287 }
288 $op_order = array();
289
290 foreach(ilRbacReview::_getOperationList() as $op)
291 {
292 $op_order[$op["ops_id"]] = $op["order"];
293 }
294
295 $operation_info = $rbacreview->getOperationAssignment();
296
297 foreach($operation_info as $info)
298 {
299 if($objDefinition->getDevMode($info['type']))
300 {
301 continue;
302 }
303 // FILTER SUBOJECTS OF adm OBJECT
304 if(in_array($info['type'],$to_filter))
305 {
306 continue;
307 }
308 if ($internal_tpl and $tpl_filter and !in_array($info['type'],$tpl_filter))
309 {
310 continue;
311 }
312 $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'],
313 "type" => $info['type']);
314
315 $txt = $objDefinition->isPlugin($info['type'])
316 ? ilPlugin::lookupTxt("rep_robj", $info['type'], $info['type']."_".$info['operation'])
317 : $this->lng->txt($info['type']."_".$info['operation']);
318 if (substr($info['operation'], 0, 7) == "create_" &&
319 $objDefinition->isPlugin(substr($info['operation'], 7)))
320 {
321 $txt = ilPlugin::lookupTxt("rep_robj", substr($info['operation'], 7), $info['type']."_".$info['operation']);
322 }
323 elseif(substr($info['operation'],0,6) == 'create')
324 {
325 $txt = $this->lng->txt('rbac_'.$info['operation']);
326 }
327
328 $order = $op_order[$info['ops_id']];
329 if(substr($info['operation'],0,6) == 'create')
330 {
331 $order = $objDefinition->getPositionByType($info['type']);
332 }
333
334 $rbac_operations[$info['typ_id']][$info['ops_id']] = array(
335 "ops_id" => $info['ops_id'],
336 "title" => $info['operation'],
337 "name" => $txt,
338 "order" => $order);
339 }
340
341 foreach ($rbac_objects as $key => $obj_data)
342 {
343 if ($objDefinition->isPlugin($obj_data["type"]))
344 {
345 $rbac_objects[$key]["name"] = ilPlugin::lookupTxt("rep_robj", $obj_data["type"],
346 "obj_".$obj_data["type"]);
347 }
348 else
349 {
350 $rbac_objects[$key]["name"] = $this->lng->txt("obj_".$obj_data["type"]);
351 }
352
353 $rbac_objects[$key]["ops"] = $rbac_operations[$key];
354 }
355
356 sort($rbac_objects);
357
358 foreach ($rbac_objects as $key => $obj_data)
359 {
360 sort($rbac_objects[$key]["ops"]);
361 }
362
363 // sort by (translated) name of object type
364 $rbac_objects = ilUtil::sortArray($rbac_objects,"name","asc");
365
366 // BEGIN CHECK_PERM
367 foreach ($rbac_objects as $key => $obj_data)
368 {
369 $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data["type"], $this->rolf_ref_id);
370 $arr_checked = array_intersect($arr_selected,array_keys($rbac_operations[$obj_data["obj_id"]]));
371
372 foreach ($rbac_operations[$obj_data["obj_id"]] as $operation)
373 {
374 $checked = in_array($operation["ops_id"],$arr_checked);
375 $disabled = false;
376
377 // Es wird eine 2-dim Post Variable �bergeben: perm[rol_id][ops_id]
378 $box = ilUtil::formCheckBox($checked,"template_perm[".$obj_data["type"]."][]",$operation["ops_id"],$disabled);
379 $output["perm"][$obj_data["obj_id"]][$operation["ops_id"]] = $box;
380 }
381 }
382 // END CHECK_PERM
383
384 $output["col_anz"] = count($rbac_objects);
385 $output["txt_save"] = $this->lng->txt("save");
386 $output["check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id,$this->object->getId()),"protected",1);
387 $output["text_protected"] = $this->lng->txt("role_protect_permissions");
388
389/************************************/
390/* adopt permissions form */
391/************************************/
392
393 $output["message_middle"] = $this->lng->txt("adopt_perm_from_template");
394
395 // send message for system role
396 if ($this->object->getId() == SYSTEM_ROLE_ID)
397 {
398 $output["adopt"] = array();
399 ilUtil::sendFailure($this->lng->txt("msg_sysrole_not_editable"));
400 }
401 else
402 {
403 // BEGIN ADOPT_PERMISSIONS
404 $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id,true);
405
406 // sort output for correct color changing
407 ksort($parent_role_ids);
408
409 foreach ($parent_role_ids as $key => $par)
410 {
411 if ($par["obj_id"] != SYSTEM_ROLE_ID)
412 {
413 $radio = ilUtil::formRadioButton(0,"adopt",$par["obj_id"]);
414 $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
415 $output["adopt"][$key]["check_adopt"] = $radio;
416 $output["adopt"][$key]["type"] = ($par["type"] == 'role' ? 'Role' : 'Template');
417 $output["adopt"][$key]["role_name"] = $par["title"];
418 }
419 }
420
421 $output["formaction_adopt"] = $this->ctrl->getFormAction($this);
422 // END ADOPT_PERMISSIONS
423 }
424
425 $output["formaction"] =
426 $this->ctrl->getFormAction($this);
427
428 $this->data = $output;
429
430
431/************************************/
432/* generate output */
433/************************************/
434
435 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html",
436 "Services/AccessControl");
437
438 foreach ($rbac_objects as $obj_data)
439 {
440 // BEGIN object_operations
441 $this->tpl->setCurrentBlock("object_operations");
442
443 $obj_data["ops"] = ilUtil::sortArray($obj_data["ops"], 'order','asc',true,true);
444
445 foreach ($obj_data["ops"] as $operation)
446 {
447 $ops_ids[] = $operation["ops_id"];
448
449 $css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2");
450 $this->tpl->setVariable("CSS_ROW",$css_row);
451 $this->tpl->setVariable("PERMISSION",$operation["name"]);
452 $this->tpl->setVariable("CHECK_PERMISSION",$this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]);
453 $this->tpl->parseCurrentBlock();
454 } // END object_operations
455
456 // BEGIN object_type
457 $this->tpl->setCurrentBlock("object_type");
458 $this->tpl->setVariable("TXT_OBJ_TYPE",$obj_data["name"]);
459
460// TODO: move this if in a function and query all objects that may be disabled or inactive
461 if ($this->objDefinition->getDevMode($obj_data["type"]))
462 {
463 $this->tpl->setVariable("TXT_NOT_IMPL", "(".$this->lng->txt("not_implemented_yet").")");
464 }
465
466 // js checkbox toggles
467 $this->tpl->setVariable("JS_VARNAME","template_perm_".$obj_data["type"]);
468 $this->tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($ops_ids));
469 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
470 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
471
472
473 $this->tpl->parseCurrentBlock();
474 // END object_type
475 }
476
477 /*
478 // BEGIN ADOPT PERMISSIONS
479 foreach ($this->data["adopt"] as $key => $value)
480 {
481 $this->tpl->setCurrentBlock("ADOPT_PERM_ROW");
482 $this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
483 $this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
484 $this->tpl->setVariable("TYPE",$value["type"]);
485 $this->tpl->setVariable("ROLE_NAME",$value["role_name"]);
486 $this->tpl->parseCurrentBlock();
487 }
488
489 $this->tpl->setCurrentBlock("ADOPT_PERM_FORM");
490 $this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]);
491 $this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]);
492 $this->tpl->setVariable("ADOPT",$this->lng->txt('copy'));
493 $this->tpl->parseCurrentBlock();
494 // END ADOPT PERMISSIONS
495 */
496
497 $this->tpl->setCurrentBlock("tblfooter_protected");
498 $this->tpl->setVariable("COL_ANZ",3);
499 $this->tpl->setVariable("CHECK_BOTTOM",$this->data["check_protected"]);
500 $this->tpl->setVariable("MESSAGE_TABLE",$this->data["text_protected"]);
501 $this->tpl->parseCurrentBlock();
502
503 $this->tpl->setVariable("COL_ANZ_PLUS",4);
504 $this->tpl->setVariable("TXT_SAVE",$this->data["txt_save"]);
505 $this->tpl->setCurrentBlock("adm_content");
506 $this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath("icon_".$this->object->getType().".svg"));
507 $this->tpl->setVariable("TBL_TITLE_IMG_ALT",$this->lng->txt($this->object->getType()));
508
509 // compute additional information in title
510 if (substr($this->object->getTitle(),0,3) == "il_")
511 {
512 $desc = $this->lng->txt("predefined_template");//$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title'];
513 }
514
515 $description = "<br/>&nbsp;<span class=\"small\">".$desc."</span>";
516
517 // translation for autogenerated roles
518 if (substr($this->object->getTitle(),0,3) == "il_")
519 {
520 include_once('./Services/AccessControl/classes/class.ilObjRole.php');
521
522 $title = ilObjRole::_getTranslation($this->object->getTitle())." (".$this->object->getTitle().")";
523 }
524 else
525 {
526 $title = $this->object->getTitle();
527 }
528
529 $this->tpl->setVariable("TBL_TITLE",$title.$description);
530
531 $this->tpl->setVariable("TXT_PERMISSION",$this->data["txt_permission"]);
532 $this->tpl->setVariable("FORMACTION",$this->data["formaction"]);
533 $this->tpl->parseCurrentBlock();
534 }
_getTranslation($a_role_title)
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
static _getOperationList($a_type=null)
get operation list by object type @access public @access static
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? @access public
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static array_php2js($data)
convert php arrays to javascript arrays
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$txt
Definition: error.php:12
$info
Definition: example_052.php:80
exit
Definition: login.php:54
global $ilSetting
Definition: privfeed.php:40

References $ilSetting, $info, ilObjectGUI\$objDefinition, $txt, ilRbacReview\_getOperationList(), ilObjRole\_getTranslation(), ilUtil\array_php2js(), exit, ilUtil\formRadioButton(), ilUtil\getImagePath(), ilPlugin\lookupTxt(), ilUtil\sendFailure(), ilUtil\sortArray(), and ilUtil\switchColor().

+ Here is the call graph for this function:

◆ permSaveObject()

ilObjRoleTemplateGUI::permSaveObject ( )

save permission templates of role

@access public

Definition at line 542 of file class.ilObjRoleTemplateGUI.php.

543 {
544 global $rbacadmin, $rbacsystem, $rbacreview,$objDefinition;
545
546 if (!$rbacsystem->checkAccess('write',$this->rolf_ref_id))
547 {
548 $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
549 }
550 else
551 {
552 // Alle Template Eintraege loeschen
553 $rbacadmin->deleteRolePermission($this->object->getId(), $this->rolf_ref_id);
554
555 foreach ($_POST["template_perm"] as $key => $ops_array)
556 {
557 // Setzen der neuen template permissions
558 $rbacadmin->setRolePermission($this->object->getId(), $key,$ops_array,$this->rolf_ref_id);
559 }
560 }
561
562 // update object data entry (to update last modification date)
563 $this->object->update();
564
565 // set protected flag
566 // not applicable for role templates
567 #$rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),ilUtil::tf2yn($_POST['protected']));
568
569 ilUtil::sendSuccess($this->lng->txt("saved_successfully"),true);
570
571 $this->ctrl->redirect($this, "perm");
572 }

References $_POST, ilObjectGUI\$objDefinition, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveObject()

ilObjRoleTemplateGUI::saveObject ( )

save a new role template object

@access public

Reimplemented from ilObjectGUI.

Definition at line 232 of file class.ilObjRoleTemplateGUI.php.

233 {
234 global $rbacsystem,$rbacadmin, $rbacreview;
235
236 if (!$rbacsystem->checkAccess("create_rolt",$this->rolf_ref_id))
237 {
238 $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"),$this->ilias->error_obj->WARNING);
239 }
240 $form = $this->initFormRoleTemplate();
241 if($form->checkInput())
242 {
243 include_once("./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
244 $roltObj = new ilObjRoleTemplate();
245 $roltObj->setTitle($form->getInput('title'));
246 $roltObj->setDescription($form->getInput('desc'));
247 $roltObj->create();
248 $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id,'n');
249 $rbacadmin->setProtected(
250 $this->rolf_ref_id,
251 $roltObj->getId(),
252 $form->getInput('protected') ? 'y' : 'n'
253 );
254
255 ilUtil::sendSuccess($this->lng->txt("rolt_added"),true);
256 // redirect to permission screen
257 $this->ctrl->setParameter($this,'obj_id',$roltObj->getId());
258 $this->ctrl->redirect($this,'perm');
259 }
260 $form->setValuesByPost();
261 $this->createObject($form);
262 }
Class ilObjRoleTemplate.
createObject()
create new object form

References ilObjectGUI\createObject(), initFormRoleTemplate(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ updateObject()

ilObjRoleTemplateGUI::updateObject ( )

update role template object

@access public

Reimplemented from ilObjectGUI.

Definition at line 196 of file class.ilObjRoleTemplateGUI.php.

197 {
198 global $rbacsystem, $rbacadmin, $rbacreview;
199
200 // check write access
201 if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id))
202 {
203 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_rolt"),$this->ilias->error_obj->WARNING);
204 }
205
206 $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
207 if($form->checkInput())
208 {
209 $this->object->setTitle($form->getInput('title'));
210 $this->object->setDescription($form->getInput('desc'));
211 $rbacadmin->setProtected(
212 $this->rolf_ref_id,
213 $this->object->getId(),
214 $form->getInput('protected') ? 'y' : 'n'
215 );
216 $this->object->update();
217 ilUtil::sendSuccess($this->lng->txt("saved_successfully"),true);
218 $this->ctrl->returnToParent($this);
219 }
220
221 $form->setValuesByPost();
222 $this->editObject($form);
223 }
editObject()
edit object

References ilObjectGUI\editObject(), initFormRoleTemplate(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $rolf_ref_id

ilObjRoleTemplateGUI::$rolf_ref_id

Definition at line 35 of file class.ilObjRoleTemplateGUI.php.

◆ $type

ilObjRoleTemplateGUI::$type

Definition at line 28 of file class.ilObjRoleTemplateGUI.php.

◆ FORM_MODE_CREATE

const ilObjRoleTemplateGUI::FORM_MODE_CREATE = 2

Definition at line 21 of file class.ilObjRoleTemplateGUI.php.

◆ FORM_MODE_EDIT

const ilObjRoleTemplateGUI::FORM_MODE_EDIT = 1

Definition at line 20 of file class.ilObjRoleTemplateGUI.php.


The documentation for this class was generated from the following file: