Files
HotLunches/email_queue.php
T
2026-10-19 15:22:52 -07:00

138 lines
3.8 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
//
// Process all actions to list and edit records
//
$action = "email-queue";
$CurrentTable = "email_queue";
$FormFile = "";
$TitleText = getLanguageText('TEXT-EMAIL-QUEUE');
$OrderBy = "posted_date_time";
// Start the template and output buffering
startTemplate();
$templatePageTitle = "$TitleText";
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Communications Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team');
if (checkPermission($AllowedUserTypes) != 1) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
endTemplate();
exit();
}
$school_num = $school_record['record_num'];
// Handle selected date ranges
$start_date = date("Y-m-d",time());
$end_date = $start_date;
$message_width = 400;
include "form.messages.php";
$scriptName = str_replace("/m/data1/app.hotlunches.net/","",__FILE__);
include "help.docs.php";
?>
<br>
<form method='post' name='email_queue' target='/'>
<table width='450' cellpadding='5' class='content-table'>
<tr height='5'>
<td colspan='2' align='left'><img src='images/spacer.gif' height='5'></td>
</tr>
<tr>
<td align='right'><?php displayLanguageText('TEXT-START-DATE'); ?>: </td>
<td align='left'><input type='text' name='start_date' id='start_date' value='<?php echo($start_date) ?>' size='15' class='date-field form-field'></td>
</tr>
<tr>
<td align='right'><?php displayLanguageText('TEXT-END-DATE'); ?>: </td>
<td align='left'><input type='text' name='end_date' id='end_date' value='<?php echo($end_date) ?>' size='15' class='date-field'></td>
</tr>
<tr>
<td></td>
<td><a href='#' class='btn btn--primary btn--xsmall' id='get-queue'><span><?php displayLanguageText('TEXT-VIEW'); ?></span></a></td>
</tr>
</table>
<input type='hidden' name='action' value='email-queue'>
<input type='hidden' name='where' value=''>
</form>
<br>
<span id='email-queue-span'></span>
<script>
$(document).ready(function(){
<?php include "include/ajax.Setup.php" ?>
$("#email-dialog").dialog({
autoOpen: false,
minWidth: 600,
minHeight: 600,
modal: true,
position: { my: 'center', at: 'center' }
});
loadEmails();
$(document).on('click', '.msg', function() {
var rnum = $(this).attr('rnum');
$.getJSON( "ajax.DataTable.Fetch.php",
{
table_name: "email_queue",
sequence_flag: "N",
rnum: rnum,
action: "email-msg"
},
function(results) {
$("#email-div").html(results.content);
$("#email-dialog").dialog("open");
}
);
});
$("#get-queue").click(function(e) {
e.preventDefault();
loadEmails();
});
function loadEmails() {
var sdate = $("#start_date").val();
var edate = $("#end_date").val();
$.getJSON( "ajax.DataTable.Fetch.php",
{
table_name: "email_queue",
sequence_flag: "N",
sdate: sdate,
edate: edate,
action: "email-queue"
},
function(results) {
$("#email-queue-span").html(results.content);
}
);
}
});
</script>
<div id='email-dialog' title="<?php displayLanguageText('TEXT-EMAIL'); ?>">
<div id='email-div'></div>
</div>
<?php
endTemplate();
?>