First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Start the template and output buffering
|
||||
startTemplate();
|
||||
$templatePageTitle = getLanguageText('TEXT-MANAGE-ORDERS');
|
||||
$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) {
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
header("Location: /?form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Get schedule_num
|
||||
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)) {
|
||||
$error_message = getLanguageText('ERRORMSG-INVALID-ACCESS');
|
||||
header("Location: /?form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
// Check if this is a valid schedule
|
||||
$swhere = "";
|
||||
if ($_SESSION['UserInfo']['type'] == 'Supplier') $swhere = " and supplier_num = " . $_SESSION['UserInfo']['supplier_num'];
|
||||
$query = "select * from hotlunch_schedules " .
|
||||
"where school_num = $school_num " .
|
||||
"and record_num = $schedule_num " .
|
||||
$swhere;
|
||||
$results = db_query($query);
|
||||
|
||||
if (db_num_rows($results) == 0) {
|
||||
$error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE');
|
||||
header("Location: /?form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
$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) {
|
||||
$error_message = getLanguageText('ERRORMSG-NO-SCHEDULE-ACCESS');
|
||||
header("Location: /?form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check that this schedule date has lunch dates specified
|
||||
$query = "select count(*) num from hotlunch_menu_dates " .
|
||||
"where school_num = $school_num " .
|
||||
"and schedule_num = $schedule_num";
|
||||
$dates = db_getVal($query);
|
||||
if ($dates == 0) {
|
||||
$error_message = getLanguageText('ERRORMSG-NO-MENU-DATES');
|
||||
}
|
||||
|
||||
|
||||
// Check that this schedule has lunch items specified
|
||||
$query = "SELECT count(hlmi.record_num) AS num " .
|
||||
"FROM hotlunch_menu_items AS hlmi, hotlunch_menu_dates AS hlmd " .
|
||||
"WHERE hlmi.school_num = $school_num " .
|
||||
"AND hlmd.school_num = $school_num " .
|
||||
"AND hlmd.record_num = hlmi.menu_num " .
|
||||
"AND hlmd.schedule_num = $schedule_num";
|
||||
$items = db_getVal($query);
|
||||
|
||||
|
||||
include "hotlunch_reports.menu.php";
|
||||
include "form.messages.php";
|
||||
|
||||
$today = date("Y-m-d",time());
|
||||
|
||||
?>
|
||||
<br>
|
||||
<table width='800' cellpadding='3' cellspacing='1' border='0' class='content-table'>
|
||||
<tr>
|
||||
<td align='left' class='heading'>
|
||||
<h2><?php echo($hotlunch_schedule['schedule_name']) ?>:</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'>
|
||||
<form method='post' id='cafeteria-form'>
|
||||
<p><b><?php displayLanguageText('TEXT-MENU-DATE'); ?>:</b><br>
|
||||
<select name='menu_date' id='menu_date'>
|
||||
<?php
|
||||
$query = "SELECT * FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num ORDER BY sequence,menu_date";
|
||||
$menu_dates = db_query($query);
|
||||
$selected_date = 'N';
|
||||
$today = date("Y-m-d",time());
|
||||
while ($row = db_fetch_assoc($menu_dates)) {
|
||||
extract($row);
|
||||
|
||||
$selected = "";
|
||||
if ($hotlunch_schedule['display_menu_date'] == 'Y') {
|
||||
$menu_title .= " - " . date($school_record['date_format'],strtotime($menu_date));
|
||||
|
||||
if ($menu_date >= $today && $selected_date == 'N') {
|
||||
$selected_date = 'Y';
|
||||
$selected = " selected='selected'";
|
||||
}
|
||||
}
|
||||
|
||||
echo(" <option value='$record_num'$selected>$menu_title</option>\n");
|
||||
}
|
||||
?>
|
||||
</select></p>
|
||||
<p><b><?php echo($GlobalText['ClassSelect']); ?>:</b><br>
|
||||
<select name='selected_class' id='selected_class'>
|
||||
<option value='0'><?php displayLanguageText('TEXT-VIEW-ALL'); ?></option>
|
||||
<?php
|
||||
$classes = db_query("select record_num from classes where school_num = $base_school_num order by sequence");
|
||||
$schedule_access = 0;
|
||||
while ($row = db_fetch_array($classes)) {
|
||||
$class_num = $row['record_num'];
|
||||
$class_info = getClassInfo($class_num);
|
||||
echo(" <option value='$class_num'>$class_info</option>\n");
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<button id='cafeteria-view-students'><?php displayLanguageText('TEXT-VIEW'); ?></button></p>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'>
|
||||
<span id='manage-orders-span'></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
endTemplate();
|
||||
?>
|
||||
Reference in new issue
Block a user