| 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/old20140314/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'; ?>
<script>
$(function() {
$('.date-picker').datetimepicker({pickTime: false});
$('#search_form').validate();
$('.time').timepicker({'step': 15, 'timeFormat': 'H:i', 'minTime': '06:00', 'maxTime': '23:30'});
$('.staff_name').select2();
$('.stun').select2();
var DeleteID = 0;
$('#select_all_btn').click(function() {
var $selectAllCheckbox = $('.select-all-checkbox');
$selectAllCheckbox.prop('checked', !$selectAllCheckbox.prop('checked'));
});
});
function check_all(obj, cName) {
var checkboxs = document.getElementsByName(cName);
for (var i = 0; i < checkboxs.length; i++) {
checkboxs[i].checked = obj.checked;
}
};
</script>
</head>
<body>
<?php
if (isset($_POST['waiting_select'])) {
$delwid = $_POST['waiting_select'];
$nextid;
$delhead;
$cid;
$delfromhead = false;
$delfromN = false;
$deleted = false;
$delcheckquery = "select is_head, priority from waiting_list where waiting_id = '$delwid'";
$sqldelcheckquery = $dbh->query($delcheckquery);
$sqldelcheckquery->setFetchMode(PDO::FETCH_OBJ);
while ($row = $sqldelcheckquery->fetch()) {
$nextid = $row->priority;
$delhead = $row->is_head;
}
if ($delhead == 1) {
$delfromhead = true;
$delfromN = false;
} else {
$delfromhead = false;
$delfromN = true;
}
if ($delfromhead) {
if ($nextid != null) {
$sth = $dbh->prepare("UPDATE `waiting_list` SET `lastupby`=1,`lastupdate`=now(),`is_head` = 1 WHERE waiting_id = '$nextid'");
$sth->execute();
}
$sth = $dbh->prepare("UPDATE `waiting_list` SET `lastupby`=1,`lastupdate`=now(),`deleted` = 1 WHERE waiting_id = '$delwid'");
$sth->execute();
$deleted = true;
}
if ($delfromN) {
$delquery = "select waiting_id from waiting_list where priority ='$delwid'";
$sqldelquery = $dbh->query($delquery);
$sqldelquery->setFetchMode(PDO::FETCH_OBJ);
while ($row1 = $sqldelquery->fetch()) {
$cid = $row1->waiting_id;
}
$sth = $dbh->prepare("UPDATE `waiting_list` SET `lastupby`=1,`lastupdate`=now(),`priority` = '$nextid' WHERE waiting_id = '$cid'");
$sth->execute();
$sth = $dbh->prepare("UPDATE `waiting_list` SET `lastupby`=1,`lastupdate`=now(),`deleted` = 1 WHERE waiting_id = '$delwid'");
$sth->execute();
$deleted = true;
}
if ($deleted) {
echo "<script>alert('deleted data successful.')</script>";
echo("<script>location.href ='index.php';</script>");
}
}
?>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<li class="active">Waiting List</li>
</ul>
</div>
<!-- line between nav bar and content -->
<div class="container-fluid pathways-container">
<div>
<table border="0" width="100%">
<tr>
<td><h2>WaitingList</h2></td>
<td><a href="add.php" class="btn pull-right"><i class="icon-plus"></i> Add</a></td>
</tr>
</table>
</div>
<div class="pathways-search">
<form id="search_form" class="form-inline" action="" method="POST">
<div class="pathways-inline-block">
<label class="" id="program" name="program">Program</label>
<select id="program" name="program" class="input-medium" value="program" >
<option value="ALL">ALL</option>
<?php
$query = "select program_code from program ";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
?>
<option <?php if (isset($_POST['go'])) if ($_POST['program'] == $row->program_code) { ?> selected <?php } ?> value ="<?= $row->program_code ?>"><?= $row->program_code ?></option>
<?php } ?>
</select>
</div>
<div class="pathways-inline-block">
<label class="" id="program" name="subject" value="subject" >Subject</label>
<select id="subject" name="subject" class="input-medium" >
<option value="ALL">ALL</option>
<?php
$query = "select sub_code from subject ";
$result = $dbh->query($query);
$result->setFetchMode(PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
?>
<option <?php if (isset($_POST['go'])) if ($_POST['subject'] == $row->sub_code) { ?> selected <?php } ?> value ="<?= $row->sub_code ?>"><?= $row->sub_code ?></option>
<?php } ?>
</select>
</div>
<div class="pathways-inline-block">
<label>Student</label>
<select name="stun" id="stun" class="stun" style="width:150px">
<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>
</div>
<!--div class="pathways-inline-block">
<label>Priority</label>
<input type="number" name="priority" id="priority" value="1" required="">
</div-->
<div class="pathways-inline-block">
<button class="btn" name="go" value="go" style="margin-left:30px" type="submit">GO</button>
</div>
</form>
</div>
<?php
if (isset($_POST['go'])) {
$countp;
$loop;
$searchstudent = NULL;
$program = NULL;
$subject = NULL;
//if ($_POST['stun'] != "ALL")
//$searchstudent = " CONCAT(s.last_name, ' ', s.first_name) = '" . $_POST['stun'] . "' and ";
if ($_POST['program'] != 'ALL')
$program = "p.program_code ='" . $_POST['program'] . "' and ";
if ($_POST['subject'] != 'ALL')
$subject = "sub.sub_code ='" . $_POST['subject'] . "' and ";
?>
<div class="pathways-search">
<form id="form" action="" method="POST">
<!--div class="btn-group">
<input type="button" id="select_all_btn" class="btn btn-small" value="Select All">
<input type="submit" name="delete" class='btn btn-small' value="Delete">
</div-->
<table class="table table-striped table-bordered table-hover table-condensed" id="tablehead">
<thead>
<tr>
<th style="min-width:20px; width:20px" > </th>
<th style="min-width:150px; width:150px">create date</th>
<th style="min-width:50px; width:100px">Year/Grade</th>
<th style="min-width:150px; width:150px">Student name</th>
<th style="min-width:250px; width:250px">program</th>
<th style="min-width:200px; width:200px">subject</th>
<th style="min-width:50px; width:100px">priority</th>
<th style="min-width:200px; width:200px">Assessment Result</th>
</tr>
</thead>
<tbody>
<?php
$query = "select g.grade as grade, s.root_id as rootid, s.last_name as stuln, s.first_name as stufn,w.waiting_id as waiting_id, w.createdate as cd, w.program_id as pro_id, w.subject_id as sub_id, w.priority as priority_id, p.program_code as pc, sub.sub_code as sc from student_grade sg, grade g, student s, waiting_list w, program p, subject sub where w.is_head = 1 and " . $program . $subject . " w.deleted = 0 and p.deleted = 0 and s.deleted = 0 and sub.deleted = 0 and sg.deleted = 0 and g.deleted = 0 and w.stu_root_id = s.root_id and w.program_id = p.program_id and w.subject_id = sub.subject_id and sg.student_grade_id = s.linking_id and g.grade_id = sg.grade_id group by w.waiting_id";
$resstu = $dbh->query($query);
$resstu->setFetchMode(PDO::FETCH_OBJ);
while ($rowstu = $resstu->fetch()) {
$countpriority = 1;
$nextpriority = $rowstu->priority_id;
$stuname = $rowstu->stuln . " " . $rowstu->stufn;
?>
<input type="hidden" name="pro_select[]" class="select-all-checkbox" value="<?= $rowstu->pro_id ?>">
<input type="hidden" name="sub_select[]" class="select-all-checkbox" value="<?= $rowstu->sub_id ?>">
<input type="hidden" name="stu_select[]" class="select-all-checkbox" value="<?= $rowstu->rootid ?>">
<?php if ($_POST['stun'] == "ALL" || $_POST['stun'] == $stuname) { ?>
<tr>
<td>
<button class="btn" name="waiting_select" value="<?= $rowstu->waiting_id ?>" style="margin-left:30px" type="submit"><i class="icon-remove"></i></button>
</td>
<td>
<h5><?php echo $rowstu->cd; ?></h5>
</td>
<td>
<h5><?php echo $rowstu->grade; ?></h5>
</td>
<td>
<h5><?php echo $stuname; ?></h5>
</td>
<td>
<h5><?php echo $rowstu->pc; ?></h5>
</td>
<td>
<h5><?php echo $rowstu->sc; ?></h5>
</td>
<td>
<h5><?php echo $countpriority; ?></h5>
</td>
<td>
<h5><?php echo 'No Assessment Result'; ?></h5>
</td>
</tr>
<?php
}
while ($nextpriority != null) {
$query1 = "select g.grade as grade, s.root_id as rootid, s.last_name as stuln, s.first_name as stufn,w.waiting_id as waiting_id, w.createdate as cd, w.program_id as pro_id, w.subject_id as sub_id, w.priority as priority_id, p.program_code as pc, sub.sub_code as sc from student_grade sg, grade g, student s, waiting_list w, program p, subject sub where w.waiting_id = '$nextpriority' and " . $program . $subject . " w.deleted = 0 and p.deleted = 0 and s.deleted = 0 and sub.deleted = 0 and sg.deleted = 0 and g.deleted = 0 and w.stu_root_id = s.root_id and w.program_id = p.program_id and w.subject_id = sub.subject_id and sg.student_grade_id = s.linking_id and g.grade_id = sg.grade_id group by w.waiting_id";
$resstu1 = $dbh->query($query1);
$resstu1->setFetchMode(PDO::FETCH_OBJ);
while ($rowstu1 = $resstu1->fetch()) {
$countpriority++;
$nextpriority = $rowstu1->priority_id;
$stuname = $rowstu1->stuln . " " . $rowstu1->stufn;
?>
<input type="hidden" name="pro_select[]" class="select-all-checkbox" value="<?= $rowstu1->pro_id ?>">
<input type="hidden" name="sub_select[]" class="select-all-checkbox" value="<?= $rowstu1->sub_id ?>">
<input type="hidden" name="stu_select[]" class="select-all-checkbox" value="<?= $rowstu1->rootid ?>">
<?php if ($_POST['stun'] == "ALL" || $_POST['stun'] == $stuname) { ?>
<tr>
<td>
<button class="btn" name="waiting_select" value="<?= $rowstu1->waiting_id ?>" style="margin-left:30px" type="submit"><i class="icon-remove"></i></button>
</td>
<td>
<h5><?php echo $rowstu1->cd; ?></h5>
</td>
<td>
<h5><?php echo $rowstu1->grade; ?></h5>
</td>
<td>
<h5><?php echo $stuname; ?></h5>
</td>
<td>
<h5><?php echo $rowstu1->pc; ?></h5>
</td>
<td>
<h5><?php echo $rowstu1->sc; ?></h5>
</td>
<td>
<h5><?php echo $countpriority; ?></h5>
</td>
<td>
<h5><?php echo 'No Assessment Result'; ?></h5>
</td>
</tr>
<?php
}
}
}
}
?>
</tbody>
</table>
</form>
<?php
}
?>
</div>
<!-- date picker -->
</div> <!-- /container -->
</body>
</html>