ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 ()
 
- 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

Profile $user_profile
 
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 Member Functions

 buildSelectableColumnsAndUdfs ()
 
 addFilterItemByUdfType (ProfileField $field)
 Add filter by standard type. More...
 
 buildUserFieldValue (string $key, array|string $value)
 
 getFormContext ()
 

Private Attributes

int $mode = null
 
int $user_folder_id = 0
 
bool $with_write_access = false
 
ilRbacReview $rbac_review
 
ilObjUser $current_user
 

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

Member Function Documentation

◆ addFilterItemByUdfType()

ilUserTableGUI::addFilterItemByUdfType ( ProfileField  $field)
private

Add filter by standard type.

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

534 $id = "udf_{$field->getIdentifier()}";
535 $item = $field->getLegacyInput($this->lng, $this->getFormContext());
536 $item->setRequired(false);
537 if (!($item instanceof ilTableFilterItem)) {
538 $item = new ilTextInputGUI($field->getLabel($this->lng));
539 }
540 $item->setPostVar($id);
541 $this->addFilterItem($item, true);
542 $item->readFromSession();
543 $this->filter[$id] = $item->getValue();
544 return $item;
545 }
This class represents a property in a property form.
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)

Referenced by initFilter().

+ Here is the caller graph for this function:

◆ addFilterItemValue()

ilUserTableGUI::addFilterItemValue (   $filter,
  $value 
)

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

348 : void // Missing parameter types.
349 {
350 $this->filter[$filter] = $value;
351 }

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

+ Here is the call graph for this function:

◆ buildSelectableColumnsAndUdfs()

ilUserTableGUI::buildSelectableColumnsAndUdfs ( )
private

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

151 : array
152 {
153
154
155 $ufs = $this->user_profile->getVisibleFields($this->getFormContext());
156
157 $udfs = [];
158 $cols = array_reduce(
159 $ufs,
160 function (array $c, ProfileField $v) use (&$udfs): array {
161 $identifier = $v->getIdentifier();
162 if ($v->isCustom()) {
163 $udfs[] = $v;
164 $identifier = "udf_{$identifier}";
165 $c[$identifier] = null;
166 }
167
168 if (!array_key_exists($identifier, $c)) {
169 return $c;
170 }
171
172 $c[$identifier] = [
173 'txt' => $v->getLabel($this->lng),
174 'default' => false
175 ];
176 return $c;
177 },
178 [
179 'firstname' => null,
180 'lastname' => null,
181 'time_limit_until' => [
182 'txt' => $this->lng->txt('access_until'),
183 'default' => false
184 ],
185 'last_login' => [
186 'txt' => $this->lng->txt('last_access'),
187 'default' => true
188 ],
189 'create_date' => [
190 'txt' => $this->lng->txt('create_date'),
191 'default' => false
192 ],
193 'approve_date' => [
194 'txt' => $this->lng->txt('approve_date'),
195 'default' => false
196 ],
197 'agree_date' => [
198 'txt' => $this->lng->txt('agree_date'),
199 'default' => false
200 ],
201 'dpro_agreed_on' => [
202 'txt' => $this->lng->txt('dpro_agreed_on'),
203 'default' => false
204 ],
205 'email' => null,
206 'second_email' => null,
207 'title' => null,
208 'birthday' => null,
209 'gender' => null,
210 'institution' => null,
211 'department' => null,
212 'street' => null,
213 'zipcode' => null,
214 'city' => null,
215 'country' => null,
216 'phone_office' => null,
217 'phone_home' => null,
218 'phone_mobile' => null,
219 'fax' => null,
220 'matriculation' => null,
221 'interests_general' => null,
222 'interests_help_offered' => null,
223 'interests_help_looking' => null,
224 'auth_mode' => [
225 'txt' => $this->lng->txt('auth_mode'),
226 'default' => false
227 ],
228 'org_units' => null
229 ]
230 );
231
232 return [
233 'selectable_columns' => array_filter($cols),
234 'udfs' => $udfs
235 ];
236 }
$c
Definition: deliver.php:25
if(!file_exists('../ilias.ini.php'))

References $c, getFormContext(), if, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildUserFieldValue()

ilUserTableGUI::buildUserFieldValue ( string  $key,
array|string  $value 
)
private

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

615 : string
616 {
617 switch ($key) {
618 case 'birthday':
620
621 case 'gender':
622 return $value === '' ? '' : $this->lng->txt('gender_' . $value);
623
624 case 'create_date':
625 case 'agree_date':
626 case 'approve_date':
628
629 case 'dpro_agreed_on':
631 }
632
633 if (is_array($value)) {
634 return implode(', ', $value);
635 }
636
637 if (trim($value) === '') {
638 return ' ';
639 }
640
641 return $value;
642 }
const IL_CAL_DATE
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
Class for single dates.

References ilDatePresentation\formatDate(), IL_CAL_DATE, IL_CAL_UNIX, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildUserQuery()

ilUserTableGUI::buildUserQuery ( )
protected

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

239 {
240 $query = new ilUserQuery();
241 $query->setOffset($this->getOffset());
242 $query->setLimit($this->getLimit());
243 $query->setTextFilter($this->filter['query'] ?? '');
244 $query->setActionFilter($this->filter['activation'] ?? '');
245 $query->setLastLogin($this->filter['last_login'] ?? null);
246 $query->setLimitedAccessFilter($this->filter['limited_access'] ?? false);
247 $query->setNoCourseFilter($this->filter['no_courses'] ?? false);
248 $query->setNoGroupFilter($this->filter['no_groups'] ?? false);
249 $query->setCourseGroupFilter($this->filter['course_group'] ?? 0);
250 $query->setRoleFilter((int) ($this->filter['global_role'] ?? 0));
251 $query->setUserFilter($this->filter['user_ids'] ?? []);
252 $query->setFirstLetterLastname($this->user_request->getLetter());
253 $query->setAuthenticationFilter($this->filter['authentication'] ?? '');
254 return $query;
255 }
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 547 of file class.ilUserTableGUI.php.

547 : void // Missing array type.
548 {
549 $this->ctrl->setParameterByClass('ilobjusergui', 'letter', $this->user_request->getLetter());
550
551 foreach ($this->getSelectedColumns() as $c) {
552 if ($c == 'time_limit_until') {
553 $this->tpl->setCurrentBlock('access_until');
554 $this->tpl->setVariable('VAL_ACCESS_UNTIL', $a_set['access_until']);
555 $this->tpl->setVariable('CLASS_ACCESS_UNTIL', $a_set['access_class']);
556 } elseif ($c == 'last_login') {
557 $this->tpl->setCurrentBlock('last_login');
558 $this->tpl->setVariable(
559 'VAL_LAST_LOGIN',
561 );
562 } elseif (in_array($c, ['firstname', 'lastname'])) {
563 $this->tpl->setCurrentBlock($c);
564 $this->tpl->setVariable('VAL_' . strtoupper($c), (string) $a_set[$c]);
565 } elseif ($c == 'auth_mode') {
566 $this->tpl->setCurrentBlock('user_field');
567 $this->tpl->setVariable('VAL_UF', ilAuthUtils::getAuthModeTranslation((string) ilAuthUtils::_getAuthMode($a_set['auth_mode'])));
568 $this->tpl->parseCurrentBlock();
569 } else { // all other fields
570 $this->tpl->setCurrentBlock('user_field');
571 $this->tpl->setVariable('VAL_UF', $this->buildUserFieldValue($c, $a_set[$c] ?? ''));
572 }
573
574 $this->tpl->parseCurrentBlock();
575 }
576
577 if ($a_set['usr_id'] != 6
578 && ($this->getMode() == self::MODE_USER_FOLDER || $a_set['time_limit_owner'] == $this->getUserFolderId())) {
579 $this->tpl->setCurrentBlock('checkb');
580 $this->tpl->setVariable('ID', $a_set['usr_id']);
581 $this->tpl->parseCurrentBlock();
582 }
583
584 if ($this->with_write_access
585 && ($this->getMode() === self::MODE_USER_FOLDER
586 || $a_set['time_limit_owner'] == $this->getUserFolderId())) {
587 $this->tpl->setVariable('VAL_LOGIN', $a_set['login']);
588 $this->ctrl->setParameterByClass('ilobjusergui', 'obj_id', $a_set['usr_id']);
589 $this->tpl->setVariable(
590 'HREF_LOGIN',
591 $this->ctrl->getLinkTargetByClass('ilobjusergui', 'view')
592 );
593 $this->ctrl->setParameterByClass('ilobjusergui', 'obj_id', '');
594 } else {
595 $this->tpl->setVariable('VAL_LOGIN_PLAIN', $a_set['login']);
596 }
597
598 if ($this->getMode() == self::MODE_LOCAL_USER) {
599 $this->tpl->setCurrentBlock('context');
600 $this->tpl->setVariable(
601 'VAL_CONTEXT',
602 ilObject::_lookupTitle(ilObject::_lookupObjId($a_set['time_limit_owner']))
603 );
604 $this->tpl->parseCurrentBlock();
605
606 $this->tpl->setCurrentBlock('roles');
607 $this->ctrl->setParameter($this->getParentObject(), 'obj_id', $a_set['usr_id']);
608 $this->tpl->setVariable('ROLE_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'assignRoles'));
609 $this->tpl->setVariable('TXT_ROLES', $this->lng->txt('edit'));
610 $this->ctrl->clearParameters($this->getParentObject());
611 $this->tpl->parseCurrentBlock();
612 }
613 }
const IL_CAL_DATETIME
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
@classDescription Date and time handling
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
buildUserFieldValue(string $key, array|string $value)

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

+ Here is the call graph for this function:

◆ getFormContext()

ilUserTableGUI::getFormContext ( )
private

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

644 : ProfileContext
645 {
646 if ($this->getMode() === self::MODE_USER_FOLDER) {
647 return ProfileContext::UserAdministration;
648 }
649 return ProfileContext::LocalUserAdministration;
650 }

Referenced by buildSelectableColumnsAndUdfs().

+ Here is the caller graph for this function:

◆ getItems()

ilUserTableGUI::getItems ( )

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

257 : void
258 {
260 if ($this->getMode() == self::MODE_USER_FOLDER) {
261 // All accessible users
262 $user_filter = ilLocalUser::_getFolderIds(true);
263 } else {
264 if ($this->filter['time_limit_owner'] ?? null) {
265 $user_filter = [$this->filter['time_limit_owner']];
266 } else {
267 // All accessible users
268 $user_filter = ilLocalUser::_getFolderIds();
269 }
270 }
271
272 if ($user_filter === []) {
273 $this->setMaxCount(0);
274 $this->setData([]);
275 return;
276 }
277
278 if (isset($this->filter['user_ids']) && is_array($this->filter['user_ids']) && $this->filter['user_ids'] === []) {
279 $this->setMaxCount(0);
280 $this->setData([]);
281 return;
282 }
283
284 $additional_fields = $this->getSelectedColumns();
285 unset(
286 $additional_fields['firstname'],
287 $additional_fields['lastname'],
288 $additional_fields['email'],
289 $additional_fields['second_email'],
290 $additional_fields['last_login'],
291 $additional_fields['access_until'],
292 $additional_fields['org_units']
293 );
294
295 $udf_filter = [];
296 foreach ($this->filter as $k => $v) {
297 if (strpos($k, 'udf_') === 0) {
298 $udf_filter[$k] = $v;
299 }
300 }
301
302 $query = $this->buildUserQuery();
303 $order_field = $this->getOrderField();
304 if (strpos($order_field, 'udf_') !== 0 || isset($additional_fields[$order_field])) {
305 $query->setOrderField($order_field);
306 $query->setOrderDirection($this->getOrderDirection());
307 }
308 $query->setAdditionalFields($additional_fields);
309 $query->setUserFolder($user_filter);
310 $query->setUdfFilter($udf_filter);
311 $usr_data = $query->query();
312
313 if (count($usr_data['set']) == 0 && $this->getOffset() > 0) {
314 $this->resetOffset();
315 $query->setOffset($this->getOffset());
316 $usr_data = $query->query();
317 }
318
319 foreach ($usr_data['set'] as $k => $user) {
320 if (in_array('org_units', $this->getSelectedColumns())) {
321 $usr_data['set'][$k]['org_units'] = ilObjUser::lookupOrgUnitsRepresentation($user['usr_id']);
322 }
323
324
325 $current_time = time();
326 if ($user['active']) {
327 if ($user['time_limit_unlimited']) {
328 $txt_access = $this->lng->txt('access_unlimited');
329 $usr_data['set'][$k]['access_class'] = 'smallgreen';
330 } elseif ($user['time_limit_until'] < $current_time) {
331 $txt_access = $this->lng->txt('access_expired');
332 $usr_data['set'][$k]['access_class'] = 'smallred';
333 } else {
334 $txt_access = ilDatePresentation::formatDate(new ilDateTime($user['time_limit_until'], IL_CAL_UNIX));
335 $usr_data['set'][$k]['access_class'] = 'small';
336 }
337 } else {
338 $txt_access = $this->lng->txt('inactive');
339 $usr_data['set'][$k]['access_class'] = 'smallred';
340 }
341 $usr_data['set'][$k]['access_until'] = $txt_access;
342 }
343
344 $this->setMaxCount($usr_data['cnt']);
345 $this->setData($usr_data['set']);
346 }
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 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, ILIAS\Repository\lng(), ilObjUser\lookupOrgUnitsRepresentation(), ilTable2GUI\resetOffset(), ilTable2GUI\setData(), and ilTableGUI\setMaxCount().

+ Here is the call graph for this function:

◆ getMode()

ilUserTableGUI::getMode ( )
protected

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

136 : int
137 {
138 return $this->mode;
139 }

References $mode.

Referenced by getItems(), 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 146 of file class.ilUserTableGUI.php.

146 : array
147 {
149 }
array $selectable_columns

References ilTable2GUI\$selectable_columns.

◆ getUserFolderId()

ilUserTableGUI::getUserFolderId ( )
protected

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

141 : int
142 {
144 }

References $user_folder_id.

Referenced by initFilter().

+ Here is the caller graph for this function:

◆ getUserIdsForFilter()

ilUserTableGUI::getUserIdsForFilter ( )

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

353 : array // Missing array type.
354 {
355 if ($this->getMode() == self::MODE_USER_FOLDER) {
356 // All accessible users
357 $user_filter = ilLocalUser::_getFolderIds(true);
358 } else {
359 if ($this->filter['time_limit_owner']) {
360 $user_filter = [$this->filter['time_limit_owner']];
361 } else {
362 // All accessible users
363 $user_filter = ilLocalUser::_getFolderIds();
364 }
365 }
366
367 if (!isset($this->filter['user_ids'])) {
368 $this->filter['user_ids'] = null;
369 }
370
371 $query = $this->buildUserQuery();
372 $query->setUserFolder($user_filter);
373 if ($this->getOrderField()) {
374 $query->setOrderField(ilUtil::stripSlashes($this->getOrderField()));
375 $query->setOrderDirection(ilUtil::stripSlashes($this->getOrderDirection()));
376 }
377 $usr_data = $query->query();
378
379 $user_ids = [];
380
381 foreach ($usr_data['set'] as $item) {
382 // #11632
383 if ($item['usr_id'] != SYSTEM_USER_ID) {
384 $user_ids[] = $item['usr_id'];
385 }
386 }
387 return $user_ids;
388 }
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 390 of file class.ilUserTableGUI.php.

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

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Input\Field\$options, $ref_id, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilLocalUser\_getFolderIds(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilTable2GUI\addFilterItem(), addFilterItemByUdfType(), ILIAS\Repository\ctrl(), ILIAS\Repository\filter(), ilAuthUtils\getAuthModeTranslation(), getMode(), getUserFolderId(), IL_CAL_DAY, IL_CAL_UNIX, ILIAS\Repository\lng(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ setMode()

ilUserTableGUI::setMode ( int  $a_mode)
protected

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

131 : void
132 {
133 $this->mode = $a_mode;
134 }

Field Documentation

◆ $current_user

ilObjUser ilUserTableGUI::$current_user
private

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

◆ $filter

array ilUserTableGUI::$filter = []
protected

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

Referenced by addFilterItemValue().

◆ $mode

int ilUserTableGUI::$mode = null
private

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

Referenced by getMode().

◆ $rbac_review

ilRbacReview ilUserTableGUI::$rbac_review
private

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

◆ $udf_fields

array ilUserTableGUI::$udf_fields = []
protected

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

◆ $user_folder_id

int ilUserTableGUI::$user_folder_id = 0
private

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

Referenced by getUserFolderId().

◆ $user_profile

Profile ilUserTableGUI::$user_profile
protected

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

◆ $user_request

UserGUIRequest ilUserTableGUI::$user_request
protected

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

◆ $with_write_access

bool ilUserTableGUI::$with_write_access = false
private

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

◆ MODE_LOCAL_USER

◆ MODE_USER_FOLDER

const ilUserTableGUI::MODE_USER_FOLDER = 1

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

Referenced by ilObjUserFolderGUI\getActionUserIds().


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