mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 23:42:11 +02:00
MDL-10985 improved form validation in xml grade import
This commit is contained in:
parent
89489cfe94
commit
d7a61f65c1
@ -55,12 +55,17 @@ class grade_import_form extends moodleform {
|
||||
$this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
|
||||
}
|
||||
|
||||
function validation($data) {
|
||||
function validation($data, $files) {
|
||||
$err = array();
|
||||
if (empty($data['url']) and empty($files['userfile'])) {
|
||||
if (array_key_exists('url', $data)) {
|
||||
$err['url'] = get_string('required');
|
||||
}
|
||||
if (array_key_exists('userfile', $data)) {
|
||||
$err['userfile'] = get_string('required');
|
||||
}
|
||||
|
||||
$strrequired = get_string('required');
|
||||
|
||||
if (array_key_exists('url', $data) and $data['url'] != clean_param($data['url'], PARAM_URL)) {
|
||||
} else if (array_key_exists('url', $data) and $data['url'] != clean_param($data['url'], PARAM_URL)) {
|
||||
$err['url'] = get_string('error');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user