Example #1
0
            $rid = $rids[0];
        }
        if ($rid) {
            $numresp = $questionnaire->count_submissions($USER->id);
            $titletext = get_string('myresponsetitle', 'questionnaire', $numresp);
        }
        // Print the page header.
        echo $OUTPUT->header();
        // Print the tabs.
        include 'tabs.php';
        echo $OUTPUT->box_start();
        echo $OUTPUT->heading($titletext);
        if (count($resps) > 1) {
            echo '<div style="text-align:center; padding-bottom:5px;">';
            $questionnaire->survey_results_navbar_student($rid, $userid, $instance, $resps);
            echo '</div>';
        }
        $questionnaire->view_response($rid);
        if (count($resps) > 1) {
            echo '<div style="text-align:center; padding-bottom:5px;">';
            $questionnaire->survey_results_navbar_student($rid, $userid, $instance, $resps);
            echo '</div>';
        }
        echo $OUTPUT->box_end();
        // Finish the page.
        echo $OUTPUT->footer($course);
        break;
    case get_string('return', 'questionnaire'):
    default:
        redirect('view.php?id=' . $cm->id);
}
            echo '</div>';
        }
        $resps = array();
        // Determine here which "global" responses should get displayed for comparison with current user.
        // Current user is viewing his own group's results.
        if (isset($currentgroupresps)) {
            $resps = $currentgroupresps;
        }
        // Current user is viewing another group's results so we must add their own results to that group's results.
        if (!$iscurrentgroupmember) {
            $resps += $respsuser;
        }
        // No groups.
        if ($groupmode == 0 || $currentgroupid == 0) {
            $resps = $respsallparticipants;
        }
        $compare = true;
        $questionnaire->view_response($rid, null, null, $resps, $compare, $iscurrentgroupmember, $allresponses = false, $currentgroupid);
        if (isset($userresps) && count($userresps) > 1) {
            echo '<div style="text-align:center; padding-bottom:5px;">';
            $questionnaire->survey_results_navbar_student($rid, $userid, $instance, $userresps);
            echo '</div>';
        }
        echo $OUTPUT->box_end();
        // Finish the page.
        echo $OUTPUT->footer($course);
        break;
    case get_string('return', 'questionnaire'):
    default:
        redirect('view.php?id=' . $cm->id);
}