\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
// Start the template and output buffering
startTemplate();
//
// 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 (array_key_exists('menu_num',$_GET)) $menu_num = intval($_GET['menu_num']);
if (array_key_exists('menu_num',$_POST)) $menu_num = intval($_POST['menu_num']);
if (!isset($schedule_num)) {
echo("
\n");
$error_message = "Error: schedule number must be specified";
include "form.messages.php";
return;
}
if (!isset($menu_num)) {
echo("
\n");
$error_message = "Error: menu 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("
\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("
\n");
$error_message = "You are not allowed access to the requested hot lunch schedule";
include "form.messages.php";
return;
}
}
// Check if this is a valid menu
$query = "select * from hotlunch_menu_dates " .
"where school_num = $school_num " .
"and schedule_num = $schedule_num " .
"and record_num = $menu_num";
$results = db_query($query);
if (db_num_rows($results) == 0) {
echo("
\n");
$error_message = "The requested hot lunch menu is invalid";
include "form.messages.php";
return;
}
$hotlunch_menu_date = db_fetch_array($results);
$menu_date = $hotlunch_menu_date['menu_date'];
$menu_title = $hotlunch_menu_date['menu_title'];
$templatePageTitle = getLanguageText('TEXT-OPTION-DETAILS') . " - $menu_title - $menu_date";
// Get the set of options for the selected menu date
$query = "select * from hotlunch_menu_items " .
"where school_num = $school_num " .
"and menu_num = $menu_num " .
"and length(options) > 0 " .
"order by sequence";
$menu_items = db_query($query);
if (db_num_rows($menu_items) == 0) $error_message = "Error: This menu has no options to report on";
include "form.messages.php";
include "hotlunch_reports.menu.php";
echo("
\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'];
//
// Display the menu selection
//
?>
| $f | \n"); echo("$number | \n"); echo(" \n"); if ($class == 'data-odd') $class = 'data-even'; else $class = 'data-odd'; } ?>