173 lines
5.2 KiB
PHP
173 lines
5.2 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$templatePageTitle = "";
|
|
$headerArgs = "";
|
|
|
|
|
|
// 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','Financial Team');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
echo("<br>\n");
|
|
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
|
|
|
|
//
|
|
// Process all actions to list and edit records
|
|
//
|
|
$naction = "";
|
|
|
|
if (array_key_exists('schedule_num',$_GET)) $schedule_num = intval($_GET['schedule_num']);
|
|
if (array_key_exists('schedule_num',$_POST)) $schedule_num = intval($_POST['schedule_num']);
|
|
|
|
if (!isset($schedule_num)) {
|
|
echo("<br>\n");
|
|
$error_message = "Error: schedule number must be specified";
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
|
|
|
|
// Check if this is a valid schedule
|
|
$query = "select * from hotlunch_schedules " .
|
|
"where school_num = $school_num " .
|
|
"and record_num = $schedule_num";
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
echo("<br>\n");
|
|
$error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE');
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
|
|
$hotlunch_schedule = db_fetch_array($results);
|
|
|
|
|
|
// If this is a ScheduleTeam user check if they have permission to access this schedule
|
|
if (in_array($_SESSION['UserInfo']['type'],array('Schedule Team','Schedule Volunteer'))) {
|
|
$userNum = intval($_SESSION['UserInfo']['record_num']);
|
|
$access = db_getVal("SELECT count(*) FROM hotlunch_schedules_people WHERE school_num = $school_num AND schedule_num = $schedule_num AND user_num = $userNum");
|
|
|
|
if (!$access || $access == 0) {
|
|
echo("<br>\n");
|
|
$error_message = "You are not allowed access to the requested hot lunch schedule";
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$templatePageTitle = getLanguageText('TEXT-ORDER-TICKETS') . " - " . $hotlunch_schedule['schedule_name'];
|
|
|
|
|
|
include "hotlunch_reports.menu.php";
|
|
echo("<br>\n");
|
|
|
|
|
|
if (array_key_exists('naction',$_GET)) $naction = $_GET['naction'];
|
|
if (array_key_exists('naction',$_POST)) $naction = $_POST['naction'];
|
|
|
|
$school_num = $school_record['record_num'];
|
|
|
|
include "form.messages.php";
|
|
|
|
|
|
//
|
|
// Display the menu selection
|
|
//
|
|
?>
|
|
<form method='post' action='/'>
|
|
<table width='600' cellpadding='5' cellspacing='1' class='content-table'>
|
|
<tr class='data-odd'>
|
|
<td width='35%' valign='top' align='right'><b><?php displayLanguageText('TEXT-MENU-DATE'); ?>: </b></td>
|
|
<td align='left'>
|
|
<select name='selected_menu_nums[]' multiple size='10' class='select-width400'>
|
|
<?php
|
|
$query = "select * from hotlunch_menu_dates " .
|
|
"where school_num = $school_num " .
|
|
"and schedule_num = $schedule_num " .
|
|
"order by sequence,menu_date";
|
|
$results = db_query($query);
|
|
|
|
$selected_date = 'N';
|
|
while ($row = db_fetch_array($results)) {
|
|
$mtitle = $row['menu_title'];
|
|
$mdate = $row['menu_date'];
|
|
$record_num = $row['record_num'];
|
|
|
|
if ($hotlunch_schedule['display_menu_date'] == 'Y') $mtitle .= " - $mdate";
|
|
|
|
$selected = " selected='selected'";
|
|
echo(" <option value='$record_num'$selected>$mtitle</option>\n");
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td width='35%' valign='top' align='right'><b><?php displayLanguageText('TEXT-SORT'); ?>: </b></td>
|
|
<td align='left'>
|
|
<select name='sort_by'>
|
|
<option value='student-name'><?php displayLanguageText('TEXT-SORT-BY-NAME'); ?></option>
|
|
<option value='class'><?php displayLanguageText('TEXT-SORT-BY-CLASS'); ?></option>
|
|
</select>
|
|
</blockquote>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<input type='hidden' name='action' value='hotlunch-tickets-print'>
|
|
<input type='hidden' name='schedule_num' value='<?php echo($schedule_num) ?>'>
|
|
<input type='submit' name='button' class='btn btn--primary' value="<?php displayLanguageText('TEXT-GENERATE'); ?>">
|
|
</form>
|
|
<br>
|
|
<?php
|
|
|
|
?>
|
|
|
|
<?php
|
|
if ($_SESSION['UserInfo']['type'] != 'Supplier') include "hotlunch_orders.print_buttons.php";
|
|
?>
|
|
<script language='javascript'>
|
|
function toggleItemCheckboxes() {
|
|
var cb = document.getElementById('select_all').checked;
|
|
|
|
if (cb == false) {
|
|
<?php
|
|
if (isset($items)) {
|
|
for ($i = 0; $i < count($items); $i++) {
|
|
$item = $items[$i];
|
|
echo(" var cb$i = document.getElementById('$item');\n");
|
|
echo(" cb$i.checked = false;\n");
|
|
}
|
|
?>
|
|
}
|
|
else {
|
|
<?php
|
|
for ($i = 0; $i < count($items); $i++) {
|
|
$item = $items[$i];
|
|
echo(" var cb$i = document.getElementById('$item');\n");
|
|
echo(" cb$i.checked = true;\n");
|
|
}
|
|
}
|
|
?>
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<?php
|
|
endTemplate();
|
|
?>
|