mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-30559' of git://github.com/timhunt/moodle
This commit is contained in:
commit
9b91efe5bc
@ -313,6 +313,35 @@ abstract class moodleform_mod extends moodleform {
|
||||
$errors['availablefrom'] = get_string('badavailabledates', 'condition');
|
||||
}
|
||||
|
||||
// Conditions: Verify that the grade conditions are numbers, and make sense.
|
||||
if (array_key_exists('conditiongradegroup', $data)) {
|
||||
foreach ($data['conditiongradegroup'] as $i => $gradedata) {
|
||||
if ($gradedata['conditiongrademin'] !== '' && !is_numeric($gradedata['conditiongrademin'])) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
|
||||
continue;
|
||||
}
|
||||
if ($gradedata['conditiongrademax'] !== '' && !is_numeric($gradedata['conditiongrademax'])) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
|
||||
continue;
|
||||
}
|
||||
if ($gradedata['conditiongrademin'] !== '' && $gradedata['conditiongrademax'] !== '' &&
|
||||
$gradedata['conditiongrademax'] < $gradedata['conditiongrademin']) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('badgradelimits', 'condition');
|
||||
continue;
|
||||
}
|
||||
if ($gradedata['conditiongrademin'] === '' && $gradedata['conditiongrademax'] === '' &&
|
||||
$gradedata['conditiongradeitemid']) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradeitembutnolimits', 'condition');
|
||||
continue;
|
||||
}
|
||||
if (($gradedata['conditiongrademin'] !== '' || $gradedata['conditiongrademax'] !== '') &&
|
||||
!$gradedata['conditiongradeitemid']) {
|
||||
$errors["conditiongradegroup[{$i}]"] = get_string('gradelimitsbutnoitem', 'condition');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
@ -471,8 +500,6 @@ abstract class moodleform_mod extends moodleform {
|
||||
$grouparray[] =& $mform->createElement('static', '', '','% '.get_string('grade_upto','condition').' ');
|
||||
$grouparray[] =& $mform->createElement('text', 'conditiongrademax','',array('size'=>3));
|
||||
$grouparray[] =& $mform->createElement('static', '', '','%');
|
||||
$mform->setType('conditiongrademin',PARAM_FLOAT);
|
||||
$mform->setType('conditiongrademax',PARAM_FLOAT);
|
||||
$group = $mform->createElement('group','conditiongradegroup',
|
||||
get_string('gradecondition', 'condition'),$grouparray);
|
||||
|
||||
|
@ -32,6 +32,7 @@ $string['availablefrom_help'] = 'Access from/to dates determine when students ca
|
||||
The difference between access from/to dates and availability settings for the activity is that outside the set dates the latter allows students to view the activity description, whereas access from/to dates prevent access completely.';
|
||||
$string['availableuntil'] = 'Allow access until';
|
||||
$string['badavailabledates'] = 'Invalid dates. If you set both dates, the \'Allow access from\' date should be before the \'until\' date.';
|
||||
$string['badgradelimits'] = 'If you set both an upper and lower grade limit, the upper limit must be higher than the lower limit.';
|
||||
$string['completion_complete'] = 'must be marked complete';
|
||||
$string['completioncondition'] = 'Activity completion condition';
|
||||
$string['completioncondition_help'] = 'This setting determines any activity completion conditions which must be met in order to access the activity. Note that completion tracking must first be set before an activity completion condition can be set.
|
||||
@ -48,6 +49,9 @@ $string['gradecondition_help'] = 'This setting determines any grade conditions w
|
||||
|
||||
Multiple grade conditions may be set if desired. If so, the activity will only allow access when ALL grade conditions are met.';
|
||||
$string['grade_upto'] = 'and less than';
|
||||
$string['gradeitembutnolimits'] = 'You must enter an upper or lower limit, or both.';
|
||||
$string['gradelimitsbutnoitem'] = 'You must choose a grade item.';
|
||||
$string['gradesmustbenumeric'] = 'The minimum and maximum grades must be numeric (or blank).';
|
||||
$string['none'] = '(none)';
|
||||
$string['notavailableyet'] = 'Not available yet';
|
||||
$string['requires_completion_0'] = 'Not available unless the activity <strong>{$a}</strong> is incomplete.';
|
||||
|
Loading…
x
Reference in New Issue
Block a user