First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Start the template and output buffering
|
||||
startTemplate();
|
||||
$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');
|
||||
$action = '';
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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']);
|
||||
|
||||
$headerArgs = "&schedule_num=$schedule_num&menu_num=$menu_num";
|
||||
|
||||
if (!isset($schedule_num)) {
|
||||
$error_message = getLanguageText('ERRORMSG-MISSING-DATA');
|
||||
$action = 'schedule-reports';
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if (!isset($menu_num)) {
|
||||
$error_message = getLanguageText('ERRORMSG-MISSING-DATA');
|
||||
$action = 'schedule-reports';
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// 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) {
|
||||
$error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE-NUM');
|
||||
$action = 'schedule-reports';
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&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 = $_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');
|
||||
$action = 'schedule-reports';
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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) {
|
||||
$error_message = getLanguageText('ERRORMSG-INVALID-MENU');
|
||||
$action = 'schedule-reports';
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
$hotlunch_menu_date = db_fetch_array($results);
|
||||
$menu_date = $hotlunch_menu_date['menu_date'];
|
||||
$menu_title = $hotlunch_menu_date['menu_title'];
|
||||
|
||||
|
||||
$templatePageTitle = getLanguageText('TEXT-MENU-SUMMARY') . " - $menu_title - $menu_date";
|
||||
|
||||
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='90%' cellpadding='5' cellspacing='1'>
|
||||
<tr>
|
||||
<td width='25%' align='right'><?php displayLanguageText('TEXT-MENU-DATE'); ?>: </td>
|
||||
<td align='left'>
|
||||
<select name='menu_num' class='select-width500'>
|
||||
<?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 = "";
|
||||
if (isset($menu_num) && $menu_num == $record_num) {
|
||||
$selected_date = 'Y';
|
||||
$selected = " selected='selected'";
|
||||
}
|
||||
echo(" <option value='$record_num'$selected>$mtitle</option>\n");
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center' colspan='2'><input type='submit' name='button' class='btn btn--primary' value="<?php displayLanguageText('TEXT-CHANGE-MENU-DATE'); ?>"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type='hidden' name='action' value='menu-summary-csv'>
|
||||
<input type='hidden' name='schedule_num' value='<?php echo($schedule_num) ?>'>
|
||||
</form>
|
||||
<br>
|
||||
<?php
|
||||
|
||||
// Check that this menu has menu items and groups
|
||||
$Groups = db_query("SELECT DISTINCT menu_group FROM hotlunch_menu_items WHERE school_num = $school_num AND menu_num = $menu_num AND menu_group >= 'A'");
|
||||
|
||||
$numGroups = db_num_rows($Groups);
|
||||
if ($numGroups > 0) {
|
||||
?>
|
||||
<form method='post' action='/'>
|
||||
<table width='700' class='content-table'>
|
||||
<tr class='heading'>
|
||||
<td colspan='5' align='center'><?php echo("$menu_title - $menu_date") ?></td>
|
||||
</tr>
|
||||
<tr class='data-odd'>
|
||||
<td align='left'> </td>
|
||||
<td align='center'><b><?php displayLanguageText('TEXT-GROUP'); ?></b></td>
|
||||
</tr>
|
||||
<?php
|
||||
// Display menu groups
|
||||
$count = 0;
|
||||
while ($row = db_fetch_assoc($Groups)) {
|
||||
extract($row);
|
||||
|
||||
$Items = db_query("SELECT item_title FROM hotlunch_menu_items WHERE school_num = $school_num AND menu_num = $menu_num AND menu_group = '$menu_group'");
|
||||
$items = "";
|
||||
while ($row = db_fetch_assoc($Items)) {
|
||||
if (strlen($items)) $items .= ",";
|
||||
$items .= ' ' . $row['item_title'];
|
||||
}
|
||||
|
||||
$class = 'data-even';
|
||||
if ($count % 2) $class = 'data-odd';
|
||||
$count++;
|
||||
?>
|
||||
<tr class='<?php echo($class) ?>'>
|
||||
<td align='left'><?php echo(getLanguageText('TEXT-GROUP') . " $menu_group") ?>:<br><?php echo($items) ?> </td>
|
||||
<td align='center' valign='top'>
|
||||
<select name='group<?php echo($menu_group) ?>'>
|
||||
<option value=''></option>
|
||||
<option value='1'><?php displayLanguageText('TEXT-COMPONENT'); ?> 1</option>
|
||||
<option value='2'><?php displayLanguageText('TEXT-COMPONENT'); ?> 2</option>
|
||||
<option value='3'><?php displayLanguageText('TEXT-COMPONENT'); ?> 3</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$class = 'data-even';
|
||||
if ($count % 2) $class = 'data-odd';
|
||||
$count++;
|
||||
?>
|
||||
<tr class='<?php echo($class) ?>' height='40'>
|
||||
<td colspan='2' align='center'>
|
||||
<input type='hidden' name='action' value='menu-summary-csv-generate'>
|
||||
<input type='hidden' name='schedule_num' value='<?php echo($schedule_num) ?>'>
|
||||
<input type='hidden' name='menu_num' value='<?php echo($menu_num) ?>'>
|
||||
<input type='submit' name='button' class='btn btn--primary' value="<?php displayLanguageText('TEXT-GENERATE'); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</form>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
echo("<p class='error'>".getLanguageText('TEXT-NO-MENU-GROUPS-FOUND')."</p>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
include "hotlunch_orders.print_buttons.php";
|
||||
endTemplate();
|
||||
?>
|
||||
Reference in new issue
Block a user