128 lines
5.3 KiB
PHP
128 lines
5.3 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Ensure that only valid user types have access to this module
|
|
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team','Supplier');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
echo("<br>\n");
|
|
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
|
|
|
|
// Get schedule record
|
|
$results = db_query("SELECT * FROM hotlunch_schedules WHERE school_num = $school_num AND record_num = $schedule_num");
|
|
$hotlunch_schedule = db_fetch_array($results);
|
|
|
|
$title_cols = 50;
|
|
|
|
$volunteerSignup = $hotlunch_schedule['volunteer_signup'];
|
|
if ($volunteerSignup == 'D') $volunteerSignup = $school_record['enable_volunteer_signup'];
|
|
|
|
?>
|
|
<br>
|
|
<form method='post' action='/'>
|
|
<?php
|
|
$message_width = $default_form_width;
|
|
include "form.messages.php";
|
|
?>
|
|
<table class='content-table'>
|
|
<tr>
|
|
<td align='center' class='heading'><?php displayLanguageText('MANAGE-MENU-TITLES'); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='center'>
|
|
<table cellspacing='20'><tr><td align='center'>
|
|
<table cellpadding='1' cellspacing='1' border='0'>
|
|
<tr>
|
|
<td class='success' align='left' valign='top'><?php displayLanguageText('TEXT-MENU-TITLE'); ?>: </td>
|
|
<?php if ($siteType == 'hotlunch' || $siteType == 'fundraising' || $hotlunch_schedule['schedule_type'] == 'Date Sensitive') { ?>
|
|
<td class='success' align='left' valign='top'><?php displayLanguageText('TEXT-MENU-DATE'); ?></td>
|
|
<?php if ($hotlunch_schedule['custom_menu_end_dates'] == 'Y') { ?>
|
|
<td class='success' align='left' valign='top'><?php displayLanguageText('TEXT-ORDERING-END-DATE'); ?></td>
|
|
<?php } ?>
|
|
<?php if ($volunteerSignup == 'Y' && ($siteType == 'hotlunch' || $siteType == 'fundraising')) { ?>
|
|
<td class='success' align='center' valign='top'><?php displayLanguageText('TEXT-MAX-VOLUNTEERS'); ?></td>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
$results = db_query("SELECT * FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num ORDER BY sequence,menu_date");
|
|
while ($row = db_fetch_array($results)) {
|
|
$menu_title = $row['menu_title'];
|
|
$menu_date = $row['menu_date'];
|
|
$menu_end_order_datetime = substr($row['menu_end_order_datetime'],0,16);
|
|
$menu_link = $row['menu_link'];
|
|
$max_volunteers = $row['max_volunteers'];
|
|
$record_num = $row['record_num'];
|
|
|
|
if ($menu_end_order_datetime == '2000-01-01 00:00' || $menu_end_order_datetime == '') $menu_end_order_datetime = $menu_date . " 09:00";
|
|
?>
|
|
<tr>
|
|
<td align='left' class='oitem'><input type='text' name='title_<?php echo($record_num) ?>' rnum='<?php echo($record_num) ?>' ftype='string' fname='menu_title' value="<?php echo($menu_title) ?>" size='<?php echo($title_cols) ?>' class='hlmd-field'></td>
|
|
<?php if ($siteType == 'hotlunch' || $siteType == 'fundraising' || $hotlunch_schedule['schedule_type'] == 'Date Sensitive') { ?>
|
|
<td align='left' class='oitem'><input type='text' name='date_<?php echo($record_num) ?>' rnum='<?php echo($record_num) ?>' ftype='string' fname='menu_date' value="<?php echo($menu_date) ?>" size='12' class='date-field hlmd-field'></td>
|
|
<?php if ($hotlunch_schedule['custom_menu_end_dates'] == 'Y') { ?>
|
|
<td align='left' class='oitem'><input type='text' name='end_date_<?php echo($record_num) ?>' rnum='<?php echo($record_num) ?>' ftype='string' fname='menu_end_order_datetime' value="<?php echo($menu_end_order_datetime) ?>" size='20' class='datetime-field hlmd-field'></td>
|
|
<?php } ?>
|
|
<?php if ($volunteerSignup == 'Y' && ($siteType == 'hotlunch' || $siteType == 'fundraising')) { ?>
|
|
<td align='center' class='oitem'><input type='text' name='max_<?php echo($record_num) ?>' rnum='<?php echo($record_num) ?>' ftype='numeric' fname='max_volunteers' value='<?php echo($max_volunteers) ?>' size='3' style='text-align: right;' class='hlmd-field'></td>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</td></tr></table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='center'>
|
|
<input type='submit' class='btn btn--primary' id='refresh-screen' value="<?php displayLanguageText('TEXT-REFRESH-DATA'); ?>">
|
|
<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
<?php include "include/ajax.Setup.php" ?>
|
|
|
|
$(document).on('change', '.hlmd-field', function() {
|
|
var fname = $(this).attr('fname');
|
|
var ftype = $(this).attr('ftype');
|
|
var fvalue = $(this).val();
|
|
var rnum = $(this).attr('rnum');
|
|
|
|
$.ajax({
|
|
url: 'ajax.UpdateDBField.php',
|
|
data: {
|
|
table_name: 'hotlunch_menu_dates',
|
|
field_name: fname,
|
|
field_value: fvalue,
|
|
field_type: ftype,
|
|
record_num: rnum
|
|
},
|
|
dataType: 'json'
|
|
})
|
|
});
|
|
|
|
$("#refresh-screen").click(function(e) {
|
|
e.preventDefault();
|
|
location.reload();
|
|
});
|
|
|
|
});
|
|
</script>
|