$submission->timemodified = time();
            $submission->numfiles = 1;
            $submission->submissioncomment = addslashes($submission->submissioncomment);
            unset($submission->data1);
            // Don't need to update this.
            unset($submission->data2);
            // Don't need to update this.
            if (update_record("webquestscorm_submissions", $submission)) {
                add_to_log($submissionsinstance->course->id, 'webquestscorm', 'upload', 'view.php?cmid=' . $submissionsinstance->cm->id, $submissionsinstance->wqid, $submissionsinstance->cm->id);
                $submissionsinstance->email_teachers($submission);
                print_heading(get_string('uploadedfile'));
            } else {
                notify(get_string("uploadfailnoupdate", "webquestscorm"));
            }
        } else {
            $newsubmission = $submissionsinstance->prepare_new_submission($USER->id);
            $newsubmission->timemodified = time();
            $newsubmission->numfiles = 1;
            if (insert_record('webquestscorm_submissions', $newsubmission)) {
                add_to_log($submissionsinstance->course->id, 'webquestscorm', 'upload', 'view.php?cmid=' . $submissionsinstance->cm->id, $submissionsinstance->wqid, $submissionsinstance->cm->id);
                $submissionsinstance->email_teachers($newsubmission);
                print_heading(get_string('uploadedfile'));
            } else {
                notify(get_string("uploadnotregistered", "webquestscorm", $newfile_name));
            }
        }
    }
} else {
    notify(get_string("uploaderror", "webquestscorm"));
    //submitting not allowed!
}
     $commenting = true;
 }
 if (isset($_POST['menu'])) {
     $col = 'menu';
     $grading = true;
 }
 if (!$col) {
     //both submissioncomment and grade columns collapsed..
     $submissionsinstance->display_submissions();
     break;
 }
 foreach ($_POST[$col] as $id => $unusedvalue) {
     $id = (int) $id;
     //clean parameter name
     if (!($submission = $submissionsinstance->get_submission($id))) {
         $submission = $submissionsinstance->prepare_new_submission($id);
         $newsubmission = true;
     } else {
         $newsubmission = false;
     }
     unset($submission->data1);
     // Don't need to update this.
     unset($submission->data2);
     // Don't need to update this.
     //for fast grade, we need to check if any changes take place
     $updatedb = false;
     if ($grading) {
         $grade = $_POST['menu'][$id];
         $updatedb = $updatedb || $submission->grade != $grade;
         $submission->grade = $grade;
     } else {