| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)pathways.org.hk/MIS20140127/old20140407/student/ |
Upload File : |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
require_once '../include/head.php';
require_once '../include/checkuser.php';
require_once '../include/Nav_bar.php';
include_once '../include/DBConnect.php';
?>
<script>
var stu_name = [];
var CurrentInput;
$(function() {
var DeleteID = 0;
$('#select_all_btn').click(function() {
var $selectAllCheckbox = $('.select-all-checkbox');
$selectAllCheckbox.prop('checked', !$selectAllCheckbox.prop('checked'));
});
});
$(document).ready(function() {
$.ajax({
type: "POST",
url: "ajax_get_name.php",
data: {
data: '1'
},
cache: false,
success: function(html) {
var obj = $.parseJSON(html);
$.each(obj, function(key, value) {
stu_name.push({id: value['name'], text: value['name']})
});
}
});
$('#stu_name').select2({
minimumInputLength: 1,
maxiumSelectionSize: 1,
createSearchChoice: function(term, data) {
return {id: term, text: term};
},
multiple: false,
data: stu_name
});
});
</script>
<?php if (isset($_POST['submit']) && $_POST['submit'] == "Search" && !empty($_POST['stu_name'])) { ?>
<script>
$(function() {
$('#stu_name').select2('data', {id: '<?= $_POST['stu_name'] ?>', text: '<?= $_POST['stu_name'] ?>'});
});
</script>
<?php } ?>
</head>
<body>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<li class="active">Student Record</li>
</ul>
</div>
<!-- line between nav bar and content -->
<div class="container-fluid pathways-container">
<div>
<table border="0" width="100%">
<tr>
<td><h2>Student Records</h2></td>
<td><a href="Add_stu.php" class="btn pull-right"><i class="icon-plus"></i> Add</a></td>
</tr>
</table>
</div>
<div class="pathways-search">
<form action="" method="POST" class="form-inline">
<table border="0" width="100%">
<tr>
<?php
if (isset($_POST['submit']) && $_POST['submit'] == "Search") {
$campus = $_POST['campus'];
$status = $_POST['status'];
$stu_name = $_POST['stu_name'];
$yr = $_POST['sem_yr'];
?>
<td>Name
<input type="text" name="stu_name" id="stu_name">
</td>
<td>
Campus
<select name='campus'>
<option value='All'>All</option>
<?php
$query = "Select campus_id,campus_name from campus";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
if ($row->campus_id == $campus)
print '<option value=' . $row->campus_id . ' selected>' . $row->campus_name . '</option>';
else
print '<option value=' . $row->campus_id . '>' . $row->campus_name . '</option>';
}
?>
</select>
</td>
<td>
School Year
<select name="sem_yr">
<option value="All">All Year</option>
<?php
$query12 = "Select Sem_yr as yr from student group by Sem_yr";
$result12 = $dbh->query($query12);
$result12->setFetchMode(PDO::FETCH_OBJ);
while ($row12 = $result12->fetch()) {
if ($row12->yr == $yr)
print '<option value="' . $row12->yr . '" selected>' . $row12->yr . '</option>';
else
print '<option value="' . $row12->yr . '">' . $row12->yr . '</option>';
}
?>
</select>
</td>
<td>
Status
<select name='status'>
<?php
if ($status == '1') {
?>
<option value='All'>All</option>
<option value='1' selected>Active</option>
<option value='0'>Disable</option>
<?php
} else {
if ($status == '0') {
?>
<option value='All'>All</option>
<option value='1'>Active</option>
<option value='0' selected>Disable</option>
<?php
} else {
?>
<option value='All'>All</option>
<option value='1'>Active</option>
<option value='0'>Disable</option>
<?php
}
}
?>
</select>
</td>
<?php
} else {
?>
<td>Name
<input type="text" name="stu_name" id="stu_name">
</td>
<td>
Campus
<select name='campus'>
<option value='All'>All</option>
<?php
$query = "Select campus_id,campus_name from campus";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
print '<option value=' . $row->campus_id . '>' . $row->campus_name . '</option>';
}
?>
</select>
</td>
<td>
School Year
<select name="sem_yr">
<option value="All">All Year</option>
<?php
$curr_yr = date("Y");
$curr_mon = date("M");
$query12 = "Select Sem_yr as yr from student group by Sem_yr";
$result12 = $dbh->query($query12);
$result12->setFetchMode(PDO::FETCH_OBJ);
while ($row12 = $result12->fetch()) {
$year = explode("-", $row12->yr);
//if ($curr_yr == $year[0] && $curr_mon >= 9) {
//print '<option value="' . $row12->yr . '"selected>' . $row12->yr . '</option>';
//} else {
//if ($curr_yr == $year[1] && $curr_mon < 9) {
//print '<option value="' . $row12->yr . '"selected>' . $row12->yr . '</option>';
//}
//else
print '<option value="' . $row12->yr . '">' . $row12->yr . '</option>';
//}
}
?>
</select>
</td>
<td>
Status
<select name='status'>
<option value='All'>All</option>
<option value='1'>Active</option>
<option value='0'>Disable</option>
</select>
</td>
<?php
}
?>
<td><input type="submit" name="submit" class='btn' id='Search' value="Search"></td>
</tr><!--input search field-->
</table>
</form>
</div>
<form action="" method="POST">
<table border="0" class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th>Edit</th>
<th>Name</th>
<th>Chinese Name</th>
<th>Year/Grade</th>
<th>Emergency Contact Person</th>
<th>Emergency Contact No. </th>
</tr>
</thead>
<tbody id='search_result'>
<?php
if (isset($_POST['submit']) && $_POST['submit'] == "Search") {
$campus_id = $_POST['campus'];
$stu_name = $_POST['stu_name'];
if ($stu_name == 'ALL')
$stu_name = ' ';
$status = $_POST['status'];
if ($status == 'All' && $campus_id == 'All' && $yr == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' order by s.createdate DESC";
} else {
if ($status == 'All' && $yr == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and s.reg_campus_id='$campus_id' order by s.createdate DESC";
} else {
if ($campus_id == 'All' && $yr == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and s.actived='$status' order by s.createdate DESC";
} else {
if ($status == 'All' && $campus_id == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and Sem_yr='$yr' order by s.createdate DESC";
} else {
if ($yr == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and s.reg_campus_id='$campus_id' and s.actived='$status' order by s.createdate DESC";
} else {
if ($campus_id == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and s.actived='$status' and Sem_yr='$yr' order by s.createdate DESC";
} else {
if ($status == 'All') {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and s.reg_campus_id='$campus_id' and Sem_yr='$yr' order by s.createdate DESC";
} else {
$query1 = "Select s.linking_id,s.first_name,s.last_name,s.ch_name,s.eme_contact_name,
s.eme_contact_number,g.grade from student as s,grade as g,student_grade as l
where s.linking_id=l.student_grade_id and l.grade_id=g.grade_id and s.deleted='0'
and concat(last_name,' ',first_name,'(',ch_name,')') like '%$stu_name%' and s.reg_campus_id='$campus_id' and s.actived='$status' and Sem_yr='$yr' order by s.createdate DESC";
}
}
}
}
}
}
}
$result1 = $dbh->query($query1);
$result1->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result1->fetch()) {
print '<tr>';
print '<td>
<a href="student_edit.php?linking_id=' . $row->linking_id . '&action=View" class="btn"><i class="icon-eye-open"></i> View</a>
</td>';
print '<td>' . $row->last_name . ' ' . $row->first_name . '</td>';
print '<td>' . $row->ch_name . '</td>';
print '<td>' . $row->grade . '</td>';
print '<td>' . $row->eme_contact_name . '</td>';
print '<td>' . $row->eme_contact_number . '</td>';
print '</tr>';
}
}
?>
</tbody>
</table>
</form>
</div>
</body>
</html>