Merge branch 'wip-MDL-57216-master' of git://github.com/abgreeve/moodle

This commit is contained in:
Dan Poltawski
2016-12-13 09:04:04 +00:00
4 changed files with 26 additions and 9 deletions
@@ -23,5 +23,6 @@
*/
$string['eventgradereportviewed'] = 'Grade overview report viewed';
$string['gradesoverview'] = 'Grades overview';
$string['pluginname'] = 'Overview report';
$string['overview:view'] = 'View the overview report';
+23 -1
View File
@@ -451,4 +451,26 @@ function grade_report_overview_settings_definition(&$mform) {
$mform->addHelpButton('report_overview_showtotalsifcontainhidden', 'hidetotalifhiddenitems', 'grades');
}
/**
* Add nodes to myprofile page.
*
* @param \core_user\output\myprofile\tree $tree Tree object
* @param stdClass $user user object
* @param bool $iscurrentuser
* @param stdClass $course Course object
*/
function gradereport_overview_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
if (empty($course)) {
// We want to display these reports under the site context.
$course = get_fast_modinfo(SITEID)->get_course();
}
$systemcontext = context_system::instance();
$usercontext = context_user::instance($user->id);
$coursecontext = context_course::instance($course->id);
if (grade_report_overview::check_access($systemcontext, $coursecontext, $usercontext, $course, $user->id)) {
$url = new moodle_url('/grade/report/overview/index.php', array('userid' => $user->id));
$node = new core_user\output\myprofile\node('reports', 'grades', get_string('gradesoverview', 'gradereport_overview'),
null, $url);
$tree->add_node($node);
}
}
+1 -1
View File
@@ -1250,7 +1250,7 @@ function gradereport_user_myprofile_navigation(core_user\output\myprofile\tree $
$anyreport = has_capability('moodle/user:viewuseractivitiesreport', $usercontext);
// Start capability checks.
if ($anyreport || ($course->showreports && $user->id == $USER->id)) {
if ($anyreport || $iscurrentuser) {
// Add grade hardcoded grade report if necessary.
$gradeaccess = false;
$coursecontext = context_course::instance($course->id);
@@ -66,12 +66,6 @@ Feature: The student can navigate to their grades page and user grade report.
And I am on site homepage
And I turn editing mode on
And I add the "Mentees" block
# TODO MDL-57216 this functionality should work without navigation block.
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I navigate to "Define roles" node in "Site administration > Users > Permissions"
And I click on "Add a new role" "button"
And I click on "Continue" "button"
@@ -95,7 +89,7 @@ Feature: The student can navigate to their grades page and user grade report.
And I log in as "parent1"
And I am on site homepage
And I follow "Student 1"
And I click on "Grades" "link" in the "Navigation" "block"
And I follow "Grades overview"
Then the following should exist in the "overview-grade" table:
| Course name | Grade |
| Course 2 | - |