| 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>
$(function() {
var DeleteID = 0;
$('#select_all_btn').click(function() {
var $selectAllCheckbox = $('.select-all-checkbox');
$selectAllCheckbox.prop('checked', !$selectAllCheckbox.prop('checked'));
});
$('#stu_name').select2();
});
function check_all(obj, cName) {
var checkboxs = document.getElementsByName(cName);
for (var i = 0; i < checkboxs.length; i++) {
checkboxs[i].checked = obj.checked;
}
};
</script>
<?php if(isset($_POST['submit'])) { ?>
<script>
$(function(){
$('#stu_name').select2().select2('val','<?=$_POST['stu_name']?>');
});
</script>
<?php } ?>
</head>
<body>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<li><a href="student.php">Student Record</a></li>
<li><a href="#"></a> <span class="divider">></span></li>
<li><a href="Add_stu.php">Add Student Record</a></li>
<li><a href="#"></a> <span class="divider">></span></li>
<li class="active">Import 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>Search a Student</h2></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
<select name="stu_name" id="stu_name" >
<option value="ALL">All</option>
<?php $sth = $dbh->query("SELECT linking_id,`New_stu_ID` id,CONCAT(last_name, ' ', first_name) studentname,`ch_name`FROM `student` WHERE `actived`=1 and`deleted`=0 group by `New_stu_ID`,`Sem_yr`"); ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?= $ResultSet['studentname']; ?>"><?= $ResultSet['studentname'] ?></option>
<?php } ?>
</select>
</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>
Semaster_Year
<select name="sem_yr">
<?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
<select name="stu_name" id="stu_name" >
<option value="ALL">All</option>
<?php $sth = $dbh->query("SELECT linking_id,`New_stu_ID` id,CONCAT(last_name, ' ', first_name) studentname,`ch_name`FROM `student` WHERE `actived`=1 and`deleted`=0 group by `New_stu_ID`,`Sem_yr`"); ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?= $ResultSet['studentname']; ?>"><?= $ResultSet['studentname'] ?></option>
<?php } ?>
</select>
</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>
Semaster_Year
<select name="sem_yr">
<?php
$curr_yr=date("Y");
$curr_mon=date("M");
echo "<script>alert('.$curr_yr.' '.$curr_mon.')</script>";
$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> </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') {
$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'";
} 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'";
} 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'";
} 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'";
}
}
}
$result1 = $dbh->query($query1);
$result1->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result1->fetch()) {
print '<tr>';
print '<td><input type="button" name="import" class="btn" value="Import" onClick="window.location=\'Add_stu.php?linking_id=' . $row->linking_id . '\'"></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>