course)) {
error("Course is misconfigured");
}
if (! $feedback = get_record("feedback", "id", $cm->instance)) {
error("Course module is incorrect");
}
}
$capabilities = feedback_load_capabilities($cm->id);
require_login($course->id, true, $cm);
if(!$capabilities->edititems){
error('this action is not allowed');
}
unset($filename);
if ($action == 'choosefile' AND confirm_sesskey() ) {
// file checks out ok
$fileisgood = false;
// work out if this is an uploaded file
// or one from the filesarea.
if ($choosefile) {
$filename = "{$CFG->dataroot}/{$course->id}/{$choosefile}";
}
}
// process if we are happy file is ok
if (isset($filename)) {
if(!is_file($filename) OR !is_readable($filename)) {
error('file not found or not readable');
}
if(!$xmldata = feedback_load_xml_data($filename)) {
error('failed to loading xml', 'edit.php?id='.$id);
}
$importerror = feedback_import_loaded_data($xmldata, $feedback->id);
if($importerror->stat == true) {
redirect('edit.php?id='.$id.'&do_show=templates', get_string('import_successfully', 'feedback'), 3);
exit;
}
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
$navlinks = array();
$navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id=$course->id", 'type' => 'activity');
$navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($feedback->name), "",
$navigation, "", "", true, $buttontext, navmenu($course, $cm));
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
print_heading(get_string('import_questions','feedback'));
if(isset($importerror->msg) AND is_array($importerror->msg)) {
// print_simple_box_start('center', '', '#FFAAAA', 5, 'notifyproblem');
print_box_start('generalbox errorboxcontent boxaligncenter');
foreach($importerror->msg as $msg) {
echo $msg.'
';
}
// print_simple_box_end();
print_box_end();
}
?>