mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-70786 report_log: respect fullname setting.
This commit is contained in:
parent
ad7599a680
commit
5a8961c9e2
@ -299,7 +299,14 @@ class report_log_renderable implements renderable {
|
||||
*/
|
||||
public function get_selected_user_fullname() {
|
||||
$user = core_user::get_user($this->userid);
|
||||
return fullname($user);
|
||||
if (empty($this->course)) {
|
||||
// We are in system context.
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
// We are in course context.
|
||||
$context = context_course::instance($this->course->id);
|
||||
}
|
||||
return fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@ class report_log_table_log extends table_sql {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->userfullnames[$userid] = fullname($user);
|
||||
$this->userfullnames[$userid] = fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context()));
|
||||
return $this->userfullnames[$userid];
|
||||
}
|
||||
|
||||
@ -596,7 +596,7 @@ class report_log_table_log extends table_sql {
|
||||
" FROM {user} WHERE id " . $usql,
|
||||
$uparams);
|
||||
foreach ($users as $userid => $user) {
|
||||
$this->userfullnames[$userid] = fullname($user);
|
||||
$this->userfullnames[$userid] = fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context()));
|
||||
unset($userids[$userid]);
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,16 @@ Feature: In a report, admin can filter log data
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
|
||||
| teacher1 | Teacher | One | teacher1@example.com | t1 | | fred | | |
|
||||
| student1 | Grainne | Beauchamp | student1@example.com | s1 | Ann | Jill | Gronya | Beecham |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| admin | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following config values are set as admin:
|
||||
| fullnamedisplay | firstname |
|
||||
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
|
||||
And I log in as "admin"
|
||||
|
||||
Scenario: Filter log report for standard and legacy log reader
|
||||
@ -25,7 +29,7 @@ Feature: In a report, admin can filter log data
|
||||
And I follow "Home"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
And I click on "Log in as" "link"
|
||||
And I press "Continue"
|
||||
And I log out
|
||||
@ -44,7 +48,7 @@ Feature: In a report, admin can filter log data
|
||||
Scenario: Filter log report for standard log reader
|
||||
Given I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
And I click on "Log in as" "link"
|
||||
And I press "Continue"
|
||||
And I log out
|
||||
@ -66,7 +70,7 @@ Feature: In a report, admin can filter log data
|
||||
And I follow "Home"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
And I click on "Log in as" "link"
|
||||
And I press "Continue"
|
||||
And I log out
|
||||
|
@ -9,9 +9,9 @@ Feature: User can view activity log.
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
|
||||
| teacher1 | Teacher | One | teacher1@example.com | t1 | | fred | | |
|
||||
| student1 | Grainne | Beauchamp | student1@example.com | s1 | Ann | Jill | Gronya | Beecham |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@ -25,6 +25,17 @@ Feature: User can view activity log.
|
||||
| section | 1 |
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And the following config values are set as admin:
|
||||
| fullnamedisplay | firstname |
|
||||
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment name |
|
||||
| Description | Submit your online text |
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
@ -38,10 +49,10 @@ Feature: User can view activity log.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
When I follow "Today's logs"
|
||||
And I should see "Assignment: Test assignment name"
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
And I follow "All logs"
|
||||
Then I should see "Assignment: Test assignment name"
|
||||
|
||||
@ -53,9 +64,17 @@ Feature: User can view activity log.
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
When I follow "Today's logs"
|
||||
And I should see "No log reader enabled"
|
||||
And I follow "Student 1"
|
||||
And I follow "Ann, Jill, Grainne, Beauchamp"
|
||||
And I follow "All logs"
|
||||
Then I should see "No log reader enabled"
|
||||
|
||||
Scenario: View Todays' log report for user through Course log report
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Reports > Logs" in current page administration
|
||||
And I set the field with xpath "//select[@name='user']" to "Ann, Jill, Grainne, Beauchamp"
|
||||
When I click on "Get these logs" "button"
|
||||
Then I should see "Ann, Jill, Grainne, Beauchamp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user