Hi. Ain't nuthing wrong with the Summary Of Attempt table. However, since by default it consists of only one column, a quiz of 50 to 100 quiz questions will result in a Summary of Attempt table that extends for most of the screen's height. I have to scroll all the way down to access and to click the "Submit all and Finish' or 'Return to attempt' buttons. Here's what my summary looks like with a quiz of 20 questions.
Just wondering if the table could be redesigned to fit across two columns, like so:
But why, you may ask? I think it looks nicer and the user, can at a glance see the status of all questions without having to scroll down.
I've narrowed down the Moodle 2.5 code to the
public function summary_table($attemptobj, $displayoptions)
function found inside the moodle/quiz/renderer.php file. Full code is below:
/**
* Generates the table of summarydata
*
* @param quiz_attempt $attemptobj
* @param mod_quiz_display_options $displayoptions
*/
public function summary_table($attemptobj, $displayoptions) {
// Prepare the summary table header.
$table = new html_table();
$table->attributes['class'] = 'generaltable quizsummaryofattempt boxaligncenter';
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
$table->align = array('left', 'left');
$table->size = array('', '');
$markscolumn = $displayoptions->marks >= question_display_options::MARK_AND_MAX;
if ($markscolumn) {
$table->head[] = get_string('marks', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
}
$table->data = array();
// Get the summary info for each question.
$slots = $attemptobj->get_slots();
foreach ($slots as $slot) {
if (!$attemptobj->is_real_question($slot)) {
continue;
}
$flag = '';
if ($attemptobj->is_question_flagged($slot)) {
$flag = html_writer::empty_tag('img', array('src' => $this->pix_url('i/flagged'),
'alt' => get_string('flagged', 'question'), 'class' => 'questionflag icon-post'));
}
if ($attemptobj->can_navigate_to($slot)) {
$row = array(html_writer::link($attemptobj->attempt_url($slot),
$attemptobj->get_question_number($slot) . $flag),
$attemptobj->get_question_status($slot, $displayoptions->correctness));
} else {
$row = array($attemptobj->get_question_number($slot) . $flag,
$attemptobj->get_question_status($slot, $displayoptions->correctness));
}
if ($markscolumn) {
$row[] = $attemptobj->get_question_mark($slot);
}
$table->data[] = $row;
$table->rowclasses[] = $attemptobj->get_question_state_class(
$slot, $displayoptions->correctness);
}
// Print the summary table.
$output = html_writer::table($table);
return $output;
}
Nope, I haven't got the answer yet. To be continued....stay tuned for the next episode of Moodle HSI - 'Hack Scene Investigation'.