MDL-47575 gradebook: Show weights and contribution by default.

This commit is contained in:
Zachary Durber 2014-10-15 13:39:36 +08:00
parent 2fdb4c6b00
commit 6deb0344c5
4 changed files with 52 additions and 8 deletions

View File

@ -0,0 +1,39 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Gradereport user plugin upgrade code
*
* @package gradereport_user
* @copyright 2014 Zachary Durber
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_gradereport_user_upgrade($oldversion) {
if ($oldversion < 2014101500) {
// Need to always show weight and contribution to course total.
set_config('grade_report_user_showweight', 1);
// User savepoint reached.
upgrade_plugin_savepoint(true, 2014101500, 'gradereport', 'user');
}
return true;
}

View File

@ -207,10 +207,10 @@ class grade_report_user extends grade_report {
$this->showfeedback = grade_get_setting($this->courseid, 'report_user_showfeedback', !empty($CFG->grade_report_user_showfeedback));
$this->showweight = grade_get_setting($this->courseid, 'report_user_showweight',
empty($CFG->grade_report_user_showweight));
!empty($CFG->grade_report_user_showweight));
$this->showcontributiontocoursetotal = grade_get_setting($this->courseid, 'report_user_showcontributiontocoursetotal',
empty($CFG->grade_report_user_showcontributiontocoursetotal));
!empty($CFG->grade_report_user_showcontributiontocoursetotal));
$this->showlettergrade = grade_get_setting($this->courseid, 'report_user_showlettergrade', !empty($CFG->grade_report_user_showlettergrade));
$this->showaverage = grade_get_setting($this->courseid, 'report_user_showaverage', !empty($CFG->grade_report_user_showaverage));
@ -1023,9 +1023,9 @@ function grade_report_user_settings_definition(&$mform) {
$mform->addElement('select', 'report_user_showfeedback', get_string('showfeedback', 'grades'), $options);
if (empty($CFG->grade_report_user_showweight)) {
$options[-1] = get_string('defaultprev', 'grades', $options[1]);
} else {
$options[-1] = get_string('defaultprev', 'grades', $options[0]);
} else {
$options[-1] = get_string('defaultprev', 'grades', $options[1]);
}
$mform->addElement('select', 'report_user_showweight', get_string('showweight', 'grades'), $options);
@ -1047,7 +1047,7 @@ function grade_report_user_settings_definition(&$mform) {
$mform->addElement('select', 'report_user_showlettergrade', get_string('showlettergrade', 'grades'), $options);
if (empty($CFG->grade_report_user_showcontributiontocoursetotal)) {
$options[-1] = get_string('defaultprev', 'grades', $options[1]);
$options[-1] = get_string('defaultprev', 'grades', $options[0]);
} else {
$options[-1] = get_string('defaultprev', 'grades', $options[$CFG->grade_report_user_showcontributiontocoursetotal]);
}

View File

@ -31,7 +31,10 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('grade_report_user_showgrade', get_string('showgrade', 'grades'), get_string('showgrade_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showfeedback', get_string('showfeedback', 'grades'), get_string('showfeedback_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showrange', get_string('showrange', 'grades'), get_string('showrange_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showweight', get_string('showweight', 'grades'), get_string('showweight_help', 'grades'), 0));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showweight',
get_string('showweight', 'grades'), get_string('showweight_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showaverage', get_string('showaverage', 'grades'), get_string('showaverage_help', 'grades'), 0));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showlettergrade', get_string('showlettergrade', 'grades'), get_string('showlettergrade_help', 'grades'), 0));
$settings->add(new admin_setting_configselect('grade_report_user_rangedecimals', get_string('rangedecimals', 'grades'),
@ -47,5 +50,7 @@ if ($ADMIN->fulltree) {
array(GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN => get_string('hide'),
GRADE_REPORT_SHOW_TOTAL_IF_CONTAINS_HIDDEN => get_string('hidetotalshowexhiddenitems', 'grades'),
GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN => get_string('hidetotalshowinchiddenitems', 'grades'))));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showcontributiontocoursetotal', get_string('showcontributiontocoursetotal', 'grades'), get_string('showcontributiontocoursetotal_help', 'grades'), 0));
$settings->add(new admin_setting_configcheckbox('grade_report_user_showcontributiontocoursetotal',
get_string('showcontributiontocoursetotal', 'grades'), get_string('showcontributiontocoursetotal_help', 'grades'), 1));
}

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014101400; // The current plugin version (Date: YYYYMMDDXX)
$plugin->version = 2014101500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'gradereport_user'; // Full name of the plugin (used for diagnostics)