ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUserTableGUI Class Reference

TableGUI class for user administration. 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=[])
 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 ()
 
 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

UserGUIRequest $user_request
 
array $udf_fields = []
 
array $filter = []
 
- 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 $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

TableGUI class for user administration.

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

Definition at line 28 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 = [] 
)

Add filter by standard type.

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

References $DIC, ilTable2GUI\$id, ilTableGUI\$lng, ilTable2GUI\addFilterItem(), ILIAS\Repository\filter(), ILIAS\Repository\lng(), null, ilLanguage\txt(), UDF_TYPE_SELECT, and UDF_TYPE_TEXT.

Referenced by initFilter().

571  : ?ilFormPropertyGUI {
572  global $DIC;
573 
574  $lng = $DIC['lng'];
575 
576  if (!$caption) {
577  $caption = $lng->txt($id);
578  }
579 
580  switch ($type) {
581  case UDF_TYPE_SELECT:
582  $item = new ilSelectInputGUI($caption, $id);
583  $sel_options = ["" => $this->lng->txt("user_all")];
584  foreach ($a_options as $o) {
585  $sel_options[$o] = $o;
586  }
587  $item->setOptions($sel_options);
588  break;
589 
590  case UDF_TYPE_TEXT:
591  $item = new ilTextInputGUI($caption, $id);
592  $item->setMaxLength(64);
593  $item->setSize(20);
594  // $item->setSubmitFormOnEnter(true);
595  break;
596 
597  default:
598  return null;
599  }
600 
601  if ($item) {
602  $this->addFilterItem($item, $a_optional);
603  $item->readFromSession();
604  $this->filter[$id] = $item->getValue();
605  }
606  return $item;
607  }
const UDF_TYPE_SELECT
This class represents a selection list property in a property form.
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)
ilLanguage $lng
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFilterItemValue()

ilUserTableGUI::addFilterItemValue (   $filter,
  $value 
)

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

References $filter, and ILIAS\Repository\filter().

374  : void // Missing parameter types.
375  {
376  $this->filter[$filter] = $value;
377  }
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ buildUserQuery()

ilUserTableGUI::buildUserQuery ( )
protected

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

References ILIAS\Repository\filter(), ilTable2GUI\getLimit(), ilTable2GUI\getOffset(), and null.

Referenced by getItems(), and getUserIdsForFilter().

257  : ilUserQuery
258  {
259  $query = new ilUserQuery();
260  $query->setOffset($this->getOffset());
261  $query->setLimit($this->getLimit());
262  $query->setTextFilter($this->filter['query'] ?? '');
263  $query->setActionFilter($this->filter['activation'] ?? '');
264  $query->setLastLogin($this->filter['last_login'] ?? null);
265  $query->setLimitedAccessFilter($this->filter['limited_access'] ?? false);
266  $query->setNoCourseFilter($this->filter['no_courses'] ?? false);
267  $query->setNoGroupFilter($this->filter['no_groups'] ?? false);
268  $query->setCourseGroupFilter($this->filter['course_group'] ?? 0);
269  $query->setRoleFilter((int) ($this->filter['global_role'] ?? 0));
270  $query->setUserFilter($this->filter['user_ids'] ?? []);
271  $query->setFirstLetterLastname($this->user_request->getLetter());
272  $query->setAuthenticationFilter($this->filter['authentication'] ?? '');
273  return $query;
274  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ 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 609 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, IL_CAL_UNIX, ILIAS\Repository\lng(), and ilLanguage\txt().

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

◆ getItems()

ilUserTableGUI::getItems ( )

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

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

276  : void
277  {
278  global $DIC;
279 
280  $lng = $DIC['lng'];
281 
282  $this->determineOffsetAndOrder();
283  if ($this->getMode() == self::MODE_USER_FOLDER) {
284  // All accessible users
285  $user_filter = ilLocalUser::_getFolderIds(true);
286  } else {
287  if ($this->filter['time_limit_owner'] ?? null) {
288  $user_filter = [$this->filter['time_limit_owner']];
289  } else {
290  // All accessible users
291  $user_filter = ilLocalUser::_getFolderIds();
292  }
293  }
294 
295 
296 
297  //#13221 don't show all users if user filter is empty!
298  if (!count($user_filter)) {
299  $this->setMaxCount(0);
300  $this->setData([]);
301  return;
302  }
303 
304  if (isset($this->filter['user_ids']) && is_array($this->filter['user_ids']) && $this->filter['user_ids'] === []) {
305  $this->setMaxCount(0);
306  $this->setData([]);
307  return;
308  }
309 
310  $additional_fields = $this->getSelectedColumns();
311  unset(
312  $additional_fields["firstname"],
313  $additional_fields["lastname"],
314  $additional_fields["email"],
315  $additional_fields["second_email"],
316  $additional_fields["last_login"],
317  $additional_fields["access_until"],
318  $additional_fields['org_units']
319  );
320 
321  $udf_filter = [];
322  foreach ($this->filter as $k => $v) {
323  if (strpos($k, "udf_") === 0) {
324  $udf_filter[$k] = $v;
325  }
326  }
327 
328  $query = $this->buildUserQuery();
329  $order_field = $this->getOrderField();
330  if (strpos($order_field, "udf_") !== 0 || isset($additional_fields[$order_field])) {
331  $query->setOrderField($order_field);
332  $query->setOrderDirection($this->getOrderDirection());
333  }
334  $query->setAdditionalFields($additional_fields);
335  $query->setUserFolder($user_filter);
336  $query->setUdfFilter($udf_filter);
337  $usr_data = $query->query();
338 
339  if (count($usr_data['set']) == 0 && $this->getOffset() > 0) {
340  $this->resetOffset();
341  $query->setOffset($this->getOffset());
342  $usr_data = $query->query();
343  }
344 
345  foreach ($usr_data['set'] as $k => $user) {
346  if (in_array('org_units', $this->getSelectedColumns())) {
347  $usr_data['set'][$k]['org_units'] = ilObjUser::lookupOrgUnitsRepresentation($user['usr_id']);
348  }
349 
350 
351  $current_time = time();
352  if ($user['active']) {
353  if ($user['time_limit_unlimited']) {
354  $txt_access = $lng->txt('access_unlimited');
355  $usr_data['set'][$k]['access_class'] = 'smallgreen';
356  } elseif ($user['time_limit_until'] < $current_time) {
357  $txt_access = $lng->txt('access_expired');
358  $usr_data['set'][$k]['access_class'] = 'smallred';
359  } else {
360  $txt_access = ilDatePresentation::formatDate(new ilDateTime($user['time_limit_until'], IL_CAL_UNIX));
361  $usr_data['set'][$k]['access_class'] = 'small';
362  }
363  } else {
364  $txt_access = $lng->txt('inactive');
365  $usr_data['set'][$k]['access_class'] = 'smallred';
366  }
367  $usr_data['set'][$k]['access_until'] = $txt_access;
368  }
369 
370  $this->setMaxCount($usr_data['cnt']);
371  $this->setData($usr_data['set']);
372  }
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...
const IL_CAL_UNIX
static lookupOrgUnitsRepresentation(int $a_usr_id)
lookup org unit representation
ilLanguage $lng
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
resetOffset(bool $a_in_determination=false)
global $DIC
Definition: shib_login.php:22
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static _getFolderIds(bool $access_with_orgunit=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
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 125 of file class.ilUserTableGUI.php.

References $mode.

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

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

◆ getSelectableColumns()

ilUserTableGUI::getSelectableColumns ( )

LTI, showing depending by mode user?

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

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

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

◆ getUserDefinedField()

ilUserTableGUI::getUserDefinedField ( string  $a_key)

Get user defined field.

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

160  : array // Missing array type.
161  {
162  return $this->udf_fields[$a_key] ?? [];
163  }

◆ getUserFolderId()

ilUserTableGUI::getUserFolderId ( )
protected

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

References $user_folder_id.

Referenced by fillRow(), and initFilter().

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

◆ getUserIdsForFilter()

ilUserTableGUI::getUserIdsForFilter ( )

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

References ilLocalUser\_getFolderIds(), buildUserQuery(), ILIAS\Repository\filter(), getMode(), ilTableGUI\getOrderDirection(), ilTable2GUI\getOrderField(), null, ilUtil\stripSlashes(), and SYSTEM_USER_ID.

379  : array // Missing array type.
380  {
381  if ($this->getMode() == self::MODE_USER_FOLDER) {
382  // All accessible users
383  $user_filter = ilLocalUser::_getFolderIds(true);
384  } else {
385  if ($this->filter['time_limit_owner']) {
386  $user_filter = [$this->filter['time_limit_owner']];
387  } else {
388  // All accessible users
389  $user_filter = ilLocalUser::_getFolderIds();
390  }
391  }
392 
393  if (!isset($this->filter['user_ids'])) {
394  $this->filter['user_ids'] = null;
395  }
396 
397  $query = $this->buildUserQuery();
398  $query->setUserFolder($user_filter);
399  if ($this->getOrderField()) {
400  $query->setOrderField(ilUtil::stripSlashes($this->getOrderField()));
401  $query->setOrderDirection(ilUtil::stripSlashes($this->getOrderDirection()));
402  }
403  $usr_data = $query->query();
404 
405  $user_ids = [];
406 
407  foreach ($usr_data["set"] as $item) {
408  // #11632
409  if ($item["usr_id"] != SYSTEM_USER_ID) {
410  $user_ids[] = $item["usr_id"];
411  }
412  }
413  return $user_ids;
414  }
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getFolderIds(bool $access_with_orgunit=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ initFilter()

ilUserTableGUI::initFilter ( )

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

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

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

◆ isUdfColumn()

ilUserTableGUI::isUdfColumn ( string  $a_key)

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

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

◆ readUserDefinedFieldsDefinitions()

ilUserTableGUI::readUserDefinedFieldsDefinitions ( )

Read user defined fields definitions.

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

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

138  : void
139  {
140  $user_defined_fields = ilUserDefinedFields::_getInstance();
141  foreach ($user_defined_fields->getDefinitions() as $field => $definition) {
142  if ($this->mode === self::MODE_LOCAL_USER
143  && $definition['visib_lua'] === '0') {
144  continue;
145  }
146 
147  $this->udf_fields["udf_" . $field] = [
148  "txt" => $definition["field_name"],
149  "default" => false,
150  "options" => $definition["field_values"],
151  "type" => $definition["field_type"],
152  "sortable" => in_array($definition["field_type"], [UDF_TYPE_TEXT, UDF_TYPE_SELECT])
153  ];
154  }
155  }
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 120 of file class.ilUserTableGUI.php.

120  : void
121  {
122  $this->mode = $a_mode;
123  }

Field Documentation

◆ $filter

array ilUserTableGUI::$filter = []
protected

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

Referenced by addFilterItemValue().

◆ $mode

int ilUserTableGUI::$mode = null
private

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

Referenced by getMode().

◆ $udf_fields

array ilUserTableGUI::$udf_fields = []
protected

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

◆ $user_folder_id

int ilUserTableGUI::$user_folder_id = 0
private

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

Referenced by getUserFolderId().

◆ $user_request

UserGUIRequest ilUserTableGUI::$user_request
protected

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

◆ $with_write_access

bool ilUserTableGUI::$with_write_access = false
private

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