if ($usergrps = groups_get_all_groups($course->id, $user->id)) { foreach ($usergrps as $ug) { $ug2 = $ug2 . $ug->name; } } echo $ug2 . "\t"; if (isset($option_text)) { echo format_string($option_text, true); } echo "\n"; } } } exit; } choice_show_results($choice, $course, $cm, $users, $format); //show table with students responses. //now give links for downloading spreadsheets. if (!empty($users) && has_capability('mod/choice:downloadresponses', $context)) { echo "<br />\n"; echo "<table class=\"downloadreport\"><tr>\n"; echo "<td>"; $options = array(); $options["id"] = "{$cm->id}"; $options["download"] = "ods"; print_single_button("report.php", $options, get_string("downloadods")); echo "</td><td>"; $options["download"] = "xls"; print_single_button("report.php", $options, get_string("downloadexcel")); echo "</td><td>"; $options["download"] = "txt";
$sitecontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) { // Guest on whole site $wwwroot = $CFG->wwwroot . '/login/index.php'; if (!empty($CFG->loginhttps)) { $wwwroot = str_replace('http:', 'https:', $wwwroot); } notice_yesno(get_string('noguestchoose', 'choice') . '<br /><br />' . get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']); } else { if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Guest in this course only $SESSION->wantsurl = $FULLME; $SESSION->enrolcancel = $_SERVER['HTTP_REFERER']; print_simple_box_start('center', '60%', '', 5, 'generalbox', 'notice'); echo '<p align="center">' . get_string('noguestchoose', 'choice') . '</p>'; echo '<div class="continuebutton">'; print_single_button($CFG->wwwroot . '/course/enrol.php?id=' . $course->id, NULL, get_string('enrolme', '', format_string($course->shortname)), 'post', $CFG->framename); echo '</div>' . "\n"; print_simple_box_end(); } } } // print the results at the bottom of the screen if ($choice->showresults == CHOICE_SHOWRESULTS_ALWAYS or $choice->showresults == CHOICE_SHOWRESULTS_AFTER_ANSWER and $current or $choice->showresults == CHOICE_SHOWRESULTS_AFTER_CLOSE and $choice->timeclose <= time()) { choice_show_results($choice, $course, $cm); } else { if (!$choiceformshown) { print_simple_box(get_string('noresultsviewable', 'choice'), 'center'); } } print_footer($course);
if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) { // Guest on whole site $wwwroot = $CFG->wwwroot . '/login/index.php'; if (!empty($CFG->loginhttps)) { $wwwroot = str_replace('http:', 'https:', $wwwroot); } notice_yesno(get_string('noguestchoose', 'choice') . '<br /><br />' . get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']); } else { if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Guest in this course only $SESSION->wantsurl = $FULLME; $SESSION->enrolcancel = $_SERVER['HTTP_REFERER']; print_simple_box_start('center', '60%', '', 5, 'generalbox', 'notice'); echo '<p align="center">' . get_string('noguestchoose', 'choice') . '</p>'; echo '<div class="continuebutton">'; print_single_button($CFG->wwwroot . '/course/enrol.php?id=' . $course->id, NULL, get_string('enrolme', '', format_string($course->shortname)), 'post', $CFG->framename); echo '</div>' . "\n"; print_simple_box_end(); } } } // print the results at the bottom of the screen if ($choice->showresults == CHOICE_SHOWRESULTS_ALWAYS or $choice->showresults == CHOICE_SHOWRESULTS_AFTER_ANSWER and $current or $choice->showresults == CHOICE_SHOWRESULTS_AFTER_CLOSE and !$choiceopen) { choice_show_results($choice, $course, $cm, $allresponses); //show table with students responses. } else { if (!$choiceformshown) { print_simple_box(get_string('noresultsviewable', 'choice'), 'center'); } } print_footer($course);