/** * Render the list of quizzes that still need to be upgraded page. * @param array $quizzes of data about quizzes. * @param int $numveryoldattemtps only relevant before upgrade. * @return string html to output. */ public function quiz_list_page(tool_qeupgradehelper_quiz_list $quizzes, $numveryoldattemtps = null) { $output = ''; $output .= $this->header(); $output .= $this->heading($quizzes->title); $output .= $this->box($quizzes->intro); $table = new html_table(); $table->head = $quizzes->get_col_headings(); $rowcount = 0; foreach ($quizzes->quizlist as $quizinfo) { $table->data[$rowcount] = $quizzes->get_row($quizinfo); if ($class = $quizzes->get_row_class($quizinfo)) { $table->rowclasses[$rowcount] = $class; } $rowcount += 1; } $table->data[] = $quizzes->get_total_row(); $output .= html_writer::table($table); if ($numveryoldattemtps) { $output .= $this->box(get_string('veryoldattemtps', 'tool_qeupgradehelper', $numveryoldattemtps)); } $output .= $this->back_to_index(); $output .= $this->footer(); return $output; }
public function get_row($quizinfo) { $row = parent::get_row($quizinfo); $row[] = html_writer::link(tool_qeupgradehelper_url('resetquiz', array('quizid' => $quizinfo->id)), get_string('resetquiz', 'tool_qeupgradehelper')); return $row; }