MDL-18004 Separated gradebook course settings from report preferences
This commit is contained in:
@@ -32,13 +32,11 @@ require_once($CFG->libdir.'/formslib.php');
|
||||
class course_settings_form extends moodleform {
|
||||
|
||||
function definition() {
|
||||
global $USER, $CFG, $COURSE;
|
||||
global $USER, $CFG;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
|
||||
$can_view_admin_links = false;
|
||||
if (has_capability('moodle/grade:manage', $systemcontext)) {
|
||||
$can_view_admin_links = true;
|
||||
@@ -104,7 +102,7 @@ class course_settings_form extends moodleform {
|
||||
foreach($types as $type) {
|
||||
foreach (get_list_of_plugins('grade/'.$type) as $plugin) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($CFG->dirroot.'/grade/'.$type.'/'.$plugin.'/lib.php') && has_capability('gradereport/'.$plugin.':view', $context)) {
|
||||
if (file_exists($CFG->dirroot.'/grade/'.$type.'/'.$plugin.'/lib.php')) {
|
||||
require_once($CFG->dirroot.'/grade/'.$type.'/'.$plugin.'/lib.php');
|
||||
$functionname = 'grade_'.$type.'_'.$plugin.'_settings_definition';
|
||||
if (function_exists($functionname)) {
|
||||
|
||||
+15
-4
@@ -429,6 +429,7 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
|
||||
'letter' => get_string('letters', 'grades'),
|
||||
'export' => get_string('export', 'grades'),
|
||||
'import' => get_string('import'),
|
||||
'preferences' => get_string('mypreferences', 'grades'),
|
||||
'settings' => get_string('settings'));
|
||||
|
||||
// Settings tab first
|
||||
@@ -466,7 +467,7 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
|
||||
// Add link to preferences tab if such a page exists
|
||||
if (file_exists($CFG->dirroot . '/grade/report/'.$plugin.'/preferences.php')) {
|
||||
$pref_url = $url_prefix.'report/'.$plugin.'/preferences.php?id='.$courseid;
|
||||
$plugin_info['settings'][$plugin] = array('id' => $plugin, 'link' => $pref_url, 'string' => get_string('modulename', 'gradereport_'.$plugin));
|
||||
$plugin_info['preferences'][$plugin] = array('id' => $plugin, 'link' => $pref_url, 'string' => get_string('modulename', 'gradereport_'.$plugin));
|
||||
}
|
||||
|
||||
$count++;
|
||||
@@ -614,9 +615,19 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
|
||||
}
|
||||
|
||||
// Put settings last
|
||||
$settings = $plugin_info['settings'];
|
||||
unset($plugin_info['settings']);
|
||||
$plugin_info['settings'] = $settings;
|
||||
if (!empty($plugin_info['settings'])) {
|
||||
$settings = $plugin_info['settings'];
|
||||
unset($plugin_info['settings']);
|
||||
$plugin_info['settings'] = $settings;
|
||||
}
|
||||
|
||||
// Put preferences last
|
||||
if (!empty($plugin_info['preferences'])) {
|
||||
$prefs = $plugin_info['preferences'];
|
||||
unset($plugin_info['preferences']);
|
||||
$plugin_info['preferences'] = $prefs;
|
||||
}
|
||||
|
||||
return $plugin_info;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ if ($data = $mform->get_data()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print_grade_page_head($courseid, 'settings', 'grader', get_string('preferences', 'gradereport_grader'));
|
||||
print_grade_page_head($courseid, 'preferences', 'grader', get_string('preferences', 'gradereport_grader'));
|
||||
|
||||
// If USER has admin capability, print a link to the site config page for this report
|
||||
if (has_capability('moodle/site:config', $systemcontext)) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
$string['modulename'] = 'Stats report';
|
||||
$string['stats:view'] = 'View course stats report';
|
||||
$string['preferences'] = 'Stats report preferences';
|
||||
|
||||
$string['moredata']='Stats Report: More Data';
|
||||
|
||||
@@ -76,4 +77,4 @@ $string['usehidden'] = 'Count hidden grades';
|
||||
$string['uselocked'] = 'Count locked grades';
|
||||
|
||||
$string['printable'] = 'Printer Friendly Version';
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -76,7 +76,7 @@ if ($mform->is_cancelled()){
|
||||
redirect($CFG->wwwroot . '/grade/report/stats/index.php?id='.$courseid);
|
||||
}
|
||||
|
||||
print_grade_page_head($courseid, 'settings', 'stats', get_string('preferences', 'gradereport_stats'));
|
||||
print_grade_page_head($courseid, 'preferences', 'stats', get_string('preferences', 'gradereport_stats'));
|
||||
|
||||
/// If USER has admin capability, print a link to the site config page for this report
|
||||
/// TODO: Add admin config page for this report
|
||||
|
||||
@@ -118,7 +118,6 @@ if ($access) {
|
||||
|
||||
// print the page
|
||||
print_grade_page_head($courseid, 'report', 'user', get_string('modulename', 'gradereport_user'). ' - '.fullname($report->user));
|
||||
echo $user_selector;
|
||||
|
||||
if ($report->fill_table()) {
|
||||
echo '<br />'.$report->print_table(true);
|
||||
|
||||
@@ -30,6 +30,8 @@ $string['nogroup'] = 'No Group';
|
||||
$string['allgroups'] = 'All Groups';
|
||||
$string['printable'] = 'Printer Friendly Version';
|
||||
|
||||
$string['preferences'] = 'Visual report preferences';
|
||||
|
||||
/// settings
|
||||
$string['prefgeneral'] = 'General';
|
||||
$string['prefcalc'] = 'Calculations';
|
||||
@@ -83,4 +85,4 @@ $string['gradesvsitems'] = 'Average Grades vs Items';
|
||||
$string['gradesvsitems:title'] = 'Average Grades vs Items';
|
||||
$string['visual:vis:grades_vs_items'] = 'View Grades vs Items Visualization';
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -76,7 +76,7 @@ if ($mform->is_cancelled()){
|
||||
redirect($CFG->wwwroot . '/grade/report/visual/index.php?id='.$courseid);
|
||||
}
|
||||
|
||||
print_grade_page_head($courseid, 'settings', 'visual', get_string('preferences', 'gradereport_visual'));
|
||||
print_grade_page_head($courseid, 'preferences', 'visual', get_string('preferences', 'gradereport_visual'));
|
||||
|
||||
/// If USER has admin capability, print a link to the site config page for this report
|
||||
/// TODO: Add admin config page for this report
|
||||
|
||||
@@ -347,6 +347,7 @@ $string['moveselectedto'] = 'Move selected items to:';
|
||||
$string['movingelement'] = 'Moving $a';
|
||||
$string['multfactor'] = 'Multiplicator';
|
||||
$string['multfactorhelp'] = 'Factor by which all grades for this grade item will be multiplied.';
|
||||
$string['mypreferences'] = 'My preferences';
|
||||
$string['myreportpreferences'] = 'My report preferences';
|
||||
$string['navmethod'] = 'Navigation method';
|
||||
$string['neverdeletehistory'] = 'Never delete history';
|
||||
|
||||
@@ -585,8 +585,9 @@ class grade_category extends grade_object {
|
||||
|
||||
/**
|
||||
* Internal function - aggregation maths.
|
||||
* Must be public: used by grade_grade::get_hiding_affected()
|
||||
*/
|
||||
private function aggregate_values($grade_values, $items) {
|
||||
public function aggregate_values($grade_values, $items) {
|
||||
switch ($this->aggregation) {
|
||||
case GRADE_AGGREGATE_MEDIAN: // Middle point value in the set: ignores frequencies
|
||||
$num = count($grade_values);
|
||||
|
||||
Reference in New Issue
Block a user