'deleteolditems'=>'1', 'action'=>'choosefile', 'confirmadd'=>'1', 'do_show'=>'templates'); $mform->set_data($newformdata); $formdata = $mform->get_data(); if ($mform->is_cancelled()) { redirect('edit.php?id='.$id.'&do_show=templates'); } // process if we are happy file is ok if ($choosefile) { $xmlcontent = $mform->get_file_content('choosefile'); if (!$xmldata = feedback_load_xml_data($xmlcontent)) { print_error('cannotloadxml', 'feedback', 'edit.php?id='.$id); } $importerror = feedback_import_loaded_data($xmldata, $feedback->id); if ($importerror->stat == true) { $url = 'edit.php?id='.$id.'&do_show=templates'; redirect($url, get_string('import_successfully', 'feedback'), 3); exit; } } /// Print the page header $strfeedbacks = get_string("modulenameplural", "feedback"); $strfeedback = get_string("modulename", "feedback");
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)) { print_error('filenotreadable'); } if (!($xmldata = feedback_load_xml_data($filename))) { print_error('cannotloadxml', 'feedback', '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');