Beispiel #1
0
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
if ($userid || $showcompleted) {
    // Print the response of the given user.
    $completedrecord = $feedbackstructure->get_completed();
    if ($userid) {
        $usr = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
        $responsetitle = userdate($completedrecord->timemodified) . ' (' . fullname($usr) . ')';
    } else {
        $responsetitle = get_string('response_nr', 'feedback') . ': ' . $completedrecord->random_response . ' (' . get_string('anonymous', 'feedback') . ')';
    }
    echo $OUTPUT->heading($responsetitle, 4);
    $form = new mod_feedback_complete_form(mod_feedback_complete_form::MODE_VIEW_RESPONSE, $feedbackstructure, 'feedback_viewresponse_form');
    $form->display();
    list($prevresponseurl, $returnurl, $nextresponseurl) = $userid ? $responsestable->get_reponse_navigation_links($completedrecord) : $anonresponsestable->get_reponse_navigation_links($completedrecord);
    echo html_writer::start_div('response_navigation');
    echo $prevresponseurl ? html_writer::link($prevresponseurl, get_string('prev'), ['class' => 'prev_response']) : '';
    echo html_writer::link($returnurl, get_string('back'), ['class' => 'back_to_list']);
    echo $nextresponseurl ? html_writer::link($nextresponseurl, get_string('next'), ['class' => 'next_response']) : '';
    echo html_writer::end_div();
} else {
    // Print the list of responses.
    $courseselectform->display();
    // Show non-anonymous responses (always retrieve them even if current feedback is anonymous).
    $totalrows = $responsestable->get_total_responses_count();
    if (!$feedbackstructure->is_anonymous() || $totalrows) {
        echo $OUTPUT->heading(get_string('non_anonymous_entries', 'feedback', $totalrows), 4);
        $responsestable->display();
    }