mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Report selection is now sticky due to user preference, and tidied up code a bit
This commit is contained in:
parent
f7998fbc55
commit
ee81379ee3
1 changed files with 14 additions and 8 deletions
|
@ -26,8 +26,8 @@
|
||||||
require_once("../config.php");
|
require_once("../config.php");
|
||||||
require_once("../lib/gradelib.php");
|
require_once("../lib/gradelib.php");
|
||||||
|
|
||||||
$courseid = required_param('id'); // course id
|
$courseid = required_param('id'); // course id
|
||||||
$report = optional_param('report', 'user', PARAM_FILE); // course id
|
$report = optional_param('report', get_user_preferences('grade_defaultreport', 'user'), PARAM_FILE);
|
||||||
$edit = optional_param('edit', -1, PARAM_BOOL); // sticky editting mode
|
$edit = optional_param('edit', -1, PARAM_BOOL); // sticky editting mode
|
||||||
|
|
||||||
/// Make sure they can even access this course
|
/// Make sure they can even access this course
|
||||||
|
@ -63,6 +63,10 @@
|
||||||
list($key, $report) = each($reports); // Just pick the first one
|
list($key, $report) = each($reports); // Just pick the first one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($report != get_user_preferences('grade_defaultreport', 'user')) {
|
||||||
|
set_user_preference('grade_defaultreport', $report);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Create menu of reports
|
/// Create menu of reports
|
||||||
|
|
||||||
|
@ -77,7 +81,7 @@
|
||||||
asort($reportnames); // Alphabetical sort
|
asort($reportnames); // Alphabetical sort
|
||||||
|
|
||||||
|
|
||||||
/// Print the header
|
/// Build navigation
|
||||||
|
|
||||||
$strgrades = get_string('grades');
|
$strgrades = get_string('grades');
|
||||||
$navlinks = array();
|
$navlinks = array();
|
||||||
|
@ -86,8 +90,9 @@
|
||||||
|
|
||||||
$navigation = build_navigation($navlinks);
|
$navigation = build_navigation($navlinks);
|
||||||
|
|
||||||
// build buttons here
|
|
||||||
/// setting up editting mode
|
/// Build editing on/off buttons
|
||||||
|
|
||||||
if (!isset($USER->gradeediting)) {
|
if (!isset($USER->gradeediting)) {
|
||||||
$USER->gradeediting = 0;
|
$USER->gradeediting = 0;
|
||||||
}
|
}
|
||||||
|
@ -114,9 +119,12 @@
|
||||||
$options['sesskey'] = sesskey();
|
$options['sesskey'] = sesskey();
|
||||||
$link = 'report.php';
|
$link = 'report.php';
|
||||||
|
|
||||||
// turn editting on and off buttons
|
|
||||||
$buttons = print_single_button($link, $options, $string, 'get', '_self', true);
|
$buttons = print_single_button($link, $options, $string, 'get', '_self', true);
|
||||||
|
|
||||||
|
|
||||||
|
/// Print header
|
||||||
|
|
||||||
print_header_simple($strgrades.':'.$reportnames[$report], ':'.$strgrades, $navigation,
|
print_header_simple($strgrades.':'.$reportnames[$report], ':'.$strgrades, $navigation,
|
||||||
'', '', true, $buttons, navmenu($course));
|
'', '', true, $buttons, navmenu($course));
|
||||||
|
|
||||||
|
@ -130,8 +138,6 @@
|
||||||
|
|
||||||
/// Now simply include the report here and we're done
|
/// Now simply include the report here and we're done
|
||||||
|
|
||||||
print_heading('(New interface under construction)');
|
|
||||||
|
|
||||||
include_once($CFG->dirroot.'/grade/report/'.$report.'/index.php');
|
include_once($CFG->dirroot.'/grade/report/'.$report.'/index.php');
|
||||||
|
|
||||||
print_footer($course);
|
print_footer($course);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue