MDL-80560 admin: user list - show picture, download, fix identity fields

This commit is contained in:
Marina Glancy 2024-01-09 13:31:51 +00:00
parent 757be30c39
commit c3db339f07
2 changed files with 7 additions and 9 deletions

View File

@ -113,7 +113,7 @@ class users extends system_report {
$this->add_actions();
// Set if report can be downloaded.
$this->set_downloadable(false);
$this->set_downloadable(true);
}
/**
@ -135,17 +135,15 @@ class users extends system_report {
$entityuser = $this->get_entity('user');
$entityuseralias = $entityuser->get_table_alias('user');
$this->add_column($entityuser->get_column('fullnamewithlink'));
$this->add_column($entityuser->get_column('fullnamewithpicturelink'));
// Include identity field columns.
$identitycolumns = $entityuser->get_identity_columns($this->get_context(), ['city', 'country', 'lastaccesstime']);
$identitycolumns = $entityuser->get_identity_columns($this->get_context());
foreach ($identitycolumns as $identitycolumn) {
$this->add_column($identitycolumn);
}
// These columns are always shown in the users list.
$this->add_column($entityuser->get_column('city'));
$this->add_column($entityuser->get_column('country'));
// Add "Last access" column.
$this->add_column(($entityuser->get_column('lastaccess'))
->set_callback(static function ($value, \stdClass $row): string {
if ($row->lastaccess) {
@ -155,7 +153,7 @@ class users extends system_report {
})
);
if ($column = $this->get_column('user:fullnamewithlink')) {
if ($column = $this->get_column('user:fullnamewithpicturelink')) {
$column
->add_fields("{$entityuseralias}.suspended, {$entityuseralias}.confirmed")
->add_callback(static function(string $fullname, \stdClass $row): string {
@ -171,7 +169,7 @@ class users extends system_report {
});
}
$this->set_initial_sort_column('user:fullnamewithlink', SORT_ASC);
$this->set_initial_sort_column('user:fullnamewithpicturelink', SORT_ASC);
$this->set_default_no_results_notice(new lang_string('nousersfound', 'moodle'));
}

View File

@ -176,7 +176,7 @@
echo html_writer::start_div('', ['data-region' => 'report-user-list-wrapper']);
$bulkactions = new user_bulk_action_form(new moodle_url('/admin/user/user_bulk.php'),
['excludeactions' => ['displayonpage'], 'passuserids' => true, 'hidesubmit' => true],
['excludeactions' => ['displayonpage', 'download'], 'passuserids' => true, 'hidesubmit' => true],
'post', '',
['id' => 'user-bulk-action-form']);
$bulkactions->set_data(['returnurl' => $PAGE->url->out_as_local_url(false)]);