Beispiel #1
0
         } else {
             //Sign up user to this webinar through Adobe Connect API call
             signup_meeting($webinar, $session, $user);
             //Send registration email to user
             send_email_signup($webinar, $session, $cm, $user);
         }
     }
 } else {
     if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
         require_capability('mod/webinar:removeattendees', $context);
         foreach ($frm->removeselect as $removeuser) {
             if (!($removeuser = clean_param($removeuser, PARAM_INT))) {
                 continue;
                 // invalid userid
             }
             if (webinar_user_cancel($session, $removeuser, true, $cancelerr)) {
                 // Notify the user of the cancellation if the session hasn't started yet
                 $timenow = time();
                 if (!$suppressemail and !webinar_has_session_started($session, $timenow)) {
                     webinar_send_cancellation_notice($webinar, $session, $removeuser);
                 }
             } else {
                 $errors[] = $cancelerr;
                 $erruser = $DB->get_record('user', array('id' => $removeuser), 'id, firstname, lastname');
                 $errors[] = get_string('error:removeattendee', 'webinar', fullname($erruser));
             }
         }
         // Update attendees
         webinar_update_attendees($session);
         $user = $DB->get_record('user', array('id' => $removeuser));
         //Unregister this user from this webinar through Adobe Connect API call
Beispiel #2
0
/**
 * Delete entry from the webinar_sessions table along with all
 * related details in other tables
 *
 * @param object $session Record from webinar_sessions
 */
function webinar_delete_session($session)
{
    global $CFG, $DB;
    $webinar = $DB->get_record('webinar', array('id' => $session->webinar));
    // Cancel user signups (and notify users)
    $signedupusers = $DB->get_records_sql("\n            SELECT DISTINCT\n                userid\n            FROM\n                {$CFG->prefix}webinar_signups s\n            LEFT JOIN\n                {$CFG->prefix}webinar_signups_status ss\n             ON ss.signupid = s.id\n            WHERE\n                s.sessionid = {$session->id}\n            AND ss.superceded = 0\n            AND ss.statuscode >= " . WEBINAR_STATUS_REQUESTED . "\n        ");
    if ($signedupusers and count($signedupusers) > 0) {
        foreach ($signedupusers as $user) {
            if (webinar_user_cancel($session, $user->userid, true)) {
                webinar_send_cancellation_notice($webinar, $session, $user->userid);
            } else {
                return false;
                // Cannot rollback since we notified users already
            }
        }
    }
    //begin_sql();
    // Remove entries from the teacher calendars
    if (!$DB->delete_records_select('event', "modulename = 'webinar' AND eventtype = 'webinarsession' AND instance = {$webinar->id}")) {
        //rollback_sql();
        return false;
    }
    // Remove entry from site-wide calendar
    webinar_remove_session_from_site_calendar($session);
    // Remove entry from site-wide calendar
    webinar_remove_session_from_site_calendar($session);
    // Delete session details
    if (!$DB->delete_records('webinar_sessions', array('id' => $session->id))) {
        //rollback_sql();
        return false;
    }
    if (!$DB->delete_records('webinar_sessions_dates', array('sessionid' => $session->id))) {
        //rollback_sql();
        return false;
    }
    if (!$DB->delete_records_select('webinar_signups_status', "signupid IN\n        (\n            SELECT\n                id\n            FROM\n                {$CFG->prefix}webinar_signups\n            WHERE\n                sessionid = {$session->id}\n        )\n        ")) {
        $result = false;
    }
    if (!$DB->delete_records('webinar_signups', array('sessionid' => $session->id))) {
        //rollback_sql();
        return false;
    }
    //commit_sql();
    return true;
}
Beispiel #3
0
$returnurl = "{$CFG->wwwroot}/course/view.php?id={$course->id}";
if ($backtoallsessions) {
    $returnurl = "{$CFG->wwwroot}/mod/webinar/view.php?f={$backtoallsessions}";
}
$mform = new mod_webinar_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', 'webinar', $returnurl);
    }
    $timemessage = 4;
    $errorstr = '';
    if (webinar_user_cancel($session, false, false, $errorstr, $fromform->cancelreason)) {
        add_to_log($course->id, 'webinar', 'cancel booking', "cancelsignup.php?s={$session->id}", $webinar->id, $cm->id);
        //Unregister this user from this webinar through Adobe Connect API call
        cancelsignup_meeting($webinar, $session, $USER);
        //Send cancel registration email to user
        send_email_cancelsignup($webinar, $session, $cm, $USER);
        /* JoeB - dev change for Moodle 2.3, comment this out
        		$PAGE->set_pagetype('webinar');
        		$PAGE->set_title($webinar->name);
        		$PAGE->set_heading($webinar->name);
        		echo $OUTPUT->header();
        		
        		$heading = get_string('confirmcancelbooking', 'webinar');
        		echo $OUTPUT->heading($heading);
        		*/
        $message = get_string('bookingcancelled', 'webinar', $webinar->name);