Exemplo n.º 1
0
 echo '<br id="unapproved" />';
 echo $OUTPUT->heading(get_string('unapprovedrequests', 'webinar'));
 echo '<form action="attendees.php?s=' . $s . '" method="post">';
 echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
 echo '<input type="hidden" name="s" value="' . $s . '" />';
 echo '<input type="hidden" name="backtoallsessions" value="' . $backtoallsessions . '" /></p>';
 //$table = new object();
 $table = new html_table();
 $table->summary = get_string('requeststablesummary', 'webinar');
 $table->head = array(get_string('name'), get_string('timerequested', 'webinar'), get_string('decidelater', 'webinar'), get_string('decline', 'webinar'), get_string('approve', 'webinar'));
 $table->align = array('left', 'center', 'center', 'center', 'center');
 $cantakeattendance = has_capability('mod/webinar:takeattendance', $context);
 foreach ($attendees as $attendee) {
     // Check the logged in user has permissions to see the user
     if (!$cantakeattendance) {
         if (webinar_get_manageremail($attendee->id) !== $USER->email) {
             continue;
         }
     }
     $data = array();
     $data[] = "<a href=\"{$CFG->wwwroot}/user/view.php?id={$attendee->id}&amp;course={$course->id}\">" . format_string(fullname($attendee)) . '</a>';
     $data[] = userdate($attendee->timerequested, get_string('strftimedatetime'));
     $data[] = '<input type="radio" name="requests[' . $attendee->id . ']" value="0" checked="checked" />';
     $data[] = '<input type="radio" name="requests[' . $attendee->id . ']" value="1" />';
     $data[] = '<input type="radio" name="requests[' . $attendee->id . ']" value="2" />';
     $table->data[] = $data;
 }
 if (empty($table->data)) {
     $table->data[] = array(get_string('noactionableunapprovedrequests', 'webinar'), '', '');
 }
 //print_table($table);
Exemplo n.º 2
0
/**
 * Common code for sending confirmation and cancellation notices
 *
 * @param string $postsubject Subject of the email
 * @param string $posttext Plain text contents of the email
 * @param string $posttextmgrheading Header to prepend to $posttext in manager email
 * @param string $notificationtype The type of notification to send
 * @see {{WEBINAR_INVITE}}
 * @param class $webinar record from the webinar table
 * @param class $session record from the webinar_sessions table
 * @param integer $userid ID of the recipient of the email
 * @returns string Error message (or empty string if successful)
 */
function webinar_send_notice($postsubject, $posttext, $posttextmgrheading, $notificationtype, $webinar, $session, $userid)
{
    global $CFG, $DB;
    $user = $DB->get_record('user', array('id' => $userid));
    if (!$user) {
        return get_string('error:invaliduserid', 'webinar');
    }
    if (empty($postsubject) || empty($posttext)) {
        return '';
    }
    // If no notice type is defined (TEXT or ICAL)
    if (!($notificationtype & WEBINAR_BOTH)) {
        // If none, make sure they at least get a text email
        $notificationtype |= WEBINAR_TEXT;
    }
    // If we are cancelling, check if ical cancellations are disabled
    if ($notificationtype & WEBINAR_CANCEL && get_config(NULL, 'webinar_disableicalcancel')) {
        $notificationtype |= WEBINAR_TEXT;
        // add a text notification
        $notificationtype &= ~WEBINAR_ICAL;
        // remove the iCalendar notification
    }
    // If we are sending an ical attachment, set file name
    if ($notificationtype & WEBINAR_ICAL) {
        if ($notificationtype & WEBINAR_INVITE) {
            $attachmentfilename = 'invite.ics';
        } elseif ($notificationtype & WEBINAR_CANCEL) {
            $attachmentfilename = 'cancel.ics';
        }
    }
    // Do iCal attachement stuff
    $icalattachments = array();
    if ($notificationtype & WEBINAR_ICAL) {
        if (get_config(NULL, 'webinar_oneemailperday')) {
            // Keep track of all sessiondates
            $sessiondates = $session->sessiondates;
            foreach ($sessiondates as $sessiondate) {
                $session->sessiondates = array($sessiondate);
                // one day at a time
                $filename = webinar_get_ical_attachment($notificationtype, $webinar, $session, $user);
                $subject = webinar_email_substitutions($postsubject, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
                $body = webinar_email_substitutions($posttext, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
                $htmlbody = '';
                // TODO
                $icalattachments[] = array('filename' => $filename, 'subject' => $subject, 'body' => $body, 'htmlbody' => $htmlbody);
            }
            // Restore session dates
            $session->sessiondates = $sessiondates;
        } else {
            $filename = webinar_get_ical_attachment($notificationtype, $webinar, $session, $user);
            $subject = webinar_email_substitutions($postsubject, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
            $body = webinar_email_substitutions($posttext, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
            $htmlbody = '';
            // FIXME
            $icalattachments[] = array('filename' => $filename, 'subject' => $subject, 'body' => $body, 'htmlbody' => $htmlbody);
        }
    }
    // Fill-in the email placeholders
    $postsubject = webinar_email_substitutions($postsubject, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
    $posttext = webinar_email_substitutions($posttext, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
    $posttextmgrheading = webinar_email_substitutions($posttextmgrheading, $webinar->name, $webinar->reminderperiod, $user, $session, $session->id);
    $posthtml = '';
    // FIXME
    $fromaddress = get_config(NULL, 'webinar_fromaddress');
    if (!$fromaddress) {
        $fromaddress = '';
    }
    $usercheck = $DB->get_record('user', array('id' => $userid));
    // Send email with iCal attachment
    if ($notificationtype & WEBINAR_ICAL) {
        foreach ($icalattachments as $attachment) {
            if (!email_to_user($user, $fromaddress, $attachment['subject'], $attachment['body'], $attachment['htmlbody'], $attachment['filename'], $attachmentfilename)) {
                return get_string('error:cannotsendconfirmationuser', 'webinar');
            }
            unlink($CFG->dataroot . '/' . $attachment['filename']);
        }
    }
    // Send plain text email
    if ($notificationtype & WEBINAR_TEXT) {
        if (!email_to_user($user, $fromaddress, $postsubject, $posttext, $posthtml)) {
            return get_string('error:cannotsendconfirmationuser', 'webinar');
        }
    }
    // Manager notification
    $manageremail = webinar_get_manageremail($userid);
    if (!empty($posttextmgrheading) and !empty($manageremail)) {
        $managertext = $posttextmgrheading . $posttext;
        $manager = $user;
        $manager->email = $manageremail;
        // Leave out the ical attachments in the managers notification
        if (!email_to_user($manager, $fromaddress, $postsubject, $managertext, $posthtml)) {
            return get_string('error:cannotsendconfirmationmanager', 'webinar');
        }
    }
    // Third-party notification
    if (!empty($webinar->thirdparty) && !empty($webinar->thirdpartywaitlist)) {
        $thirdparty = $user;
        $recipients = explode(',', $webinar->thirdparty);
        foreach ($recipients as $recipient) {
            $thirdparty->email = trim($recipient);
            // Leave out the ical attachments in the 3rd parties notification
            if (!email_to_user($thirdparty, $fromaddress, $postsubject, $posttext, $posthtml)) {
                return get_string('error:cannotsendconfirmationthirdparty', 'webinar');
            }
        }
    }
}
Exemplo n.º 3
0
    echo $OUTPUT->box_end();
    echo $OUTPUT->footer($course);
    exit;
}
//print_r($webinar);
webinar_print_session($session, $viewattendees);
/*
if ($signedup) {
    // Cancellation link
    echo '<a href="'.$CFG->wwwroot.'/mod/webinar/cancelsignup.php?s='.$session->id.'&amp;backtoallsessions='.$backtoallsessions.'" title="'.get_string('cancelbooking','webinar').'">'.get_string('cancelbooking', 'webinar').'</a>';

    // See attendees link
    if ($viewattendees) {
        echo ' &ndash; <a href="'.$CFG->wwwroot.'/mod/webinar/attendees.php?s='.$session->id.'&amp;backtoallsessions='.$backtoallsessions.'" title="'.get_string('seeattendees', 'webinar').'">'.get_string('seeattendees', 'webinar').'</a>';
    }

    echo '<br/><a href="'.$returnurl.'" title="'.get_string('goback', 'webinar').'">'.get_string('goback', 'webinar').'</a>';
}
// Don't allow signup to proceed if a manager is required
elseif (webinar_manager_needed($webinar) && !webinar_get_manageremail($USER->id)){
*/
if (webinar_manager_needed($webinar) && !webinar_get_manageremail($USER->id)) {
    // Check to see if the user has a managers email set
    echo '<p><strong>' . get_string('error:manageremailaddressmissing', 'webinar') . '</strong></p>';
    echo '<br/><a href="' . $returnurl . '" title="' . get_string('goback', 'webinar') . '">' . get_string('goback', 'webinar') . '</a>';
} else {
    // Signup form
    $mform->display();
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer($course);