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

TableGUI class for user administration. More...

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

Public Member Functions

 getSelectableColumns ()
 Get selectable columns. More...
 
 getItems ()
 
 addFilterItemValue ($filter, $value)
 
 getUserIdsForFilter ()
 
 initFilter ()
 
 addFilterItemByUdfType (string $id, string $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)
 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 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)
 Standard Version of Fill Row. 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

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 @ilCtrl_Calls ilUserTableGUI: ilFormPropertyDispatchGUI

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

Member Function Documentation

◆ addFilterItemByUdfType()

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

Add filter by standard type.

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

528 global $DIC;
529
530 $lng = $DIC['lng'];
531
532 if (!$caption) {
533 $caption = $lng->txt($id);
534 }
535
536 switch ($type) {
537 case UDF_TYPE_SELECT:
538 $item = new ilSelectInputGUI($caption, $id);
539 $sel_options = ["" => $this->lng->txt("user_all")];
540 foreach ($a_options as $o) {
541 $sel_options[$o] = $o;
542 }
543 $item->setOptions($sel_options);
544 break;
545
546 case UDF_TYPE_TEXT:
547 $item = new ilTextInputGUI($caption, $id);
548 $item->setMaxLength(64);
549 $item->setSize(20);
550 // $item->setSubmitFormOnEnter(true);
551 break;
552
553 default:
554 return null;
555 }
556
557 if ($item) {
558 $this->addFilterItem($item, $a_optional);
559 $item->readFromSession();
560 $this->filter[$id] = $item->getValue();
561 }
562 return $item;
563 }
This class represents a 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...
This class represents a selection list property in a property form.
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
ilLanguage $lng
This class represents a text property in a property form.
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
global $DIC
Definition: shib_login.php:26

References ilTable2GUI\$id, ilTableGUI\$lng, and ilLanguage\txt().

Referenced by initFilter().

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

◆ addFilterItemValue()

ilUserTableGUI::addFilterItemValue (   $filter,
  $value 
)

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

330 : void // Missing parameter types.
331 {
332 $this->filter[$filter] = $value;
333 }

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

+ Here is the call graph for this function:

◆ buildUserQuery()

ilUserTableGUI::buildUserQuery ( )
protected

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

214 {
215 $query = new ilUserQuery();
216 $query->setOffset($this->getOffset());
217 $query->setLimit($this->getLimit());
218 $query->setTextFilter($this->filter['query'] ?? '');
219 $query->setActionFilter($this->filter['activation'] ?? '');
220 $query->setLastLogin($this->filter['last_login'] ?? null);
221 $query->setLimitedAccessFilter($this->filter['limited_access'] ?? false);
222 $query->setNoCourseFilter($this->filter['no_courses'] ?? false);
223 $query->setNoGroupFilter($this->filter['no_groups'] ?? false);
224 $query->setCourseGroupFilter($this->filter['course_group'] ?? 0);
225 $query->setRoleFilter((int) ($this->filter['global_role'] ?? 0));
226 $query->setUserFilter($this->filter['user_ids'] ?? []);
227 $query->setFirstLetterLastname($this->user_request->getLetter());
228 $query->setAuthenticationFilter($this->filter['authentication'] ?? '');
229 return $query;
230 }
User query class.

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

Referenced by getItems(), and getUserIdsForFilter().

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

◆ fillRow()

ilUserTableGUI::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 565 of file class.ilUserTableGUI.php.

565 : void // Missing array type.
566 {
567 global $DIC;
568
569 $ilCtrl = $DIC['ilCtrl'];
570 $lng = $DIC['lng'];
571
572 $ilCtrl->setParameterByClass("ilobjusergui", "letter", $this->user_request->getLetter());
573
574 foreach ($this->getSelectedColumns() as $c) {
575 if ($c == "access_until") {
576 $this->tpl->setCurrentBlock("access_until");
577 $this->tpl->setVariable("VAL_ACCESS_UNTIL", $a_set["access_until"]);
578 $this->tpl->setVariable("CLASS_ACCESS_UNTIL", $a_set["access_class"]);
579 } elseif ($c == "last_login") {
580 $this->tpl->setCurrentBlock("last_login");
581 $this->tpl->setVariable(
582 "VAL_LAST_LOGIN",
584 );
585 } elseif (in_array($c, ["firstname", "lastname"])) {
586 $this->tpl->setCurrentBlock($c);
587 $this->tpl->setVariable("VAL_" . strtoupper($c), (string) $a_set[$c]);
588 } elseif ($c == 'auth_mode') {
589 $this->tpl->setCurrentBlock('user_field');
590 $this->tpl->setVariable('VAL_UF', ilAuthUtils::getAuthModeTranslation((string) ilAuthUtils::_getAuthMode($a_set['auth_mode'])));
591 $this->tpl->parseCurrentBlock();
592 } else { // all other fields
593 $this->tpl->setCurrentBlock("user_field");
594 $val = (trim($a_set[$c] ?? '') == "")
595 ? " "
596 : $a_set[$c];
597 if ($a_set[$c] != "") {
598 switch ($c) {
599 case "birthday":
601 break;
602
603 case "gender":
604 $val = $lng->txt("gender_" . $a_set[$c]);
605 break;
606
607 case "create_date":
608 case "agree_date":
609 case "approve_date":
610 // $val = ilDatePresentation::formatDate(new ilDateTime($val,IL_CAL_DATETIME));
612 break;
613 case 'dpro_agreed_on':
615 break;
616 }
617 }
618 $this->tpl->setVariable("VAL_UF", $val);
619 }
620
621 $this->tpl->parseCurrentBlock();
622 }
623
624 if ($a_set["usr_id"] != 6
625 && ($this->getMode() == self::MODE_USER_FOLDER || $a_set['time_limit_owner'] == $this->getUserFolderId())) {
626 $this->tpl->setCurrentBlock("checkb");
627 $this->tpl->setVariable("ID", $a_set["usr_id"]);
628 $this->tpl->parseCurrentBlock();
629 }
630
631 if ($this->with_write_access
632 && ($this->getMode() === self::MODE_USER_FOLDER
633 || $a_set['time_limit_owner'] == $this->getUserFolderId())) {
634 $this->tpl->setVariable("VAL_LOGIN", $a_set["login"]);
635 $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $a_set["usr_id"]);
636 $this->tpl->setVariable(
637 "HREF_LOGIN",
638 $ilCtrl->getLinkTargetByClass("ilobjusergui", "view")
639 );
640 $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", "");
641 } else {
642 $this->tpl->setVariable('VAL_LOGIN_PLAIN', $a_set['login']);
643 }
644
645 if ($this->getMode() == self::MODE_LOCAL_USER) {
646 $this->tpl->setCurrentBlock('context');
647 $this->tpl->setVariable(
648 'VAL_CONTEXT',
649 ilObject::_lookupTitle(ilObject::_lookupObjId($a_set['time_limit_owner']))
650 );
651 $this->tpl->parseCurrentBlock();
652
653 $this->tpl->setCurrentBlock('roles');
654 $ilCtrl->setParameter($this->getParentObject(), 'obj_id', $a_set['usr_id']);
655 $this->tpl->setVariable('ROLE_LINK', $ilCtrl->getLinkTarget($this->getParentObject(), 'assignRoles'));
656 $this->tpl->setVariable('TXT_ROLES', $this->lng->txt('edit'));
657 $ilCtrl->clearParameters($this->getParentObject());
658 $this->tpl->parseCurrentBlock();
659 }
660 }
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
Class for single dates.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
$c
Definition: deliver.php:25

References $c, $DIC, $lng, ilAuthUtils\_getAuthMode(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilDatePresentation\formatDate(), ilAuthUtils\getAuthModeTranslation(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getItems()

ilUserTableGUI::getItems ( )

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

232 : void
233 {
234 global $DIC;
235
236 $lng = $DIC['lng'];
237
239 if ($this->getMode() == self::MODE_USER_FOLDER) {
240 // All accessible users
241 $user_filter = ilLocalUser::_getFolderIds(true);
242 } else {
243 if ($this->filter['time_limit_owner'] ?? null) {
244 $user_filter = [$this->filter['time_limit_owner']];
245 } else {
246 // All accessible users
247 $user_filter = ilLocalUser::_getFolderIds();
248 }
249 }
250
251
252
253 //#13221 don't show all users if user filter is empty!
254 if (!count($user_filter)) {
255 $this->setMaxCount(0);
256 $this->setData([]);
257 return;
258 }
259
260 if (isset($this->filter['user_ids']) && is_array($this->filter['user_ids']) && $this->filter['user_ids'] === []) {
261 $this->setMaxCount(0);
262 $this->setData([]);
263 return;
264 }
265
266 $additional_fields = $this->getSelectedColumns();
267 unset(
268 $additional_fields["firstname"],
269 $additional_fields["lastname"],
270 $additional_fields["email"],
271 $additional_fields["second_email"],
272 $additional_fields["last_login"],
273 $additional_fields["access_until"],
274 $additional_fields['org_units']
275 );
276
277 $udf_filter = [];
278 foreach ($this->filter as $k => $v) {
279 if (strpos($k, "udf_") === 0) {
280 $udf_filter[$k] = $v;
281 }
282 }
283
284 $query = $this->buildUserQuery();
285 $order_field = $this->getOrderField();
286 if (strpos($order_field, "udf_") !== 0 || isset($additional_fields[$order_field])) {
287 $query->setOrderField($order_field);
288 $query->setOrderDirection($this->getOrderDirection());
289 }
290 $query->setAdditionalFields($additional_fields);
291 $query->setUserFolder($user_filter);
292 $query->setUdfFilter($udf_filter);
293 $usr_data = $query->query();
294
295 if (count($usr_data['set']) == 0 && $this->getOffset() > 0) {
296 $this->resetOffset();
297 $query->setOffset($this->getOffset());
298 $usr_data = $query->query();
299 }
300
301 foreach ($usr_data['set'] as $k => $user) {
302 if (in_array('org_units', $this->getSelectedColumns())) {
303 $usr_data['set'][$k]['org_units'] = ilObjUser::lookupOrgUnitsRepresentation($user['usr_id']);
304 }
305
306
307 $current_time = time();
308 if ($user['active']) {
309 if ($user['time_limit_unlimited']) {
310 $txt_access = $lng->txt('access_unlimited');
311 $usr_data['set'][$k]['access_class'] = 'smallgreen';
312 } elseif ($user['time_limit_until'] < $current_time) {
313 $txt_access = $lng->txt('access_expired');
314 $usr_data['set'][$k]['access_class'] = 'smallred';
315 } else {
316 $txt_access = ilDatePresentation::formatDate(new ilDateTime($user['time_limit_until'], IL_CAL_UNIX));
317 $usr_data['set'][$k]['access_class'] = 'small';
318 }
319 } else {
320 $txt_access = $lng->txt('inactive');
321 $usr_data['set'][$k]['access_class'] = 'smallred';
322 }
323 $usr_data['set'][$k]['access_until'] = $txt_access;
324 }
325
326 $this->setMaxCount($usr_data['cnt']);
327 $this->setData($usr_data['set']);
328 }
static _getFolderIds(bool $access_with_orgunit=false)
static lookupOrgUnitsRepresentation(int $a_usr_id)
determineOffsetAndOrder(bool $a_omit_offset=false)
resetOffset(bool $a_in_determination=false)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.

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(), ilTable2GUI\resetOffset(), ilTable2GUI\setData(), ilTableGUI\setMaxCount(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getMode()

ilUserTableGUI::getMode ( )
protected

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

122 : int
123 {
124 return $this->mode;
125 }

References $mode.

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

+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilUserTableGUI::getSelectableColumns ( )

Get selectable columns.

Returns
array key: column id, val: true/false -> default on/off

Reimplemented from ilTable2GUI.

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

132 : array // Missing array type.
133 {
134 global $DIC;
135
136 $lng = $DIC['lng'];
137
138 $up = LocalDIC::dic()[Profile::class];
139
140 // default fields
141 $cols = [];
142
143 // first and last name cannot be hidden
144 $cols["firstname"] = [
145 "txt" => $lng->txt("firstname"),
146 "default" => true];
147 $cols["lastname"] = [
148 "txt" => $lng->txt("lastname"),
149 "default" => true];
150
151 $cols["access_until"] = [
152 "txt" => $lng->txt("access_until"),
153 "default" => true];
154 $cols["last_login"] = [
155 "txt" => $lng->txt("last_login"),
156 "default" => true];
157
158 // #13967
159 $cols["create_date"] = [
160 "txt" => $lng->txt("create_date")];
161 $cols["approve_date"] = [
162 "txt" => $lng->txt("approve_date")];
163 $cols["agree_date"] = [
164 "txt" => $lng->txt("agree_date")];
165 $cols['dpro_agreed_on'] = [
166 'txt' => $lng->txt('dpro_agreed_on')];
167
168 $context = ProfileContext::LocalUserAdministration;
169 if ($this->getMode() === self::MODE_USER_FOLDER) {
170 $context = ProfileContext::UserAdministration;
171 }
172
173 $ufs = $up->getVisibleFields($context);
174
175 // email should be the 1st "optional" field (can be hidden)
176 if (isset($ufs['email'])) {
177 $cols['email'] = [
178 'txt' => $lng->txt('email'),
179 'default' => true];
180 }
181 if (isset($ufs['second_email'])) {
182 $cols['second_email'] = [
183 'txt' => $lng->txt('second_email'),
184 'default' => true];
185 }
186
187 foreach ($ufs as $f => $fd) {
188 if (isset($cols[$f])) {
189 continue;
190 }
191 $cols[$f] = [
192 'txt' => $fd->getLabel($this->lng),
193 'default' => false];
194 }
195
196 $cols['auth_mode'] = [
197 'txt' => $lng->txt('auth_mode'),
198 'default' => false];
199
200 foreach ($this->udf_fields as $k => $field) {
201 if ($field->hiddenInLists()) {
202 continue;
203 }
204 $cols[$k] = $field;
205 }
206
207 // fields that are always shown
208 unset($cols['username']);
209
210 return $cols;
211 }

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

+ Here is the call graph for this function:

◆ getUserFolderId()

ilUserTableGUI::getUserFolderId ( )
protected

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

127 : int
128 {
130 }

References $user_folder_id.

Referenced by initFilter().

+ Here is the caller graph for this function:

◆ getUserIdsForFilter()

ilUserTableGUI::getUserIdsForFilter ( )

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

335 : array // Missing array type.
336 {
337 if ($this->getMode() == self::MODE_USER_FOLDER) {
338 // All accessible users
339 $user_filter = ilLocalUser::_getFolderIds(true);
340 } else {
341 if ($this->filter['time_limit_owner']) {
342 $user_filter = [$this->filter['time_limit_owner']];
343 } else {
344 // All accessible users
345 $user_filter = ilLocalUser::_getFolderIds();
346 }
347 }
348
349 if (!isset($this->filter['user_ids'])) {
350 $this->filter['user_ids'] = null;
351 }
352
353 $query = $this->buildUserQuery();
354 $query->setUserFolder($user_filter);
355 if ($this->getOrderField()) {
356 $query->setOrderField(ilUtil::stripSlashes($this->getOrderField()));
357 $query->setOrderDirection(ilUtil::stripSlashes($this->getOrderDirection()));
358 }
359 $usr_data = $query->query();
360
361 $user_ids = [];
362
363 foreach ($usr_data["set"] as $item) {
364 // #11632
365 if ($item["usr_id"] != SYSTEM_USER_ID) {
366 $user_ids[] = $item["usr_id"];
367 }
368 }
369 return $user_ids;
370 }
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

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

+ Here is the call graph for this function:

◆ initFilter()

ilUserTableGUI::initFilter ( )

Reimplemented from ilTable2GUI.

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

372 : void
373 {
374 global $DIC;
375
376 $lng = $DIC['lng'];
377 $rbacreview = $DIC['rbacreview'];
378 $ilUser = $DIC['ilUser'];
379 $ilCtrl = $DIC['ilCtrl'];
380
381
382 // Show context filter
383 if ($this->getMode() == self::MODE_LOCAL_USER) {
384 $parent_ids = ilLocalUser::_getFolderIds();
385
386 if (count($parent_ids) > 1) {
387 $co = new ilSelectInputGUI($lng->txt('context'), 'time_limit_owner');
388
389 $ref_id = $this->getUserFolderId();
390
391 $opt[0] = $this->lng->txt('all_users');
392 $opt[$this->getUserFolderId()] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($this->getUserFolderId())) . ')';
393
394 foreach ($parent_ids as $parent_id) {
395 if ($parent_id == $this->getUserFolderId()) {
396 continue;
397 }
398 switch ($parent_id) {
399 case USER_FOLDER_ID:
400 $opt[USER_FOLDER_ID] = $lng->txt('global_user');
401 break;
402
403 default:
404 $opt[$parent_id] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($parent_id)) . ')';
405 break;
406 }
407 }
408 $co->setOptions($opt);
409 $this->addFilterItem($co);
410 $co->readFromSession();
411 $this->filter['time_limit_owner'] = $co->getValue();
412 }
413 }
414
415 // User name, login, email filter
416 $ul = new ilTextInputGUI($lng->txt("login") . "/" . $lng->txt("email") . "/" .
417 $lng->txt("name"), "query");
418 $ul->setDataSource($ilCtrl->getLinkTarget(
419 $this->getParentObject(),
420 "addUserAutoComplete",
421 "",
422 true
423 ));
424 $ul->setSize(20);
425 $ul->setSubmitFormOnEnter(true);
426 $this->addFilterItem($ul);
427 $ul->readFromSession();
428 $this->filter["query"] = $ul->getValue();
429
430
431 // activation
432 $options = [
433 "" => $lng->txt("user_all"),
434 "active" => $lng->txt("active"),
435 "inactive" => $lng->txt("inactive"),
436 ];
437 $si = new ilSelectInputGUI($this->lng->txt("user_activation"), "activation");
438 $si->setOptions($options);
439 $this->addFilterItem($si);
440 $si->readFromSession();
441 $this->filter["activation"] = $si->getValue();
442
443 // limited access
444 $cb = new ilCheckboxInputGUI($this->lng->txt("user_limited_access"), "limited_access");
445 $this->addFilterItem($cb);
446 $cb->readFromSession();
447 $this->filter["limited_access"] = $cb->getChecked();
448
449 // last login
450 $di = new ilDateTimeInputGUI($this->lng->txt("user_last_login_before"), "last_login");
451 $default_date = new ilDateTime(time(), IL_CAL_UNIX);
452 $default_date->increment(IL_CAL_DAY, 1);
453 $di->setDate($default_date);
454 $this->addFilterItem($di);
455 $di->readFromSession();
456 $this->filter["last_login"] = $di->getDate();
457
458 if ($this->getMode() == self::MODE_USER_FOLDER) {
459 // no assigned courses
460 $cb = new ilCheckboxInputGUI($this->lng->txt("user_no_courses"), "no_courses");
461 $this->addFilterItem($cb);
462 $cb->readFromSession();
463 $this->filter["no_courses"] = $cb->getChecked();
464
465 // no assigned groups
466 $ng = new ilCheckboxInputGUI($this->lng->txt("user_no_groups"), "no_groups");
467 $this->addFilterItem($ng);
468 $ng->readFromSession();
469 $this->filter['no_groups'] = $ng->getChecked();
470
471 // course/group members
472 $rs = new ilRepositorySelectorInputGUI($lng->txt("user_member_of_course_group"), "course_group");
473 $rs->setSelectText($lng->txt("user_select_course_group"));
474 $rs->setHeaderMessage($lng->txt("user_please_select_course_group"));
475 $rs->setClickableTypes(["crs", "grp"]);
476 $this->addFilterItem($rs);
477 $rs->readFromSession();
478 $this->filter["course_group"] = $rs->getValue();
479 }
480
481 // global roles
482 $options = [
483 "" => $lng->txt("user_any"),
484 ];
485 foreach ($rbacreview->getRolesByFilter(2, $ilUser->getId()) as $role) {
486 $options[$role["rol_id"]] = $role["title"];
487 }
488 $si = new ilSelectInputGUI($this->lng->txt("user_global_role"), "global_role");
489 $si->setOptions($options);
490 $this->addFilterItem($si);
491 $si->readFromSession();
492 $this->filter["global_role"] = $si->getValue();
493
494 // authentication mode
495 $auth_methods = ilAuthUtils::_getActiveAuthModes();
496 $options = [
497 "" => $lng->txt("user_any"),
498 ];
499 foreach ($auth_methods as $method => $value) {
500 if ($method == 'default') {
501 $options[$method] = $this->lng->txt('auth_' . $method) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($value)) . ")";
502 } else {
503 $options[$method] = ilAuthUtils::getAuthModeTranslation((string) $value);
504 }
505 }
506 $si = new ilSelectInputGUI($this->lng->txt("auth_mode"), "authentication_method");
507 $si->setOptions($options);
508 $this->addFilterItem($si);
509 $si->readFromSession();
510 $this->filter["authentication"] = $si->getValue();
511
512 // udf fields
513 foreach ($this->udf_fields as $id => $f) {
514 $this->addFilterItemByUdfType($id, $f["type"], true, $f["txt"], $f["options"]);
515 }
516 }
const IL_CAL_DAY
static _getActiveAuthModes()
static _getAuthModeName($a_auth_key)
This class represents a checkbox property in a property form.
This class represents a date/time property in a property form.
This class represents a repository selector in a property form.
addFilterItemByUdfType(string $id, string $type, bool $a_optional=false, ?string $caption=null, array $a_options=[])
Add filter by standard type.
const USER_FOLDER_ID
Definition: constants.php:33
$ref_id
Definition: ltiauth.php:66

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(), ilLanguage\txt(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ setMode()

ilUserTableGUI::setMode ( int  $a_mode)
protected

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

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

Field Documentation

◆ $filter

array ilUserTableGUI::$filter = []
protected

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

Referenced by addFilterItemValue().

◆ $mode

int ilUserTableGUI::$mode = null
private

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

Referenced by getMode().

◆ $udf_fields

array ilUserTableGUI::$udf_fields = []
protected

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

◆ $user_folder_id

int ilUserTableGUI::$user_folder_id = 0
private

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

Referenced by getUserFolderId().

◆ $user_request

UserGUIRequest ilUserTableGUI::$user_request
protected

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

◆ $with_write_access

bool ilUserTableGUI::$with_write_access = false
private

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

◆ MODE_LOCAL_USER

◆ MODE_USER_FOLDER

const ilUserTableGUI::MODE_USER_FOLDER = 1

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

Referenced by ilObjUserFolderGUI\getActionUserIds().


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