'schedule_num', 'default' => $schedule_num, 'ftype' => 'form-data'), array('field_name' => 'select_classes', 'default' => "'AllClasses'", 'ftype' => 'form-data'), array('field_name' => 'selected_classes', 'default' => '[]', 'ftype' => 'form-data'), ); // Ensure that only valid user types have access to this module $AllowedUserTypes = array('SuperUser','System Administrator','Schedule Team','Application Administrator'); 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 = getLanguageText('TEXT-MANAGE-FORM'); $moduleName = "hotlunch_menu_dates.php"; // if ($_SESSION['UserInfo']['type'] == 'SuperUser') startLog($moduleName); 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) || intval($schedule_num) == 0) { $error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE'); include "form.messages.php"; include "hotlunch_reports.menu.php"; endTemplate(); 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 record_num = $schedule_num " . "and school_num = $school_num $swhere"; $results = db_query($query); if (db_num_rows($results) == 0) { $error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE-NUM'); include "form.messages.php"; include "hotlunch_reports.menu.php"; endTemplate(); exit(); } $hotlunch_schedule = db_fetch_array($results); $templatePageTitle .= " - " . $hotlunch_schedule['schedule_name']; // If this is a ScheduleTeam user check if they have permission to access this schedule if ($_SESSION['UserInfo']['type'] == 'Schedule Team') { $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"; $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); if ($numLinks > 0) { $JSeditValidation = " var mlink = $(\"#menu-date-link-\"+record_num).val(); if (mlink != 'No') { alert(\"".getLanguageText('TEXT-UNABLE-TO-EDIT-LINKED-MENUS')."\"); return; } "; } $query = "SELECT count(*) FROM hotlunch_menu_items " . "WHERE school_num = $school_num " . "AND menu_num IN (SELECT record_num FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num)"; $numItems = db_getVal($query); ?>