-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
43 lines (36 loc) · 1.21 KB
/
search.php
File metadata and controls
43 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require_once("db.php");
require_once("util.php");
$db = new SkyWinDatabase();
$members = $db->find_members($_GET['term']);
$result = array();
$cacheable = true;
foreach($members as $member) {
if('PAX' == $member['MemberType'])
continue;
$label = member_text($member);
$student = null;
if($member['LicenseType'] == 'E' && $member['Education'] != NULL
&& isset($_GET['details'])) {
$cacheable = false;
$jumpno = $db->execute("SELECT StudentJumpNo FROM Member".
" WHERE InternalNo = ?", array($member['InternalNo']));
$jumpno = $jumpno[0]['StudentJumpNo'] + 1;
$sjn = $db->execute("SELECT StudentJumpNo FROM Typeeducations".
" WHERE Education = ?", array($member['Education']));
$jump = $db->execute("SELECT * FROM Typestudentjumprow".
" WHERE StudentJumpNo = ? AND StudentJumpRowNo = ?",
array($sjn[0]['StudentJumpNo'], $jumpno));
if(isset($jump[0])) {
$jump = $jump[0];
$student = array('nextjump' => $jumpno,
'education' => $sjn[0]['StudentJumpNo']);
}
}
$result[] = array('label' => $label, 'value' => $member['InternalNo'],
'student' => $student);
}
if($cacheable)
include("cacheable.php");
echo json_encode($result);
?>