ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 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)
 
 cancelObject ()
 cancelObject is called when an operation is canceled, method links back 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 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 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...
 
 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 public More...
 
 setAdminTabs ()
 set admin tabs 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...
 
 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)
 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...
 

Detailed Description

Member Function Documentation

◆ addAdminLocatorItems()

ilObjRoleTemplateGUI::addAdminLocatorItems ( )

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

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

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

636  {
637  global $ilLocator;
638 
639  parent::addAdminLocatorItems(true);
640 
641  $ilLocator->addItem(ilObject::_lookupTitle(
642  ilObject::_lookupObjId($_GET["ref_id"])),
643  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view"));
644  }
$_GET["client_id"]
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
+ Here is the call graph for this function:

◆ adoptPermSaveObject()

ilObjRoleTemplateGUI::adoptPermSaveObject ( )

adopting permission setting from other roles/role templates

public

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

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

566  {
567  global $rbacadmin, $rbacsystem, $rbacreview;
568 
569  if (!$rbacsystem->checkAccess('write',$this->rolf_ref_id))
570  {
571  $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
572  }
573  elseif ($this->obj_id == $_POST["adopt"])
574  {
575  ilUtil::sendFailure($this->lng->txt("msg_perm_adopted_from_itself"),true);
576  }
577  else
578  {
579  $rbacadmin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
580  $parentRoles = $rbacreview->getParentRoleIds($this->rolf_ref_id,true);
581  $rbacadmin->copyRoleTemplatePermissions($_POST["adopt"],$parentRoles[$_POST["adopt"]]["parent"],
582  $this->rolf_ref_id,$this->obj_id);
583  // update object data entry (to update last modification date)
584  $this->object->update();
585 
586  // send info
587  $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_POST["adopt"]);
588  ilUtil::sendSuccess($this->lng->txt("msg_perm_adopted_from1")." '".$obj_data->getTitle()."'.<br/>".$this->lng->txt("msg_perm_adopted_from2"),true);
589  }
590 
591  $this->ctrl->redirect($this, "perm");
592  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ cancelObject()

ilObjRoleTemplateGUI::cancelObject ( )

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

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

624  {
625  $this->ctrl->redirectByClass("ilobjrolefoldergui","view");
626  }

◆ createObject()

ilObjRoleTemplateGUI::createObject ( ilPropertyFormGUI  $form = null)

create new role definition template

public

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

References initFormRoleTemplate().

150  {
151  global $rbacsystem;
152 
153  if (!$rbacsystem->checkAccess("create_rolt", $this->rolf_ref_id))
154  {
155  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
156  }
157  if(!$form)
158  {
159  $form = $this->initFormRoleTemplate(self::FORM_MODE_CREATE);
160  }
161  $this->tpl->setContent($form->getHTML());
162  return true;
163  }
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

◆ editObject()

ilObjRoleTemplateGUI::editObject ( ilPropertyFormGUI  $form = null)

Create new object.

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

References $GLOBALS, and initFormRoleTemplate().

169  {
170  global $rbacsystem;
171 
172  if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id))
173  {
174  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
175  }
176 
177  if(!$form)
178  {
179  $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
180  }
181  $GLOBALS['tpl']->setContent($form->getHTML());
182  }
$GLOBALS['ct_recipient']
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

◆ executeCommand()

ilObjRoleTemplateGUI::executeCommand ( )

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

References $cmd, and ilObjectGUI\prepareOutput().

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  }
$cmd
Definition: sahs_server.php:35
prepareOutput()
prepare output
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjRoleTemplateGUI::getAdminTabs ( $tabs_gui)

admin and normal tabs are equal for roles

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

References getTabs().

598  {
599  $this->getTabs($tabs_gui);
600  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjRoleTemplateGUI::getTabs ( $tabs_gui)

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

Referenced by getAdminTabs().

603  {
604  global $rbacsystem,$rbacreview;
605 
606  if ($rbacsystem->checkAccess('write',$this->rolf_ref_id))
607  {
608  $tabs_gui->addTarget("settings",
609  $this->ctrl->getLinkTarget($this, "edit"),
610  array("edit","update"), get_class($this));
611 
612  $tabs_gui->addTarget("default_perm_settings",
613  $this->ctrl->getLinkTarget($this, "perm"),
614  array("perm"), get_class($this));
615  }
616  }
+ Here is the caller graph for this function:

◆ ilObjRoleTemplateGUI()

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

Constructor.

public

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

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

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 public.
+ 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.

References $GLOBALS, ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setDisabled(), and ilTextAreaInputGUI\setValue().

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

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  $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'),'protected');
133  $pro->setChecked($GLOBALS['rbacreview']->isProtected(
134  $this->rolf_ref_id,
135  $this->object->getId()
136  ));
137  $pro->setValue(1);
138  $form->addItem($pro);
139 
140  return $form;
141  }
This class represents a property form user interface.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
setChecked($a_checked)
Set Checked.
$GLOBALS['ct_recipient']
This class represents a text property in a property form.
This class represents a text area property in a property form.
setDisabled($a_disabled)
Set Disabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permObject()

ilObjRoleTemplateGUI::permObject ( )

display permissions

public

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

References ilObjectGUI\$objDefinition, $rolf_ref_id, ilObjRole\_getTranslation(), ilUtil\array_php2js(), exit, ilUtil\formRadioButton(), ilUtil\getImagePath(), ilPlugin\lookupTxt(), ilUtil\sendFailure(), ilUtil\sortArray(), and ilUtil\switchColor().

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

◆ permSaveObject()

ilObjRoleTemplateGUI::permSaveObject ( )

save permission templates of role

public

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

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

529  {
530  global $rbacadmin, $rbacsystem, $rbacreview,$objDefinition;
531 
532  if (!$rbacsystem->checkAccess('write',$this->rolf_ref_id))
533  {
534  $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"),$this->ilias->error_obj->WARNING);
535  }
536  else
537  {
538  // Alle Template Eintraege loeschen
539  $rbacadmin->deleteRolePermission($this->object->getId(), $this->rolf_ref_id);
540 
541  foreach ($_POST["template_perm"] as $key => $ops_array)
542  {
543  // Setzen der neuen template permissions
544  $rbacadmin->setRolePermission($this->object->getId(), $key,$ops_array,$this->rolf_ref_id);
545  }
546  }
547 
548  // update object data entry (to update last modification date)
549  $this->object->update();
550 
551  // set protected flag
552  // not applicable for role templates
553  #$rbacadmin->setProtected($this->rolf_ref_id,$this->object->getId(),ilUtil::tf2yn($_POST['protected']));
554 
555  ilUtil::sendSuccess($this->lng->txt("saved_successfully"),true);
556 
557  $this->ctrl->redirect($this, "perm");
558  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

◆ saveObject()

ilObjRoleTemplateGUI::saveObject ( )

save a new role template object

public

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

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

226  {
227  global $rbacsystem,$rbacadmin, $rbacreview;
228 
229  if (!$rbacsystem->checkAccess("create_rolt",$this->rolf_ref_id))
230  {
231  $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"),$this->ilias->error_obj->WARNING);
232  }
233  $form = $this->initFormRoleTemplate();
234  if($form->checkInput())
235  {
236  include_once("./Services/AccessControl/classes/class.ilObjRoleTemplate.php");
237  $roltObj = new ilObjRoleTemplate();
238  $roltObj->setTitle($form->getInput('title'));
239  $roltObj->setDescription($form->getInput('desc'));
240  $roltObj->create();
241  $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id,'n');
242  $rbacadmin->setProtected(
243  $this->rolf_ref_id,
244  $roltObj->getId(),
245  $form->getInput('protected') ? 'y' : 'n'
246  );
247 
248  ilUtil::sendSuccess($this->lng->txt("rolt_added"),true);
249  // redirect to permission screen
250  $this->ctrl->setParameter($this,'obj_id',$roltObj->getId());
251  $this->ctrl->redirect($this,'perm');
252  }
253  $form->setValuesByPost();
254  $this->createObject($form);
255  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilObjRoleTemplate.
createObject()
create new object form
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

◆ updateObject()

ilObjRoleTemplateGUI::updateObject ( )

update role template object

public

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

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

190  {
191  global $rbacsystem, $rbacadmin, $rbacreview;
192 
193  // check write access
194  if (!$rbacsystem->checkAccess("write", $this->rolf_ref_id))
195  {
196  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_rolt"),$this->ilias->error_obj->WARNING);
197  }
198 
199  $form = $this->initFormRoleTemplate(self::FORM_MODE_EDIT);
200  if($form->checkInput())
201  {
202  $this->object->setTitle($form->getInput('title'));
203  $this->object->setDescription($form->getInput('desc'));
204  $rbacadmin->setProtected(
205  $this->rolf_ref_id,
206  $this->object->getId(),
207  $form->getInput('protected') ? 'y' : 'n'
208  );
209  $this->object->update();
210  ilUtil::sendSuccess($this->lng->txt("saved_successfully"),true);
211  $this->ctrl->returnToParent($this);
212  }
213 
214  $form->setValuesByPost();
215  $this->editObject($form);
216  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initFormRoleTemplate($a_mode=self::FORM_MODE_CREATE)
Init create form.
redirection script todo: (a better solution should control the processing via a xml file) ...
editObject()
edit object
+ 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.

Referenced by permObject(), permSaveObject(), and saveObject().

◆ $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: