First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Setup defaults for the lookup
|
||||
//
|
||||
?>
|
||||
|
||||
<br>
|
||||
<?php
|
||||
$message_width = $default_form_width;
|
||||
include "form.messages.php";
|
||||
?>
|
||||
<table width='<?php echo($default_form_width) ?>' class='content-table'>
|
||||
<tr>
|
||||
<td colspan='2' align='center' class='heading'><?php displayLanguageText('TEXT-LOOKUP-FORM'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center'>
|
||||
<br>
|
||||
<form method='post'>
|
||||
<table width='100%' cellpadding='1' cellspacing='1' border='0' align='center'>
|
||||
<tr>
|
||||
<td align='right' width='50'></td>
|
||||
<td align='left' width='650'><?php echo(getLanguageText('TEXT-SEARCH')) ?>:<br>
|
||||
<input type='text' name='search_text' id='search_text' tabindex=1 size='40'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td><td align='left' width=650>
|
||||
<div id=dataResultsRow>
|
||||
<div style="width: 645px; border: 1px solid #000; border-bottom: none; background:#eee;">
|
||||
<table id=dataResultsHead border=0 cellspacing=0 cellpadding=2>
|
||||
<tr>
|
||||
<th align=left><?php echo(getLanguageText('TEXT-NAME')) ?></th>
|
||||
<?php if ($school_record['collect_student_number'] == 'Y') { ?>
|
||||
<th align=left><?php echo(getLanguageText('TEXT-NUMBER')) ?></th>
|
||||
<?php } ?>
|
||||
<th align=left><?php echo(getLanguageText('TEXT-PARENT')) ?></th>
|
||||
<th align=left><?php echo(getLanguageText('TEXT-PHONE')) ?></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id=dataResultsScroll style="height:100px; width:645px; overflow:auto; border: 1px solid #000; border-top: none; background:#fff;">
|
||||
<table id=dataResultsTable border=0 cellspacing=0 cellpadding=2><tr><td></td></tr></table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type='hidden' name='action' value='students'>
|
||||
<input type='hidden' name='naction' value='student-lookup-search'>
|
||||
</form>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
|
||||
$.ajaxSetup({ scriptCharset: "utf-8" ,contentType: "application/json; charset=UTF-8" })
|
||||
|
||||
$("#search_text").focus();
|
||||
|
||||
<?php if ($school_record['collect_student_number'] == 'Y') { ?>
|
||||
var dataCellWidths = [200, 100, 200, 145];
|
||||
<?php } else { ?>
|
||||
var dataCellWidths = [250, 250, 145];
|
||||
<?php } ?>
|
||||
for (i=0; i<dataCellWidths.length; i++) $('#dataResultsHead th').eq(i).css('width', dataCellWidths[i]);
|
||||
|
||||
// Hide everything by default
|
||||
var dataSearch = $('#search_text');
|
||||
var dataResultsRow = $('#dataResultsRow').hide();
|
||||
var dataResultsTable = $('#dataResultsTable');
|
||||
var dataResultsScroll = $('#dataResultsScroll');
|
||||
|
||||
|
||||
// Handle typing in the search box
|
||||
dataSearch.keyup(function() {
|
||||
var searchName = $(this).val();
|
||||
if (searchName.length < 2) {
|
||||
doClick(null);
|
||||
return;
|
||||
}
|
||||
var d = new Date();
|
||||
searchName = escape(searchName);
|
||||
$.getJSON('/ajaxSearchStudents.php', {s:searchName, sn:<?php echo($school_num) ?>, bn:<?php echo($base_school_num) ?>, d:d.getTime()}, updateResults);
|
||||
});
|
||||
|
||||
function updateResults(data) {
|
||||
var row;
|
||||
var radio;
|
||||
|
||||
if (data.length == 0) {
|
||||
doClick(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// empty the results table, and rebuild it
|
||||
dataResultsTable.empty();
|
||||
|
||||
for (var i=0; i<data.length; i++) {
|
||||
data[i]['name'] = unescape(data[i]['name']);
|
||||
row = $('<tr>');
|
||||
<?php if ($school_record['collect_student_number'] == 'Y') { ?>
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[0]).html(decodeURIComponent( escape( data[i]['name'] ) )));
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[1]).html(data[i]['student_number']==''?' ':data[i]['student_number']));
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[2]).html(data[i]['parent']==''?' ':unescape(decodeURIComponent( data[i]['parent'] ))));
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[3]).html(data[i]['phone']==''?' ':data[i]['phone']));
|
||||
<?php } else { ?>
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[0]).html(decodeURIComponent( escape( data[i]['name'] ) )));
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[1]).html(data[i]['parent']==''?' ':unescape(decodeURIComponent( data[i]['parent'] ))));
|
||||
row.append($('<td align=left>').css('width', dataCellWidths[2]).html(data[i]['phone']==''?' ':data[i]['phone']));
|
||||
<?php } ?>
|
||||
row.data('info', data[i]);
|
||||
dataResultsTable.append(row);
|
||||
}
|
||||
|
||||
// treat a click anywhere on the row as a click on the radio button
|
||||
$('#dataResultsTable tr *').css('cursor','pointer').click(function() {
|
||||
doClick($(this).closest('tr'));
|
||||
});
|
||||
|
||||
// display results, if the height > 150px, setup autoscroll
|
||||
dataResultsScroll.css('overflow','visible').css('height', 'auto');
|
||||
dataResultsRow.show();
|
||||
if (dataResultsScroll.height() > 150) dataResultsScroll.css('overflow','auto').css('height', 150);
|
||||
}
|
||||
function doClick(row) {
|
||||
if (row != null) {
|
||||
// clicked on a selection
|
||||
data = row.data('info');
|
||||
location.href= '?action=students&naction=show-info&student_num=' + data['record_num'];
|
||||
}
|
||||
dataResultsRow.hide();
|
||||
dataResultsTable.empty();
|
||||
}
|
||||
$('#search_text').focus(function() {
|
||||
dataResultsRow.hide();
|
||||
dataResultsTable.empty();
|
||||
});
|
||||
doClick(null);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user