MDL-27964 lesson - Old file picker is replaced with new filepicker, currently all imported questions will be saved in /temp/questionimport/ where questionbank files are saved.

This commit is contained in:
Rajesh Taneja 2011-06-23 10:12:18 +08:00
parent 7fde489dae
commit b89bf55f84
2 changed files with 54 additions and 23 deletions

View file

@ -66,9 +66,13 @@ if ($data = $mform->get_data()) {
require_sesskey();
if (!$importfile = $mform->get_importfile_name()) {
print_error('uploadproblem', 'moodle');
}
$realfilename = $mform->get_new_filename('questionfile');
//TODO: Leave all imported questions in Questionimport for now.
$importfile = "{$CFG->dataroot}/temp/questionimport/{$realfilename}";
make_upload_directory('temp/questionimport');
if (!$result = $mform->save_file('questionfile', $importfile, true)) {
throw new moodle_exception('uploadproblem');
}
$formatclass = 'qformat_'.$data->format;
$formatclassfile = $CFG->dirroot.'/question/format/'.$data->format.'/format.php';
@ -102,4 +106,4 @@ if ($data = $mform->get_data()) {
$mform->display();
}
echo $OUTPUT->footer();
echo $OUTPUT->footer();