/** * Cancel a user who signed up earlier * * @param class $session Record from the webinar_sessions table * @param integer $userid ID of the user to remove from the session * @param bool $forcecancel Forces cancellation of sessions that have already occurred * @param string $errorstr Passed by reference. For setting error string in calling function * @param string $cancelreason Optional justification for cancelling the signup */ function webinar_user_cancel($session, $userid = false, $forcecancel = false, &$errorstr = null, $cancelreason = '') { if (!$userid) { global $USER; $userid = $USER->id; } // if $forcecancel is set, cancel session even if already occurred // used by webinar_delete_session() if (!$forcecancel) { $timenow = time(); // don't allow user to cancel a session that has already occurred if (webinar_has_session_started($session, $timenow)) { $errorstr = get_string('error:eventoccurred', 'webinar'); return false; } } if (webinar_user_cancel_submission($session->id, $userid, $cancelreason)) { webinar_remove_bookings_from_user_calendar($session, $userid); webinar_update_attendees($session); return true; } $errorstr = get_string('error:cancelbooking', 'webinar'); return false; }
// 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 cancelsignup_meeting($webinar, $session, $user); //Send cancel registration email to user send_email_cancelsignup($webinar, $session, $cm, $user); } elseif ($showall) { $searchtext = ''; $previoussearch = 0; } } } /// Main page $pagetitle = format_string($webinar->name); $navlinks[] = array('name' => $strwebinars, 'link' => "index.php?id={$course->id}", 'type' => 'title'); $navlinks[] = array('name' => $pagetitle, 'link' => "view.php?f={$webinar->id}", 'type' => 'activityinstance');