ILIAS  release_8 Revision v8.23
ilUserTableGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilUserTableGUI:
+ Collaboration diagram for ilUserTableGUI:

Public Member Functions

 readUserDefinedFieldsDefinitions ()
 Read user defined fields definitions. More...
 
 getUserDefinedField (string $a_key)
 Get user defined field. More...
 
 isUdfColumn (string $a_key)
 
 getSelectableColumns ()
 
 getItems ()
 
 addFilterItemValue ($filter, $value)
 
 getUserIdsForFilter ()
 
 initFilter ()
 
 addFilterItemByUdfType (string $id, int $type, bool $a_optional=false, ?string $caption=null, array $a_options=array())
 Add filter by standard type. 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)
 
 getData ()
 
 dataExists ()
 
 setPrefix (string $a_prefix)
 
 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 ()
 
 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 ()
 
 setShowTemplates (bool $a_value)
 
 getShowTemplates ()
 
 restoreTemplate (string $a_name)
 Restore state from template. More...
 
 saveTemplate (string $a_name)
 Save current state as template. More...
 
 deleteTemplate (string $a_name)
 
 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)
 
- 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 MODE_USER_FOLDER = 1
 
const MODE_LOCAL_USER = 2
 
- 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

 setMode (int $a_mode)
 
 getMode ()
 
 getUserFolderId ()
 
 buildUserQuery ()
 
 fillRow (array $a_set)
 
- 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

ILIAS User StandardGUIRequest $user_request
 
array $udf_fields = []
 
array $filter = []
 
- Protected Attributes inherited from ilTable2GUI
string $requested_tmpl_delete
 
string $requested_tmpl_create
 
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_templates = false
 
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 $mode = null
 
int $user_folder_id = 0
 
bool $with_write_access = false
 

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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning TableGUI class for user administration

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilUserTableGUI: ilFormPropertyDispatchGUI

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

Member Function Documentation

◆ addFilterItemByUdfType()

ilUserTableGUI::addFilterItemByUdfType ( string  $id,
int  $type,
bool  $a_optional = false,
?string  $caption = null,
array  $a_options = array() 
)

Add filter by standard type.

Definition at line 561 of file class.ilUserTableGUI.php.

References $DIC, ilTable2GUI\$id, ilTableGUI\$lng, ilTable2GUI\addFilterItem(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ILIAS\Repository\lng(), ilLanguage\txt(), UDF_TYPE_SELECT, and UDF_TYPE_TEXT.

Referenced by initFilter().

567  : ?ilFormPropertyGUI {
568  global $DIC;
569 
570  $lng = $DIC['lng'];
571 
572  if (!$caption) {
573  $caption = $lng->txt($id);
574  }
575 
576  switch ($type) {
577  case UDF_TYPE_SELECT:
578  $item = new ilSelectInputGUI($caption, $id);
579  $sel_options = array("" => $this->lng->txt("user_all"));
580  foreach ($a_options as $o) {
581  $sel_options[$o] = $o;
582  }
583  $item->setOptions($sel_options);
584  break;
585 
586  case UDF_TYPE_TEXT:
587  $item = new ilTextInputGUI($caption, $id);
588  $item->setMaxLength(64);
589  $item->setSize(20);
590  // $item->setSubmitFormOnEnter(true);
591  break;
592 
593  default:
594  return null;
595  }
596 
597  if ($item) {
598  $this->addFilterItem($item, $a_optional);
599  $item->readFromSession();
600  $this->filter[$id] = $item->getValue();
601  }
602  return $item;
603  }
const UDF_TYPE_SELECT
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
$type
ilLanguage $lng
global $DIC
Definition: feed.php:28
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFilterItemValue()

ilUserTableGUI::addFilterItemValue (   $filter,
  $value 
)

Definition at line 370 of file class.ilUserTableGUI.php.

References $filter, and ILIAS\UI\examples\Symbol\Glyph\Filter\filter().

370  : void // Missing parameter types.
371  {
372  $this->filter[$filter] = $value;
373  }
+ Here is the call graph for this function:

◆ buildUserQuery()

ilUserTableGUI::buildUserQuery ( )
protected

Definition at line 253 of file class.ilUserTableGUI.php.

References $query, ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilTable2GUI\getLimit(), and ilTable2GUI\getOffset().

Referenced by getItems(), and getUserIdsForFilter().

253  : ilUserQuery
254  {
255  $query = new ilUserQuery();
256  $query->setOffset($this->getOffset());
257  $query->setLimit($this->getLimit());
258  $query->setTextFilter($this->filter['query'] ?? '');
259  $query->setActionFilter($this->filter['activation'] ?? '');
260  $query->setLastLogin($this->filter['last_login'] ?? null);
261  $query->setLimitedAccessFilter($this->filter['limited_access'] ?? false);
262  $query->setNoCourseFilter($this->filter['no_courses'] ?? false);
263  $query->setNoGroupFilter($this->filter['no_groups'] ?? false);
264  $query->setCourseGroupFilter($this->filter['course_group'] ?? 0);
265  $query->setRoleFilter((int) ($this->filter['global_role'] ?? 0));
266  $query->setUserFilter($this->filter['user_ids'] ?? []);
267  $query->setFirstLetterLastname($this->user_request->getLetter());
268  $query->setAuthenticationFilter($this->filter['authentication'] ?? '');
269  return $query;
270  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillRow()

ilUserTableGUI::fillRow ( array  $a_set)
protected

Definition at line 605 of file class.ilUserTableGUI.php.

References $c, $DIC, ilTableGUI\$lng, ilAuthUtils\_getAuthMode(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilDatePresentation\formatDate(), ilAuthUtils\getAuthModeTranslation(), getMode(), ilTable2GUI\getParentObject(), ilTable2GUI\getSelectedColumns(), getUserFolderId(), IL_CAL_DATE, IL_CAL_DATETIME, ILIAS\Repository\lng(), and ilLanguage\txt().

605  : void // Missing array type.
606  {
607  global $DIC;
608 
609  $ilCtrl = $DIC['ilCtrl'];
610  $lng = $DIC['lng'];
611 
612  $ilCtrl->setParameterByClass("ilobjusergui", "letter", $this->user_request->getLetter());
613 
614  foreach ($this->getSelectedColumns() as $c) {
615  if ($c == "access_until") {
616  $this->tpl->setCurrentBlock("access_until");
617  $this->tpl->setVariable("VAL_ACCESS_UNTIL", $a_set["access_until"]);
618  $this->tpl->setVariable("CLASS_ACCESS_UNTIL", $a_set["access_class"]);
619  } elseif ($c == "last_login") {
620  $this->tpl->setCurrentBlock("last_login");
621  $this->tpl->setVariable(
622  "VAL_LAST_LOGIN",
623  ilDatePresentation::formatDate(new ilDateTime($a_set['last_login'], IL_CAL_DATETIME))
624  );
625  } elseif (in_array($c, array("firstname", "lastname"))) {
626  $this->tpl->setCurrentBlock($c);
627  $this->tpl->setVariable("VAL_" . strtoupper($c), (string) $a_set[$c]);
628  } elseif ($c == 'auth_mode') {
629  $this->tpl->setCurrentBlock('user_field');
630  $this->tpl->setVariable('VAL_UF', ilAuthUtils::getAuthModeTranslation(ilAuthUtils::_getAuthMode($a_set['auth_mode'])));
631  $this->tpl->parseCurrentBlock();
632  } else { // all other fields
633  $this->tpl->setCurrentBlock("user_field");
634  $val = (trim($a_set[$c]) == "")
635  ? " "
636  : $a_set[$c];
637  if ($a_set[$c] != "") {
638  switch ($c) {
639  case "birthday":
641  break;
642 
643  case "gender":
644  $val = $lng->txt("gender_" . $a_set[$c]);
645  break;
646 
647  case "create_date":
648  case "agree_date":
649  case "approve_date":
650  // $val = ilDatePresentation::formatDate(new ilDateTime($val,IL_CAL_DATETIME));
652  break;
653  }
654  }
655  $this->tpl->setVariable("VAL_UF", $val);
656  }
657 
658  $this->tpl->parseCurrentBlock();
659  }
660 
661  if ($a_set["usr_id"] != 6
662  && ($this->getMode() == self::MODE_USER_FOLDER || $a_set['time_limit_owner'] == $this->getUserFolderId())) {
663  $this->tpl->setCurrentBlock("checkb");
664  $this->tpl->setVariable("ID", $a_set["usr_id"]);
665  $this->tpl->parseCurrentBlock();
666  }
667 
668  if ($this->with_write_access
669  && ($this->getMode() == self::MODE_USER_FOLDER
670  || $a_set['time_limit_owner'] == $this->getUserFolderId())) {
671  $this->tpl->setVariable("VAL_LOGIN", $a_set["login"]);
672  $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $a_set["usr_id"]);
673  $this->tpl->setVariable(
674  "HREF_LOGIN",
675  $ilCtrl->getLinkTargetByClass("ilobjusergui", "view")
676  );
677  $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", "");
678  } else {
679  $this->tpl->setVariable('VAL_LOGIN_PLAIN', $a_set['login']);
680  }
681 
682  if ($this->getMode() == self::MODE_LOCAL_USER) {
683  $this->tpl->setCurrentBlock('context');
684  $this->tpl->setVariable(
685  'VAL_CONTEXT',
686  ilObject::_lookupTitle(ilObject::_lookupObjId($a_set['time_limit_owner']))
687  );
688  $this->tpl->parseCurrentBlock();
689 
690  $this->tpl->setCurrentBlock('roles');
691  $ilCtrl->setParameter($this->getParentObject(), 'obj_id', $a_set['usr_id']);
692  $this->tpl->setVariable('ROLE_LINK', $ilCtrl->getLinkTarget($this->getParentObject(), 'assignRoles'));
693  $this->tpl->setVariable('TXT_ROLES', $this->lng->txt('edit'));
694  $ilCtrl->clearParameters($this->getParentObject());
695  $this->tpl->parseCurrentBlock();
696  }
697  }
const IL_CAL_DATETIME
$c
Definition: cli.php:38
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
ilLanguage $lng
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getItems()

ilUserTableGUI::getItems ( )

Definition at line 272 of file class.ilUserTableGUI.php.

References $DIC, ilTableGUI\$lng, ilTable2GUI\$order_field, $query, ilLocalUser\_getFolderIds(), buildUserQuery(), ilTable2GUI\determineOffsetAndOrder(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilDatePresentation\formatDate(), getMode(), ilTable2GUI\getOffset(), ilTableGUI\getOrderDirection(), ilTable2GUI\getOrderField(), ilTable2GUI\getSelectedColumns(), IL_CAL_UNIX, ilObjUser\lookupOrgUnitsRepresentation(), ilTable2GUI\resetOffset(), ilTable2GUI\setData(), ilTableGUI\setMaxCount(), and ilLanguage\txt().

272  : void
273  {
274  global $DIC;
275 
276  $lng = $DIC['lng'];
277 
278  $this->determineOffsetAndOrder();
279  if ($this->getMode() == self::MODE_USER_FOLDER) {
280  // All accessible users
281  $user_filter = ilLocalUser::_getFolderIds(true);
282  } else {
283  if ($this->filter['time_limit_owner'] ?? null) {
284  $user_filter = array($this->filter['time_limit_owner']);
285  } else {
286  // All accessible users
287  $user_filter = ilLocalUser::_getFolderIds();
288  }
289  }
290 
291 
292 
293  //#13221 don't show all users if user filter is empty!
294  if (!count($user_filter)) {
295  $this->setMaxCount(0);
296  $this->setData([]);
297  return;
298  }
299 
300  if (isset($this->filter['user_ids']) && is_array($this->filter['user_ids']) && !count($this->filter['user_ids'])) {
301  $this->setMaxCount(0);
302  $this->setData([]);
303  return;
304  }
305 
306  $additional_fields = $this->getSelectedColumns();
307  unset(
308  $additional_fields["firstname"],
309  $additional_fields["lastname"],
310  $additional_fields["email"],
311  $additional_fields["second_email"],
312  $additional_fields["last_login"],
313  $additional_fields["access_until"],
314  $additional_fields['org_units']
315  );
316 
317  $udf_filter = array();
318  foreach ($this->filter as $k => $v) {
319  if (strpos($k, "udf_") === 0) {
320  $udf_filter[$k] = $v;
321  }
322  }
323 
324  $query = $this->buildUserQuery();
325  $order_field = $this->getOrderField();
326  if (strpos($order_field, "udf_") !== 0 || isset($additional_fields[$order_field])) {
327  $query->setOrderField($order_field);
328  $query->setOrderDirection($this->getOrderDirection());
329  }
330  $query->setAdditionalFields($additional_fields);
331  $query->setUserFolder($user_filter);
332  $query->setUdfFilter($udf_filter);
333  $usr_data = $query->query();
334 
335  if (count($usr_data["set"]) == 0 && $this->getOffset() > 0) {
336  $this->resetOffset();
337  $query->setOffset($this->getOffset());
338  $usr_data = $query->query();
339  }
340 
341  foreach ($usr_data["set"] as $k => $user) {
342  if (in_array('org_units', $this->getSelectedColumns())) {
343  $usr_data['set'][$k]['org_units'] = ilObjUser::lookupOrgUnitsRepresentation($user['usr_id']);
344  }
345 
346 
347  $current_time = time();
348  if ($user['active']) {
349  if ($user["time_limit_unlimited"]) {
350  $txt_access = $lng->txt("access_unlimited");
351  $usr_data["set"][$k]["access_class"] = "smallgreen";
352  } elseif ($user["time_limit_until"] < $current_time) {
353  $txt_access = $lng->txt("access_expired");
354  $usr_data["set"][$k]["access_class"] = "smallred";
355  } else {
356  $txt_access = ilDatePresentation::formatDate(new ilDateTime($user["time_limit_until"], IL_CAL_UNIX));
357  $usr_data["set"][$k]["access_class"] = "small";
358  }
359  } else {
360  $txt_access = $lng->txt("inactive");
361  $usr_data["set"][$k]["access_class"] = "smallred";
362  }
363  $usr_data["set"][$k]["access_until"] = $txt_access;
364  }
365 
366  $this->setMaxCount($usr_data["cnt"]);
367  $this->setData($usr_data["set"]);
368  }
setData(array $a_data)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
static lookupOrgUnitsRepresentation(int $a_usr_id)
lookup org unit representation
ilLanguage $lng
global $DIC
Definition: feed.php:28
resetOffset(bool $a_in_determination=false)
$query
static _getFolderIds(bool $access_with_orgunit=false)
determineOffsetAndOrder(bool $a_omit_offset=false)
setMaxCount(int $a_max_count)
set max.
+ Here is the call graph for this function:

◆ getMode()

ilUserTableGUI::getMode ( )
protected

Definition at line 123 of file class.ilUserTableGUI.php.

References $mode.

Referenced by fillRow(), getItems(), getSelectableColumns(), getUserIdsForFilter(), and initFilter().

123  : int
124  {
125  return $this->mode;
126  }
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilUserTableGUI::getSelectableColumns ( )

LTI, showing depending by mode user?

Definition at line 171 of file class.ilUserTableGUI.php.

References $cols, $DIC, Vendor\Package\$f, ilTableGUI\$lng, getMode(), and ilLanguage\txt().

171  : array // Missing array type.
172  {
173  global $DIC;
174 
175  $lng = $DIC['lng'];
176 
177  $up = new ilUserProfile();
178  $up->skipGroup("preferences");
179  $up->skipGroup("interests");
180  $up->skipGroup("settings");
181 
182  // default fields
183  $cols = array();
184 
185  // first and last name cannot be hidden
186  $cols["firstname"] = array(
187  "txt" => $lng->txt("firstname"),
188  "default" => true);
189  $cols["lastname"] = array(
190  "txt" => $lng->txt("lastname"),
191  "default" => true);
192  if ($this->getMode() == self::MODE_USER_FOLDER) {
193  $ufs = $up->getStandardFields();
194 
195  $cols["access_until"] = array(
196  "txt" => $lng->txt("access_until"),
197  "default" => true);
198  $cols["last_login"] = array(
199  "txt" => $lng->txt("last_login"),
200  "default" => true);
201 
202  // #13967
203  $cols["create_date"] = array(
204  "txt" => $lng->txt("create_date"));
205  $cols["approve_date"] = array(
206  "txt" => $lng->txt("approve_date"));
207  $cols["agree_date"] = array(
208  "txt" => $lng->txt("agree_date"));
209  } else {
210  $ufs = $up->getLocalUserAdministrationFields();
211  }
212 
213  // email should be the 1st "optional" field (can be hidden)
214  if (isset($ufs["email"])) {
215  $cols["email"] = array(
216  "txt" => $lng->txt("email"),
217  "default" => true);
218  }
219  if (isset($ufs["second_email"])) {
220  $cols["second_email"] = array(
221  "txt" => $lng->txt("second_email"),
222  "default" => true);
223  }
224  // other user profile fields
225  foreach ($ufs as $f => $fd) {
226  if (!isset($cols[$f]) && (!isset($fd["lists_hide"]) || !$fd["lists_hide"])) {
227  // #18795
228  $caption = $fd["lang_var"] ?? $f;
229  $cols[$f] = array(
230  "txt" => $lng->txt($caption),
231  "default" => false);
232  }
233  }
234 
235 
239  $cols["auth_mode"] = array(
240  "txt" => $lng->txt("auth_mode"),
241  "default" => false);
242 
243  foreach ($this->udf_fields as $k => $field) {
244  $cols[$k] = $field;
245  }
246 
247  // fields that are always shown
248  unset($cols["username"]);
249 
250  return $cols;
251  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class ilUserProfile.
ilLanguage $lng
global $DIC
Definition: feed.php:28
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:

◆ getUserDefinedField()

ilUserTableGUI::getUserDefinedField ( string  $a_key)

Get user defined field.

Definition at line 158 of file class.ilUserTableGUI.php.

158  : array // Missing array type.
159  {
160  return $this->udf_fields[$a_key] ?? array();
161  }

◆ getUserFolderId()

ilUserTableGUI::getUserFolderId ( )
protected

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

References $user_folder_id.

Referenced by fillRow(), and initFilter().

128  : int
129  {
130  return $this->user_folder_id;
131  }
+ Here is the caller graph for this function:

◆ getUserIdsForFilter()

ilUserTableGUI::getUserIdsForFilter ( )

Definition at line 375 of file class.ilUserTableGUI.php.

References $query, ilLocalUser\_getFolderIds(), buildUserQuery(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), getMode(), ilTableGUI\getOrderDirection(), ilTable2GUI\getOrderField(), ilUtil\stripSlashes(), and SYSTEM_USER_ID.

375  : array // Missing array type.
376  {
377  if ($this->getMode() == self::MODE_USER_FOLDER) {
378  // All accessible users
379  $user_filter = ilLocalUser::_getFolderIds(true);
380  } else {
381  if ($this->filter['time_limit_owner']) {
382  $user_filter = array($this->filter['time_limit_owner']);
383  } else {
384  // All accessible users
385  $user_filter = ilLocalUser::_getFolderIds();
386  }
387  }
388 
389  if (!isset($this->filter['user_ids'])) {
390  $this->filter['user_ids'] = null;
391  }
392 
393  $query = $this->buildUserQuery();
394  $query->setUserFolder($user_filter);
395  if ($this->getOrderField()) {
396  $query->setOrderField(ilUtil::stripSlashes($this->getOrderField()));
397  $query->setOrderDirection(ilUtil::stripSlashes($this->getOrderDirection()));
398  }
399  $usr_data = $query->query();
400 
401  $user_ids = array();
402 
403  foreach ($usr_data["set"] as $item) {
404  // #11632
405  if ($item["usr_id"] != SYSTEM_USER_ID) {
406  $user_ids[] = $item["usr_id"];
407  }
408  }
409  return $user_ids;
410  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
$query
static _getFolderIds(bool $access_with_orgunit=false)
+ Here is the call graph for this function:

◆ initFilter()

ilUserTableGUI::initFilter ( )

Definition at line 412 of file class.ilUserTableGUI.php.

References $DIC, Vendor\Package\$f, ilTable2GUI\$id, $ilUser, ilTableGUI\$lng, $ref_id, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilLocalUser\_getFolderIds(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilTable2GUI\addFilterItem(), addFilterItemByUdfType(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilAuthUtils\getAuthModeTranslation(), getMode(), getUserFolderId(), IL_CAL_DAY, IL_CAL_UNIX, ILIAS\Repository\lng(), ilDateTimeInputGUI\setDate(), ilRepositorySelectorInputGUI\setSelectText(), ilLanguage\txt(), and USER_FOLDER_ID.

412  : void
413  {
414  global $DIC;
415 
416  $lng = $DIC['lng'];
417  $rbacreview = $DIC['rbacreview'];
418  $ilUser = $DIC['ilUser'];
419  $ilCtrl = $DIC['ilCtrl'];
420 
421 
422  // Show context filter
423  if ($this->getMode() == self::MODE_LOCAL_USER) {
424  $parent_ids = ilLocalUser::_getFolderIds();
425 
426  if (count($parent_ids) > 1) {
427  $co = new ilSelectInputGUI($lng->txt('context'), 'time_limit_owner');
428 
429  $ref_id = $this->getUserFolderId();
430 
431  $opt[0] = $this->lng->txt('all_users');
432  $opt[$this->getUserFolderId()] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($this->getUserFolderId())) . ')';
433 
434  foreach ($parent_ids as $parent_id) {
435  if ($parent_id == $this->getUserFolderId()) {
436  continue;
437  }
438  switch ($parent_id) {
439  case USER_FOLDER_ID:
440  $opt[USER_FOLDER_ID] = $lng->txt('global_user');
441  break;
442 
443  default:
444  $opt[$parent_id] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($parent_id)) . ')';
445  break;
446  }
447  }
448  $co->setOptions($opt);
449  $this->addFilterItem($co);
450  $co->readFromSession();
451  $this->filter['time_limit_owner'] = $co->getValue();
452  }
453  }
454 
455  // User name, login, email filter
456  $ul = new ilTextInputGUI($lng->txt("login") . "/" . $lng->txt("email") . "/" .
457  $lng->txt("name"), "query");
458  $ul->setDataSource($ilCtrl->getLinkTarget(
459  $this->getParentObject(),
460  "addUserAutoComplete",
461  "",
462  true
463  ));
464  $ul->setSize(20);
465  $ul->setSubmitFormOnEnter(true);
466  $this->addFilterItem($ul);
467  $ul->readFromSession();
468  $this->filter["query"] = $ul->getValue();
469 
470 
471  // activation
472  $options = array(
473  "" => $lng->txt("user_all"),
474  "active" => $lng->txt("active"),
475  "inactive" => $lng->txt("inactive"),
476  );
477  $si = new ilSelectInputGUI($this->lng->txt("user_activation"), "activation");
478  $si->setOptions($options);
479  $this->addFilterItem($si);
480  $si->readFromSession();
481  $this->filter["activation"] = $si->getValue();
482 
483  // limited access
484  $cb = new ilCheckboxInputGUI($this->lng->txt("user_limited_access"), "limited_access");
485  $this->addFilterItem($cb);
486  $cb->readFromSession();
487  $this->filter["limited_access"] = $cb->getChecked();
488 
489  // last login
490  $di = new ilDateTimeInputGUI($this->lng->txt("user_last_login_before"), "last_login");
491  $default_date = new ilDateTime(time(), IL_CAL_UNIX);
492  $default_date->increment(IL_CAL_DAY, 1);
493  $di->setDate($default_date);
494  $this->addFilterItem($di);
495  $di->readFromSession();
496  $this->filter["last_login"] = $di->getDate();
497 
498  if ($this->getMode() == self::MODE_USER_FOLDER) {
499  // no assigned courses
500  $cb = new ilCheckboxInputGUI($this->lng->txt("user_no_courses"), "no_courses");
501  $this->addFilterItem($cb);
502  $cb->readFromSession();
503  $this->filter["no_courses"] = $cb->getChecked();
504 
505  // no assigned groups
506  $ng = new ilCheckboxInputGUI($this->lng->txt("user_no_groups"), "no_groups");
507  $this->addFilterItem($ng);
508  $ng->readFromSession();
509  $this->filter['no_groups'] = $ng->getChecked();
510 
511  // course/group members
512  $rs = new ilRepositorySelectorInputGUI($lng->txt("user_member_of_course_group"), "course_group");
513  $rs->setSelectText($lng->txt("user_select_course_group"));
514  $rs->setHeaderMessage($lng->txt("user_please_select_course_group"));
515  $rs->setClickableTypes(array("crs", "grp"));
516  $this->addFilterItem($rs);
517  $rs->readFromSession();
518  $this->filter["course_group"] = $rs->getValue();
519  }
520 
521  // global roles
522  $options = array(
523  "" => $lng->txt("user_any"),
524  );
525  foreach ($rbacreview->getRolesByFilter(2, $ilUser->getId()) as $role) {
526  $options[$role["rol_id"]] = $role["title"];
527  }
528  $si = new ilSelectInputGUI($this->lng->txt("user_global_role"), "global_role");
529  $si->setOptions($options);
530  $this->addFilterItem($si);
531  $si->readFromSession();
532  $this->filter["global_role"] = $si->getValue();
533 
534  // authentication mode
535  $auth_methods = ilAuthUtils::_getActiveAuthModes();
536  $options = array(
537  "" => $lng->txt("user_any"),
538  );
539  foreach ($auth_methods as $method => $value) {
540  if ($method == 'default') {
541  $options[$method] = $this->lng->txt('auth_' . $method) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($value)) . ")";
542  } else {
543  $options[$method] = ilAuthUtils::getAuthModeTranslation($value);
544  }
545  }
546  $si = new ilSelectInputGUI($this->lng->txt("auth_mode"), "authentication_method");
547  $si->setOptions($options);
548  $this->addFilterItem($si);
549  $si->readFromSession();
550  $this->filter["authentication"] = $si->getValue();
551 
552  // udf fields
553  foreach ($this->udf_fields as $id => $f) {
554  $this->addFilterItemByUdfType($id, $f["type"], true, $f["txt"], $f["options"]);
555  }
556  }
const USER_FOLDER_ID
Definition: constants.php:33
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
This class represents a checkbox property in a property form.
static _getActiveAuthModes()
const IL_CAL_UNIX
static _getAuthModeName($a_auth_key)
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
const IL_CAL_DAY
$ref_id
Definition: ltiauth.php:67
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDate(ilDateTime $a_date=null)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
addFilterItemByUdfType(string $id, int $type, bool $a_optional=false, ?string $caption=null, array $a_options=array())
Add filter by standard type.
$ilUser
Definition: imgupload.php:34
static _getFolderIds(bool $access_with_orgunit=false)
+ Here is the call graph for this function:

◆ isUdfColumn()

ilUserTableGUI::isUdfColumn ( string  $a_key)

Definition at line 163 of file class.ilUserTableGUI.php.

163  : bool
164  {
165  if (strpos($a_key, "udf_") === 0) {
166  return true;
167  }
168  return false;
169  }

◆ readUserDefinedFieldsDefinitions()

ilUserTableGUI::readUserDefinedFieldsDefinitions ( )

Read user defined fields definitions.

Definition at line 136 of file class.ilUserTableGUI.php.

References ilUserDefinedFields\_getInstance(), UDF_TYPE_SELECT, and UDF_TYPE_TEXT.

136  : void
137  {
138  $user_defined_fields = ilUserDefinedFields::_getInstance();
139  foreach ($user_defined_fields->getDefinitions() as $field => $definition) {
140  if ($this->mode === self::MODE_LOCAL_USER
141  && $definition['visib_lua'] === '0') {
142  continue;
143  }
144 
145  $this->udf_fields["udf_" . $field] = array(
146  "txt" => $definition["field_name"],
147  "default" => false,
148  "options" => $definition["field_values"],
149  "type" => $definition["field_type"],
150  "sortable" => in_array($definition["field_type"], array(UDF_TYPE_TEXT, UDF_TYPE_SELECT)),
151  );
152  }
153  }
const UDF_TYPE_SELECT
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ setMode()

ilUserTableGUI::setMode ( int  $a_mode)
protected

Definition at line 118 of file class.ilUserTableGUI.php.

118  : void
119  {
120  $this->mode = $a_mode;
121  }

Field Documentation

◆ $filter

array ilUserTableGUI::$filter = []
protected

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

Referenced by addFilterItemValue().

◆ $mode

int ilUserTableGUI::$mode = null
private

Definition at line 29 of file class.ilUserTableGUI.php.

Referenced by getMode().

◆ $udf_fields

array ilUserTableGUI::$udf_fields = []
protected

Definition at line 33 of file class.ilUserTableGUI.php.

◆ $user_folder_id

int ilUserTableGUI::$user_folder_id = 0
private

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

Referenced by getUserFolderId().

◆ $user_request

ILIAS User StandardGUIRequest ilUserTableGUI::$user_request
protected

Definition at line 32 of file class.ilUserTableGUI.php.

◆ $with_write_access

bool ilUserTableGUI::$with_write_access = false
private

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

◆ MODE_LOCAL_USER

◆ MODE_USER_FOLDER

const ilUserTableGUI::MODE_USER_FOLDER = 1

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