| 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/WaitingList/ |
Upload File : |
<!DOCTYPE html>
<html>
<head>
<?php require_once '../include/head.php'; ?>
<?php require_once '../include/checkuser.php'; ?>
<?php require_once '../include/Nav_bar.php'; ?>
<?php include_once '../include/DBConnect.php'; ?>
<?php $waiting_id = $_GET['id']; ?>
<script>
$(function() {
$('.date-picker').datetimepicker({pickTime: false});
$('.stun').select2();
});
</script>
</head>
<style>
.table{
background:#feffde;
}
</style>
<body>
<?php
$studentid = "";
$countstudent = 0;
$createdate = date('Y-m-d');
$state = array('Application Form', 'Assessment', 'Schedule');
if (isset($_POST['addstu'])) {
$maxwid;
$stuid;
$subid;
$proid;
$next;
$ishead;
$inserted = false;
$newstate = $_POST['state'];
$searchdata = "select stu_linking_id, program_id, subject_id, priority, is_head from waiting_list where deleted = 0 and waiting_id = '$waiting_id' group by waiting_id";
$result = $dbh->query($searchdata);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
$stuid = $row->stu_linking_id;
$proid = $row->program_id;
$subid = $row->subject_id;
$next = $row->priority;
$ishead = $row->is_head;
}
$sth = $dbh->prepare("INSERT INTO `waiting_list`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`, `stu_linking_id`, `program_id`, `subject_id`, `priority`, `is_head`, `state_id`) VALUES (1, now(), 1 ,now(),1,0,?,?,?,?,?,?)");
$sth->bindParam(1, $stuid);
$sth->bindParam(2, $proid);
$sth->bindParam(3, $subid);
$sth->bindParam(4, $next);
$sth->bindParam(5, $ishead);
$sth->bindParam(6, $newstate);
$sth->execute();
$sth = $dbh->prepare("UPDATE `waiting_list` SET `lastupby`=1,`lastupdate`=now(),`deleted` = 1 WHERE waiting_id = '$waiting_id'");
$sth->execute();
$max = "select max(waiting_id) as maxid from waiting_list";
$sqlmax = $dbh->query($max);
$sqlmax->setFetchMode(PDO::FETCH_OBJ);
while ($row = $sqlmax->fetch()) {
$maxwid = $row->maxid;
}
$sth = $dbh->prepare("UPDATE `waiting_list` SET `lastupby`=1,`lastupdate`=now(),`priority` = '$maxwid' WHERE priority = '$waiting_id' and deleted = 0");
$sth->execute();
$inserted = true;
if ($inserted) {
echo "<script>alert('update successful.')</script>";
echo("<script>location.href ='index.php';</script>");
}
if ($inserted == false)
echo "<script>alert('Error!!! Delete fail')</script>";
}
?>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<li class="active">Edit WaitingList</li>
</ul>
</div>
<!-- line between nav bar and content -->
<div class="container-fluid pathways-container">
<form id="search_form" class="form-inline" action="" method="POST">
<table border="0" class="table table-bordered table-hover table-condensed">
<?php
$searchdata = "select waiting_id, stu_linking_id, program_id, subject_id,state_id from waiting_list where deleted = 0 and waiting_id = '$waiting_id' group by waiting_id";
$result = $dbh->query($searchdata);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row1 = $result->fetch()) {
?>
<tr><td><h3>Edit Waiting List</h3></td></tr>
<tr>
<td width="20%"><label>Student</label></td>
<td><?php $sth = $dbh->query("SELECT CONCAT(last_name, ' ', first_name) studentname,`ch_name`FROM `student` WHERE `root_id`='$row1->stu_linking_id' and `deleted`=0 "); ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<input type="text" readonly value="<?= $ResultSet['studentname'] ?>">
<?php } ?>
</td>
</tr>
<tr>
<td width="20%"><label class="" id="program" name="program">Program</label></td>
<td><?php
$query = "select program_code from program where program_id ='$row1->program_id' ";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
?>
<input type="text" readonly value="<?= $row->program_code ?>">
<?php } ?> </td>
</tr>
<tr>
<td width="20%"><label class="" id="program" name="subject" value="subject" >Subject</label></td>
<td>
<?php
$query = "select sub_code from subject where subject_id = '$row1->subject_id'";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
?>
<input type="text" readonly value ="<?= $row->sub_code ?>">
<?php } ?>
</td>
</tr>
<tr>
<td width="20%"><label>State</label></td>
<td><select name="state" class="state" style="width:150px">
<?php for ($a = 0; $a < count($state); $a++) { ?>
<option <?php if ($row1->state_id == $a) { ?> selected <?php } ?> value="<?= $a ?>"><?= $state[$a] ?></option>
<?php } ?>
</select></td>
</tr>
<!--tr>
<td><label width="20%">Priority</label></td>
<td><input type="text" name="priority" id="priority" onkeydown="return (event.ctrlKey || event.altKey || (47 < event.keyCode && event.keyCode < 58 && event.shiftKey == false) || (95 < event.keyCode && event.keyCode < 106) || (event.keyCode == 8) || (event.keyCode == 9) || (event.keyCode > 34 && event.keyCode < 40) || (event.keyCode == 46))"></td>
</tr-->
</table>
<?php } ?>
<div class="input-append date-picker">
<button class="btn" name="addstu" value="addstu" style="margin-left:30px" type="submit">Edit</button>
</div>
</form>
</div> <!-- /container -->
</body>
</html>