Example #1
0
/**
 * Send a confirmation email to the user and manager regarding the
 * cancellation
 *
 * @param class $facetoface record from the facetoface table
 * @param class $session record from the facetoface_sessions table
 * @param integer $userid ID of the recipient of the email
 * @returns string Error message (or empty string if successful)
 */
function facetoface_send_cancellation_notice($facetoface, $session, $userid)
{
    global $DB;
    $postsubject = $facetoface->cancellationsubject;
    $posttext = $facetoface->cancellationmessage;
    $posttextmgrheading = $facetoface->cancellationinstrmngr;
    // Lookup what type of notification to send.
    $notificationtype = $DB->get_field('facetoface_signups', 'notificationtype', array('sessionid' => $session->id, 'userid' => $userid));
    // Set cancellation bit.
    $notificationtype |= MDL_F2F_CANCEL;
    return facetoface_send_notice($postsubject, $posttext, $posttextmgrheading, $notificationtype, $facetoface, $session, $userid);
}
Example #2
0
/**
 * Send booking request notice to user and their manager
 *
 * @param   object  $facetoface Facetoface instance
 * @param   object  $session    Session instance
 * @param   int     $userid     ID of user requesting booking
 * @return  string  Error string, empty on success
 */
function facetoface_send_request_notice($facetoface, $session, $userid) {
    global $DB;

    $manager = get_manager($userid);
    if (empty($manager->email)) {
        return 'error:nomanagersemailset';
    }

    $params = array(
        'facetofaceid'  => $facetoface->id,
        'type'          => MDL_F2F_NOTIFICATION_AUTO,
        'conditiontype' => MDL_F2F_CONDITION_BOOKING_REQUEST
    );

    return facetoface_send_notice($facetoface, $session, $userid, $params);
}