Minor bug fixes.

This commit is contained in:
tjhunt 2008-09-18 04:33:38 +00:00
parent 1aea04dcbf
commit 8033d8423f

View file

@ -113,14 +113,14 @@ class quiz_grading_report extends quiz_default_report {
if ($data = data_submitted()) { // post data submitted, process it if ($data = data_submitted()) { // post data submitted, process it
if (confirm_sesskey() && $this->users){ if (confirm_sesskey() && $this->users){
// now go through all of the responses and save them. // now go through all of the responses and save them.
$allok = true; $allok = true;
foreach($data->manualgrades as $uniqueid => $response) { foreach($data->manualgrades as $uniqueid => $response) {
// get our attempt // get our attempt
$uniqueid = clean_param($uniqueid, PARAM_INT); $uniqueid = clean_param($uniqueid, PARAM_INT);
list($usql, $params) = $DB->get_in_or_equal(array_keys($this->users)); list($usql, $params) = $DB->get_in_or_equal(array_keys($this->users));
if (!$attempt = $DB->get_record_sql("SELECT * FROM {quiz_attempts} " . if (!$attempt = $DB->get_record_sql("SELECT * FROM {quiz_attempts} " .
"WHERE uniqueid = ? AND " . "WHERE uniqueid = ? AND " .
"userid $usql AND " . "userid $usql AND " .
@ -145,7 +145,7 @@ class quiz_grading_report extends quiz_default_report {
quiz_save_best_grade($quiz, $attempt->userid); quiz_save_best_grade($quiz, $attempt->userid);
} }
} }
if ($allok) { if ($allok) {
notify(get_string('changessaved', 'quiz'), 'notifysuccess'); notify(get_string('changessaved', 'quiz'), 'notifysuccess');
} else { } else {
@ -285,6 +285,7 @@ class quiz_grading_report extends quiz_default_report {
// get the attempts and process them // get the attempts and process them
if ($attempts = $DB->get_records_sql($select.$from.$where.$sort, $params, $table->get_page_start(), $table->get_page_size())) { if ($attempts = $DB->get_records_sql($select.$from.$where.$sort, $params, $table->get_page_start(), $table->get_page_size())) {
echo '<div id="tablecontainer">';
// grade all link // grade all link
$links = "<strong><a href=\"report.php?mode=grading&amp;gradeall=1&amp;q=$quiz->id&amp;questionid=$question->id\">".get_string('gradeall', 'quiz_grading', $totalattempts).'</a></strong>'; $links = "<strong><a href=\"report.php?mode=grading&amp;gradeall=1&amp;q=$quiz->id&amp;questionid=$question->id\">".get_string('gradeall', 'quiz_grading', $totalattempts).'</a></strong>';
if ($ungraded>0){ if ($ungraded>0){
@ -320,7 +321,6 @@ class quiz_grading_report extends quiz_default_report {
$table->add_separator(); $table->add_separator();
$table->add_data_keyed(array('grade'=> $links)); $table->add_data_keyed(array('grade'=> $links));
// print everything here // print everything here
echo '<div id="tablecontainer">';
$table->print_html(); $table->print_html();
echo '</div>'; echo '</div>';
} else { } else {
@ -339,7 +339,7 @@ class quiz_grading_report extends quiz_default_report {
global $CFG, $DB; global $CFG, $DB;
// TODO get the context, and put in proper roles an permissions checks. // TODO get the context, and put in proper roles an permissions checks.
$context = NULL; $context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
$questions[$question->id] = &$question; $questions[$question->id] = &$question;
$usehtmleditor = can_use_html_editor(); $usehtmleditor = can_use_html_editor();
@ -417,10 +417,6 @@ class quiz_grading_report extends quiz_default_report {
} }
echo '<div class="boxaligncenter"><input type="submit" value="'.get_string('savechanges').'" /></div>'. echo '<div class="boxaligncenter"><input type="submit" value="'.get_string('savechanges').'" /></div>'.
'</form>'; '</form>';
if ($usehtmleditor) {
use_html_editor();
}
} else { } else {
notify(get_string('noattemptstoshow', 'quiz')); notify(get_string('noattemptstoshow', 'quiz'));
} }