\n"); $error_message = getLanguageText('ERRORMSG-ACCESS-DENIED'); include "form.messages.php"; return; } // Set log permissions $permissions = ''; if ($_SESSION['UserInfo']['type'] == 'staff') { $permissions = "and (group_num = '0' or group_num = {$_SESSION['UserInfo']['group_num']})"; } // startLog("email-logs.php"); if (array_key_exists('batch_num', $_GET)) $batch_num = intval($_GET['batch_num']); if (isset($batch_num)) writeLog("batch_num: $batch_num"); // If batch_num set make sure user is permitted to view log details if (isset($batch_num) && $batch_num > 0) { $query = "select * from email_header " . "where school_num = $school_num " . "and record_num = $batch_num {$permissions}"; $results = db_query($query); if (db_num_rows($results) != 1) { echo("

Error: Record Not Found

\n"); exit(); } } // Cancel a batch is requested if (isset($batch_num) && isset($naction)) { switch ($naction) { // Cancel a job case 'cancel': $query = "update email_header set status = 'cancelled' where record_num = $batch_num {$permissions}"; db_query($query); $batch_num = 0; $naction = 'listmine'; echo("

" . getLanguageText('TEXT-THE-EMAIL-BROADCAST-HAS-BEEN-CANCELLED') . "

\n"); break; // Flag a job entry as deleted case 'delete': $query = "update email_header set status = 'deleted' where record_num = $batch_num {$permissions}"; db_query($query); $batch_num = 0; $naction = 'listmine'; echo("

" . getLanguageText('TEXT-THE-LOG-ENTRY-HAS-BEEN-DELETED') . "

\n"); break; // Undelete a job case 'undelete': $query = "select * from email_header " . "where school_num = $school_num " . "and record_num = $batch_num {$permissions}"; $results = db_query($query); $row = db_fetch_array($results); if ($row['processed_records'] == $row['matching_records']) $new_status = 'completed'; else $new_status = 'cancelled'; $query = "update email_header set status = '$new_status' where record_num = $batch_num {$permissions}"; db_query($query); $batch_num = 0; $naction = 'listmine'; echo("

" . getLanguageText('TEXT-THE-LOG-ENTRY-HAS-BEEN-RESTORED') . "

\n"); break; default: if ($naction != 'listmine') $naction = "list"; break; } } // If no batch number then list all batches if (!isset($batch_num) || $batch_num == 0) { $totalLogs = db_getVal("SELECT count(*) FROM email_header WHERE school_num = $school_num"); // // Get list of header records // if ($_SESSION['UserInfo']['type'] == 'SuperUser') { $query = "select * from email_header " . "where school_num = $school_num " . "and status != 'deleted' " . "and status != 'cancelled' " . "order by posted desc limit 0,50"; } else { $query = "select * from email_header " . "where school_num = $school_num " . "and status != 'deleted' " . "and status != 'cancelled' " . "AND category NOT IN ('Hot Lunch Contacts Broadcast','Sales Contacts Broadcast') " . "order by posted desc limit 0,50"; } $headers = db_query($query); $numHeaders = db_num_rows($headers); if ($numHeaders <= 50) $view_all = 'Y'; ?>
$matching_records"; if ($status == 'cancelled') $completed = getLanguageText('TEXT-CANCELLED'); if ($status == 'deleted') $completed = getLanguageText('TEXT-DELETED'); // Setup second button if there is one $btn_details = ""; if ($processed_records == 0) $btn_details = ""; // Setup third button $cancel_icon = ""; $cancel_msg = getLanguageText('TEXT-CONFIRM-CANCEL'); $cancel_delete = "$cancel_icon"; if ($status == 'completed') { $delete_icon = ""; $delete_msg = getLanguageText('TEXT-CONFIRM-DELETE'); $cancel_delete = "$delete_icon"; } if ($status == 'deleted' || $status == 'cancelled') { $undelete_icon = ""; $cancel_delete = "$undelete_icon"; } $bgclass = "data-even"; if ($count %2) $bgclass = "data-odd"; $count++; ?>

of
 
0) { ?>

0 && $naction = 'list') { // // Get batch details // $query = "select * from email_header where school_num = $school_num and record_num = '$batch_num' {$permissions}"; $results = db_query($query); if (db_num_rows($results)) { $header = db_fetch_array($results); if ($header['status'] == 'cancelled') $header['completed'] = 'Cancelled'; $processed = $header['processed_records']; $subject = $header['subject']; $reply_address = $header['reply_address']; // Set up link to message text if (!isset($batch_mode) || $batch_mode == 'details') { $subject = "$subject"; } // Set up link to log details $details = ""; if (!isset($batch_mode) || $batch_mode == 'message') { if ($processed > 0) { $details = "View Log Details"; } } // Create links to delete and cancel this job if (!isset($batch_mode)) { // Setup delete job link if ($header['status'] == 'completed' || $header['status'] == 'cancelled') { $delete = "Delete This Log Entry"; } // Setup cancel job link if ($processed == 0 && $header['status'] == 'open') { $cancel = "Cancel This Job"; } } } ?>
\n\n"); // Display the full batch header if (!isset($batch_mode)) { ?>

- :

:
:
:
:
:
:
:
:
:
:
:
:
:
"; $postfix = ""; } ?>
 
TEXT-EMAIL-ADDRESS
Message Content\n"); ?>