/** * exitlinks * * @param xxx $hotpot * @return xxx */ public function exitlinks($hotpot) { $table = new html_table(); $table->attributes['class'] = 'hotpotexitlinks'; if ($hotpot->attempt->status == hotpot::STATUS_COMPLETED) { if ($hotpot->require_exitgrade() && $hotpot->attempt->score < $hotpot->exitgrade) { // insufficient grade to show link to next activity $cm = false; } else { // get next activity, if there is one $cm = $hotpot->get_cm('exit'); } if ($cm) { $url = new moodle_url('/mod/' . $cm->modname . '/view.php', array('id' => $cm->id)); $table->data[] = new html_table_row(array(new html_table_cell(html_writer::link($url, get_string('exit_next', 'hotpot'))), new html_table_cell(html_writer::link($url, format_string(urldecode($cm->name)))))); } } if ($hotpot->exitoptions & hotpot::EXITOPTIONS_RETRY) { // retry this hotpot, if allowed if ($hotpot->attemptlimit == 0 || empty($hotpot->attempts) || $hotpot->attemptlimit < count($hotpot->attempts)) { $table->data[] = new html_table_row(array(new html_table_cell(html_writer::link($hotpot->view_url(), get_string('exit_retry', 'hotpot'))), new html_table_cell(html_writer::link($hotpot->view_url(), format_string($hotpot->name))))); } } if ($hotpot->exitoptions & hotpot::EXITOPTIONS_INDEX) { $table->data[] = new html_table_row(array(new html_table_cell(html_writer::link($hotpot->index_url(), get_string('exit_index', 'hotpot'))), new html_table_cell(html_writer::link($hotpot->index_url(), get_string('exit_index_text', 'hotpot'))))); } if ($hotpot->exitoptions & hotpot::EXITOPTIONS_COURSE) { $table->data[] = new html_table_row(array(new html_table_cell(html_writer::link($hotpot->course_url(), get_string('exit_course', 'hotpot'))), new html_table_cell(html_writer::link($hotpot->course_url(), get_string('exit_course_text', 'hotpot'))))); } if ($hotpot->exitoptions & hotpot::EXITOPTIONS_GRADES) { if ($hotpot->course->showgrades && $hotpot->gradeweighting) { $url = new moodle_url($hotpot->grades_url()); $table->data[] = new html_table_row(array(new html_table_cell(html_writer::link($url, get_string('exit_grades', 'hotpot'))), new html_table_cell(html_writer::link($url, get_string('exit_grades_text', 'hotpot'))))); } } $output = ''; if ($count = count($table->data)) { if ($count > 1) { $output .= $this->whatnext('exit_whatnext'); } $output .= html_writer::table($table); } return $output; }