From c3db339f07fdb6a10e5015d316c4c8f53dd32d08 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 9 Jan 2024 13:31:51 +0000 Subject: [PATCH] MDL-80560 admin: user list - show picture, download, fix identity fields --- .../reportbuilder/local/systemreports/users.php | 14 ++++++-------- admin/user.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/admin/classes/reportbuilder/local/systemreports/users.php b/admin/classes/reportbuilder/local/systemreports/users.php index b3ae4c56434..28fde601b0c 100644 --- a/admin/classes/reportbuilder/local/systemreports/users.php +++ b/admin/classes/reportbuilder/local/systemreports/users.php @@ -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')); } diff --git a/admin/user.php b/admin/user.php index 63e16a229c1..fe29620cb4b 100644 --- a/admin/user.php +++ b/admin/user.php @@ -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)]);