ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjectRolePermissionTableGUI Class Reference

Table for object role permissions. More...

+ Inheritance diagram for ilObjectRolePermissionTableGUI:
+ Collaboration diagram for ilObjectRolePermissionTableGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, $a_ref_id)
 Constructor. More...
 
 getRoleFolderId ()
 Get role folder of current object. More...
 
 getPathIds ()
 Get tree path ids. More...
 
 getRefId ()
 Get ref id of current object. More...
 
 getObjId ()
 Get obj id. More...
 
 getObjType ()
 get obj type More...
 
 addActiveOperation ($a_ops_id)
 Add active operation. More...
 
 getActiveOperations ()
 get active operations More...
 
 setVisibleRoles ($a_ar)
 Set Visible roles. More...
 
 getVisibleRoles ()
 get visible roles More...
 
 initFilter ()
 Init role filter. More...
 
 fillRow ($row)
 Fill one permission row. More...
 
 parse ()
 Parse. More...
 
- Public Member Functions inherited from ilTable2GUI
 __construct ($a_parent_obj, $a_parent_cmd="", $a_template_context="")
 Constructor. More...
 
 setOpenFormTag ($a_val)
 Set open form tag. More...
 
 getOpenFormTag ()
 Get open form tag. More...
 
 setCloseFormTag ($a_val)
 Set close form tag. More...
 
 getCloseFormTag ()
 Get close form tag. More...
 
 determineLimit ()
 Determine the limit. More...
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 Determine selected columns. More...
 
 isColumnSelected ($a_col)
 Is given column selected? More...
 
 getSelectedColumns ()
 Get selected columns. More...
 
executeCommand ()
 Execute command. More...
 
 resetOffset ($a_in_determination=false)
 Reset offset. More...
 
 initFilter ()
 Init filter. More...
 
 getParentObject ()
 Get parent object. More...
 
 getParentCmd ()
 Get parent command. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setNoEntriesText ($a_text)
 Set text for an empty table. More...
 
 getNoEntriesText ()
 Get text for an empty table. More...
 
 setIsDataTable ($a_val)
 Set is data table. More...
 
 getIsDataTable ()
 Get is data table. More...
 
 setEnableTitle ($a_enabletitle)
 Set Enable Title. More...
 
 getEnableTitle ()
 Get Enable Title. More...
 
 setEnableHeader ($a_enableheader)
 Set Enable Header. More...
 
 getEnableHeader ()
 Get Enable Header. More...
 
 setEnableNumInfo ($a_val)
 Set enable num info. More...
 
 getEnableNumInfo ()
 Get enable num info. More...
 
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 Set title and title icon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setOrderField ($a_order_field)
 set order column More...
 
 getOrderField ()
 
 setData ($a_data)
 
 getData ()
 
 dataExists ()
 
 setPrefix ($a_prefix)
 
 getPrefix ()
 
 addFilterItem ($a_input_item, $a_optional=false)
 Add filter item. More...
 
 addFilterItemByMetaType ($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
 Add filter by standard type. More...
 
 getFilterItems ($a_optionals=false)
 Get filter items. More...
 
 getFilterItemByPostVar ($a_post_var)
 
 setFilterCols ($a_val)
 Set filter columns. More...
 
 getFilterCols ()
 Get filter columns. More...
 
 setDisableFilterHiding ($a_val=true)
 Set disable filter hiding. More...
 
 getDisableFilterHiding ()
 Get disable filter hiding. More...
 
 isFilterSelected ($a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 Get selected filters. More...
 
 determineSelectedFilters ()
 Determine selected filters. More...
 
 setCustomPreviousNext ($a_prev_link, $a_next_link)
 Set custom previous/next links. More...
 
 setFormAction ($a_form_action)
 Set Form action parameter. More...
 
 getFormAction ()
 Get Form action parameter. More...
 
 setFormName ($a_formname)
 Set Form name. More...
 
 getFormName ()
 Get Form name. More...
 
 setId ($a_val)
 Set id. More...
 
 getId ()
 Get element id. More...
 
 setDisplayAsBlock ($a_val)
 Set display as block. More...
 
 getDisplayAsBlock ()
 Get display as block. More...
 
 getSelectAllCheckbox ()
 Get the name of the checkbox that should be toggled with a select all button. More...
 
 setSelectAllCheckbox ($a_select_all_checkbox)
 Set the name of the checkbox that should be toggled with a select all button. More...
 
 setExternalSorting ($a_val)
 Set external sorting. More...
 
 getExternalSorting ()
 Get external sorting. More...
 
 setFilterCommand ($a_val)
 Set filter command. More...
 
 getFilterCommand ()
 Get filter command. More...
 
 setResetCommand ($a_val)
 Set reset filter command. More...
 
 getResetCommand ()
 Get reset filter command. More...
 
 setExternalSegmentation ($a_val)
 Set external segmentation. More...
 
 getExternalSegmentation ()
 Get external segmentation. More...
 
 setRowTemplate ($a_template, $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField ($a_defaultorderfield)
 Set Default order field. More...
 
 getDefaultOrderField ()
 Get Default order field. More...
 
 setDefaultOrderDirection ($a_defaultorderdirection)
 Set Default order direction. More...
 
 getDefaultOrderDirection ()
 Get Default order direction. More...
 
 clearCommandButtons ()
 
 addCommandButton ($a_cmd, $a_text, $a_onclick='', $a_id="")
 Add Command button. More...
 
 addSelectionButton ($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
 Add Selection List + Command button. More...
 
 addMultiItemSelectionButton ($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
 Add Selection List + Command button for selected items. More...
 
 setCloseCommand ($a_link)
 Add command for closing table. More...
 
 addMultiCommand ($a_cmd, $a_text)
 Add Command button. More...
 
 addHiddenInput ($a_name, $a_value)
 Add Hidden Input field. More...
 
 addHeaderCommand ($a_href, $a_text, $a_target="", $a_img="")
 Add Header Command (Link) (Image needed for now) More...
 
 setTopCommands ($a_val)
 Set top commands (display command buttons on top of table, too) More...
 
 getTopCommands ()
 Get top commands (display command buttons on top of table, too) More...
 
 addColumn ($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
 Add a column to the header. More...
 
 getNavParameter ()
 
 setOrderLink ($sort_field, $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder ($a_omit_offset=false)
 Determine offset and order. More...
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering ($a_field)
 Should this field be sorted numeric? More...
 
 render ()
 render table public More...
 
 writeFilterToSession ()
 Write filter values to session. More...
 
 resetFilter ()
 Reset filter. More...
 
 fillFooter ()
 Fill footer row. More...
 
 getLinkbar ($a_num)
 Get previous/next linkbar. More...
 
 fillHiddenRow ()
 
 fillActionRow ()
 Fill Action Row. More...
 
 setHeaderHTML ($html)
 set header html More...
 
 storeProperty ($type, $value)
 Store table property. More...
 
 loadProperty ($type)
 Load table property. More...
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext ($id)
 Set context. More...
 
 getContext ()
 Get context. More...
 
 setShowRowsSelector ($a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 Get rows-per-page selector state. More...
 
 setShowTemplates ($a_value)
 Toggle templates. More...
 
 getShowTemplates ()
 Get template state. More...
 
 restoreTemplate ($a_name)
 Restore state from template. More...
 
 saveTemplate ($a_name)
 Save current state as template. More...
 
 deleteTemplate ($a_name)
 Delete template. More...
 
 getLimit ()
 Get limit. More...
 
 getOffset ()
 Get offset. More...
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode ($a_value=false)
 Toogle print mode. More...
 
 getPrintMode ()
 Get print mode. More...
 
 getExportMode ()
 Was export activated? More...
 
 exportData ($format, $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand ($a_value)
 Enable actions for all entries in current result. More...
 
 setRowSelectorLabel ($row_selector_label)
 
 getRowSelectorLabel ()
 
- Public Member Functions inherited from ilTableGUI
 ilTableGUI ($a_data=0, $a_global_tpl=true)
 Constructor. More...
 
 setTemplate (&$a_tpl)
 set template public More...
 
getTemplateObject ()
 
 setData ($a_data)
 set table data public More...
 
 getData ()
 
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 set table title public More...
 
 setHelp ($a_help_page, $a_help_icon, $a_help_icon_alt=0)
 set table help page public More...
 
 setHeaderNames ($a_header_names)
 set table header names public More...
 
 getColumnCount ()
 Returns the column count based on the number of the header row columns public. More...
 
 setHeaderVars ($a_header_vars, $a_header_params=0)
 set table header vars public More...
 
 setColumnWidth ($a_column_width)
 set table column widths public More...
 
 setOneColumnWidth ($a_column_width, $a_column_number)
 set one table column width public More...
 
 setMaxCount ($a_max_count)
 set max. More...
 
 setLimit ($a_limit=0, $a_default_limit=0)
 set max. More...
 
 getLimit ()
 Get limit. More...
 
 setPrefix ($a_prefix)
 set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort separately) public More...
 
 setOffset ($a_offset)
 set dataset offset public More...
 
 getOffset ()
 Get offset. More...
 
 setOrderColumn ($a_order_column=0, $a_default_column=0)
 set order column public More...
 
 getOrderColumn ()
 Get order column. More...
 
 setOrderDirection ($a_order_direction)
 set order direction public More...
 
 getOrderDirection ()
 Get order direction. More...
 
 setFooter ($a_style, $a_previous=0, $a_next=0)
 set order direction public More...
 
 enable ($a_module_name)
 enables particular modules of table More...
 
 disable ($a_module_name)
 diesables particular modules of table More...
 
 sortData ()
 
 render ()
 render table public More...
 
 renderHeader ()
 
 setOrderLink ($key, $order_dir)
 
 setStyle ($a_element, $a_style)
 
 getStyle ($a_element)
 
 setBase ($a_base)
 Set Base script name (deprecated, only use this for workarounds). More...
 
 getBase ()
 Get Base script name (deprecated, only use this for workarounds). More...
 
 getFormName ()
 
 setFormName ($a_name="cmd")
 
 getSelectAllCheckbox ()
 
 setSelectAllCheckbox ($a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton ($btn_name, $btn_value)
 

Data Fields

const ROLE_FILTER_ALL = 1
 
const ROLE_FILTER_GLOBAL = 2
 
const ROLE_FILTER_LOCAL = 3
 
const ROLE_FILTER_LOCAL_POLICY = 4
 
const ROLE_FILTER_LOCAL_OBJECT = 5
 
- Data Fields inherited from ilTable2GUI
const FILTER_TEXT = 1
 
const FILTER_SELECT = 2
 
const FILTER_DATE = 3
 
const FILTER_LANGUAGE = 4
 
const FILTER_NUMBER_RANGE = 5
 
const FILTER_DATE_RANGE = 6
 
const FILTER_DURATION_RANGE = 7
 
const FILTER_DATETIME_RANGE = 8
 
const EXPORT_EXCEL = 1
 
const EXPORT_CSV = 2
 
const ACTION_ALL_LIMIT = 1000
 
- Data Fields inherited from ilTableGUI
 $title
 
 $icon
 
 $icon_alt
 
 $help_page
 
 $help_icon
 
 $help_icon_alt
 
 $header_names
 
 $header_vars
 
 $linkbar_vars
 
 $data
 
 $column_count
 
 $column_width
 
 $max_count
 
 $limit
 
 $max_limit = false
 
 $offset
 
 $order_column
 
 $order_direction
 
 $footer_style
 
 $footer_previous
 
 $footer_next
 
 $lang_support = true
 
 $global_tpl
 
 $form_name
 
 $select_all_checkbox
 
 $action_buttons
 
 $prefix
 
 $base = ""
 
 $enabled
 
 $styles
 

Protected Member Functions

 initColumns ()
 init Columns More...
 
 createTooltip ($role)
 Create a linked title for roles with local policy. More...
 
 createTitle ($role)
 Create (linked) title. More...
 
- Protected Member Functions inherited from ilTable2GUI
 prepareOutput ()
 Anything that must be done before HTML is generated. More...
 
 fillRow ($a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilFormPropertyGUI $a_item)
 Get current filter value. More...
 
 SetFilterValue (ilFormPropertyGUI $a_item, $a_value)
 Set current filter value. More...
 
 fillMetaExcel ($worksheet, &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel ($worksheet, &$a_row)
 Excel Version of Fill Row. More...
 
 fillRowExcel ($a_worksheet, &$a_row, $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV ($a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV ($a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV ($a_csv, $a_set)
 CSV Version of Fill Row. More...
 

Private Attributes

 $ref_id = null
 
 $role_folder_id = 0
 
 $roles = array()
 
 $tree_path_ids = array()
 
 $activeOperations = array()
 
 $visible_roles = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 Get maximum number of entries to enable actions for all. More...
 
- Protected Attributes inherited from ilTable2GUI
 $close_command = ""
 
 $top_anchor = "il_table_top"
 
 $filters = array()
 
 $optional_filters = array()
 
 $filter_cmd = 'applyFilter'
 
 $reset_cmd = 'resetFilter'
 
 $filter_cols = 5
 
 $ext_sort = false
 
 $ext_seg = false
 
 $context = ""
 
 $mi_sel_buttons = null
 
 $disable_filter_hiding = false
 
 $selected_filter = false
 
 $top_commands = true
 
 $selectable_columns = array()
 
 $selected_column = array()
 
 $show_templates = false
 
 $show_rows_selector = false
 
 $nav_determined = false
 
 $limit_determined = false
 
 $filters_determined = false
 
 $columns_determined = false
 
 $open_form_tag = true
 
 $close_form_tag = true
 
 $export_formats
 
 $export_mode
 
 $print_mode
 
 $enable_command_for_all
 
 $row_selector_label
 

Detailed Description

Table for object role permissions.

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

Definition at line 16 of file class.ilObjectRolePermissionTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectRolePermissionTableGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $a_ref_id 
)

Constructor.

Returns

Definition at line 37 of file class.ilObjectRolePermissionTableGUI.php.

References $ilCtrl, $tpl, ilTable2GUI\addCommandButton(), ilTableGUI\disable(), getRefId(), initFilter(), ilTable2GUI\setDisableFilterHiding(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTableGUI\setLimit(), ilTable2GUI\setNoEntriesText(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setShowRowsSelector(), and ilTable2GUI\setTitle().

38  {
39  global $ilCtrl,$rbacreview,$tpl,$tree;
40 
41  parent::__construct($a_parent_obj,$a_parent_cmd);
42 
43  $this->lng->loadLanguageModule('rbac');
44 
45  $this->ref_id = $a_ref_id;
46  $this->tree_path_ids = $tree->getPathId($this->ref_id);
47  $this->role_folder_id = $rbacreview->getRoleFolderIdOfObject($this->getRefId());
48 
49  $this->setId('objroleperm_'.$this->ref_id);
50 
51  $tpl->addJavaScript('./Services/AccessControl/js/ilPermSelect.js');
52 
53  $this->setTitle($this->lng->txt('permission_settings'));
54  $this->setEnableHeader(true);
55  $this->disable('sort');
56  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
57  $this->disable('numinfo');
58  $this->setRowTemplate("tpl.obj_role_perm_row.html", "Services/AccessControl");
59  $this->setLimit(100);
60  $this->setShowRowsSelector(false);
61  $this->setDisableFilterHiding(true);
62  $this->setNoEntriesText($this->lng->txt('msg_no_roles_of_type'));
63 
64  $this->addCommandButton('savePermissions', $this->lng->txt('save'));
65 
66  $this->initFilter();
67  }
setNoEntriesText($a_text)
Set text for an empty table.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="")
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
disable($a_module_name)
diesables particular modules of table
setFormAction($a_form_action)
Set Form action parameter.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
+ Here is the call graph for this function:

Member Function Documentation

◆ addActiveOperation()

ilObjectRolePermissionTableGUI::addActiveOperation (   $a_ops_id)

Add active operation.

Parameters
int$a_ops_id
Returns

Definition at line 119 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by parse().

120  {
121  $this->activeOperations[] = $a_ops_id;
122  }
+ Here is the caller graph for this function:

◆ createTitle()

ilObjectRolePermissionTableGUI::createTitle (   $role)
protected

Create (linked) title.

Parameters
array$role
Returns

Definition at line 642 of file class.ilObjectRolePermissionTableGUI.php.

References $ilCtrl, ilObjRole\_getTranslation(), and getRoleFolderId().

Referenced by initColumns().

643  {
644  global $ilCtrl;
645 
646  include_once './Services/AccessControl/classes/class.ilObjRole.php';
647  $role['title'] = ilObjRole::_getTranslation($role['title']);
648 
649  // No local policies
650  if($role['parent'] != $this->getRoleFolderId())
651  {
652  return $role['title'];
653  }
654  $ilCtrl->setParameterByClass('ilobjrolegui', 'rolf_ref_id', $this->getRoleFolderId());
655  $ilCtrl->setParameterByClass('ilobjrolegui', 'obj_id', $role['obj_id']);
656 
657  return '<a class="tblheader" href="'.$ilCtrl->getLinkTargetByClass('ilobjrolegui','').'" >'.$role['title'].'</a>';
658  }
_getTranslation($a_role_title)
getRoleFolderId()
Get role folder of current object.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createTooltip()

ilObjectRolePermissionTableGUI::createTooltip (   $role)
protected

Create a linked title for roles with local policy.

Parameters
object$role
Returns

Definition at line 573 of file class.ilObjectRolePermissionTableGUI.php.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), and getRefId().

Referenced by initColumns().

574  {
575  global $rbacreview,$tree;
576 
577  #vd($role);
578  $protected_status = $rbacreview->isProtected($role['parent'], $role['obj_id']) ? 'protected_' : '';
579  if($role['role_type'] == 'global')
580  {
581  $tp = $this->lng->txt('perm_'.$protected_status.'global_role');
582  }
583  else
584  {
585  $tp = $this->lng->txt('perm_'.$protected_status.'local_role');
586  }
587 
588  $inheritance_seperator = ': ';
589 
590  // Show create at info
591  if(
592  ($role['assign'] == 'y' and $role['role_type'] != 'global') or
593  ($role['assign'] == 'n' and $role['role_type'] != 'global')
594  )
595  {
596  $tp .= ': ';
597 
598  $obj = $rbacreview->getObjectOfRole($role['obj_id']);
599  if($obj)
600  {
601  $tp .= sprintf(
602  $this->lng->txt('perm_role_path_info_created'),
603  $this->lng->txt('obj_'.ilObject::_lookupType($obj)),ilObject::_lookupTitle($obj)
604  );
605  $inheritance_seperator = ', ';
606  }
607  }
608 
609  $path_hierarchy = $rbacreview->getObjectsWithStopedInheritance(
610  $role['obj_id'],
611  $tree->getPathId($this->getRefId())
612  );
613 
614  $reduced_path_hierarchy = (array) array_diff(
615  $path_hierarchy,
616  array(
617  $this->getRefId(),
618  $rbacreview->getObjectReferenceOfRole($role['obj_id'])
619  )
620  );
621 
622 
623  // Inheritance
624  if($role['assign'] == 'n' and count($reduced_path_hierarchy))
625  {
626  $tp .= $inheritance_seperator;
627 
628  $parent = end($reduced_path_hierarchy);
629  $p_type = ilObject::_lookupType(ilObject::_lookupObjId($parent));
630  $p_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent));
631  $tp .= sprintf($this->lng->txt('perm_role_path_info_inheritance'),$this->lng->txt('obj_'.$p_type),$p_title);
632  }
633 
634  return $tp;
635  }
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillRow()

ilObjectRolePermissionTableGUI::fillRow (   $row)

Fill one permission row.

Parameters
object$row
Returns

Definition at line 197 of file class.ilObjectRolePermissionTableGUI.php.

References $row, ilTable2GUI\getFormName(), getObjType(), getVisibleRoles(), and ilPlugin\lookupTxt().

198  {
199  global $objDefinition;
200 
201 
202  // local policy
203  if(isset($row['show_local_policy_row']))
204  {
205  foreach($row['roles'] as $role_id => $role_info)
206  {
207  $this->tpl->setCurrentBlock('role_option');
208  $this->tpl->setVariable('INHERIT_ROLE_ID',$role_id);
209  $this->tpl->setVariable('INHERIT_CHECKED',$role_info['local_policy'] ? 'checked=checked' : '');
210  $this->tpl->setVariable('INHERIT_DISABLED',($role_info['protected'] or $role_info['isLocal']) ? 'disabled="disabled"' : '');
211  $this->tpl->setVariable('TXT_INHERIT',$this->lng->txt('rbac_local_policy'));
212  $this->tpl->setVariable('INHERIT_LONG',$this->lng->txt('perm_use_local_policy_desc'));
213  $this->tpl->parseCurrentBlock();
214  }
215  return true;
216  }
217  // protected
218  if(isset($row['show_protected_row']))
219  {
220  foreach($row['roles'] as $role_id => $role_info)
221  {
222  $this->tpl->setCurrentBlock('role_protect');
223  $this->tpl->setVariable('PROTECT_ROLE_ID',$role_id);
224  $this->tpl->setVariable('PROTECT_CHECKED',$role_info['protected_status'] ? 'checked=checked' : '');
225  $this->tpl->setVariable('PROTECT_DISABLED',$role_info['protected_allowed'] ? '' : 'disabled="disabled"');
226  $this->tpl->setVariable('TXT_PROTECT',$this->lng->txt('role_protect_permissions'));
227  $this->tpl->setVariable('PROTECT_LONG',$this->lng->txt('role_protect_permissions_desc'));
228  $this->tpl->parseCurrentBlock();
229  }
230  return true;
231  }
232 
233  // block role
234  if(isset($row['show_block_row']))
235  {
236  foreach($this->getVisibleRoles() as $counter => $role_info)
237  {
238  $this->tpl->setCurrentBlock('role_block');
239  $this->tpl->setVariable('BLOCK_ROLE_ID',$role_info['obj_id']);
240  $this->tpl->setVariable('TXT_BLOCK',$this->lng->txt('role_block_role'));
241  $this->tpl->setVariable('BLOCK_LONG',$this->lng->txt('role_block_role_desc'));
242  if($role_info['protected'] == 'y')
243  {
244  $this->tpl->setVariable('BLOCK_DISABLED','disabled="disabled');
245  }
246 
247  $this->tpl->parseCurrentBlock();
248  }
249  return true;
250  }
251 
252  // Select all
253  if(isset($row['show_select_all']))
254  {
255  foreach($this->getVisibleRoles() as $role)
256  {
257  $this->tpl->setCurrentBlock('role_select_all');
258  $this->tpl->setVariable('JS_ROLE_ID',$role['obj_id']);
259  $this->tpl->setVariable('JS_SUBID',$row['subtype']);
260  $this->tpl->setVariable('JS_ALL_PERMS',"['".implode("','",$row['ops'])."']");
261  $this->tpl->setVariable('JS_FORM_NAME',$this->getFormName());
262  $this->tpl->setVariable('TXT_SEL_ALL',$this->lng->txt('select_all'));
263  $this->tpl->parseCurrentBlock();
264  }
265  return true;
266  }
267 
268  // Object permissions
269  if(isset($row['show_start_info']))
270  {
271  $this->tpl->setCurrentBlock('section_info');
272  $this->tpl->setVariable('SECTION_TITLE',$this->lng->txt('perm_class_object'));
273  $this->tpl->setVariable('SECTION_DESC',$this->lng->txt('perm_class_object_desc'));
274  $this->tpl->parseCurrentBlock();
275 
276  return true;
277  }
278 
279  if(isset($row['show_create_info']))
280  {
281  $this->tpl->setCurrentBlock('section_info');
282  $this->tpl->setVariable('SECTION_TITLE',$this->lng->txt('perm_class_create'));
283  $this->tpl->setVariable('SECTION_DESC',$this->lng->txt('perm_class_create_desc'));
284  $this->tpl->parseCurrentBlock();
285 
286  return true;
287  }
288 
289  foreach((array) $row['roles'] as $role_id => $role_info)
290  {
291  $this->tpl->setCurrentBlock('role_td');
292  $this->tpl->setVariable('PERM_ROLE_ID',$role_id);
293  $this->tpl->setVariable('PERM_PERM_ID',$row['perm']['ops_id']);
294 
295 
296  if(substr($row['perm']['operation'],0,6) == 'create')
297  {
298  if ($objDefinition->isPlugin(substr($row['perm']['operation'],7)))
299  {
300  $perm = ilPlugin::lookupTxt("rep_robj", substr($row['perm']['operation'],7),
301  "obj_".substr($row['perm']['operation'],7));
302  }
303  else
304  {
305  $perm = $this->lng->txt('obj_'.substr($row['perm']['operation'],7));
306  }
307  }
308  else
309  {
310  if($this->lng->exists($this->getObjType().'_'.$row['perm']['operation'].'_short'))
311  {
312  $perm = $this->lng->txt($this->getObjType().'_'.$row['perm']['operation'].'_short');
313  }
314  else
315  {
316  $perm = $this->lng->txt($row['perm']['operation']);
317  }
318  }
319 
320  $this->tpl->setVariable('TXT_PERM',$perm);
321 
322  if ($objDefinition->isPlugin($this->getObjType()))
323  {
324  $this->tpl->setVariable('PERM_LONG',ilPlugin::lookupTxt("rep_robj", $this->getObjType(),
325  $this->getObjType()."_".$row['perm']['operation']));
326  }
327  elseif(substr($row['perm']['operation'],0,6) == 'create')
328  {
329  $this->tpl->setVariable('PERM_LONG',$this->lng->txt('rbac_'.$row['perm']['operation']));
330  }
331  else
332  {
333  $this->tpl->setVariable('PERM_LONG',$this->lng->txt($this->getObjType().'_'.$row['perm']['operation']));
334  }
335 
336  if($role_info['protected'])
337  {
338  $this->tpl->setVariable('PERM_DISABLED',$role_info['protected'] ? 'disabled="disabled"' : '');
339  }
340  if($role_info['permission_set'])
341  {
342  $this->tpl->setVariable('PERM_CHECKED','checked="checked"');
343  }
344 
345  $this->tpl->parseCurrentBlock();
346  }
347  }
getFormName()
Get Form name.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
+ Here is the call graph for this function:

◆ getActiveOperations()

ilObjectRolePermissionTableGUI::getActiveOperations ( )

get active operations

Returns

Definition at line 128 of file class.ilObjectRolePermissionTableGUI.php.

References $activeOperations.

◆ getObjId()

ilObjectRolePermissionTableGUI::getObjId ( )

Get obj id.

Returns

Definition at line 100 of file class.ilObjectRolePermissionTableGUI.php.

References ilObject\_lookupObjId(), and getRefId().

Referenced by getObjType().

101  {
102  return ilObject::_lookupObjId($this->getRefId());
103  }
static _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjType()

ilObjectRolePermissionTableGUI::getObjType ( )

get obj type

Returns

Definition at line 109 of file class.ilObjectRolePermissionTableGUI.php.

References ilObject\_lookupType(), and getObjId().

Referenced by fillRow(), and parse().

110  {
111  return ilObject::_lookupType($this->getObjId());
112  }
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathIds()

ilObjectRolePermissionTableGUI::getPathIds ( )

Get tree path ids.

Returns
array

Definition at line 82 of file class.ilObjectRolePermissionTableGUI.php.

References $tree_path_ids.

◆ getRefId()

ilObjectRolePermissionTableGUI::getRefId ( )

Get ref id of current object.

Returns

Definition at line 91 of file class.ilObjectRolePermissionTableGUI.php.

References $ref_id.

Referenced by __construct(), createTooltip(), getObjId(), initColumns(), and parse().

+ Here is the caller graph for this function:

◆ getRoleFolderId()

ilObjectRolePermissionTableGUI::getRoleFolderId ( )

Get role folder of current object.

Returns

Definition at line 73 of file class.ilObjectRolePermissionTableGUI.php.

References $role_folder_id.

Referenced by createTitle().

+ Here is the caller graph for this function:

◆ getVisibleRoles()

ilObjectRolePermissionTableGUI::getVisibleRoles ( )

get visible roles

Returns

Definition at line 147 of file class.ilObjectRolePermissionTableGUI.php.

References $visible_roles.

Referenced by fillRow(), and parse().

+ Here is the caller graph for this function:

◆ initColumns()

ilObjectRolePermissionTableGUI::initColumns ( )
protected

init Columns

Returns

Definition at line 522 of file class.ilObjectRolePermissionTableGUI.php.

References ilTableGUI\$column_width, $ilCtrl, $roles, ilTable2GUI\addColumn(), createTitle(), createTooltip(), ilTable2GUI\getFilterItemByPostVar(), ilTable2GUI\getParentObject(), getRefId(), and setVisibleRoles().

Referenced by parse().

523  {
524  global $rbacreview,$ilCtrl;
525 
526  $roles = $rbacreview->getParentRoleIds($this->getRefId());
527  $roles = $this->getParentObject()->applyRoleFilter(
528  $roles,
529  $this->getFilterItemByPostVar('role')->getValue()
530  );
531 
532  if(count($roles))
533  {
534  $column_width = 100/count($roles);
535  $column_width .= '%';
536  }
537  else
538  {
539  $column_widht = "0%";
540  }
541 
542  $all_roles = array();
543  foreach($roles as $role)
544  {
545  if($role['obj_id'] == SYSTEM_ROLE_ID)
546  {
547  continue;
548  }
549 
550  $role['role_type'] = $rbacreview->isGlobalRole($role['obj_id']) ? 'global' : 'local';
551 
552  // TODO check filter
553  $this->addColumn(
554  $this->createTitle($role),
555  $role['obj_id'],
556  '',
557  '',
558  false,
559  $this->createTooltip($role)
560  );
561  $all_roles[] = $role;
562  }
563 
564  $this->setVisibleRoles($all_roles);
565  return true;
566  }
getFilterItemByPostVar($a_post_var)
getParentObject()
Get parent object.
global $ilCtrl
Definition: ilias.php:18
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
createTooltip($role)
Create a linked title for roles with local policy.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilObjectRolePermissionTableGUI::initFilter ( )

Init role filter.

Returns

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

References $roles, ilTable2GUI\addFilterItemByMetaType(), and ilTable2GUI\FILTER_SELECT.

Referenced by __construct().

157  {
158  global $tree;
159 
161  'role',
163  );
164 
165  // Limit filter to local roles only for objects with group or course in path
166  if(!$roles->getValue())
167  {
168  if ($tree->checkForParentType($this->getRefId(), 'crs') or
169  $tree->checkForParentType($this->getRefId(), 'grp'))
170  {
171  $roles->setValue(self::ROLE_FILTER_LOCAL);
172  }
173  else
174  {
175  $roles->setValue(self::ROLE_FILTER_ALL);
176  }
177  }
178 
179 
180  $roles->setOptions(
181  array(
182  self::ROLE_FILTER_ALL => $this->lng->txt('filter_all_roles'),
183  self::ROLE_FILTER_GLOBAL => $this->lng->txt('filter_global_roles'),
184  self::ROLE_FILTER_LOCAL => $this->lng->txt('filter_local_roles'),
185  self::ROLE_FILTER_LOCAL_POLICY => $this->lng->txt('filter_roles_local_policy'),
186  self::ROLE_FILTER_LOCAL_OBJECT => $this->lng->txt('filter_local_roles_object')
187  )
188  );
189 
190  }
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse()

ilObjectRolePermissionTableGUI::parse ( )

Parse.

Returns

Definition at line 354 of file class.ilObjectRolePermissionTableGUI.php.

References $roles, addActiveOperation(), getObjType(), getRefId(), getVisibleRoles(), ilPermissionGUI\hasContainerCommands(), initColumns(), ilRbacReview\lookupCreateOperationIds(), and ilTable2GUI\setData().

355  {
356  global $rbacreview,$objDefinition;
357 
358  $this->initColumns();
359 
360  $perms = array();
361  $roles = array();
362 
363  if(!count($this->getVisibleRoles()))
364  {
365  return $this->setData(array());
366  }
367 
368  // Read operations of role
369  $operations = array();
370  foreach($this->getVisibleRoles() as $role_data)
371  {
372  $operations[$role_data['obj_id']] = $rbacreview->getActiveOperationsOfRole($this->getRefId(), $role_data['obj_id']);
373  }
374 
375  $counter = 0;
376 
377  $rolf = $rbacreview->getRoleFolderIdOfObject($this->getRefId());
378 
379  // Local policy
381  {
382  $roles = array();
383  $local_roles = $rbacreview->getRoleFolderIdOfObject($this->getRefId());
384  $local_roles = $rbacreview->getRolesOfRoleFolder($local_roles);
385  foreach($this->getVisibleRoles() as $role_id => $role_data)
386  {
387  $roles[$role_data['obj_id']] = array(
388  'protected' => $role_data['protected'],
389  'local_policy' => in_array($role_data['obj_id'],$local_roles),
390  'isLocal' => ($rolf == $role_data['parent']) && $role_data['assign'] == 'y'
391  );
392  }
393  $perms[$counter]['roles'] = $roles;
394  $perms[$counter]['show_local_policy_row'] = 1;
395 
396  $counter++;
397  }
398 
399  // Protect permissions
401  {
402  $roles = array();
403  foreach($this->getVisibleRoles() as $role_id => $role_data)
404  {
405  $roles[$role_data['obj_id']] = array(
406  'protected_allowed' => $rbacreview->isAssignable($role_data['obj_id'],$rolf),
407  'protected_status' => $rbacreview->isProtected($role_data['parent'], $role_data['obj_id'])
408  );
409  }
410  $perms[$counter]['roles'] = $roles;
411  $perms[$counter]['show_protected_row'] = 1;
412 
413  $counter++;
414  }
415  // Block role
417  {
418  $perms[$counter++]['show_block_row'] = 1;
419  }
420 
421 
423  {
424  $perms[$counter++]['show_start_info'] = true;
425  }
426 
427  // no creation permissions
428  $no_creation_operations = array();
429  foreach($rbacreview->getOperationsByTypeAndClass($this->getObjType(),'object') as $operation)
430  {
431  $this->addActiveOperation($operation);
432  $no_creation_operations[] = $operation;
433 
434  $roles = array();
435  foreach($this->getVisibleRoles() as $role_data)
436  {
437 
438  $roles[$role_data['obj_id']] =
439  array(
440  'protected' => $role_data['protected'],
441  'permission_set' => in_array($operation,(array) $operations[$role_data['obj_id']])
442  );
443  }
444 
445  $op = $rbacreview->getOperation($operation);
446 
447  $perms[$counter]['roles'] = $roles;
448  $perms[$counter]['perm'] = $op;
449  $counter++;
450 
451  }
452 
453  /*
454  * Select all
455  */
456  if($no_creation_operations)
457  {
458  $perms[$counter]['show_select_all'] = 1;
459  $perms[$counter]['ops'] = $no_creation_operations;
460  $perms[$counter]['subtype'] = 'nocreation';
461  $counter++;
462  }
463 
464 
465  if($objDefinition->isContainer($this->getObjType()))
466  {
467  $perms[$counter++]['show_create_info'] = true;
468  }
469 
470  // Get creatable objects
471  $objects = $objDefinition->getCreatableSubObjects($this->getObjType());
472  $ops_ids = ilRbacReview::lookupCreateOperationIds(array_keys($objects));
473  $creation_operations = array();
474  foreach($objects as $type => $info)
475  {
476  $ops_id = $ops_ids[$type];
477 
478  if(!$ops_id)
479  {
480  continue;
481  }
482 
483  $this->addActiveOperation($ops_id);
484  $creation_operations[] = $ops_id;
485 
486  $roles = array();
487  foreach($this->getVisibleRoles() as $role_data)
488  {
489  $roles[$role_data['obj_id']] =
490  array(
491  'protected' => $role_data['protected'],
492  'permission_set' => in_array($ops_id,(array) $operations[$role_data['obj_id']])
493  );
494  }
495 
496  $op = $rbacreview->getOperation($ops_id);
497 
498  $perms[$counter]['roles'] = $roles;
499  $perms[$counter]['perm'] = $op;
500  $counter++;
501 
502  }
503 
504 
505 
506  // Select all
507  if(count($creation_operations))
508  {
509  $perms[$counter]['show_select_all'] = 1;
510  $perms[$counter]['ops'] = $creation_operations;
511  $perms[$counter]['subtype'] = 'creation';
512  $counter++;
513  }
514 
515  $this->setData($perms);
516  }
addActiveOperation($a_ops_id)
Add active operation.
static hasContainerCommands($a_type)
Check if container commands are possible for the current object type.
static lookupCreateOperationIds($a_type_arr)
Lookup operation ids.
+ Here is the call graph for this function:

◆ setVisibleRoles()

ilObjectRolePermissionTableGUI::setVisibleRoles (   $a_ar)

Set Visible roles.

Parameters
object$a_ar
Returns

Definition at line 138 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by initColumns().

139  {
140  $this->visible_roles = $a_ar;
141  }
+ Here is the caller graph for this function:

Field Documentation

◆ $activeOperations

ilObjectRolePermissionTableGUI::$activeOperations = array()
private

Definition at line 30 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by getActiveOperations().

◆ $ref_id

ilObjectRolePermissionTableGUI::$ref_id = null
private

Definition at line 24 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by getRefId().

◆ $role_folder_id

ilObjectRolePermissionTableGUI::$role_folder_id = 0
private

Definition at line 25 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by getRoleFolderId().

◆ $roles

ilObjectRolePermissionTableGUI::$roles = array()
private

Definition at line 26 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by initColumns(), initFilter(), and parse().

◆ $tree_path_ids

ilObjectRolePermissionTableGUI::$tree_path_ids = array()
private

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

Referenced by getPathIds().

◆ $visible_roles

ilObjectRolePermissionTableGUI::$visible_roles = array()
private

Definition at line 31 of file class.ilObjectRolePermissionTableGUI.php.

Referenced by getVisibleRoles().

◆ ROLE_FILTER_ALL

const ilObjectRolePermissionTableGUI::ROLE_FILTER_ALL = 1

◆ ROLE_FILTER_GLOBAL

const ilObjectRolePermissionTableGUI::ROLE_FILTER_GLOBAL = 2

◆ ROLE_FILTER_LOCAL

const ilObjectRolePermissionTableGUI::ROLE_FILTER_LOCAL = 3

◆ ROLE_FILTER_LOCAL_OBJECT

const ilObjectRolePermissionTableGUI::ROLE_FILTER_LOCAL_OBJECT = 5

◆ ROLE_FILTER_LOCAL_POLICY

const ilObjectRolePermissionTableGUI::ROLE_FILTER_LOCAL_POLICY = 4

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