| 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/old20140414/student/ |
Upload File : |
<!DOCTYPE html>
<?php
require_once '../include/head.php';
require_once '../include/checkuser.php';
require_once '../include/Nav_bar.php';
include_once '../include/DBConnect.php';
if (isset($_POST['submit']) && $_POST['submit'] == 'Save') {
$Start = "START TRANSACTION";
$dbh->query($Start);
$RollBack = false;
try {
$old_id = $_POST['old_stu_id'];
//$new_id = $_POST['new_stu_id'];
$sem_yr = $_POST['sem_yr'];
$input_by = $_POST['input_by'];
$input_date = $_POST['input_date'];
$is_actived = $_POST['is_actived'];
$reg_date = $_POST['reg_date'];
if (isset($_POST['is_pathway_stu']))
$is_pathway_stu = $_POST['is_pathway_stu'];
else
$is_pathway_stu = 0;
if (isset($_POST['is_in_school']))
$is_in_school = $_POST['is_in_school'];
else
$is_in_school = 0;
$reg_campus = $_POST['reg_campus'];
$last_name = $_POST['last_name'];
$first_name = $_POST['first_name'];
$ch_name = $_POST['ch_name'];
$gender = $_POST['gender'];
$date_of_birth = $_POST['date_of_birth'];
$home_tel = $_POST['home_tel'];
$fax = $_POST['fax'];
$email = $_POST['email'];
$stu_mobile = $_POST['stu_mobile'];
$address = $_POST['address'];
$address2 = $_POST['address1'];
$address3 = $_POST['address2'];
$district = $_POST['district'];
$school_id = $_POST['school_name'];
$school_district = $_POST['sch_district'];
$grade = $_POST['grade'];
$photo = $_POST['photo'];
$father_name = $_POST['father_name'];
$father_occ = $_POST['father_occ'];
$father_mobile = $_POST['father_mobile'];
$father_off_tel = $_POST['father_off_tel'];
$mother_name = $_POST['mother_name'];
$mother_occ = $_POST['mother_occ'];
$mother_mobile = $_POST['mother_mobile'];
$mother_off_tel = $_POST['mother_off_tel'];
$Guard_name = $_POST['guard_name'];
$Guard_occ = $_POST['guard_occ'];
$Guard_relationship = $_POST['guard_relationship'];
$Guard_tel_home = $_POST['guard_tel_home'];
$guard_mobile = $_POST['guard_mobile'];
$guard_off_tel = $_POST['guard_off_tel'];
$eme_name = $_POST['eme_name'];
$eme_contact_no = $_POST['eme_contact_no'];
$eme_relationship = $_POST['eme_relationship'];
$medication = $_POST['medication'];
$traveling_allowance = $_POST['traveling_allowance'];
$others = $_POST['others'];
$punch_id = $_POST['punch_id'];
if (isset($_POST['study_campus'][0]))
$sha_tin = 1;
else
$sha_tin = 0;
if (isset($_POST['study_campus'][1]))
$kowloon = 1;
else
$kowloon = 0;
$query_gene = "Select cam_short_form from campus where campus_id='$reg_campus'";
$result_gene = $dbh->query($query_gene);
$result_gene->setFetchMode(PDO::FETCH_OBJ);
$cam_short_form = $result_gene->fetch()->cam_short_form;
$year = explode("-", $sem_yr);
$front_yr = substr($year[0], 2);
$last_yr = substr($year[1], 2);
if (!empty($_POST['new_stu_id'])) {
$new_id = $_POST['new_stu_id'];
} else {
$new_id = $cam_short_form . $front_yr . $last_yr . $old_id;
}
echo "<script>alert('Student ID(new system):" . $new_id . "')</script>";
$query_frozen = "Update student set actived=0 where New_stu_ID='$new_id'";
$result_frozen = $dbh->query($query_frozen);
$query = "Insert into student set New_stu_ID='$new_id', Old_stu_ID='$old_id', Sem_yr='$sem_yr',
createby='$input_by', createdate=Now(), lastupby=0, lastupdate=Now(), actived='$is_actived', deleted=0,
reg_campus_id='$reg_campus', is_shatin='$sha_tin',is_kowloon='$kowloon',
input_date='$input_date', registration_date='$reg_date', is_pathway_student='$is_pathway_stu',
is_in_school_student='$is_in_school',last_name='$last_name', first_name='$first_name',
ch_name='$ch_name', gender='$gender', date_of_birth='$date_of_birth', home_tel='$home_tel', fax='$fax', email='$email',stu_mobile='$stu_mobile', photo='$photo', address='$address',address2='$address2',address3='$address3',
district_id='$district',school_id='$school_id',sch_district_id='$school_district', father_name='$father_name', father_occupation='$father_occ', father_mobile='$father_mobile', father_off_tel='$father_off_tel',
mother_name='$mother_name', mother_occupation='$mother_occ', mother_mobile='$mother_mobile', mother_off_tel='$mother_off_tel', guardian_name='$Guard_name',
guardian_occupation='$Guard_occ', guardian_relationship='$Guard_relationship', guardian_mobile='$guard_mobile', guardian_home_tel='$Guard_tel_home',
guardian_off_tel='$guard_off_tel', eme_contact_name='$eme_name', eme_contact_number='$eme_contact_no', eme_contact_relationship='$eme_relationship',
medication='$medication',others='$others',traveling_allowance='$traveling_allowance',stu_punch_id='$punch_id'";
$result = $dbh->query($query);
$get_linking_q = 'Select Max(linking_id) as l from student where deleted=0;';
$get_link_r = $dbh->query($get_linking_q);
$get_link_r->setFetchMode(PDO::FETCH_OBJ);
$linking_id = $get_link_r->fetch()->l; //this is the root_id also
$query_root = "Update student set root_id='$linking_id' where linking_id='$linking_id' and deleted=0";
$dbh->query($query_root);
$query1 = "Insert into student_grade set student_grade_id=(Select linking_id from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(),
lastupby=0, lastupdate=Now(), actived=1, deleted=0,grade_id='$grade'";
$result1 = $dbh->query($query1);
if ($_POST['ass_program'][0] != "") {
for ($j = 0; $j < count($_POST['ass_program']); $j++) {
$no_of_same = 0;
$ass_program = $_POST['ass_program'][$j];
$ass_subject = $_POST['ass_subject'][$j];
$ass_date = $_POST['assessment_date'][$j]; //$ass_date = $_POST['assessment_date'][$j];
$f = "assessment_doc" . $j;
$myFile = $_FILES[$f];
if ($myFile['name'] != "") {
if ($myFile["error"] !== UPLOAD_ERR_OK) {
//echo "<p>An error occurred.</p>";
$error = "<p>An error occurred.</p>";
exit;
}
// ensure a safe filename
$name = preg_replace("/[^A-Z0-9._-]/i", "_", $myFile["name"]);
// don't overwrite an existing file
$parts = pathinfo($name);
while (file_exists('assessment/' . $name)) {
$no_of_same++;
$name = $parts["filename"] . "-" . $no_of_same . "." . $parts["extension"];
}
// preserve file from temporary directory
$success = move_uploaded_file($myFile["tmp_name"], 'assessment/' . $name);
if (!$success) {
$msg = "<p>Unable to save file.</p>";
echo "<script>alert('$msg')</script>";
exit;
} else {
$msg = $name;
}
// set proper permissions on the new file
chmod('assessment/' . $name, 0644);
}
$dir = 'assessment/' . $name;
$query5 = "Insert into student_assessment set stu_linking_id='$linking_id',createby='$input_by',
createdate=Now(),lastupby='$input_by', lastupdate=Now(), actived=1, deleted=0,program_id='$ass_program',subject_id='$ass_subject',assessment_doc='$dir',assessment_date='$ass_date'";
$result5 = $dbh->query($query5);
if (!$result5) {
echo "<script>alert('Error 5.')</script>";
}
}
}
if (isset($_POST['refer_by'])) {
for ($i = 0; $i < count($_POST['refer_by']); $i++) {
$refer_by = $_POST['refer_by'][$i];
$query7 = "Insert into student_refer set stu_refer_id='$linking_id',createby=0,createdate=Now(),
lastupby=0,lastupdate=Now(),actived=1,deleted=0,refer_id='$refer_by'";
$result7 = $dbh->query($query7);
if (!$result7)
echo "<script>alert('Error 7.')</script>";
}
}
if ($_POST['assessed_date'][0] != "") {
for ($i = 0; $i < count($_POST['assessed_date']); $i++) {
$no_of_same = 0;
//$refer_by = $_POST['refer_by'][$i];
$assessed_date = $_POST['assessed_date'][$i];
$f = "assessed_doc" . $i;
if (isset($_FILES[$f]) && $_FILES[$f]['size'] > 0) {
$myFile = $_FILES[$f];
if ($myFile['name'] != "") {
if ($myFile["error"] !== UPLOAD_ERR_OK) {
//echo "<p>An error occurred.</p>";
$error = "<p>An error occurred.</p>";
exit;
}
// ensure a safe filename
$name = preg_replace("/[^A-Z0-9._-]/i", "_", $myFile["name"]);
// don't overwrite an existing file
$parts = pathinfo($name);
while (file_exists('diagnose_report/' . $name)) {
$no_of_same++;
$name = $parts["filename"] . "-" . $no_of_same . "." . $parts["extension"];
}
// preserve file from temporary directory
$success = move_uploaded_file($myFile["tmp_name"], 'diagnose_report/' . $name);
if (!$success) {
$msg = "<p>Unable to save file.</p>";
echo "<script>alert('$msg')</script>";
exit;
} else {
$msg = $name;
}
// set proper permissions on the new file
chmod('diagnose_report/' . $name, 0644);
}
$dir = 'diagnose_report/' . $name;
} else {
$dir = $_POST['file_name'][$i];
}
$query5 = "Insert into student_document set stu_linking_id='$linking_id',createby='$input_by',
createdate=Now(),lastupby=0, lastupdate=Now(), actived=1, deleted=0,
assessed_by='',assessed_doc='$dir', assessed_date='$assessed_date'";
$result5 = $dbh->query($query5);
if (!$result5) {
echo "<script>alert('Error 5.')</script>";
}
$query_stu_doc_id = "Select stu_doc_id from student_document where
stu_linking_id='$linking_id' and assessed_doc='$dir' and assessed_date='$assessed_date'";
$result_stu_doc_id = $dbh->query($query_stu_doc_id);
$result_stu_doc_id->setFetchMode(PDO::FETCH_OBJ);
$stu_doc_id = $result_stu_doc_id->fetch()->stu_doc_id;
if (isset($_POST['assessed_by'])) {
if (isset($_POST['assessed_by'][$i])) {
$assessed_by = $_POST[$temp_assessed_by][$i];
$query10 = "Insert into studoc_assessor set stu_doc_id='$stu_doc_id',createby=0,
createdate=Now(),lastupby=0,lastupdate=Now(),actived=1,deleted=0,assessor_id='$assessed_by'";
$result10 = $dbh->query($query10);
if (!$result10) {
echo "<script>alert('Error 10.')</script>";
}
}
}
}
}
if (isset($_POST['subsidy_get'])) {
for ($i = 0; $i < count($_POST['subsidy_get']); $i++) {
$subsidy_get = $_POST['subsidy_get'][$i];
$query2 = "Insert into student_subsidy set stu_subsidy_id=(Select linking_id from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(),
lastupby=0, lastupdate=Now(), actived=1, deleted=0,subsidy_id='$subsidy_get'";
$result2 = $dbh->query($query2);
if (!$result2) {
echo "<script>alert('Error 2.')</script>";
}
}
}
if (isset($_POST['diagnose'])) {
for ($i = 0; $i < count($_POST['diagnose']); $i++) {
$diagnose = $_POST['diagnose'][$i];
$query3 = "Insert into student_diagnose set stu_dia_ID=(Select linking_id from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(),
lastupby=0, lastupdate=Now(), actived=1, deleted=0,diagnose_id='$diagnose'";
$result3 = $dbh->query($query3);
if (!$result3) {
echo "<script>alert('Error 3.')</script>";
}
}
}
if (isset($_POST['add_aspect'])) {
for ($i = 0; $i < count($_POST['add_aspect']); $i++) {
$add_aspect = $_POST['add_aspect'][$i]; //add_aspect
$query4 = "Insert into student_additional_aspect set stu_add_ID=(Select linking_id from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student
where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(),
lastupby=0, lastupdate=Now(), actived=1, deleted=0,aspect_id='$add_aspect'";
$result4 = $dbh->query($query4);
if (!$result4) {
echo "<script>alert('Error 4.')</script>";
}
}
}
} catch (Exception $e) {
$RollBack = true;
$errorMsg = $e->getMessage();
echo $errorMsg;
}
if (!$RollBack) {
$Commit = "COMMIT";
$dbh->query($Commit);
if ($result && $result1) {
echo "<script>alert('Insert data successful.')</script>";
echo "<script>location.href ='student.php';</script>";
}
} else {
$Rollback = "ROLLBACK";
$dbh->query($Rollback);
}
}
?>
<html>
<head>
<script type="text/javascript" src="../include/FileUpload/ajaxfileupload.js"></script>
<script>
var is_import;
var browse;
$(document).ready(function() {
Add_Diagnoses();
Add_aspect();
is_import = 'F';
browse = $('#browse').clone();
});
$(document).on('click', '#upload',
function ajaxFileUpload() {
$.ajaxFileUpload({
url: 'upload_stu_photo.php',
secureuri: false,
fileElementId: 'browse',
dataType: 'json',
data: {name: 'logan', id: 'id'},
success: function(data, status) {
if (typeof (data.error) != 'undefined')
{
if (data.error != '') {
alert(data.error);
}
else {
loading.src = "student_photo/" + data.msg;
$('#photo').val("student_photo/" + data.msg);
}
}
},
error: function(data, status, e) {
alert("error");
alert(e);
}
});
return false;
});
$(function() {
var limit_date = new Date();
var curr_yr = limit_date.getFullYear();
limit_date.setYear(curr_yr - 3);
$('.date-picker').datetimepicker({pickTime: false, format: 'yyyy-MM-dd'});
$('#day_of_birth').datetimepicker({autoclose: true, pickTime: false, format: 'yyyy-MM-dd', endDate: limit_date});
$(document).on('click', '#import', function() {
is_import = 'T';
});
});
$(document).on('click', '#add_assessed', function() {
$.ajax({
type: "POST",
url: "ajax_stu_add_report.php",
data: {
i: $('#i').val()
},
cache: false,
success: function(html) {
$("#add_thing2").append(html);
var tem_i = $("#i").val();
tem_i++;
$("#i").val(tem_i);
$('.date-picker').datetimepicker({pickTime: false, format: 'yyyy-MM-dd'});
}
});//add_assessed
});
$(document).on('click', '#add_assessment', function() {
$.ajax({
type: "POST",
url: "ajax_stu_add_assessment.php",
data: {
j: $('#j').val()
},
cache: false,
success: function(html) {
$("#add_thing3").append(html);
var tem_j = $("#j").val();
tem_j++;
$("#j").val(tem_j);
$('.date-picker').datetimepicker({pickTime: false, format: 'yyyy-MM-dd'});
}
});//add_assessed
});
$(document).on('change', '#subsidy', function() {
$.ajax({
type: "POST",
url: "ajax_add_stu.php",
data: {
subsidy: $('#subsidy').val()
},
cache: false,
success: function(html) {
$("#subsidy_show").html(html);
}
});
});
function Add_Diagnoses() {
var array = new Array();
var tr = "";
for (var i = 0; i < (document.getElementsByName("diagnose[]")).length; i++) {
if (document.getElementsByName("diagnose[]")[i].checked == true) {
array.push((document.getElementsByName("diagnoseval[]")[i].value));
}
}
for (var i = 0; i < array.length; i++) {
tr +=
"<tr>" +
//"<td style=\"border: 1px solid #dddddd;width: 50px;\"><button onclick=\"delete_row(this);\" type='button' class=\"btn\"><i class=\"icon-remove\"></i></button></td>" +
"<td>" + array[i] + "</td>" +
"</tr>";
}
$('#Add_Diagnoses').html(tr);
}
function Add_aspect() {
var array = new Array();
var tr = "";
for (var i = 0; i < (document.getElementsByName("add_aspect[]")).length; i++) {
if (document.getElementsByName("add_aspect[]")[i].checked == true) {
array.push((document.getElementsByName("add_aspectval[]")[i].value));
}
}
for (var i = 0; i < array.length; i++) {
tr +=
"<tr>" +
//"<td style=\"border: 1px solid #dddddd;width: 50px;\"><button onclick=\"delete_row(this);\" type='button' class=\"btn\"><i class=\"icon-remove\"></i></button></td>" +
"<td>" + array[i] + "</td>" +
"</tr>";
}
$('#Add_Aspect').html(tr);
}
function delete_row() {
$('#add_thing2').children().last().remove();
$('#add_thing2').children().last().remove();
}
function delete_row2() {
$('#add_thing3').children().last().remove();
$('#add_thing3').children().last().remove();
}
$(document).on('focusout', '#DOB', function() {
if (is_import == 'F') {
if ($('#last_name').val().length != 0 && $('#first_name').val().length != 0 && $('#DOB').val().length != 0) {
$.ajax({
type: "POST",
url: "ajax_checking.php",
data: {
last_name: $('#last_name').val(),
first_name: $('#first_name').val(),
DOB: $('#DOB').val()
},
cache: false,
success: function(html) {
if (html == 'yes') {
alert('There is a record duplicated with the record you are inputting.Please,input again');
window.location = 'Add_stu.php';
}
else {
//alert('The record you are inputting is not duplicated.');
}
}
});
}
}
});
$(document).on('focusout', '#last_name', function() {
if (is_import == 'F') {
if ($('#last_name').val().length != 0 && $('#first_name').val().length != 0 && $('#DOB').val().length != 0) {
$.ajax({
type: "POST",
url: "ajax_checking.php",
data: {
last_name: $('#last_name').val(),
first_name: $('#first_name').val(),
DOB: $('#DOB').val()
},
cache: false,
success: function(html) {
if (html == 'yes') {
alert('There is a record duplicated with the record you are inputting.Please,input again');
window.location = 'Add_stu.php';
}
else {
//alert('The record you are inputting is not duplicated.');
}
}
});
}
}
});
$(document).on('focusout', '#first_name', function() {
if (is_import == 'F') {
if ($('#last_name').val().length != 0 && $('#first_name').val().length != 0 && $('#DOB').val().length != 0) {
$.ajax({
type: "POST",
url: "ajax_checking.php",
data: {
last_name: $('#last_name').val(),
first_name: $('#first_name').val(),
DOB: $('#DOB').val()
},
cache: false,
success: function(html) {
if (html == 'yes') {
alert('There is a record duplicated with the record you are inputting.Please,input again');
window.location = 'Add_stu.php';
}
else {
//alert('The record you are inputting is not duplicated.');
}
}
});
}
}
});
function delete_photo() {
$.ajax({
type: "POST",
url: "ajax_delete_photo.php",
data: {
photo: $('#photo').val()
},
cache: false,
success: function(html) {
if (html == 'Yes') {
alert('Delete photo successful');
$('#loading').attr('src', 'student_photo/personal_photo.gif');
$('#photo').val('no photo');
$('#browse').replaceWith(browse);
}
else {
alert('Fail to delete this photo');
}
}
});
}
$(document).on('change', '#sem_yr1', function() {
if ($('#sem_yr').val() == $('#hidden_sem_yr').val()) {
// alert('Please input another Semester year.');
}
});
</script>
<style>
.div-color2 {
border: 1px solid #E6E6E6;
border-radius: 6px 6px 6px 6px;
background-color: #EEEFDE;
padding-top: 10px;
padding-bottom: 10px;
}
.div-color3 {
border: 1px solid #E6E6E6;
border-radius: 6px 6px 6px 6px;
background-color: ghostwhite;
padding-top: 10px;
padding-bottom: 10px;
}
</style>
</head>
<body>
<?php
$i = 0;
$j = 0;
?>
<!-- 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>
<?php
$curr_yr = date("Y");
$curr_yr-=3;
$curr_mon = date("m");
$curr_day = date("d");
if (!isset($_GET['linking_id'])) {
?>
<li class="active">Add Student Record</li>
</ul>
</div>
<div class="container-fluid div-color2">
<form action="" method="POST" enctype="multipart/form-data" id="form">
<table border="0">
<tr>
<td colspan="4">
<h2>Add Student Record</h2>
</td>
</tr>
<tr>
<td colspan="4"><b><h4>Student Record</h4></b></td>
</tr>
<tr>
<td>Student No.(Old System)</td><td><input type="text" name="old_stu_id" required="true" maxlength="4"></td>
<td>Student No.(New System)</td><td><input type="text" name="new_stu_id" readonly="true"></td>
</tr>
<tr>
<td>School Year</td>
<td colspan="3">
<select name="sem_yr" required="true" id="sem_yr1">
<option></option>
<?php
$query_schyr = "Select sem_yr from semester_year where deleted=0";
$result_schyr = $dbh->query($query_schyr);
$result_schyr->setFetchMode(PDO::FETCH_OBJ);
while ($row_schyr = $result_schyr->fetch()) {
?>
<option value="<?= $row_schyr->sem_yr ?>"><?= $row_schyr->sem_yr ?></option>
<?php
}
?>
</select>
</td>
</tr>
<!--<tr>
<td>Registration No(Old system)</td>
<td>
<input type="text" name="old_reg_no" required="true">
</td>
<td>Registration No</td>
<td>
<input type="text" name="new_reg_no" readonly="true">
</td>
</tr>-->
<tr>
<td>Registration Campus</td>
<td>
<select name="reg_campus" required="true">
<option></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>Registration Date</td>
<td>
<div class="input-append date-picker">
<input type="text" name="reg_date" class="dateISO" required="true">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
</tr>
<tr>
<td>Center Attending</td>
<td colspan="3">
<?php
$query = "Select campus_id,campus_name from campus";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {//first is shatin ,then kowloon
print '<input type="checkbox" name="study_campus[]" value="1">' . $row->campus_name . ' ';
}
?>
</td>
</tr>
<!--<tr>
<td>Registration Semester</td>
<td colspan="3">
<select name="reg_sem_yr" required="true">
<option></option>
<?php
/* $query_schyr = "Select sem_yr from semester_year where deleted=0";
$result_schyr = $dbh->query($query_schyr);
$result_schyr->setFetchMode(PDO::FETCH_OBJ);
while ($row_schyr = $result_schyr->fetch()) {
?>
<option value="<?= $row_schyr->sem_yr ?>"><?= $row_schyr->sem_yr ?></option>
<?php
} */
?>
</select>
</td>
</tr>-->
<tr>
<td>Type</td>
<td>
<input type="checkbox" name="is_pathway_stu" value="1">Pathways Student
<input type="checkbox" name="is_in_school" value="1">In-School Student
</td>
<td>Status</td>
<td><select name="is_actived" required="true"><option></option><option value="1">Active</option><option value="0">Disable</option></select></td>
</tr>
<tr>
<td>Data Input Date</td>
<td>
<div class="input-append date-picker">
<input type="text" name="input_date" class="dateISO" required="true" data-format="yyyy-MM-dd" value='<?= ($curr_yr + 3) . '-' . $curr_mon . '-' . $curr_day ?>'>
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Input By</td>
<td>
<input type="text" name="input_by" value="Chung Wai ki" readonly="true" required="true">
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Student Information</h4></b></td>
</tr>
<tr>
<td>Date of Birth</td>
<td colspan="3">
<div class="input-append" id="day_of_birth">
<input type="text" name="date_of_birth" id="DOB" class="dateISO" required="true" value="<?= $curr_yr . '-' . $curr_mon . '-' . $curr_day ?>">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" id="last_name" name="last_name" required="true"></td>
<td>First Name</td>
<td><input type="text" id="first_name" name="first_name" required="true"></td>
</tr>
<tr>
<td>中文姓名</td>
<td><input type="text" name="ch_name" required="true"></td>
<td>Gender</td>
<td><select name="gender"><option></option><option value="1">Male</option><option value="0">Female</option></select></td>
</tr>
<tr>
<td>Tel (Home)</td>
<td><input type="tel" name="home_tel" placeholder="24131323" required="true"></td>
<td>Fax</td>
<td><input type="tel" name="fax"></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="stu_mobile" placeholder="98121234"></td>
<td>E-mail</td>
<td><input type="email" name="email" placeholder="user@example.com"></td>
</tr>
<tr>
<td>Address</td>
<td colspan="2"><input type="text" name="address" required="true" class="input-block-level" placeholder="Flat Floor Block"></td>
<td rowspan="6">
<center>
<img id="loading" src="student_photo/personal_photo.gif">
<input type="hidden" name="photo" id="photo" value="no photo">
</center>
</td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="text" name="address1" class="input-block-level" placeholder="Building/Estate"></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="text" name="address2" class="input-block-level" placeholder="Road/Street"></td>
</tr>
<tr>
<td>District</td>
<td colspan="2">
<select name="district" required="true">
<option></option>
<?php
$query1 = "Select district,district_id from district";
$result1 = $dbh->query($query1);
$result1->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result1->fetch()) {
print '<option value=' . $row->district_id . '>' . $row->district . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Name of School Attending</td>
<td colspan="2">
<select name="school_name" required="true">
<option></option>
<?php
$query_school = "Select root_id,sch_name,sch_ch_name from school where deleted=0";
$result_sch = $dbh->query($query_school);
$result_sch->setFetchMode(PDO::FETCH_OBJ);
while ($row_sch = $result_sch->fetch()) {
?>
<option value="<?= $row_sch->root_id ?>"><?= $row_sch->sch_name . '(' . $row_sch->sch_ch_name . ')' ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>School District</td>
<td colspan="2">
<select name="sch_district" required="true">
<option></option>
<?php
$query1 = "Select district,district_id from district";
$result1 = $dbh->query($query1);
$result1->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result1->fetch()) {
print '<option value=' . $row->district_id . '>' . $row->district . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Year/Grade</td>
<td colspan="2">
<select name="grade" required="true">
<option></option>
<?php
$query2 = "Select grade_id,grade from grade";
$result2 = $dbh->query($query2);
$result2->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result2->fetch()) {
print '<option value=' . $row->grade_id . '.>' . $row->grade . '</option>';
}
?>
</select>
</td>
<td>
<center>
<input type="file" name="browse" id="browse" size="10">
</center>
</td>
</tr>
<tr>
<td colspan='3'></td>
<td>
<center>
<input type='button' name='upload' id='upload' class='btn' value='Upload'>
<input type='button' name='remove' id='remove' class='btn' value='Remove' onclick="delete_photo();">
</center>
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Father</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="father_name"></td>
<td>Occupation</td>
<td><input type="text" name="father_occ"></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="father_mobile"></td>
<td>Tel (Office)</td>
<td><input type="tel" name="father_off_tel"></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Mother</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="mother_name"></td>
<td>Occupation</td>
<td><input type="text" name="mother_occ"></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="mother_mobile"></td>
<td>Tel (Office)</td>
<td><input type="tel" name="mother_off_tel"></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Guardian</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="guard_name"></td>
<td>Occupation</td>
<td><input type="text" name="guard_occ"></td>
</tr>
<tr>
<td>Relationship</td>
<td><input type="text" name="guard_relationship"></td>
<td>Tel (Home)</td>
<td><input type="tel" name="guard_tel_home"></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="guard_mobile"></td>
<td>Tel (Office)</td>
<td><input type="tel" name="guard_off_tel"></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Emergency Contact Person</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="eme_name"></td>
<td>Contact No.</td>
<td><input type="tel" name="eme_contact_no"></td>
</tr>
<tr>
<td>Relationship</td>
<td colspan="3"><input type="text" name="eme_relationship"></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td><b><h4>Diagnoses</h4></b></td>
<td><button type="button" class="btn" id="diagnoses_btn" data-toggle="modal" data-target="#diagnoses"><i class="icon-plus" ></i> Edit</button></td>
<td><b><h4>Intellectual Functioning </h4></b></td>
<td><button type="button" class="btn" id="add_aspect_btn" data-toggle="modal" data-target="#add_aspect"><i class="icon-plus" ></i> Edit</button></td>
</tr>
<tr>
<td colspan="2">
<table id="Add_Diagnoses" style="width: 80%;border: 1px solid #dddddd;margin-left: 40px;margin-bottom: 10px;margin-top: 10px;margin-right: 10px;" >
</table>
</td>
<td colspan="2">
<table id="Add_Aspect" style="width: 80%;border: 1px solid #dddddd;margin-left: 40px;margin-bottom: 10px;margin-top: 10px;margin-right: 10px;" >
</table>
</td>
</tr>
<tr>
<td>Refer by</td>
<td colspan="3">
<?php
$query6 = "Select refer_id,refer_name from refer";
$result6 = $dbh->query($query6);
$result6->setFetchMode(PDO::FETCH_OBJ);
while ($row6 = $result6->fetch()) {
print '<input type="checkbox" name="refer_by[]" value="' . $row6->refer_id . '">' . $row6->refer_name;
}
?>
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Reports</h4></b></td>
</tr>
<tr>
<td>Assessed By</td>
<td colspan="3">
<select name="assessed_by[]">
<option></option>
<?php
$query7 = "Select assessor_id,assessor from assessor";
$result7 = $dbh->query($query7);
$result7->setFetchMode(PDO::FETCH_OBJ);
while ($row7 = $result7->fetch()) {
?>
<option value="<?= $row7->assessor_id ?>"><?= $row7->assessor ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Date of Assessment</td>
<td>
<div class="input-append date-picker">
<input type="text" name="assessed_date[]" class="dateISO">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Diagnoses Report</td>
<td colspan="3">
<div class="fileupload fileupload-new" style="margin:0px" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input ">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><a href="diagnose_report/<? //= $attachment[$attribute] ?>" target="_blank"><? //= $attachment[$attribute] ?></a></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="assessed_doc<?= $i ?>">
<?php $i++; ?>
<input type='hidden' name='i' id='i' value='<?= $i ?>' >
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
<tbody id='add_thing2'></tbody>
<tr>
<td colspan="4">
<input type="button" class="btn" name="add_assessed" id="add_assessed" value="Add a record">
<input type="button" class="btn btn-danger" name="del_assessed" id="del_assessed" value="Delete a record" onclick="delete_row();">
</td>
</tr>
<tr>
<td>Medication</td>
<td colspan="3"><textarea name="medication"></textarea></td>
</tr>
<tr>
<td>Others</td>
<td colspan="3"><textarea name="others"></textarea></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4"><b><h4>Assessment Result</h4></b></td></tr>
<tr>
<td>Program</td>
<td>
<select name="ass_program[]">
<option></option>
<?php
$query_prog = "Select program_id,program_name from program";
$result_prog = $dbh->query($query_prog);
$result_prog->setFetchMode(PDO::FETCH_OBJ);
while ($row_prog = $result_prog->fetch()) {
print '<option value="' . $row_prog->program_id . '">' . $row_prog->program_name . '</option>';
}
?>
</select>
</td>
<td>Subject</td>
<td>
<select name="ass_subject[]">
<option></option>
<?php
$query_subj = "Select subject_id,sub_name from subject";
$result_subj = $dbh->query($query_subj);
$result_subj->setFetchMode(PDO::FETCH_OBJ);
while ($row_subj = $result_subj->fetch()) {
print '<option value="' . $row_subj->subject_id . '">' . $row_subj->sub_name . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Date of Assessment</td>
<td>
<div class="input-append date-picker">
<input type="text" name="assessment_date[]" class="dateISO">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Assessment</td>
<td colspan="3">
<div class="fileupload fileupload-new" style="margin:0px" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input ">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><a href="assessment/<? //= $attachment[$attribute] ?>" target="_blank"><? //= $attachment[$attribute] ?></a></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="assessment_doc<?= $j ?>">
<?php $j++; ?>
<input type='hidden' name='j' id='j' value='<?= $j ?>' >
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
<tbody id='add_thing3'></tbody>
<tr>
<td colspan="4">
<input type="button" class="btn" name="add_assessment" id="add_assessment" value="Add a record">
<input type="button" class="btn btn-danger" name="del_assessment" id="del_assessment" value="Delete a record" onclick="delete_row2();">
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4"><b><h4>Subsidy</h4></b></td></tr>
<tr>
<td>
<select name="select_subsidy" id="subsidy">
<option value="1">None</option>
<option value="2">Subsidy Rate</option>
</select>
</td>
<td colspan="3"><input type="text" name="subsidy_pecent" id="subsidy_percent" value="0%" readonly="true"></td>
</tr>
<tr>
<tbody id="subsidy_show"></tbody>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4"><b><h4>Other Information</h4></b></td></tr>
<tr>
<td>Traveling Allowance </td>
<td colspan="3">
<select name="traveling_allowance" required="true">
<option></option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</td>
</tr>
<tr>
<td>Punch ID</td>
<td colspan="3">
<input type="text" name="punch_id">
</td>
</tr>
</table>
<input type="button" value="Back" class="btn" onclick="window.history.go(-1);"/>
<input type="submit" name="submit" class="btn" value="Save">
<div style="display: none;" class="modal fade" id="add_aspect" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4>Intellectual Functioning</h4>
</div>
<div class="modal-body">
<table border="0">
<?php
$query3 = "Select aspect_id,aspect_name from additional_aspect";
$result3 = $dbh->query($query3);
$result3->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result3->fetch()) {
print '<tr>';
print '<td>';
print '<input type="checkbox" name="add_aspect[]" value="' . $row->aspect_id . '">' . $row->aspect_name;
print '<input type="hidden" name="add_aspectval[]" value="' . $row->aspect_name . '">';
print '</td>';
print '</tr>';
}
?>
</table>
</div>
<div class="modal-footer">
<input type="button" name="submit_aspect" class="btn" value="Add" data-dismiss="modal" onclick="Add_aspect();">
</div>
</div>
</div>
</div>
<div style="display: none;" class="modal fade" id="diagnoses" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4>Diagnoses</h4>
</div>
<div class="modal-body">
<table border="0">
<?php
$query3 = "Select diagnose_id,diagnose_name from diagnose";
$result3 = $dbh->query($query3);
$result3->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result3->fetch()) {
print '<tr>';
print '<td>';
print '<input type="checkbox" name="diagnose[]" value="' . $row->diagnose_id . '">' . $row->diagnose_name;
print '<input type="hidden" name="diagnoseval[]" value="' . $row->diagnose_name . '">';
print '</td>';
print '</tr>';
}
?>
</table>
</div>
<div class="modal-footer">
<input type="button" name="submit_diagnose" class="btn" value="Add" data-dismiss="modal" onclick="Add_Diagnoses();">
</div>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
<?php
} else {
$i = 0;
$linking_id = $_GET['linking_id'];
$query_init = "Select Old_stu_id as o,New_stu_id as n,Sem_yr as s_yr,root_id,(Year(Now())-Year(date_of_birth)) as age,
createby, createdate, lastupby, lastupdate, actived, deleted,
reg_campus_id,is_shatin,is_kowloon,input_date, registration_date, is_pathway_student, is_in_school_student,
last_name, first_name, ch_name, gender, date_of_birth, home_tel,
fax, email, photo, address,address2,address3,district_id,school_id,sch_district_id, father_name,stu_mobile,
father_occupation, father_mobile, father_off_tel,mother_name, mother_occupation,
mother_mobile, mother_off_tel, guardian_name,guardian_occupation, guardian_relationship,
guardian_mobile, guardian_home_tel,guardian_off_tel, eme_contact_name, eme_contact_number,stu_punch_id,
eme_contact_relationship,medication,others,traveling_allowance from student where linking_id='$linking_id' and deleted='0'";
$query_init1 = "Select grade_id from student_grade where student_grade_id='$linking_id' and deleted='0'";
$query_init2 = "Select diagnose_id from student_diagnose where stu_dia_ID='$linking_id' and deleted='0'";
$query_init3 = "Select aspect_id from student_additional_aspect where stu_add_ID='$linking_id' and deleted='0'";
$result = $dbh->query($query_init);
$result->setFetchMode(PDO::FETCH_OBJ);
$row = $result->fetch();
$result1 = $dbh->query($query_init1);
$result1->setFetchMode(PDO::FETCH_OBJ); //grade
$row_init = $result1->fetch();
$result2 = $dbh->query($query_init2);
$result3 = $dbh->query($query_init3);
?>
<li class="active">Import Student Record</li>
</ul>
</div>
<div class="container-fluid div-color3">
<form action="" method="POST" enctype="multipart/form-data" id="form">
<table border="0">
<tr>
<td colspan="4">
<h2>Import Student Record</h2>
</td>
</tr>
<tr>
<td colspan="4"><b><h4>Student Record</h4></b></td>
</tr>
<tr>
<td>Student No.(Old System)</td><td><input type="text" name="old_stu_id" required="true" readonly="true" value="<?= $row->o ?>" maxlength="4"></td>
<td>Student No.(New System)</td><td><input type="text" name="new_stu_id" required="true" readonly="true" value="<?= $row->n ?>"></td>
</tr>
<tr>
<td>School Year</td>
<td colspan="3">
<select name="sem_yr" required="true" id="sem_yr1">
<option></option>
<?php
$query_schyr = "Select sem_yr from semester_year where deleted=0";
$result_schyr = $dbh->query($query_schyr);
$result_schyr->setFetchMode(PDO::FETCH_OBJ);
while ($row_schyr = $result_schyr->fetch()) {
if ($row_schyr->sem_yr == $row->s_yr) {
?>
<option value="<?= $row_schyr->sem_yr ?>" selected><?= $row_schyr->sem_yr ?></option>
<?php
} else {
?>
<option value="<?= $row_schyr->sem_yr ?>"><?= $row_schyr->sem_yr ?></option>
<?php
}
}
?>
</select>
<input type="hidden" name="old_sem_yr" id="hidden_sem_yr" value="<?= $row->s_yr; ?>">
</td>
</tr>
<tr>
<td>Registration Campus</td>
<td>
<select name="reg_campus" required="true">
<option></option>
<?php
$query = "Select campus_id,campus_name from campus";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row1 = $result->fetch()) {
if ($row->reg_campus_id == $row1->campus_id)
print '<option value=' . $row1->campus_id . ' selected>' . $row1->campus_name . '</option>';
else
print '<option value=' . $row1->campus_id . '>' . $row1->campus_name . '</option>';
}
?>
</select>
</td>
<td>Registration Date</td>
<td>
<div class="input-append date-picker">
<input type="text" name="reg_date" class="dateISO" required="true" value="<?= $row->registration_date; ?>">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
</tr>
<tr>
<td>Center Attending</td>
<td colspan="3">
<?php
$query = "Select campus_name from campus";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
$h = 0;
while ($row100 = $result->fetch()) {//first is shatin ,then kowloon
if ($row->is_shatin == 1 && $h == 0) {
print '<input type="checkbox" name="study_campus[]" value="1" checked>' . $row100->campus_name . ' ';
} else {
if ($h == 0) {
print '<input type="checkbox" name="study_campus[]" value="1">' . $row100->campus_name . ' ';
} else {
if ($row->is_kowloon == 1) {
print '<input type="checkbox" name="study_campus[]" value="1" checked>' . $row100->campus_name . ' ';
} else {
print '<input type="checkbox" name="study_campus[]" value="1">' . $row100->campus_name . ' ';
}
}
}
$h++;
}
?>
</td>
</tr>
<tr>
<td>Type</td>
<td>
<?php
if ($row->is_pathway_student == 1) {
?>
<input type="checkbox" name="is_pathway_stu" value="1" checked>Pathways Student
<?php
} else {
?>
<input type="checkbox" name="is_pathway_stu" value="1">Pathways Student
<?php
}
?>
<?php
if ($row->is_in_school_student == 1) {
?>
<input type="checkbox" name="is_in_school" value="1" checked>In-School Student
<?php
} else {
?>
<input type="checkbox" name="is_in_school" value="1">In-School Student
<?php
}
?>
</td>
<td>Status</td>
<td>
<select name="is_actived" required="true">
<option></option>
<?php
if ($row->actived == 1) {
?>
<option value="1" selected>Active</option>
<option value="0">Disable</option>
<?php
} else {
?>
<option value="1">Active</option>
<option value="0" selected>Disable</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Data Input Date</td>
<td>
<div class="input-append date-picker">
<input type="text" name="input_date" class="dateISO" required="true" readonly="true" data-format="yyyy-MM-dd" value="<?= $row->input_date; ?>">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Input By</td>
<td>
<input type="text" name="input_by" value="Chung Wai ki" readonly="true" required="true">
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Student Information</h4></b></td>
</tr>
<tr>
<td>Date of Birth</td>
<td colspan="3">
<div class="input-append" id="day_of_birth">
<input type="text" name="date_of_birth" id="DOB" class="dateISO" required="true" value="<?= $row->date_of_birth ?>">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="last_name" id="last_name" required="true" value="<?= $row->last_name; ?>"></td>
<td>First Name</td>
<td><input type="text" name="first_name" id="first_name" required="true" value="<?= $row->first_name; ?>"></td>
</tr>
<tr>
<td>中文姓名</td>
<td><input type="text" name="ch_name" required="true" value="<?= $row->ch_name; ?>"></td>
<td>Gender</td>
<td>
<select name="gender" required="true">
<option></option>
<?php
if ($row->gender == 1) {
?>
<option value="1" selected>Male</option>
<option value="0">Female</option>
<?php
} else {
?>
<option value="1">Male</option>
<option value="0" selected>Female</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Tel (Home)</td>
<td><input type="tel" name="home_tel" placeholder="24131323" required="true" value="<?= $row->home_tel ?>"></td>
<td>Fax</td>
<td><input type="tel" name="fax" value="<?= $row->fax ?>"></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="stu_mobile" placeholder="98121234" value="<?= $row->stu_mobile ?>"></td>
<td>E-mail</td>
<td><input type="email" name="email" placeholder="user@example.com" value="<?= $row->email ?>"></td>
</tr>
<tr>
<td>Address</td>
<td colspan="2"><input type="text" name="address" required="true" class="input-block-level" value="<?= $row->address ?>" placeholder="Flat Floor Block"></td>
<td rowspan="6">
<center>
<?php
if ($row->photo != 'no photo') {
?>
<img id="loading" src="<?= $row->photo ?>">
<input type="hidden" name="photo" id="photo" value="<?= $row->photo ?>">
<?php
} else {
?>
<img id="loading" src="student_photo/personal_photo.gif">
<input type="hidden" name="photo" id="photo" value="no photo">
<?php
}
?>
</center>
</td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="text" name="address1" class="input-block-level" value="<?= $row->address2 ?>" placeholder="Building/Estate"></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="text" name="address2" class="input-block-level" value="<?= $row->address3 ?>" placeholder="Road/Street"></td>
</tr>
<tr>
<td>District</td>
<td colspan="2">
<select name="district">
<option></option>
<?php
$query1 = "Select district,district_id from district";
$result4 = $dbh->query($query1);
$result4->setFetchMode(PDO::FETCH_OBJ);
while ($row1 = $result4->fetch()) {
if ($row1->district_id == $row->district_id)
print '<option value=' . $row1->district_id . ' selected>' . $row1->district . '</option>';
else
print '<option value=' . $row1->district_id . '>' . $row1->district . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Name of School Attending</td>
<td colspan="2">
<select name="school_name" required="true">
<option></option>
<?php
$query_school = "Select root_id,sch_name,sch_ch_name from school where deleted=0";
$result_sch = $dbh->query($query_school);
$result_sch->setFetchMode(PDO::FETCH_OBJ);
while ($row_sch = $result_sch->fetch()) {
if ($row_sch->root_id == $row->school_id && $row_init->grade_id != 2 && $row_init->grade_id != 8 && $row_init->grade_id != 20) {
?>
<option value="<?= $row_sch->root_id ?>" selected><?= $row_sch->sch_name . '(' . $row_sch->sch_ch_name . ')' ?></option>
<?php
} else {
?>
<option value="<?= $row_sch->root_id ?>"><?= $row_sch->sch_name . '(' . $row_sch->sch_ch_name . ')' ?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td>School District</td>
<td colspan="2">
<select name="sch_district" required="true">
<option></option>
<?php
$query1 = "Select district,district_id from district";
$result4 = $dbh->query($query1);
$result4->setFetchMode(PDO::FETCH_OBJ);
while ($row1 = $result4->fetch()) {
if ($row1->district_id == $row->sch_district_id && ($row_init->grade_id != 2 && $row_init->grade_id != 8 && $row_init->grade_id != 20))
print '<option value=' . $row1->district_id . ' selected>' . $row1->district . '</option>';
else
print '<option value=' . $row1->district_id . '>' . $row1->district . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Year/Grade</td>
<td colspan="2">
<select name="grade" required="true">
<option></option>
<?php
$query2 = "Select grade_id,grade from grade";
$result5 = $dbh->query($query2);
$result5->setFetchMode(PDO::FETCH_OBJ);
while ($row1 = $result5->fetch()) {
print '<option value=' . $row1->grade_id . '.>' . $row1->grade . '</option>';
}
?>
</select>
</td>
<td>
<center>
<input type="file" name="browse" id="browse" size="10">
</center>
</td>
</tr>
<tr>
<td colspan='3'></td>
<td>
<center>
<input type='button' name='upload' id='upload' class='btn' value='Upload'>
<input type='button' name='remove' id='remove' class='btn' value='Remove' onclick="delete_photo();">
</center>
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Father</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="father_name" value='<?= $row->father_name ?>'></td>
<td>Occupation</td>
<td><input type="text" name="father_occ" value='<?= $row->father_occupation ?>'></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="father_mobile" value='<?= $row->father_mobile ?>'></td>
<td>Tel (Office)</td>
<td><input type="tel" name="father_off_tel" value='<?= $row->father_off_tel ?>'></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Mother</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="mother_name" value='<?= $row->mother_name ?>'></td>
<td>Occupation</td>
<td><input type="text" name="mother_occ" value='<?= $row->father_occupation ?>'></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="mother_mobile" value='<?= $row->mother_mobile ?>'></td>
<td>Tel (Office)</td>
<td><input type="tel" name="mother_off_tel" value='<?= $row->mother_off_tel ?>'></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Guardian</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="guard_name" value='<?= $row->guardian_name ?>'></td>
<td>Occupation</td>
<td><input type="text" name="guard_occ" value='<?= $row->guardian_occupation ?>'></td>
</tr>
<tr>
<td>Relationship</td>
<td><input type="text" name="guard_relationship" value='<?= $row->guardian_relationship ?>'></td>
<td>Tel (Home)</td>
<td><input type="tel" name="guard_tel_home" value='<?= $row->guardian_home_tel ?>'></td>
</tr>
<tr>
<td>Mobile</td>
<td><input type="tel" name="guard_mobile" value='<?= $row->guardian_mobile ?>'></td>
<td>Tel (Office)</td>
<td><input type="tel" name="guard_off_tel" value='<?= $row->guardian_off_tel ?>'></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Emergency Contact Person</h4></b></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="eme_name" value='<?= $row->eme_contact_name ?>'></td>
<td>Contact No.</td>
<td><input type="tel" name="eme_contact_no" value='<?= $row->eme_contact_number ?>'></td>
</tr>
<tr>
<td>Relationship</td>
<td colspan="3"><input type="text" name="eme_relationship" value='<?= $row->eme_contact_relationship ?>'></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td><b><h4>Diagnoses</h4></b></td>
<td><button type="button" class="btn" id="diagnoses_btn" data-toggle="modal" data-target="#diagnoses"><i class="icon-plus" ></i> Edit</button></td>
<td><b><h4>Intellectual Functioning </h4></b></td>
<td><button type="button" class="btn" id="add_aspect_btn" data-toggle="modal" data-target="#add_aspect"><i class="icon-plus" ></i> Edit</button></td>
</tr>
<tr>
<td colspan="2">
<table id="Add_Diagnoses" style="width: 80%;border: 1px solid #dddddd;margin-left: 40px;margin-bottom: 10px;margin-top: 10px;margin-right: 10px;" >
</table>
</td>
<td colspan="2">
<table id="Add_Aspect" style="width: 80%;border: 1px solid #dddddd;margin-left: 40px;margin-bottom: 10px;margin-top: 10px;margin-right: 10px;" >
</table>
</td>
</tr>
<tr>
<td>Refer by</td>
<td colspan="3">
<?php
$query9 = "Select refer_id from student_refer where stu_refer_id='$linking_id' and deleted=0";
$query6 = "Select refer_id,refer_name from refer";
$result6 = $dbh->query($query6);
$result6->setFetchMode(PDO::FETCH_OBJ);
while ($row6 = $result6->fetch()) {
$print = true;
$result9 = $dbh->query($query9);
$result9->setFetchMode(PDO::FETCH_OBJ);
while ($row9 = $result9->fetch()) {
if ($row6->refer_id == $row9->refer_id) {
print '<input type="checkbox" name="refer_by[]" value="' . $row6->refer_id . '" checked>' . $row6->refer_name;
$print = false;
}
}
if ($print == true)
print '<input type="checkbox" name="refer_by[]" value="' . $row6->refer_id . '">' . $row6->refer_name;
}
?>
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td colspan="4"><b><h4>Reports</h4></b></td>
</tr>
<?php
$query7 = "Select stu_doc_id,stu_linking_id,assessed_doc,assessed_date
from student_document where stu_linking_id='$linking_id' and deleted=0";
$query8 = "Select count(*) as num from student_document where stu_linking_id='$linking_id' and deleted=0";
$result7 = $dbh->query($query7);
$result8 = $dbh->query($query8);
$result8->setFetchMode(PDO::FETCH_OBJ);
$no_of_doc = $result8->fetch()->num;
if ($result7->rowcount() != 0) {
$result7->setFetchMode(PDO::FETCH_OBJ);
$z = 0;
$i = 0;
while ($row7 = $result7->fetch()) {
?>
<tr>
<td>Assessed By</td>
<td colspan="3">
<select name="assessed_by[]">
<option></option>
<?php
$query80 = "Select assessor_id from studoc_assessor where
stu_doc_id ='$row7->stu_doc_id' and deleted=0";
$query70 = "Select assessor_id,assessor from assessor";
$result70 = $dbh->query($query70);
$result70->setFetchMode(PDO::FETCH_OBJ);
while ($row70 = $result70->fetch()) {
$checked = false;
$result80 = $dbh->query($query80);
$result80->setFetchMode(PDO::FETCH_OBJ);
while ($row80 = $result80->fetch()) {
if ($row80->assessor_id == $row70->assessor_id) {
$checked = true;
}
}
if ($checked) {
?>
<option value="<?= $row70->assessor_id ?>" selected><?= $row70->assessor ?></option>
<?php
} else {
?>
<option value="<?= $row70->assessor_id ?>"><?= $row70->assessor ?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Date of Assessment</td>
<td>
<div class="input-append date-picker">
<input type="text" name="assessed_date[]" class="dateISO" value="<?= $row7->assessed_date ?>">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Diagnoses Report</td>
<td colspan="3">
<div class="fileupload fileupload-new" style="margin:0px" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input ">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><a href="<?= $row7->assessed_doc ?>" target="_blank"><?= $row7->assessed_doc ?></a></span>
<input type='hidden' name='file_name[]' value='<?= $row7->assessed_doc ?>' >
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="assessed_doc<?= $i ?>">
<?php if ($i == 0) { ?>
<input type='hidden' name='i' id='i' value='<?= $no_of_doc ?>' >
<?php } ?>
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
<?php
$i++;
}
} else {
?>
<tr>
<td>Assessed By</td>
<td colspan="3">
<select name="assessed_by[]">
<option></option>
<?php
$query7 = "Select assessor_id,assessor from assessor";
$result7 = $dbh->query($query7);
$result7->setFetchMode(PDO::FETCH_OBJ);
while ($row7 = $result7->fetch()) {
?>
<option value="<?= $row7->assessor_id ?>"><?= $row7->assessor ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Date of Assessment</td>
<td>
<div class="input-append date-picker">
<input type="text" name="assessed_date[]" class="dateISO">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Diagnoses Report</td>
<td colspan="3">
<div class="fileupload fileupload-new" style="margin:0px" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input ">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><a href="diagnose_report/<? //= $attachment[$attribute] ?>" target="_blank"><? //= $attachment[$attribute] ?></a></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="assessed_doc<?= $i ?>">
<?php $i++; ?>
<input type='hidden' name='i' id='i' value='<?= $i ?>' >
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
<?php
}
?>
<tbody id='add_thing2'></tbody>
<tr>
<td colspan="4">
<input type="button" class="btn" name="add_assessed" id="add_assessed" value="Add a record">
<input type="button" class="btn btn-danger" name="del_assessed" id="del_assessed" value="Delete a record" onclick="delete_row();">
</td>
</tr>
<tr>
<td>Medication</td>
<td colspan="4"><textarea name="medication"><?= $row->medication ?></textarea></td>
</tr>
<tr>
<td>Others</td>
<td colspan="3"><textarea name="others"><?= $row->others ?></textarea></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4"><b><h4>Assessment Result</h4></b></td></tr>
<tr>
<td>Program</td>
<td>
<select name="ass_program[]">
<option></option>
<?php
$query_prog = "Select program_id,program_name from program";
$result_prog = $dbh->query($query_prog);
$result_prog->setFetchMode(PDO::FETCH_OBJ);
while ($row_prog = $result_prog->fetch()) {
print '<option value="' . $row_prog->program_id . '">' . $row_prog->program_name . '</option>';
}
?>
</select>
</td>
<td>Subject</td>
<td>
<select name="ass_subject[]">
<option></option>
<?php
$query_subj = "Select subject_id,sub_name from subject";
$result_subj = $dbh->query($query_subj);
$result_subj->setFetchMode(PDO::FETCH_OBJ);
while ($row_subj = $result_subj->fetch()) {
print '<option value="' . $row_subj->subject_id . '">' . $row_subj->sub_name . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Date of Assessment</td>
<td>
<div class="input-append date-picker">
<input type="text" name="assessment_date[]" class="dateISO">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</td>
<td>Assessment</td>
<td colspan="3">
<div class="fileupload fileupload-new" style="margin:0px" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input ">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><a href="assessment/<? //= $attachment[$attribute] ?>" target="_blank"><? //= $attachment[$attribute] ?></a></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="assessment_doc<?= $j ?>">
<?php $j++; ?>
<input type='hidden' name='j' id='j' value='<?= $j ?>' >
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</td>
</tr>
<tbody id='add_thing3'></tbody>
<tr>
<td colspan="4">
<input type="button" class="btn" name="add_assessment" id="add_assessment" value="Add a record">
<input type="button" class="btn btn-danger" name="del_assessment" id="del_assessment" value="Delete a record" onclick="delete_row2();">
</td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4"><b><h4>Subsidy</h4></b></td></tr>
<tr>
<td>
<select name="select_subsidy" id="subsidy">
<option value="1">None</option>
<option value="2">Subsidy Rate</option>
</select>
</td>
<td colspan="3"><input type="text" name="subsidy_pecent" id="subsidy_percent" value="0%" readonly="true"></td>
</tr>
<tr>
<tbody id="subsidy_show"></tbody>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr><td colspan="4"><b><h4>Other Information</h4></b></td></tr>
<tr>
<td>Traveling Allowance </td>
<td colspan="3">
<select name="traveling_allowance" required="true">
<option></option>
<?php
if ($row->traveling_allowance == 1) {
?>
<option value="1" selected>Yes</option>
<option value="0">No</option>
<?php
} else {
?>
<option value="1">Yes</option>
<option value="0" selected>No</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Punch ID</td>
<td colspan="3">
<input type="text" name="punch_id" value="<?= $row->stu_punch_id ?>">
</td>
</tr>
</table>
<input type="button" value="Back" class="btn" onclick="window.history.go(-1);"/>
<input type="submit" name="submit" class="btn" value="Save">
<div style="display: none;" class="modal fade" id="add_aspect" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4>Intellectual Functioning</h4>
</div>
<div class="modal-body">
<table border="0">
<?php
$check = FALSE;
$query3 = "Select aspect_id,aspect_name from additional_aspect";
$result6 = $dbh->query($query3);
$result6->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result6->fetch()) {
$result3 = $dbh->query($query_init3);
$result3->setFetchMode(PDO::FETCH_OBJ); //aspect
print '<tr>';
print '<td>';
while ($row1 = $result3->fetch()) {
if ($row1->aspect_id == $row->aspect_id)
$check = TRUE;
}
if ($check == TRUE) {
print '<input type="checkbox" name="add_aspect[]" value="' . $row->aspect_id . '" checked>' . $row->aspect_name;
print '<input type="hidden" name="add_aspectval[]" value="' . $row->aspect_name . '" >';
} else {
print '<input type="checkbox" name="add_aspect[]" value="' . $row->aspect_id . '">' . $row->aspect_name;
print '<input type="hidden" name="add_aspectval[]" value="' . $row->aspect_name . '" >';
}
print '</td>';
print '</tr>';
$check = FALSE;
}
?>
</table>
</div>
<div class="modal-footer">
<input type="button" name="submit_aspect" class="btn" value="Add" data-dismiss="modal" onclick="Add_aspect();">
</div>
</div>
</div>
</div>
<div style="display: none;" class="modal fade" id="diagnoses" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4>Diagnoses</h4>
</div>
<div class="modal-body">
<table border="0">
<?php
$query3 = "Select diagnose_id,diagnose_name from diagnose";
$result30 = $dbh->query($query3);
$result30->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result30->fetch()) {
$result2 = $dbh->query($query_init2);
$result2->setFetchMode(PDO::FETCH_OBJ); //diagnose
print '<tr>';
print '<td>';
while ($row_init2 = $result2->fetch()) {
if ($row_init2->diagnose_id == $row->diagnose_id) {
$check = TRUE;
}
}
if ($check == TRUE) {
print '<input type="checkbox" name="diagnose[]" value="' . $row->diagnose_id . '" checked>' . $row->diagnose_name;
print '<input type="hidden" name="diagnoseval[]" value="' . $row->diagnose_name . '" >';
} else {
print '<input type="checkbox" name="diagnose[]" value="' . $row->diagnose_id . '">' . $row->diagnose_name;
print '<input type="hidden" name="diagnoseval[]" value="' . $row->diagnose_name . '" >';
}
print '</td>';
print '</tr>';
$check = FALSE;
}
?>
</table>
</div>
<div class="modal-footer">
<input type="button" name="submit_diagnose" class="btn" value="Add" data-dismiss="modal" onclick="Add_Diagnoses();">
</div>
</div>
</div>
</div>
</form>
</div> <!-- /container -->
</body>
</html>
<?php
}
?>