First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to list and edit records
|
||||
//
|
||||
$CurrentTable = "people";
|
||||
$FormFile = "staff.dialog.php";
|
||||
$DialogWidth = 600;
|
||||
$TitleText = getLanguageText('TEXT-STAFF-PERSON');
|
||||
$SequenceFlag = 'N';
|
||||
$tableAction = "staff-list";
|
||||
$RequiredFields = array('first_name','last_name');
|
||||
|
||||
|
||||
// Ensure that only valid user types have access to this module
|
||||
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Communications Administrator');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
exit();
|
||||
}
|
||||
|
||||
$defaultCategory = 0;
|
||||
$results = db_query("SELECT * FROM staff_categories WHERE school_num = $school_num AND is_default = 'Y' ORDER BY sequence LIMIT 0,1");
|
||||
if (db_num_rows($results) == 1) {
|
||||
$row = db_fetch_assoc($results);
|
||||
$defaultCategory = $row['record_num'];
|
||||
}
|
||||
|
||||
$today = date("Y-m-d", time());
|
||||
|
||||
$FieldDefaultValues = array(
|
||||
'staff_category' => $defaultCategory,
|
||||
'added_date' => $today,
|
||||
);
|
||||
|
||||
|
||||
|
||||
// if ($school_record['implement_meal_locations'] == 'Y' && in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator'))) {
|
||||
// $query = "UPDATE people SET meal_location = class_num WHERE school_num = $school_num AND meal_location IS NULL";
|
||||
// db_query($query);
|
||||
// }
|
||||
|
||||
// Start the template and output buffering
|
||||
startTemplate();
|
||||
$templatePageTitle = "$TitleText " . getLanguageText('TEXT-ADMINISTRATION');
|
||||
|
||||
include "form.js.php";
|
||||
|
||||
?>
|
||||
<table cellpadding='5'>
|
||||
<tr>
|
||||
<td><a href='?action=staff-report' class='btn btn--primary>'><?php displayLanguageText('TEXT-STAFF-REPORT'); ?></a></td>
|
||||
<td><a href='?action=staff-csv' class='btn btn--primary>'><?php displayLanguageText('TEXT-STAFF-CSV'); ?></a></td>
|
||||
<?php if ($school_record['implement_meal_locations'] == 'Y' && $_SESSION['UserInfo']['type'] == 'SuperUser') { ?>
|
||||
<td><a href='' id='set-locations' class='btn btn--primary>'><?php displayLanguageText('TEXT-DELIVERY-LOCATIONS'); ?></a></td>
|
||||
<?php } ?>
|
||||
<td><a href='#' id='reset-staff-meal-locations' class='btn btn--primary>'><?php displayLanguageText('TEXT-RESET-MEAL-LOCATIONS'); ?></a></td>
|
||||
<td><a href='#' id='reset-staff-passwords' class='btn btn--primary>'><?php displayLanguageText('TEXT-RESET-PASSWORDS'); ?></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
// include "staff.set_price_category.form.php";
|
||||
//
|
||||
// if ($_SESSION['UserInfo']['type'] == 'SuperUser') include "staff.upload.form.php";
|
||||
|
||||
?>
|
||||
<div id='locations-dialog' title="<?php displayLanguageText('TEXT-MANAGE-LOCATIONS'); ?>">
|
||||
<p align='left'><b><label for='selected_location'><?php displayLanguageText('TEXT-DELIVERY-LOCATIONS'); ?></label>:</b><br>
|
||||
<select name='selected_location' id='selected_location'>
|
||||
<?php
|
||||
$query = "SELECT * FROM classes WHERE school_num = $base_school_num AND entry_type = 'Location' ORDER BY description";
|
||||
$results = db_query($query);
|
||||
while ($row = db_fetch_assoc($results)) {
|
||||
echo("<option value='" . $row['record_num'] . "'>" . $row['description'] . "</option>\n");
|
||||
}
|
||||
?>
|
||||
</select></p>
|
||||
<button id='all-staff' class='btn btn--outline btn--xsmall'> <?php displayLanguageText('TEXT-ALL-STAFF'); ?> </button>
|
||||
<button id='staff-without-location' class='btn btn--outline btn--xsmall'> <?php displayLanguageText('TEXT-STAFF-WITHOUT-LOCATION'); ?> </button>
|
||||
<button id='classroom' class='btn btn--outline btn--xsmall'> <?php displayLanguageText('TEXT-CLASSROOM'); ?> </button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php include "include/ajax.Setup.php" ?>
|
||||
|
||||
$("#locations-dialog").dialog({
|
||||
autoOpen: false,
|
||||
minWidth: 400,
|
||||
modal: true,
|
||||
position: { my: 'center', at: 'center' }
|
||||
});
|
||||
|
||||
$("#set-locations").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#locations-dialog").dialog("open");
|
||||
});
|
||||
|
||||
$("#all-staff").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#locations-dialog").dialog("close");
|
||||
|
||||
var location = $("#selected_location").val();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "ajax.StaffLocationUpdate.php",
|
||||
data: { set: 'all', location: location }
|
||||
}).done(function(){
|
||||
loadRecords("");
|
||||
});
|
||||
});
|
||||
|
||||
$("#staff-without-location").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#locations-dialog").dialog("close");
|
||||
|
||||
var location = $("#selected_location").val();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "ajax.StaffLocationUpdate.php",
|
||||
data: { set: 'selected', location: location }
|
||||
}).done(function(){
|
||||
loadRecords("");
|
||||
});
|
||||
});
|
||||
|
||||
$("#classroom").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#locations-dialog").dialog("close");
|
||||
|
||||
var location = 'classroom';
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "ajax.StaffLocationUpdate.php",
|
||||
data: { set: 'classroom', location: location }
|
||||
}).done(function(){
|
||||
loadRecords("");
|
||||
});
|
||||
});
|
||||
|
||||
$("#reset-staff-passwords").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var ans = confirm("<?php displayLanguageText('TEXT-CONFIRM-UPDATE'); ?>");
|
||||
if (ans) {
|
||||
var data = "table_name=staff";
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "ajax.ResetStaffPasswords.php",
|
||||
data: data
|
||||
}).done(function(data) {
|
||||
loadRecords("");
|
||||
alert("<?php displayLanguageText('MESSAGE-STAFF-PASSWORDS-RESET'); ?>");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#reset-staff-meal-locations").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var ans = confirm("<?php displayLanguageText('TEXT-CONFIRM-UPDATE'); ?>");
|
||||
if (ans) {
|
||||
var data = "table_name=staff";
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "ajax.ResetStaffMealLocations.php",
|
||||
data: data
|
||||
}).done(function(data) {
|
||||
loadRecords("");
|
||||
alert("<?php displayLanguageText('TEXT-LOCATIONS-HAVE-BEEN-RESET'); ?>");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(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=people"+
|
||||
"&sequence_flag=N"+
|
||||
"&record_num="+snum+
|
||||
"&menu_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();
|
||||
?>
|
||||
Reference in new issue
Block a user