Ejemplo n.º 1
0
if (has_capability('mod/feedback:mapcourse', $context) && $feedback->course == SITEID) {
    echo $OUTPUT->box_start('generalbox feedback_mapped_courses');
    echo $OUTPUT->heading(get_string("mappedcourses", "feedback"), 3);
    echo '<p>' . get_string('mapcourse_help', 'feedback') . '</p>';
    $mapurl = new moodle_url('/mod/feedback/mapcourse.php', array('id' => $id));
    echo '<p class="mdl-align">' . html_writer::link($mapurl, get_string('mapcourses', 'feedback')) . '</p>';
    echo $OUTPUT->box_end();
}
if ($feedbackcompletion->can_complete()) {
    echo $OUTPUT->box_start('generalbox boxaligncenter');
    if (!$feedbackcompletion->is_open()) {
        // Feedback is not yet open or is already closed.
        echo $OUTPUT->notification(get_string('feedback_is_not_open', 'feedback'));
        echo $OUTPUT->continue_button(course_get_url($courseid ?: $course->id));
    } else {
        if ($feedbackcompletion->can_submit()) {
            // Display a link to complete feedback or resume.
            $completeurl = new moodle_url('/mod/feedback/complete.php', ['id' => $id, 'courseid' => $courseid]);
            if ($startpage = $feedbackcompletion->get_resume_page()) {
                $completeurl->param('gopage', $startpage);
                $label = get_string('continue_the_form', 'feedback');
            } else {
                $label = get_string('complete_the_form', 'feedback');
            }
            echo html_writer::div(html_writer::link($completeurl, $label), 'complete-feedback');
        } else {
            // Feedback was already submitted.
            echo $OUTPUT->notification(get_string('this_feedback_is_already_submitted', 'feedback'));
            $OUTPUT->continue_button(course_get_url($courseid ?: $course->id));
        }
    }
Ejemplo n.º 2
0
    echo $OUTPUT->header();
    echo $OUTPUT->heading(format_string($feedback->name));
    echo $OUTPUT->box_start('generalbox boxaligncenter');
    echo $OUTPUT->notification(get_string('feedback_is_not_open', 'feedback'));
    echo $OUTPUT->continue_button(course_get_url($courseid ?: $feedback->course));
    echo $OUTPUT->box_end();
    echo $OUTPUT->footer();
    exit;
}
// Mark activity viewed for completion-tracking.
$completion = new completion_info($course);
if (isloggedin() && !isguestuser()) {
    $completion->set_module_viewed($cm);
}
// Check if user is prevented from re-submission.
$cansubmit = $feedbackcompletion->can_submit();
// Initialise the form processing feedback completion.
if (!$feedbackcompletion->is_empty() && $cansubmit) {
    $form = new mod_feedback_complete_form(mod_feedback_complete_form::MODE_COMPLETE, $feedbackcompletion, 'feedback_complete_form', array('gopage' => $gopage));
    if ($form->is_cancelled()) {
        // Form was cancelled - return to the course page.
        redirect(course_get_url($courseid ?: $course));
    } else {
        if ($form->is_submitted() && ($form->is_validated() || optional_param('gopreviouspage', null, PARAM_RAW))) {
            // Form was submitted (skip validation for "Previous page" button).
            $data = $form->get_submitted_data();
            if (!isset($SESSION->feedback->is_started) or !$SESSION->feedback->is_started == true) {
                print_error('error', '', $CFG->wwwroot . '/course/view.php?id=' . $course->id);
            }
            $feedbackcompletion->save_response_tmp($data);
            if (!empty($data->savevalues) || !empty($data->gonextpage)) {