125 lines
3.6 KiB
PHP
125 lines
3.6 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
//
|
|
// Process all actions to list and edit records
|
|
//
|
|
$CurrentTable = "people";
|
|
$DeleteField = "first_name,last_name";
|
|
$dSeparator = " ";
|
|
$FormFile = "";
|
|
$TitleText = getLanguageText('TEXT-STUDENTS');
|
|
$OrderBy = "last_name,first_name";
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$templatePageTitle = $TitleText;
|
|
|
|
|
|
// 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();
|
|
}
|
|
|
|
|
|
// $school_num = $school_record['record_num'];
|
|
// $school_num = $base_school_num;
|
|
|
|
|
|
//
|
|
// List all records
|
|
//
|
|
?>
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
<?php include "include/ajax.Setup.php" ?>
|
|
|
|
$(document).on("click", ".create-flag", function(e) {
|
|
e.preventDefault();
|
|
|
|
var flag = $(this).attr('flag');
|
|
var rnum = $(this).attr('rnum');
|
|
var snum = $(this).attr('sn');
|
|
|
|
var new_flag = 'N';
|
|
if (flag == 'N') new_flag = 'Y';
|
|
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: "ajax.PendingStudent.Update.php",
|
|
data: { flag: new_flag, sn: snum, record_num: rnum }
|
|
}).done(function(data) {
|
|
// $(".sn_"+snum).each(function(e) {
|
|
// $(this).html('-- N --');
|
|
// $(this).attr('flag','N');
|
|
// });
|
|
|
|
$("#span_"+rnum).html('-- '+new_flag+' --');
|
|
$("#span_"+rnum).attr('flag',new_flag);
|
|
});
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<?php
|
|
|
|
// Get records to display
|
|
$columnHeaders = array(getLanguageText('TEXT-STUDENT'),
|
|
getLanguageText('TEXT-STUDENT-NUMBER'),
|
|
getLanguageText('TEXT-PARENT'),
|
|
getLanguageText('TEXT-PHONE'),
|
|
getLanguageText('TEXT-USER-ID'),
|
|
"Create");
|
|
$columnAlign = array("left","left","left","left","left","center");
|
|
$query = "SELECT * FROM people_csv " .
|
|
"WHERE school_num = $base_school_num " .
|
|
"AND created_flag = 'N' " .
|
|
"ORDER BY first_name,last_name,student_number,parent_first_name,parent_last_name";
|
|
$results = db_query($query);
|
|
|
|
$data = array();
|
|
$prev_name = "";
|
|
$prev_num = "";
|
|
while ($row = db_fetch_assoc($results)) {
|
|
extract($row);
|
|
|
|
// Format the data
|
|
$name = "$first_name $last_name";
|
|
$parent = "$parent_first_name $parent_last_name";
|
|
$userid = strtolower(str_replace(' ','',str_replace("'",'',"$parent_first_name.$parent_last_name")));
|
|
|
|
// If there is an email address create a link for the name field
|
|
if (strlen($email) && strstr($email,'@')) {
|
|
$parent = "<a href='mailto:" . $email . "'>$parent</a>";
|
|
}
|
|
|
|
if ($name == $prev_name && $student_number == $prev_num) {
|
|
$name = "";
|
|
$student_number = "";
|
|
}
|
|
else {
|
|
$prev_name = $name;
|
|
$prev_num = $student_number;
|
|
}
|
|
|
|
$create_flag = "<b><span class='create-flag sn_$student_number' id='span_$record_num' sn='$student_number' flag='$create_flag' rnum='$record_num'>-- $create_flag --</span></b>";
|
|
|
|
$data[] = array($name, $student_number, $parent, $phone, $userid, $create_flag);
|
|
}
|
|
|
|
listDataCustom($data,$columnHeaders,$action,array(),'N',$columnAlign);
|
|
|
|
endTemplate();
|
|
?>
|