Files
2026-10-19 15:22:52 -07:00

143 lines
4.0 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
//
// Process all actions to list and edit records
//
$CurrentTable = "classes";
$FormFile = "classes.dialog.php";
$JQueryFile = "classes.js.php";
$DialogWidth = 600;
$TitleText = getLanguageText('TEXT-CLASS');
$SequenceFlag = 'Y';
$tableAction = "classes-list";
$RequiredFields = array();
$FieldDefaultValues = array(
'default_price_category' => 'Regular'
);
if ($school_record['p_display_grade'] == 'Y' || $school_record['i_display_grade'] == 'Y') {
$RequiredFields[] = 'grade';
}
if ($school_record['p_display_division'] == 'Y' || $school_record['i_display_division'] == 'Y') {
$RequiredFields[] = 'division';
}
// $RequiredFields[] = 'description';
// if ($siteType == 'hotlunch' || $siteType == 'fundraising') {
// $RequiredFields[] = 'label_description';
// }
// Start the template and output buffering
startTemplate();
$templatePageTitle = $GlobalText['ClassAdministration'];
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Administration Team','Communications Administrator');
if (checkPermission($AllowedUserTypes) != 1) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
endTemplate();
exit();
}
include "form.js.php";
if ($_SESSION['UserInfo']['type'] == 'SuperUser') include "classes.options.php";
?>
<div id='info-dialog' title="<?php displayLanguageText('TEXT-INFORMATION'); ?>">
<center>
<div id='class-students-div'></div>
<br>
<table width='100%'>
<tr>
<td align='center' style='background-color: #e0e0e0; height: 25px;'>
<button id='closeInfoDialogBtn' class='btn btn--outline btn--small'> <?php displayLanguageText('TEXT-CLOSE-WINDOW'); ?> </button>
</td>
</tr>
</table>
<p><br></p>
<p><br></p>
<p><br></p>
<p><br></p>
</center>
</div>
<script>
$(document).ready(function() {
<?php include "include/ajax.Setup.php" ?>
$(document).on("click", ".price-category", function() {
var mcat = $(this).attr('mcat');
var snum = $(this).attr('snum');
var spanID = $(this);
var Regular = "<?php displayLanguageText('TEXT-REGULAR'); ?>";
var Special1 = "<span class='warning'><?php echo($Special1_Title); ?></span>";
var Special2 = "<span class='warning'><?php echo($Special2_Title); ?></span>";
var Special3 = "<span class='warning'><?php echo($Special3_Title); ?></span>";
var newText;
var data = "table_name=classes"+
"&sequence_flag=N"+
"&record_num="+snum+
"&default_price_category=";
switch (mcat) {
case 'regular':
var cat = "Special 1";
var ncat = "special1";
data = data+cat;
newText = Special1;
break;
case 'special1':
var cat = "Special 2";
var ncat = "special2";
data = data+cat;
newText = Special2;
break;
case 'special2':
var cat = "Special 3";
var ncat = "special3";
data = data+cat;
newText = Special3;
break;
case 'special3':
var cat = "Regular";
var ncat = "regular";
data = data+cat;
newText = Regular;
break;
}
$.getJSON("ajax.DataRecord.Update.php", data,
function(results) {
$(spanID).html(newText);
$(spanID).attr('mcat',ncat);
}
);
});
});
</script>
<?php
endTemplate();
?>