\n"); $error_message = getLanguageText('ERRORMSG-INVALID-ACCESS'); include "form.messages.php"; return; } // Start the template and output buffering startTemplate(); $templatePageTitle = getLanguageText('TEXT-SEND-STAFF-NOTICES'); // Check for a selected_staff parameter $sWhere = ""; if (array_key_exists('selected_staff',$_POST) && $_POST['selected_staff'] > 0) { $selected_staff = $_POST['selected_staff']; $sWhere = "AND p.record_num = $selected_staff "; } // Handle parameters unset($naction); if (array_key_exists('naction',$_GET) && $_GET['naction'] == 'email') $naction = 'email'; if (array_key_exists('naction',$_POST) && $_POST['naction'] == 'email') $naction = 'email'; // // If a selected_schedules is posted send the emails // if (isset($naction) && $naction == 'email') { // No emails from the demo // if ($school_num == 3) { // header("Location: /?action=send-reminders&error_message=" . urlencode("Error: Unable to Send Notices From 'demo' Site")); // exit(); // } // Get the reply email address $emailSubject = $_POST['email_subject']; $replyEmail = setReplyAddress($_POST['reply_email']); if (strlen($replyEmail) == 0 || strlen($emailSubject) == 0) { header("Location: /?action=send-reminders&error_message=" . urlencode("Error: Missing Reply Email Address or Email Subject")); exit(); } else { include "include/queuemail.php"; // Get set of staff $staff = db_query("SELECT p.*,u.email,u.userid,u.password FROM people AS p, users AS u " . "WHERE p.school_num = $base_school_num " . "AND p.people_type = 'Staff' " . "AND u.school_num = $school_num " . $sWhere . "AND p.user_num = u.record_num"); $numStaff = db_num_rows($staff); if ($numStaff) { $Sent = 0; $Errors = 0; $NoEmail = 0; $staffResults = ""; // Initialize the user message $staffMessage = db_getVal("SELECT text_data FROM text_data WHERE school_num = $school_num AND text_id = 'Staff Notice'"); $url = $school_record['url']; // Get next batch id $batch_id = db_getVal("SELECT max(batch_id) FROM email_queue WHERE school_num = $school_num"); $batch_id++; // Process each user while ($row = db_fetch_array($staff)) { extract($row); $name = "$first_name $last_name"; if (strlen($email) && strstr($email,'@')) { // Create message for staff person $message = trim($staffMessage) . "\n\n" . " -------------------------------------\n" . " Staff Person: $name\n" . " Web Address: https://$url\n" . " User ID: $userid\n" . " Password: $password\n" . "\n\n"; // Send the emails QueueEmail($email,$replyEmail,$emailSubject,$message,$school_record['reply_description'],$name,"","",$batch_id); $Sent++; } else { $Errors++; } } } else { header("Location: /?action=email-staff-notices&error_message=" . urlencode(getLanguageText('ERRORMSG-NO-STAFF'))); exit(); } // Complete the email send $form_message = getLanguageText('MESSAGE-STAFF-NOTICES-SENT') . " - " . $Sent; header("Location: /?action=email-staff-notices&batch_id=$batch_id&form_message=" . urlencode($form_message)); exit(); } } include "form.messages.php"; if (!array_key_exists('naction',$_POST) && !array_key_exists('naction',$_GET)) { ?>