First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Start the template and output buffering
|
||||
startTemplate();
|
||||
$templatePageTitle = getLanguageText('TEXT-MENU-ITEM-UPDATE');
|
||||
|
||||
|
||||
|
||||
// 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');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
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-SCHEDULE-NUM');
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
exit();
|
||||
}
|
||||
|
||||
// Check if this is a valid schedule
|
||||
$today = date("Y-m-d",time());
|
||||
$query = "select * from hotlunch_schedules " .
|
||||
"where record_num = $schedule_num " .
|
||||
"and school_num = $school_num";
|
||||
$results = db_query($query);
|
||||
|
||||
if (db_num_rows($results) == 0) {
|
||||
$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 = $_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";
|
||||
endTemplate();
|
||||
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";
|
||||
$results = db_query($query);
|
||||
$row = db_fetch_array($results);
|
||||
if ($row['num'] == 0) {
|
||||
$error_message = getLanguageText('ERRORMSG-NO-MENU-DATES');
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Check that this schedule date has lunch items specified
|
||||
$query = "select count(hotlunch_menu_items.record_num) num from hotlunch_menu_items,hotlunch_menu_dates " .
|
||||
"WHERE hotlunch_menu_items.school_num = $school_num " .
|
||||
"AND hotlunch_menu_dates.school_num = $school_num " .
|
||||
"AND hotlunch_menu_dates.record_num = hotlunch_menu_items.menu_num " .
|
||||
"AND hotlunch_menu_dates.schedule_num = $schedule_num";
|
||||
$results = db_query($query);
|
||||
$row = db_fetch_array($results);
|
||||
if ($row['num'] == 0) {
|
||||
$error_message = getLanguageText('ERRORMSG-NO-MENU-ITEMS');
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to list and edit records
|
||||
//
|
||||
$naction = "";
|
||||
|
||||
|
||||
if (array_key_exists('naction',$_GET)) $naction = $_GET['naction'];
|
||||
if (array_key_exists('naction',$_POST)) $naction = $_POST['naction'];
|
||||
|
||||
|
||||
// Display the selected menu form
|
||||
include "hotlunch_menu.item_update.form.php";
|
||||
|
||||
endTemplate();
|
||||
?>
|
||||
Reference in new issue
Block a user