} else { if (!is_enrolled($context)) { // Only people enrolled can make a randchoice $SESSION->wantsurl = qualified_me(); $SESSION->enrolcancel = get_local_referer(false); $coursecontext = context_course::instance($course->id); $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext)); echo $OUTPUT->box_start('generalbox', 'notice'); echo '<p align="center">' . get_string('notenrolledchoose', 'randchoice') . '</p>'; echo $OUTPUT->container_start('continuebutton'); echo $OUTPUT->single_button(new moodle_url('/enrol/index.php?', array('id' => $course->id)), get_string('enrolme', 'core_enrol', $courseshortname)); echo $OUTPUT->container_end(); echo $OUTPUT->box_end(); } } } // print the results at the bottom of the screen if ($randchoice->showresults == CHOICE_SHOWRESULTS_ALWAYS or $randchoice->showresults == CHOICE_SHOWRESULTS_AFTER_ANSWER and $current or $randchoice->showresults == CHOICE_SHOWRESULTS_AFTER_CLOSE and !$randchoiceopen) { if (!empty($randchoice->showunanswered)) { $randchoice->option[0] = get_string('notanswered', 'randchoice'); $randchoice->maxanswers[0] = 0; } $results = prepare_randchoice_show_results($randchoice, $course, $cm, $allresponses); $renderer = $PAGE->get_renderer('mod_randchoice'); echo $renderer->display_result($results); } else { if (!$randchoiceformshown) { echo $OUTPUT->box(get_string('noresultsviewable', 'randchoice')); } } echo $OUTPUT->footer();
echo $ug2 . "\t"; if (isset($option_text)) { echo format_string($option_text, true); } echo "\n"; } } } exit; } // Show those who haven't answered the question. if (!empty($randchoice->showunanswered)) { $randchoice->option[0] = get_string('notanswered', 'randchoice'); $randchoice->maxanswers[0] = 0; } $results = prepare_randchoice_show_results($randchoice, $course, $cm, $users); $renderer = $PAGE->get_renderer('mod_randchoice'); echo $renderer->display_result($results, has_capability('mod/randchoice:readresponses', $context)); //now give links for downloading spreadsheets. if (!empty($users) && has_capability('mod/randchoice:downloadresponses', $context)) { $downloadoptions = array(); $options = array(); $options["id"] = "{$cm->id}"; $options["download"] = "ods"; $button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadods")); $downloadoptions[] = html_writer::tag('li', $button, array('class' => 'reportoption')); $options["download"] = "xls"; $button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadexcel")); $downloadoptions[] = html_writer::tag('li', $button, array('class' => 'reportoption')); $options["download"] = "txt"; $button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadtext"));