course)) { error("This category doesn't belong to a valid course!"); } require_login($course->id); if (!isteacher($course->id)) { error("Only the teacher can import quiz questions!"); } $streditingquiz = get_string("editingquiz", "quiz"); $strimportquestions = get_string("importquestions", "quiz"); $strquestions = get_string("questions", "quiz"); print_header("$course->shortname: $strimportquestions", "$course->shortname: $strimportquestions", "wwwroot/course/view.php?id=$course->id\">$course->shortname -> $streditingquiz -> $strimportquestions"); if ($form = data_submitted()) { /// Filename if (!empty($_FILES['newfile'])) { $newfile = $_FILES['newfile']; } if (empty($newfile)) { notify(get_string("uploadproblem") ); } else if (!is_uploaded_file($newfile['tmp_name']) or $newfile['size'] == 0) { notify(get_string("uploadnofilefound") ); } else { if (! is_readable("format/$form->format".".php")) { error("Format not known ($form->format)"); } require("format/$form->format".".php"); $format = new quiz_file_format(); if (! $format->importpreprocess($category)) { // Do anything before that we need to error("Error occurred during pre-processing!"); } if (! $format->importprocess($newfile['tmp_name'])) { // Process the uploaded file error("Error occurred during processing!"); } if (! $format->importpostprocess()) { // In case anything needs to be done after error("Error occurred during post-processing!"); } echo "