Skip to content

Commit

Permalink
MDL-31158 make grade recovery site-configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
mackensen authored and andyjdavis committed Feb 17, 2012
1 parent 0dde394 commit dbe93bc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions admin/settings/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
GRADE_NAVMETHOD_TABS => new lang_string('tabs', 'grades'),
GRADE_NAVMETHOD_COMBO => new lang_string('combo', 'grades'))));

$temp->add(new admin_setting_configcheckbox('recovergradesdefault', new lang_string('recovergradesdefault', 'grades'), new lang_string('recovergradesdefault_help', 'grades'), 0));

$temp->add(new admin_setting_special_gradeexport());

$temp->add(new admin_setting_special_gradelimiting());
Expand Down
8 changes: 7 additions & 1 deletion enrol/manual/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,14 @@ public function get_manual_enrol_button(course_enrolment_manager $manager) {
'url' => $manager->get_moodlepage()->url->out(false),
'optionsStartDate' => $startdateoptions,
'defaultRole' => $instance->roleid,
'disableGradeHistory' => $CFG->disablegradehistory
'disableGradeHistory' => $CFG->disablegradehistory,
'recoverGradesDefault'=> ''
);

if ($CFG->recovergradesdefault) {
$arguments['recoverGradesDefault'] = ' checked="checked"';
}

$function = 'M.enrol_manual.quickenrolment.init';
$button->require_yui_module($modules, $function, array($arguments));
$button->strings_for_js(array(
Expand Down
8 changes: 6 additions & 2 deletions enrol/manual/yui/quickenrolment/quickenrolment.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
DEFAULTSTARTDATE : 'defaultStartDate',
DEFAULTDURATION : 'defaultDuration',
ASSIGNABLEROLES : 'assignableRoles',
DISABLEGRADEHISTORY : 'disableGradeHistory'
DISABLEGRADEHISTORY : 'disableGradeHistory',
RECOVERGRADESDEFAULT : 'recoverGradesDefault'
};
/** CSS classes for nodes in structure **/
var CSS = {
Expand Down Expand Up @@ -78,7 +79,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
if (this.get(UEP.DISABLEGRADEHISTORY) != true) {
recovergrades = create('<div class="'+CSS.ENROLMENTOPTION+' '+CSS.RECOVERGRADES+'"></div>')
.append(create('<label class="'+CSS.RECOVERGRADESTITLE+'" for="'+CSS.RECOVERGRADES+'">'+M.str.enrol.recovergrades+'</label>'))
.append(create('<input type="checkbox" id="'+CSS.RECOVERGRADES+'" name="'+CSS.RECOVERGRADES+'" />'))
.append(create('<input type="checkbox" id="'+CSS.RECOVERGRADES+'" name="'+CSS.RECOVERGRADES+'"'+ this.get(UEP.RECOVERGRADESDEFAULT) +' />'))
}

this.set(UEP.BASE, create('<div class="'+CSS.PANEL+' '+CSS.HIDDEN+'"></div>')
Expand Down Expand Up @@ -504,6 +505,9 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
},
disableGradeHistory : {
value : 0
},
recoverGradesDefault : {
value : ''
}
}
});
Expand Down
2 changes: 2 additions & 0 deletions lang/en/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@
$string['real'] = 'Real';
$string['realletter'] = 'Real (letter)';
$string['realpercentage'] = 'Real (percentage)';
$string['recovergradesdefault'] = 'Recover grades';
$string['recovergradesdefault_help'] = 'Choose whether to always recover grades by default when re-enrolling a student.';
$string['regradeanyway'] = 'Regrade anyway';
$string['removeallcoursegrades'] = 'Delete all grades';
$string['removeallcourseitems'] = 'Delete all items and categories';
Expand Down

0 comments on commit dbe93bc

Please sign in to comment.