$course->id)); if (!empty($CFG->gradepublishing)) { $CFG->gradepublishing = has_capability('gradeimport/xml:publish', $context); } $mform = new grade_import_form(); if ($data = $mform->get_data()) { // Large files are likely to take their time and memory. Let PHP know // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); @raise_memory_limit("256M"); if (function_exists('apache_child_terminate')) { @apache_child_terminate(); } if ($text = $mform->get_file_content('userfile')) { print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation); print_grade_plugin_selector($id, 'import', 'xml'); $error = ''; $importcode = import_xml_grades($text, $course, $error); if ($importcode) { grade_import_commit($id, $importcode, $data->feedback, true); print_footer(); die; } else { notify($error); print_continue($CFG->wwwroot.'/grade/index.php?id='.$course->id); print_footer(); die; } } else if (empty($data->key)) { redirect('import.php?id='.$id.'&feedback='.(int)($data->feedback).'&url='.urlencode($data->url)); } else { if ($data->key == 1) { $data->key = create_user_key('grade/import', $USER->id, $course->id, $data->iprestriction, $data->validuntil); } print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation); print_grade_plugin_selector($id, 'import', 'xml'); echo ''; print_footer(); die; } } print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation); print_grade_plugin_selector($id, 'import', 'xml'); $mform->display(); print_footer(); ?>