Files
HotLunches/delivery_groups.php
2026-10-19 15:22:52 -07:00

59 lines
1.6 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
//
// Process all actions to list and edit records
//
$naction = "";
$CurrentTable = "delivery_groups";
$FormFile = "delivery_groups.dialog.php";
$DialogWidth = 400;
$TitleText = getLanguageText('TEXT-DELIVERY-GROUPS');
$RequiredFields = array('group_id','group_title');
$tableAction = "delivery-groups";
$SequenceFlag = 'Y';
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator');
if (checkPermission($AllowedUserTypes) != 1) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
$action = '';
$naction = '';
header("Location: /?action=$action&naction=$naction&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
exit();
}
// Check that there are entries
$num = db_getVal("SELECT count(*) FROM delivery_groups WHERE school_num = $school_num");
if ($num == 0) {
$group_ids = array('A','B','C','D');
$delivery_groups = new Table("$CurrentTable");
for ($i = 0; $i < count($group_ids); $i++) {
$group_id = $group_ids[$i];
$group_title = getLanguageText('TEXT-GROUP').": $group_id";
$query = $delivery_groups->BuildInsert();
db_query($query);
}
}
// Start the template and output buffering
startTemplate();
$templatePageTitle = "$TitleText";
startTemplate();
include "form.js.php";
endTemplate();
?>