ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjectRolePermissionTableGUI Class Reference

Table for object role permissions. More...

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

Public Member Functions

 __construct (ilPermissionGUI $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
 
 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 (int $a_ops_id)
 Add active operation. More...
 
 getActiveOperations ()
 get active operations More...
 
 setVisibleRoles (array $a_ar)
 
 getVisibleRoles ()
 get visible roles More...
 
 initFilter ()
 Init role filter. More...
 
 parse ()
 Parse. More...
 
- Public Member Functions inherited from ilTable2GUI
 __construct (?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
 
 setOpenFormTag (bool $a_val)
 
 getOpenFormTag ()
 
 setCloseFormTag (bool $a_val)
 
 getCloseFormTag ()
 
 determineLimit ()
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 
 isColumnSelected (string $col)
 
 getSelectedColumns ()
 
 resetOffset (bool $a_in_determination=false)
 
 initFilter ()
 
 getParentObject ()
 
 getParentCmd ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setNoEntriesText (string $a_text)
 
 getNoEntriesText ()
 
 setIsDataTable (bool $a_val)
 
 getIsDataTable ()
 
 setEnableTitle (bool $a_enabletitle)
 
 getEnableTitle ()
 
 setEnableHeader (bool $a_enableheader)
 
 getEnableHeader ()
 
 setEnableNumInfo (bool $a_val)
 
 getEnableNumInfo ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setOrderField (string $a_order_field)
 
 getOrderField ()
 
 setData (array $a_data)
 Set table data. More...
 
 getData ()
 
 dataExists ()
 
 setPrefix (string $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) More...
 
 getPrefix ()
 
 addFilterItem (ilTableFilterItem $a_input_item, bool $a_optional=false)
 
 addFilterItemByMetaType (string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
 Add filter by standard type. More...
 
 getFilterItems (bool $a_optionals=false)
 
 getFilterItemByPostVar (string $a_post_var)
 
 setFilterCols (int $a_val)
 
 getFilterCols ()
 
 setDisableFilterHiding (bool $a_val=true)
 
 getDisableFilterHiding ()
 
 isFilterSelected (string $a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 
 determineSelectedFilters ()
 
 setCustomPreviousNext (string $a_prev_link, string $a_next_link)
 
 setFormAction (string $a_form_action, bool $a_multipart=false)
 
 getFormAction ()
 
 setFormName (string $a_name="")
 
 getFormName ()
 get the name of the parent form More...
 
 setId (string $a_val)
 
 getId ()
 
 setDisplayAsBlock (bool $a_val)
 
 getDisplayAsBlock ()
 
 setSelectAllCheckbox (string $a_select_all_checkbox, bool $a_select_all_on_top=false)
 
 setExternalSorting (bool $a_val)
 
 getExternalSorting ()
 
 setFilterCommand (string $a_val, string $a_caption="")
 
 getFilterCommand ()
 
 setResetCommand (string $a_val, string $a_caption="")
 
 getResetCommand ()
 
 setExternalSegmentation (bool $a_val)
 
 getExternalSegmentation ()
 
 setRowTemplate (string $a_template, string $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField (string $a_defaultorderfield)
 
 getDefaultOrderField ()
 
 setDefaultOrderDirection (string $a_defaultorderdirection)
 
 getDefaultOrderDirection ()
 
 setDefaultFilterVisiblity (bool $a_status)
 
 getDefaultFilterVisibility ()
 
 clearCommandButtons ()
 
 addCommandButton (string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
 
 addCommandButtonInstance (ilButtonBase $a_button)
 
 addMultiItemSelectionButton (string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
 
 setCloseCommand (string $a_link)
 
 addMultiCommand (string $a_cmd, string $a_text)
 
 addHiddenInput (string $a_name, string $a_value)
 
 addHeaderCommand (string $a_href, string $a_text, string $a_target="", string $a_img="")
 
 setTopCommands (bool $a_val)
 
 getTopCommands ()
 
 addColumn (string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
 
 getNavParameter ()
 
 setOrderLink (string $key, string $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder (bool $a_omit_offset=false)
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering (string $a_field)
 Should this field be sorted numeric? More...
 
 render ()
 
 writeFilterToSession ()
 
 resetFilter ()
 
 fillFooter ()
 
 getLinkbar (string $a_num)
 
 fillHiddenRow ()
 
 fillActionRow ()
 
 setHeaderHTML (string $html)
 
 storeProperty (string $type, string $value)
 
 loadProperty (string $type)
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext (string $id)
 
 getContext ()
 
 setShowRowsSelector (bool $a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 
 getLimit ()
 
 getOffset ()
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode (bool $a_value=false)
 
 getPrintMode ()
 
 getExportMode ()
 
 exportData (int $format, bool $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand (bool $a_value)
 
 setRowSelectorLabel (string $row_selector_label)
 
 getRowSelectorLabel ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 set max. More...
 
- Public Member Functions inherited from ilTableGUI
 __construct (array $a_data=[], bool $a_global_tpl=true)
 
 setTemplate (ilTemplate $a_tpl)
 
 getTemplateObject ()
 
 setData (array $a_data)
 Set table data. More...
 
 getData ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setHelp (string $a_help_page, string $a_help_icon, string $a_help_icon_alt="")
 
 setHeaderNames (array $a_header_names)
 
 getColumnCount ()
 
 setHeaderVars (array $a_header_vars, array $a_header_params=[])
 
 setColumnWidth (array $a_column_width)
 set table column widths More...
 
 setOneColumnWidth (string $a_column_width, int $a_column_number)
 
 setMaxCount (int $a_max_count)
 set max. More...
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 set max. More...
 
 getLimit ()
 
 setPrefix (string $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) More...
 
 setOffset (int $a_offset)
 set dataset offset More...
 
 getOffset ()
 
 setOrderColumn (string $a_order_column="", string $a_default_column="")
 
 getOrderColumn ()
 
 setOrderDirection (string $a_order_direction)
 
 getOrderDirection ()
 
 setFooter (string $a_style, string $a_previous="", string $a_next="")
 
 enable (string $a_module_name)
 
 disable (string $a_module_name)
 
 sortData ()
 
 render ()
 
 renderHeader ()
 
 setOrderLink (string $key, string $order_dir)
 
 setStyle (string $a_element, string $a_style)
 
 getStyle (string $a_element)
 
 setBase (string $a_base)
 
 getBase ()
 
 getFormName ()
 get the name of the parent form More...
 
 setFormName (string $a_name="cmd")
 
 getSelectAllCheckbox ()
 get the name of the checkbox that should be toggled with a select all button More...
 
 setSelectAllCheckbox (string $a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton (string $btn_name, string $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 FILTER_CHECKBOX = 9
 
const EXPORT_EXCEL = 1
 
const EXPORT_CSV = 2
 
const ACTION_ALL_LIMIT = 1000
 
- Data Fields inherited from ilTableGUI
string $title = ""
 
string $icon = ""
 
string $icon_alt = ""
 
string $help_page = ""
 
string $help_icon = ""
 
string $help_icon_alt = ""
 
array $header_names = []
 
array $header_vars = []
 
array $linkbar_vars = []
 
array $data = []
 
int $column_count = 0
 
array $column_width = []
 
int $max_count = 0
 
int $limit = 0
 
bool $max_limit = false
 
int $offset = 0
 
string $order_column = ""
 
string $order_direction = ""
 
string $footer_style = ""
 
string $footer_previous = ""
 
string $footer_next = ""
 
bool $lang_support = true
 
bool $global_tpl = false
 
string $form_name = ""
 
string $select_all_checkbox = ""
 
array $action_buttons = []
 
string $prefix = ""
 
string $base = ""
 
array $enabled
 
array $styles
 

Protected Member Functions

 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
 initColumns ()
 
 createTooltip (array $role)
 Create a linked title for roles with local policy. More...
 
 createTitle (array $role)
 Create (linked) title. More...
 
- Protected Member Functions inherited from ilTable2GUI
 getRequestedValues ()
 
 prepareOutput ()
 Anything that must be done before HTML is generated. More...
 
 isFilterVisible ()
 Check if filter is visible: manually shown (session, db) or default value set. More...
 
 isAdvMDFilter (ilAdvancedMDRecordGUI $a_gui, ilTableFilterItem $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilTableFilterItem $a_item)
 Get current filter value. More...
 
 setFilterValue (ilTableFilterItem $a_item, $a_value)
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, int &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV (ilCSVWriter $a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 CSV Version of Fill Row. More...
 

Protected Attributes

ilTree $tree
 
ilRbacReview $review
 
ilObjectDefinition $objDefinition
 
- Protected Attributes inherited from ilTable2GUI
string $requested_nav_par2 = ""
 
string $requested_nav_par = ""
 
string $requested_nav_par1 = ""
 
ILIAS Table TableGUIRequest $table_request = null
 
array $selected_columns = []
 
ilCtrl $ctrl
 
object $parent_obj = null
 
string $parent_cmd = ""
 
string $close_command = ""
 
string $top_anchor = "il_table_top"
 
array $filters = array()
 
array $optional_filters = array()
 
string $filter_cmd = 'applyFilter'
 
string $reset_cmd = 'resetFilter'
 
int $filter_cols = 5
 
bool $ext_sort = false
 
bool $ext_seg = false
 
string $context = ""
 
array $mi_sel_buttons = []
 
bool $disable_filter_hiding = false
 
bool $top_commands = true
 
array $selectable_columns = array()
 
array $selected_column = array()
 
bool $show_rows_selector = true
 
bool $rows_selector_off = false
 
bool $nav_determined = false
 
bool $limit_determined = false
 
bool $filters_determined = false
 
bool $columns_determined = false
 
bool $open_form_tag = true
 
bool $close_form_tag = true
 
array $export_formats = []
 
int $export_mode = 0
 
bool $print_mode = false
 
bool $enable_command_for_all = false
 
bool $restore_filter = false
 
array $restore_filter_values = []
 
bool $default_filter_visibility = false
 
array $sortable_fields = array()
 
bool $prevent_double_submission = true
 
string $row_selector_label = ""
 
bool $select_all_on_top = false
 
array $sel_buttons = []
 
string $nav_value = ''
 
string $noentriestext = ''
 
string $css_row = ''
 
bool $display_as_block = false
 
string $description = ''
 
string $id = ""
 
bool $custom_prev_next = false
 
string $reset_cmd_txt = ""
 
string $defaultorderfield = ""
 
string $defaultorderdirection = ""
 
array $column = []
 
bool $datatable = false
 
bool $num_info = false
 
bool $form_multipart = false
 
array $row_data = []
 
string $order_field = ""
 
array $selected_filter = []
 
string $form_action = ""
 
string $formname = ""
 
string $sort_order = ""
 
array $buttons = []
 
array $multi = []
 
array $hidden_inputs = []
 
array $header_commands = []
 
string $row_template = ""
 
string $row_template_dir = ""
 
string $filter_cmd_txt = ""
 
string $custom_prev = ""
 
string $custom_next = ""
 
array $raw_post_data = null
 
ilGlobalTemplateInterface $main_tpl
 
- Protected Attributes inherited from ilTableGUI
string $sort_order
 
string $link_params
 
array $header_params
 
 $tpl
 
ilLanguage $lng
 

Private Attributes

int $ref_id
 
array $tree_path_ids = []
 
array $activeOperations = []
 
array $visible_roles = []
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 
- Static Public Member Functions inherited from ilTableGUI
static linkbar (string $AScript, int $AHits, int $ALimit, int $AOffset, array $AParams=array(), array $ALayout=array(), string $prefix='')
 

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 26 of file class.ilObjectRolePermissionTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectRolePermissionTableGUI::__construct ( ilPermissionGUI  $a_parent_obj,
string  $a_parent_cmd,
int  $a_ref_id 
)

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

44 {
45 global $DIC;
46
47 $this->objDefinition = $DIC['objDefinition'];
48 $this->review = $DIC->rbac()->review();
49
50 $this->ref_id = $a_ref_id;
51 $this->setId('objroleperm_' . $this->ref_id);
52 parent::__construct($a_parent_obj, $a_parent_cmd);
53
54 $this->lng->loadLanguageModule('rbac');
55
56 $this->tree = $DIC->repositoryTree();
57 $this->tree_path_ids = $this->tree->getPathId($this->ref_id);
58
59 $tpl = $DIC->ui()->mainTemplate();
60 $tpl->addJavaScript('assets/js/ilPermSelect.js');
61
62 $this->setTitle($this->lng->txt('permission_settings'));
63 $this->setEnableHeader(true);
64 $this->disable('sort');
65 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
66 $this->disable('numinfo');
67 $this->setRowTemplate("tpl.obj_role_perm_row.html", "components/ILIAS/AccessControl");
68 $this->setLimit(100);
69 $this->setShowRowsSelector(false);
70 $this->setDisableFilterHiding(true);
71 $this->setNoEntriesText($this->lng->txt('msg_no_roles_of_type'));
72 $this->addCommandButton('savePermissions', $this->lng->txt('save'));
73 $this->initFilter();
74 }
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableHeader(bool $a_enableheader)
setDisableFilterHiding(bool $a_val=true)
setNoEntriesText(string $a_text)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
disable(string $a_module_name)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ilTableGUI\$tpl, ILIAS\GlobalScreen\Provider\__construct(), ilTable2GUI\addCommandButton(), ILIAS\Repository\ctrl(), ilTableGUI\disable(), initFilter(), ILIAS\Repository\lng(), ilTable2GUI\setDisableFilterHiding(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setLimit(), ilTable2GUI\setNoEntriesText(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setShowRowsSelector(), and ilTable2GUI\setTitle().

+ Here is the call graph for this function:

Member Function Documentation

◆ addActiveOperation()

ilObjectRolePermissionTableGUI::addActiveOperation ( int  $a_ops_id)

Add active operation.

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

111 : void
112 {
113 $this->activeOperations[] = $a_ops_id;
114 }

Referenced by parse().

+ Here is the caller graph for this function:

◆ createTitle()

ilObjectRolePermissionTableGUI::createTitle ( array  $role)
protected

Create (linked) title.

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

600 : string
601 {
602 $role_title = ilObjRole::_getTranslation($role['title']);
603
604 // No local policies
605 if ($role['parent'] != $this->getRefId()) {
606 return $role_title;
607 }
608
609 $type = ilObject::_lookupType($this->getRefId(), true);
610 if ($this->objDefinition->isPlugin($type)) {
611 if (preg_match("/^il_./", $role["title"])) {
612 $role_title = ilObjectPlugin::lookupTxtById($type, ilObjRole::_removeObjectId($role["title"]));
613 }
614 }
615
616 if ($role['blocked']) {
617 return $role_title;
618 }
619 $this->ctrl->setParameterByClass('ilobjrolegui', 'obj_id', $role['obj_id']);
620
621 return '<a class="tblheader" href="' . $this->ctrl->getLinkTargetByClass(
622 'ilobjrolegui',
623 ''
624 ) . '" >' . $role_title . '</a>';
625 }
static _removeObjectId(string $a_role_title)
static _getTranslation(string $a_role_title)
static lookupTxtById(string $plugin_id, string $lang_var)
static _lookupType(int $id, bool $reference=false)

References ilObjRole\_getTranslation(), ilObject\_lookupType(), ilObjRole\_removeObjectId(), ILIAS\Repository\ctrl(), getRefId(), and ilObjectPlugin\lookupTxtById().

Referenced by initColumns().

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

◆ createTooltip()

ilObjectRolePermissionTableGUI::createTooltip ( array  $role)
protected

Create a linked title for roles with local policy.

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

532 : string
533 {
534 $protected_status = $this->review->isProtected($role['parent'], $role['obj_id']) ? 'protected_' : '';
535 if ($role['role_type'] == 'global') {
536 $tp = $this->lng->txt('perm_' . $protected_status . 'global_role');
537 } else {
538 $tp = $this->lng->txt('perm_' . $protected_status . 'local_role');
539 }
540
541 $inheritance_seperator = ': ';
542
543 // Show create at info
544 if (
545 $role['assign'] == 'y' && $role['role_type'] != 'global' || $role['assign'] == 'n' && $role['role_type'] != 'global'
546 ) {
547 $tp .= ': ';
548
549 $obj = $this->review->getObjectOfRole($role['obj_id']);
550 if ($obj) {
551 $type = ilObject::_lookupType($this->getRefId(), true);
552 if ($this->objDefinition->isPlugin($type)) {
553 $type_text = ilObjectPlugin::lookupTxtById($type, 'obj_' . $type);
554 } else {
555 $type_text = $this->lng->txt('obj_' . ilObject::_lookupType($obj));
556 }
557
558 $tp .= sprintf(
559 $this->lng->txt('perm_role_path_info_created'),
560 $type_text,
562 );
563 $inheritance_seperator = ', ';
564 }
565 }
566
567 $path_hierarchy = $this->review->getObjectsWithStopedInheritance(
568 $role['obj_id'],
569 $this->tree->getPathId($this->getRefId())
570 );
571
572 $reduced_path_hierarchy = array_diff(
573 $path_hierarchy,
574 [
575 $this->getRefId(),
576 $this->review->getObjectReferenceOfRole($role['obj_id'])
577 ]
578 );
579
580 // Inheritance
581 if ($role['assign'] == 'n' && count($reduced_path_hierarchy)) {
582 $tp .= $inheritance_seperator;
583
584 $parent = end($reduced_path_hierarchy);
587 $tp .= sprintf(
588 $this->lng->txt('perm_role_path_info_inheritance'),
589 $this->lng->txt('obj_' . $p_type),
590 $p_title
591 );
592 }
593
594 return $tp;
595 }
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), getRefId(), ILIAS\Repository\lng(), and ilObjectPlugin\lookupTxtById().

Referenced by initColumns().

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

◆ fillRow()

ilObjectRolePermissionTableGUI::fillRow ( array  $a_set)
protected

Standard Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
array<string,mixed>$a_set data array

Reimplemented from ilTable2GUI.

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

174 : void
175 {
176 // local policy
177 if (isset($a_set['show_local_policy_row'])) {
178 foreach ($a_set['roles'] as $role_id => $role_info) {
179 $this->tpl->setCurrentBlock('role_option');
180 $this->tpl->setVariable('INHERIT_ROLE_ID', $role_id);
181 $this->tpl->setVariable('INHERIT_CHECKED', $role_info['local_policy'] ? 'checked=checked' : '');
182 $this->tpl->setVariable(
183 'INHERIT_DISABLED',
184 ($role_info['protected'] || $role_info['isLocal'] || $role_info['blocked']) ? 'disabled="disabled"' : ''
185 );
186 $this->tpl->setVariable('TXT_INHERIT', $this->lng->txt('rbac_local_policy'));
187 $this->tpl->setVariable('INHERIT_LONG', $this->lng->txt('perm_use_local_policy_desc'));
188 $this->tpl->parseCurrentBlock();
189 }
190 return;
191 }
192 // protected
193 if (isset($a_set['show_protected_row'])) {
194 foreach ($a_set['roles'] as $role_id => $role_info) {
195 $this->tpl->setCurrentBlock('role_protect');
196 $this->tpl->setVariable('PROTECT_ROLE_ID', $role_id);
197 $this->tpl->setVariable('PROTECT_CHECKED', $role_info['protected_status'] ? 'checked=checked' : '');
198 $this->tpl->setVariable(
199 'PROTECT_DISABLED',
200 $role_info['protected_allowed'] ? '' : 'disabled="disabled"'
201 );
202 $this->tpl->setVariable('TXT_PROTECT', $this->lng->txt('role_protect_permissions'));
203 $this->tpl->setVariable('PROTECT_LONG', $this->lng->txt('role_protect_permissions_desc'));
204 $this->tpl->parseCurrentBlock();
205 }
206 return;
207 }
208
209 // block role
210 if (isset($a_set['show_block_row'])) {
211 foreach ($this->getVisibleRoles() as $role_info) {
212 $this->tpl->setCurrentBlock('role_block');
213 $this->tpl->setVariable('BLOCK_ROLE_ID', $role_info['obj_id']);
214 $this->tpl->setVariable('TXT_BLOCK', $this->lng->txt('role_block_role'));
215 $this->tpl->setVariable('BLOCK_LONG', $this->lng->txt('role_block_role_desc'));
216 if ($role_info['blocked']) {
217 $this->tpl->setVariable('BLOCK_CHECKED', 'checked="checked"');
218 }
219 if (
220 ($role_info['protected'] == 'y') ||
221 ($role_info['assign'] == 'y' && $role_info['parent'] == $this->getRefId())
222 ) {
223 $this->tpl->setVariable('BLOCK_DISABLED', 'disabled="disabled');
224 }
225
226 $this->tpl->parseCurrentBlock();
227 }
228 return;
229 }
230
231 // Select all
232 if (isset($a_set['show_select_all'])) {
233 foreach ($this->getVisibleRoles() as $role) {
234 $this->tpl->setCurrentBlock('role_select_all');
235 $this->tpl->setVariable('JS_ROLE_ID', $role['obj_id']);
236 $this->tpl->setVariable('JS_SUBID', $a_set['subtype']);
237 $this->tpl->setVariable('JS_ALL_PERMS', "['" . implode("','", $a_set['ops']) . "']");
238 $this->tpl->setVariable('JS_FORM_NAME', $this->getFormName());
239 $this->tpl->setVariable('TXT_SEL_ALL', $this->lng->txt('select_all'));
240 $this->tpl->parseCurrentBlock();
241 }
242 return;
243 }
244
245 // Object permissions
246 if (isset($a_set['show_start_info'])) {
247 $this->tpl->setCurrentBlock('section_info');
248 $this->tpl->setVariable('SECTION_TITLE', $this->lng->txt('perm_class_object'));
249 $this->tpl->setVariable('SECTION_DESC', $this->lng->txt('perm_class_object_desc'));
250 $this->tpl->parseCurrentBlock();
251
252 return;
253 }
254
255 if (isset($a_set['show_create_info'])) {
256 $this->tpl->setCurrentBlock('section_info');
257 $this->tpl->setVariable('SECTION_TITLE', $this->lng->txt('perm_class_create'));
258 $this->tpl->setVariable('SECTION_DESC', $this->lng->txt('perm_class_create_desc'));
259 $this->tpl->parseCurrentBlock();
260
261 return;
262 }
263
264 foreach ((array) $a_set['roles'] as $role_id => $role_info) {
265 $perm = "";
266 $this->tpl->setCurrentBlock('role_td');
267 $this->tpl->setVariable('PERM_ROLE_ID', $role_id);
268 $this->tpl->setVariable('PERM_PERM_ID', $a_set['perm']['ops_id']);
269
270 if (substr($a_set['perm']['operation'], 0, 6) == 'create') {
271 if ($this->objDefinition->isPlugin(substr($a_set['perm']['operation'], 7))) {
273 substr($a_set['perm']['operation'], 7),
274 "obj_" . substr($a_set['perm']['operation'], 7)
275 );
276 } else {
277 $perm = $this->lng->txt('obj_' . substr($a_set['perm']['operation'], 7));
278 }
279 } else {
280 if ($this->objDefinition->isPlugin($this->getObjType())) {
281 if (ilObjectPlugin::langExitsById($this->getObjType(), $a_set['perm']['operation'])) {
282 $perm = ilObjectPlugin::lookupTxtById($this->getObjType(), $a_set['perm']['operation']);
283 }
284 }
285
286 if (!$perm) {
287 if ($this->lng->exists($this->getObjType() . '_' . $a_set['perm']['operation'] . '_short')) {
288 $perm = $this->lng->txt($this->getObjType() . '_' . $a_set['perm']['operation'] . '_short');
289 } else {
290 $perm = $this->lng->txt($a_set['perm']['operation']);
291 }
292 }
293 }
294
295 $this->tpl->setVariable('TXT_PERM', $perm);
296
297 if ($this->objDefinition->isPlugin($this->getObjType())) {
298 $this->tpl->setVariable('PERM_LONG', ilObjectPlugin::lookupTxtById(
299 $this->getObjType(),
300 $this->getObjType() . "_" . $a_set['perm']['operation']
301 ));
302 } elseif (substr($a_set['perm']['operation'], 0, 6) == 'create') {
303 if ($this->objDefinition->isPlugin(substr($a_set['perm']['operation'], 7))) {
304 $this->tpl->setVariable('PERM_LONG', ilObjectPlugin::lookupTxtById(
305 substr($a_set['perm']['operation'], 7),
306 $this->getObjType() . "_" . $a_set['perm']['operation']
307 ));
308 } else {
309 $this->tpl->setVariable('PERM_LONG', $this->lng->txt('rbac_' . $a_set['perm']['operation']));
310 }
311 } else {
312 $this->tpl->setVariable(
313 'PERM_LONG',
314 $this->lng->txt($this->getObjType() . '_' . $a_set['perm']['operation'])
315 );
316 }
317
318 if ($role_info['protected'] || $role_info['blocked']) {
319 $this->tpl->setVariable('PERM_DISABLED', 'disabled="disabled"');
320 }
321 if ($role_info['permission_set']) {
322 $this->tpl->setVariable('PERM_CHECKED', 'checked="checked"');
323 }
324
325 $this->tpl->parseCurrentBlock();
326 }
327 }
static langExitsById(string $pluginId, string $langVar)
Is searched lang var available in plugin lang files.
getFormName()
get the name of the parent form

References ilTable2GUI\getFormName(), getObjType(), getRefId(), getVisibleRoles(), ilObjectPlugin\langExitsById(), ILIAS\Repository\lng(), and ilObjectPlugin\lookupTxtById().

+ Here is the call graph for this function:

◆ getActiveOperations()

ilObjectRolePermissionTableGUI::getActiveOperations ( )

get active operations

Returns
int[]

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

References $activeOperations.

◆ getObjId()

ilObjectRolePermissionTableGUI::getObjId ( )

Get obj id.

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

95 : int
96 {
97 return ilObject::_lookupObjId($this->getRefId());
98 }

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

Referenced by getObjType().

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

◆ getObjType()

ilObjectRolePermissionTableGUI::getObjType ( )

get obj type

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

103 : string
104 {
105 return ilObject::_lookupType($this->getObjId());
106 }

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

Referenced by fillRow(), and parse().

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

◆ getPathIds()

ilObjectRolePermissionTableGUI::getPathIds ( )

Get tree path ids.

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

References $tree_path_ids.

◆ getRefId()

ilObjectRolePermissionTableGUI::getRefId ( )

Get ref id of current object.

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

References $ref_id.

Referenced by createTitle(), createTooltip(), fillRow(), getObjId(), initColumns(), and parse().

+ Here is the caller graph for this function:

◆ getVisibleRoles()

ilObjectRolePermissionTableGUI::getVisibleRoles ( )

get visible roles

Definition at line 133 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

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

480 : void
481 {
482 global $DIC;
483
484 $roles = $this->review->getParentRoleIds($this->getRefId());
485 $roles = $this->getParentObject()->applyRoleFilter(
486 $roles,
487 (int) $this->getFilterItemByPostVar('role')->getValue()
488 );
489
490 $possible_roles = [];
491 foreach ($roles as $role) {
492 if ($this->review->isBlockedInUpperContext((int) $role['obj_id'], $this->getRefId())) {
493 ilLoggerFactory::getLogger('ac')->debug('Ignoring blocked role: ' . $role['obj_id']);
494 continue;
495 }
496 $possible_roles[] = $role;
497 }
498
499 if ($possible_roles !== []) {
500 $column_width = 100 / count($possible_roles);
501 $column_width .= '%';
502 } else {
503 }
504
505 $all_roles = [];
506 foreach ($possible_roles as $role) {
507 if ($role['obj_id'] == SYSTEM_ROLE_ID) {
508 continue;
509 }
510 $role['obj_id'] = (int) $role['obj_id'];
511 $role['blocked'] = (bool) $this->review->isBlockedAtPosition($role['obj_id'], $this->getRefId());
512 $role['role_type'] = $this->review->isGlobalRole($role['obj_id']) ? 'global' : 'local';
513
514 // TODO check filter
515 $this->addColumn(
516 $this->createTitle($role),
517 (string) $role['obj_id'],
518 '',
519 false,
520 '',
521 $this->createTooltip($role)
522 );
523 $all_roles[] = $role;
524 }
525
526 $this->setVisibleRoles($all_roles);
527 }
static getLogger(string $a_component_id)
Get component logger.
createTooltip(array $role)
Create a linked title for roles with local policy.
createTitle(array $role)
Create (linked) title.
getFilterItemByPostVar(string $a_post_var)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
const SYSTEM_ROLE_ID
Definition: constants.php:29
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49

References ilTableGUI\$column_width, $DIC, ilTable2GUI\addColumn(), createTitle(), createTooltip(), ilTable2GUI\getFilterItemByPostVar(), ilLoggerFactory\getLogger(), ilTable2GUI\getParentObject(), getRefId(), ILIAS\UI\Implementation\Component\Input\getValue(), ILIAS\Repository\int(), setVisibleRoles(), and SYSTEM_ROLE_ID.

Referenced by parse().

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

◆ initFilter()

ilObjectRolePermissionTableGUI::initFilter ( )

Init role filter.

Reimplemented from ilTable2GUI.

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

141 : void
142 {
143 global $DIC;
144
145 $tree = $DIC['tree'];
146
147 $roles = $this->addFilterItemByMetaType(
148 'role',
150 );
151
152 // Limit filter to local roles only for objects with group or course in path
153 if (!$roles->getValue()) {
154 if ($tree->checkForParentType($this->getRefId(), 'crs') || $tree->checkForParentType($this->getRefId(), 'grp')) {
155 $roles->setValue(self::ROLE_FILTER_LOCAL);
156 } else {
157 $roles->setValue(self::ROLE_FILTER_ALL);
158 }
159 }
160
161 $roles->setOptions(
162 [
163 self::ROLE_FILTER_ALL => $this->lng->txt('filter_all_roles'),
164 self::ROLE_FILTER_GLOBAL => $this->lng->txt('filter_global_roles'),
165 self::ROLE_FILTER_LOCAL => $this->lng->txt('filter_local_roles'),
166 self::ROLE_FILTER_LOCAL_POLICY => $this->lng->txt('filter_roles_local_policy'),
167 self::ROLE_FILTER_LOCAL_OBJECT => $this->lng->txt('filter_local_roles_object')
168 ]
169 );
170 }
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...

References $DIC, $tree, ilTable2GUI\addFilterItemByMetaType(), ilTree\checkForParentType(), ilTable2GUI\FILTER_SELECT, and ILIAS\Repository\lng().

Referenced by __construct().

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

◆ parse()

ilObjectRolePermissionTableGUI::parse ( )

Parse.

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

332 : void
333 {
334 $this->initColumns();
335
336 $perms = [];
337 $roles = [];
338
339 if ($this->getVisibleRoles() === []) {
340 $this->setData([]);
341 return;
342 }
343
344 // Read operations of role
345 $operations = [];
346 foreach ($this->getVisibleRoles() as $role_data) {
347 $operations[$role_data['obj_id']] = $this->review->getActiveOperationsOfRole(
348 $this->getRefId(),
349 $role_data['obj_id']
350 );
351 }
352
353 $counter = 0;
354
355 // Local policy
357 $roles = [];
358 $local_roles = $this->review->getRolesOfObject($this->getRefId());
359 foreach ($this->getVisibleRoles() as $role_data) {
360 $roles[$role_data['obj_id']] = [
361 'blocked' => $role_data['blocked'],
362 'protected' => $role_data['protected'],
363 'local_policy' => in_array($role_data['obj_id'], $local_roles),
364 'isLocal' => ($this->getRefId() == $role_data['parent']) && $role_data['assign'] == 'y'
365 ];
366 }
367 $perms[$counter]['roles'] = $roles;
368 $perms[$counter]['show_local_policy_row'] = 1;
369
370 $counter++;
371 }
372
373 // Protect permissions
375 $roles = [];
376 foreach ($this->getVisibleRoles() as $role_data) {
377 $roles[$role_data['obj_id']] = [
378 'blocked' => $role_data['blocked'],
379 'protected_allowed' => $this->review->isAssignable($role_data['obj_id'], $this->getRefId()),
380 'protected_status' => $this->review->isProtected($role_data['parent'], $role_data['obj_id']),
381 'isLocal' => ($this->getRefId() == $role_data['parent']) && $role_data['assign'] == 'y'
382 ];
383 }
384 $perms[$counter]['roles'] = $roles;
385 $perms[$counter]['show_protected_row'] = 1;
386
387 $counter++;
388 }
389 // Block role
391 $perms[$counter++]['show_block_row'] = 1;
392 }
393
395 $perms[$counter++]['show_start_info'] = true;
396 }
397
398 // no creation permissions
399 $no_creation_operations = [];
400 foreach ($this->review->getOperationsByTypeAndClass($this->getObjType(), 'object') as $operation) {
401 $this->addActiveOperation($operation);
402 $no_creation_operations[] = $operation;
403
404 $roles = [];
405 foreach ($this->getVisibleRoles() as $role_data) {
406 $roles[$role_data['obj_id']] =
407 [
408 'blocked' => $role_data['blocked'],
409 'protected' => $role_data['protected'],
410 'permission_set' => in_array($operation, (array) $operations[$role_data['obj_id']]),
411 'isLocal' => ($this->getRefId() == $role_data['parent']) && $role_data['assign'] == 'y'
412 ];
413 }
414
415 $op = $this->review->getOperation($operation);
416
417 $perms[$counter]['roles'] = $roles;
418 $perms[$counter]['perm'] = $op;
419 $counter++;
420 }
421
422 /*
423 * Select all
424 */
425 if ($no_creation_operations !== []) {
426 $perms[$counter]['show_select_all'] = 1;
427 $perms[$counter]['ops'] = $no_creation_operations;
428 $perms[$counter]['subtype'] = 'nocreation';
429 $counter++;
430 }
431
432 if ($this->objDefinition->isContainer($this->getObjType())) {
433 $perms[$counter++]['show_create_info'] = true;
434 }
435
436 // Get creatable objects
437 $objects = $this->objDefinition->getCreatableSubObjects($this->getObjType());
438 $ops_ids = ilRbacReview::lookupCreateOperationIds(array_keys($objects));
439 $creation_operations = [];
440 foreach ($objects as $type => $info) {
441 $ops_id = $ops_ids[$type] ?? null;
442
443 if (!$ops_id) {
444 continue;
445 }
446
447 $this->addActiveOperation($ops_id);
448 $creation_operations[] = $ops_id;
449
450 $roles = [];
451 foreach ($this->getVisibleRoles() as $role_data) {
452 $roles[$role_data['obj_id']] =
453 [
454 'blocked' => $role_data['blocked'],
455 'protected' => $role_data['protected'],
456 'permission_set' => in_array($ops_id, (array) $operations[$role_data['obj_id']]),
457 'isLocal' => ($this->getRefId() == $role_data['parent']) && $role_data['assign'] == 'y'
458
459 ];
460 }
461
462 $op = $this->review->getOperation($ops_id);
463
464 $perms[$counter]['roles'] = $roles;
465 $perms[$counter]['perm'] = $op;
466 $counter++;
467 }
468
469 // Select all
470 if ($creation_operations !== []) {
471 $perms[$counter]['show_select_all'] = 1;
472 $perms[$counter]['ops'] = $creation_operations;
473 $perms[$counter]['subtype'] = 'creation';
474 $counter++;
475 }
476
477 $this->setData($perms);
478 }
addActiveOperation(int $a_ops_id)
Add active operation.
static hasContainerCommands(string $a_type)
static lookupCreateOperationIds(array $a_type_arr)
Lookup operation ids.
setData(array $a_data)
Set table data.
$info
Definition: entry_point.php:21
$counter

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

+ Here is the call graph for this function:

◆ setVisibleRoles()

ilObjectRolePermissionTableGUI::setVisibleRoles ( array  $a_ar)

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

125 : void
126 {
127 $this->visible_roles = $a_ar;
128 }

Referenced by initColumns().

+ Here is the caller graph for this function:

Field Documentation

◆ $activeOperations

array ilObjectRolePermissionTableGUI::$activeOperations = []
private

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

Referenced by getActiveOperations().

◆ $objDefinition

ilObjectDefinition ilObjectRolePermissionTableGUI::$objDefinition
protected

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

◆ $ref_id

int ilObjectRolePermissionTableGUI::$ref_id
private

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

Referenced by getRefId().

◆ $review

ilRbacReview ilObjectRolePermissionTableGUI::$review
protected

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

◆ $tree

ilTree ilObjectRolePermissionTableGUI::$tree
protected

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

Referenced by initFilter().

◆ $tree_path_ids

array ilObjectRolePermissionTableGUI::$tree_path_ids = []
private

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

Referenced by getPathIds().

◆ $visible_roles

array ilObjectRolePermissionTableGUI::$visible_roles = []
private

Definition at line 37 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: