Ejemplo n.º 1
0
    print_error('error:coursemisconfigured', 'facetoface');
}
if (!$cm = get_coursemodule_from_instance("facetoface", $facetoface->id, $course->id)) {
    print_error('error:incorrectcoursemoduleid', 'facetoface');
}

require_course_login($course);
$context = context_course::instance($course->id);
require_capability('mod/facetoface:view', $context);

$returnurl = "$CFG->wwwroot/course/view.php?id=$course->id";
if ($backtoallsessions) {
    $returnurl = "$CFG->wwwroot/mod/facetoface/view.php?f=$backtoallsessions";
}

$mform = new mod_facetoface_cancelsignup_form(null, compact('s', 'backtoallsessions'));
if ($mform->is_cancelled()) {
    redirect($returnurl);
}

if ($fromform = $mform->get_data()) { // Form submitted

    if (empty($fromform->submitbutton)) {
        print_error('error:unknownbuttonclicked', 'facetoface', $returnurl);
    }

    $forcecancel = false;
    $timenow = time();
    $bookedsession = facetoface_get_user_submissions($facetoface->id, $USER->id, MDL_F2F_STATUS_WAITLISTED, MDL_F2F_STATUS_WAITLISTED, $session->id);
    if (!empty($bookedsession) && facetoface_has_session_started($session, $timenow)) {
        $forcecancel = true;
Ejemplo n.º 2
0
    print_error('error:incorrectfacetofaceid', 'facetoface');
}
if (!($course = $DB->get_record('course', array('id' => $facetoface->course)))) {
    print_error('error:coursemisconfigured', 'facetoface');
}
if (!($cm = get_coursemodule_from_instance("facetoface", $facetoface->id, $course->id))) {
    print_error('error:incorrectcoursemoduleid', 'facetoface');
}
require_course_login($course);
$context = context_course::instance($course->id);
require_capability('mod/facetoface:view', $context);
$returnurl = "{$CFG->wwwroot}/course/view.php?id={$course->id}";
if ($backtoallsessions) {
    $returnurl = "{$CFG->wwwroot}/mod/facetoface/view.php?f={$backtoallsessions}";
}
$mform = new mod_facetoface_cancelsignup_form(null, compact('s', 'backtoallsessions'));
if ($mform->is_cancelled()) {
    redirect($returnurl);
}
if ($fromform = $mform->get_data()) {
    // Form submitted.
    if (empty($fromform->submitbutton)) {
        print_error('error:unknownbuttonclicked', 'facetoface', $returnurl);
    }
    $timemessage = 4;
    $errorstr = '';
    if (facetoface_user_cancel($session, false, false, $errorstr, $fromform->cancelreason)) {
        // Logging and events trigger.
        $params = array('context' => $contextmodule, 'objectid' => $session->id);
        $event = \mod_facetoface\event\cancel_booking::create($params);
        $event->add_record_snapshot('facetoface_sessions', $session);