First Commit

This commit is contained in:
mark committed 2026-10-19 15:22:52 -07:00
1 parent 5eb9dd037d
commit 2e62c0e60b
11877 files changed
+2035312

No files matched your search

+162
View File
@@ -0,0 +1,162 @@
<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
//
// Process all actions to list and edit records
//
$naction = "";
$CurrentTable = "hotlunch_menu_items";
$FormFile = "hotlunch_menu_items.dialog.php";
$JQueryFile = "hotlunch_menu_items.js.php";
$DialogWidth = 750;
$DialogHeight = 450;
$TitleText = getLanguageText('TEXT-MENU-ITEM');
$SequenceFlag = 'Y';
$InsertNewRecord = 'N';
$tableAction = "menu-items-list";
$RequiredFields = array('item_title');
$CustomDialogFields = array(
array('field_name' => 'qty0', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'qty1', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'qty2', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'qty3', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'qty4', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'qty5', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product0', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product1', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product2', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product3', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product4', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product5', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'product5', 'default' => "''", 'ftype' => 'form-data'),
array('field_name' => 'num_alt_prices', 'default' => "0", 'ftype' => 'form-data'),
array('field_name' => 'menu_num', 'default' => $menu_num, 'ftype' => 'form-data'),
);
// 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) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
include "hotlunch_reports.menu.php";
endTemplate();
exit();
}
// Start the template and output buffering
startTemplate();
$templatePageTitle = "$TitleText " . getLanguageText('TEXT-ADMINISTRATION');
$moduleName = "hotlunch_menu_items.php";
// startLog($moduleName);
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($menu_num)) {
$error_message = getLanguageText('ERRORMSG-NO-MENU-NUM');
include "form.messages.php";
include "hotlunch_reports.menu.php";
endTemplate();
exit();
}
$current_menu_num = $menu_num;
// Get menu date information
$query = "select * from hotlunch_menu_dates " .
"where school_num = $school_num " .
"and record_num = $menu_num";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$error_message = getLanguageText('ERRORMSG-NO-SCHEDULE-ACCESS');
include "form.messages.php";
include "hotlunch_reports.menu.php";
endTemplate();
exit();
}
$hotlunch_menu_date = db_fetch_array($results);
$menu_date_title = $hotlunch_menu_date['menu_title'];
$menu_date = $hotlunch_menu_date['menu_date'];
$schedule_num = $hotlunch_menu_date['schedule_num'];
$menu_link = $hotlunch_menu_date['menu_link'];
if ($menu_link != 'No') $SequenceFlag = 'N';
// Get the schedule information
$results = db_query("SELECT * FROM hotlunch_schedules WHERE school_num = $school_num AND record_num = $schedule_num");
$row = db_fetch_assoc($results);
$schedule_name = $row['schedule_name'];
$schedule_type = $row['schedule_type'];
if ($schedule_type == 'Hot Lunch' || $schedule_type == 'Date Sensitive') $templatePageTitle .= " - $menu_date_title - $menu_date - $schedule_name";
else $templatePageTitle .= " - $menu_date_title - $schedule_name";
// 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');
include "form.messages.php";
include "hotlunch_reports.menu.php";
endTemplate();
exit();
}
}
$CustomData = "&schedule_num=$schedule_num&menu_num=$menu_num&menu_link=$menu_link";
$numOrders = db_getVal("SELECT count(*) FROM hotlunch_order_items WHERE school_num = $school_num AND schedule_num = $schedule_num AND active = 'Y'");
$query = "SELECT count(*) FROM hotlunch_menu_dates " .
"WHERE school_num = $school_num " .
"AND schedule_num = $schedule_num " .
"AND menu_link != 'No'";
$numLinks = db_getVal($query);
$JSinitForm = "
var num_alt_prices = $('#dialog_number_of_alternate_prices').val();
$('.alt10').hide();
if (num_alt_prices > 0) $('.alt'+num_alt_prices).show();
var new_type = $('#new_entry_type').val();
if (new_type.length > 0) $('#dialog_item_type').val(new_type);
";
$menuTitle = getLanguageText('TEXT-MENU-ITEM');
$headerTitle = getLanguageText('TEXT-HEADING');
$JSeditValidation = "
setupDialog(record_num);
";
// Define other values
$productRows = 6;
// Main buttons
include "hotlunch_reports.menu.php";
include "form.js.php";
include "hotlunch_menu_items.options.php";
include "hotlunch_orders.print_buttons.php";
endTemplate();
?>