function send_email_sessiondeleted($webinar, $session_info)
{
    global $CFG;
    foreach ($session_info->sessiondates as $dates) {
        $startdatetime = date('d F Y', $dates->timestart) . " at " . date('h:i A', $dates->timestart);
    }
    if ($attendees = webinar_get_attendees($session_info->id)) {
        foreach ($attendees as $user) {
            $a = new stdClass();
            $a->name = $user->firstname . " " . $user->lastname;
            $a->starttime = $startdatetime;
            $a->webinarname = $webinar->name;
            $a->webinarintro = $webinar->description;
            $a->webinaragenda = $webinar->agenda;
            $a->adminemail = $webinar->adminemail;
            //print_r($a);
            $subject = get_string('sessiondeletedsubject', 'webinar', $a);
            $contact = get_string('sessiondeletedcontact', 'webinar', $a);
            $message = get_string('sessiondeletedmessage', 'webinar', $a);
            //last task - strip <p> and </p> from the message before we send the email
            $message = str_replace('<p>', '', $message);
            $message = str_replace('</p>', '', $message);
            email_to_user($user, $contact, $subject, $message);
        }
    }
}
function send_email_sessionupdated($webinar, $session_info, $cm, $date)
{
    global $CFG;
    if ($attendees = webinar_get_attendees($session_info->id)) {
        foreach ($attendees as $user) {
            $a = new stdClass();
            $a->name = $user->firstname . " " . $user->lastname;
            $a->starttime = date('d F Y h:i A', $date->timestart);
            $a->webinarname = $webinar->name;
            $a->webinarintro = $webinar->description;
            $a->webinaragenda = $webinar->agenda;
            $a->sessionurl = $CFG->wwwroot . "/mod/" . $cm->modname . "/view.php?id=" . $cm->id;
            $a->adminemail = $webinar->adminemail;
            //print_r($a);
            $subject = get_string('sessionupdatedsubject', 'webinar', $a);
            $contact = get_string('sessionupdatedcontact', 'webinar', $a);
            $message = get_string('sessionupdatedmessage', 'webinar', $a);
            //last task - strip <p> and </p> from the message before we send the email
            $message = str_replace('<p>', '', $message);
            $message = str_replace('</p>', '', $message);
            email_to_user($user, $contact, $subject, $message);
        }
    }
}
Exemple #3
0
/**
 * Update attendee list status' on booking size change
 */
function webinar_update_attendees($session)
{
    global $USER, $DB;
    // Get webinar
    if (!($webinar = $DB->get_record('webinar', array('id' => $session->webinar)))) {
        error('Could not load webinar record');
    }
    // Get course
    if (!($course = $DB->get_record('course', array('id' => $webinar->course)))) {
        error('Could not load course record');
    }
    // Update user status'
    $users = webinar_get_attendees($session->id);
    if ($users) {
        // Convert earliest signed up users to booked, and make the rest waitlisted
        $capacity = $session->capacity;
        // Count number of booked users
        $booked = 0;
        foreach ($users as $user) {
            if ($user->statuscode == WEBINAR_STATUS_BOOKED) {
                $booked++;
            }
        }
        // If booked less than capacity, book some new users
        if ($booked < $capacity) {
            foreach ($users as $user) {
                if ($booked >= $capacity) {
                    break;
                }
                if ($user->statuscode == WEBINAR_STATUS_WAITLISTED) {
                    if (!webinar_user_signup($session, $webinar, $course, '', 0, WEBINAR_STATUS_BOOKED, $user->id)) {
                        //rollback_sql();
                        return false;
                    }
                    $booked++;
                }
            }
        }
    }
    return $session->id;
}
Exemple #4
0
        $table->head[] = get_string('attendedsession', 'webinar');
        $table->align[] = array('center');
    } else {
        //webinar has not yet started, or is in progress - just show the users who are booked to attend the course
        $table->head[] = get_string('attendance', 'webinar');
        $table->align[] = array('center');
    }
}
$status_options = array();
foreach ($WEBINAR_STATUS as $key => $value) {
    if ($key <= WEBINAR_STATUS_BOOKED) {
        continue;
    }
    $status_options[$key] = get_string('status_' . $value, 'webinar');
}
if ($attendees = webinar_get_attendees($session->id)) {
    foreach ($attendees as $attendee) {
        $data = array();
        $data[] = "<a href=\"{$CFG->wwwroot}/user/view.php?id={$attendee->id}&amp;course={$course->id}\">" . format_string(fullname($attendee)) . '</a>';
        if ($takeattendance) {
            // Show current status
            $data[] = get_string('status_' . webinar_get_status($attendee->statuscode), 'webinar');
            $optionid = 'submissionid_' . $attendee->submissionid;
            $status = $attendee->statuscode;
            $select = choose_from_menu($status_options, $optionid, $status, 'choose', '', '0', true);
            $data[] = $select;
        } else {
            if (time() >= $timefinish) {
                //compare the finish time to the current time - if the webinar has now finished, print out the attendance report
                /*
                			//Step 1 - get session value
$navlinks[] = array('name' => $strwebinars, 'link' => "index.php?id={$course->id}", 'type' => 'title');
$navlinks[] = array('name' => $pagetitle, 'link' => "view.php?f={$webinar->id}", 'type' => 'activityinstance');
$navlinks[] = array('name' => get_string('attendees', 'webinar'), 'link' => "attendees.php?s={$session->id}", 'type' => 'activityinstance');
$navlinks[] = array('name' => get_string('addremoveattendees', 'webinar'), 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks);
/*print_header_simple($pagetitle, '', $navigation, '', '', true,
  update_module_button($cm->id, $course->id, $strwebinar), navmenu($course, $cm));*/
$PAGE->set_pagetype('webinar');
$PAGE->set_title($webinar->name);
$PAGE->set_heading($webinar->name);
$PAGE->set_url('/editattendees.php?s=' . $session->id . '&amp;backtoallsessions=' . $backtoallsessions);
echo $OUTPUT->header();
echo $OUTPUT->box_start();
echo $OUTPUT->heading(get_string('addremoveattendees', 'webinar'));
/// Get the list of currently signed-up users
$existingusers = webinar_get_attendees($session->id);
$existingcount = $existingusers ? count($existingusers) : 0;
$select = "username <> 'guest' AND deleted = 0 AND confirmed = 1";
/// Apply search terms
$searchtext = trim($searchtext);
if ($searchtext !== '') {
    // Search for a subset of remaining users
    $LIKE = sql_ilike();
    $FULLNAME = sql_fullname();
    $selectsql = " AND ({$FULLNAME} {$LIKE} '%{$searchtext}%' OR\n                            email {$LIKE} '%{$searchtext}%' OR\n                         idnumber {$LIKE} '%{$searchtext}%' OR\n                         username {$LIKE} '%{$searchtext}%') ";
    $select .= $selectsql;
}
/// All non-signed up system users
$availableusers = $DB->get_recordset_sql('SELECT u.id, u.firstname, u.lastname, u.email 
	FROM ' . $CFG->prefix . 'user u, ' . $CFG->prefix . 'enrol e, ' . $CFG->prefix . 'user_enrolments ue 
	WHERE