| 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/Event/ |
Upload File : |
<?php include_once '../include/DBConnect.php'; ?>
<!DOCTYPE html>
<?php
if (isset($_GET["search"])) {
$search_List = array();
$event_id = array();
$activity_sql_code = "";
$activity_sql_programmeid = "";
$activity_sql_subjectid = "";
if (!empty($_GET['search']['code_id'])) {
$activity_sql_code = " and e.event_code = \"" . $_GET['search']['code_id'] . '" ';
}
if (!empty($_GET['search']['programme_id'])) {
$activity_sql_programmeid = " and e.program_id = '" . $_GET['search']['programme_id'] . "' ";
}
if (!empty($_GET['search']['subject_id'])) {
$activity_sql_subjectid = " and e.subject_id = \"" . $_GET['search']['subject_id'] . '" ';
}
if (isset($_GET['event_type'])) {
if ($_GET['event_type'] == 1 || $_GET['event_type'] == "") {
$search_activity = "select e.event_id,e.event_code,p.program_name,s.sub_name,a.date from activity a ,event e ,program p,subject s where e.event_id = a.event_id and a.actived = 1 and a.deleted = 0 and e.actived = 1 and e.deleted = 0 and p.actived = 1 and p.deleted = 0 and s.actived= 1 and s.deleted = 0 and e.program_id = p.program_id and e.subject_id = s.subject_id and a.activity_id not in ( SELECT activity_id FROM `activity_stu_list` WHERE actived = 1 and deleted = 0 ) $activity_sql_code $activity_sql_programmeid $activity_sql_subjectid order by 1";
$sth3 = $dbh->query($search_activity);
}
}
$staff_name = ($_GET['staff_name'] == "") ? "" : ' and staff_id ="' . $_GET['staff_name'] . '" ';
$student_name = ($_GET['student_name'] == "") ? "" : '`stu_linking_id` ="' . $_GET['student_name'] . '" and';
$search_code_id = (empty($_GET['search']['code_id'])) ? "" : 'and e.event_code = "' . $_GET['search']['code_id'] . '"';
$search_programme_id = (empty($_GET['search']['programme_id'])) ? "" : 'and e.program_id ="' . $_GET['search']['programme_id'] . '"';
$search_subject_id = (empty($_GET['search']['subject_id'])) ? "" : 'and e.subject_id ="' . $_GET['search']['subject_id'] . '" ';
$sth2 = $dbh->query('select Min(date) startdate,Max(date) enddate,e.event_id eid,e.event_code ec,p.program_code pc,s.sub_code sc
from subject s,program p,lesson l,event_lesson el,event e
where el.lesson_id=l.lesson_id and e.event_id=el.event_id and
el.lesson_id in
(SELECT lesson_id FROM `lesson_attendance` WHERE actived=1 and deleted=0 ' . $staff_name . ' )
and el.lesson_id in
(SELECT lesson_id FROM `lesson_attendance` WHERE ' . $student_name . ' deleted=0 and actived=1)
and p.program_id=e.program_id and e.subject_id=s.subject_id and e.actived=1 and e.deleted=0 ' . $search_code_id . $search_programme_id . $search_subject_id . ' group by e.event_id');
while ($ResultSet2 = $sth2->fetch(PDO::FETCH_ASSOC)) {
if (!empty($_GET['search']['startdate_id'])) {
if ($ResultSet2['startdate'] <= $_GET['search']['startdate_id'] && $ResultSet2['enddate'] >= $_GET['search']['startdate_id']) {
array_push($search_List, array($ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate']));
continue;
}
if ($ResultSet2['startdate'] <= $_GET['search']['enddate_id'] && $ResultSet2['enddate'] >= $_GET['search']['enddate_id']) {
array_push($search_List, array($ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate']));
continue;
}
if ($ResultSet2['startdate'] >= $_GET['search']['startdate_id'] && $ResultSet2['enddate'] <= $_GET['search']['enddate_id']) {
array_push($search_List, array("event_type" => 0, $ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate']));
continue;
}
} else {
array_push($search_List, array("event_type" => 0, $ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate']));
}
}
if (isset($_GET['event_type'])) {
if ($_GET['event_type'] == 1 || $_GET['event_type'] == "") {
if ($_GET['event_type'] == 1)
$search_List = array();
while ($result = $sth3->fetch(PDO::FETCH_ASSOC)) {
array_push($search_List, array("event_type" => 1, $result['event_id'], $result["event_code"], $result["program_name"], $result['sub_name'], $result['date'], $result['date']));
}
}
}
}
?>
<html>
<head>
<?php include_once '../include/head.php'; ?>
<?php include_once '../include/checkuser.php'; ?>
<?php include_once '../include/Nav_bar.php'; ?>
<?php if (isset($_GET['search']['code_id'])) { ?>
<script>
$(function() {
$('#code_id').select2().select2('val', '<?= $_GET['search']['code_id'] ?>');
$('#student_name').select2().select2('val', '<?= $_GET['student_name'] ?>');
$('#staff_name').select2().select2('val', '<?= $_GET['staff_name'] ?>')
});
</script>
<?php } ?>
<script>
$(function() {
$('#start_date_id').datetimepicker({pickTime: false});
$('#start_date_id').datetimepicker().on('changeDate', function(ev) {
date = new Date($('#start_date_input').val());
$('#end_date_id').datetimepicker('setStartDate', date);
$('#end_date_id').datetimepicker('setDate', date);
$('#end_date_id').datetimepicker('show');
$('#start_date_id').datetimepicker('hide');
$('#end_date_id').datetimepicker('remove');
});
$('#end_date_id').datetimepicker({autoclose: true, pickTime: false, startDate: new Date()});
$('#end_date_id').datetimepicker().on('changeDate', function(ev) {
$('#end_date_id').datetimepicker('hide');
});
$('#code_id').select2();
$(".student_name").select2();
$('.staff_name').select2();
});
function check_all() {
for (var i = 0; i < (document.getElementsByName("event_id[]")).length; i++)
(document.getElementsByName("event_id[]"))[i].checked = true;
}
</script>
<style>
div.pathways-inline-block{
margin-right: 20px;
}
</style>
</head>
<body>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<li class="active">Event</li>
</ul>
</div>
<div class="container-fluid pathways-container">
<!--<a class="btn pull-right" href="Event_AddActivityFrom.php"><i class="icon-plus"></i>Activity</a>-->
<a class="btn pull-right" href="Event_AddFrom.php"><i class="icon-plus"></i>Add</a>
<h3>Event</h3>
<form id="search_form" class="form-inline" action="" method="get">
<div id="2" style="margin: 0;padding: 5px 10px;background-color: #F7F7F7;border: 1px solid #E6E6E6;border-radius: 5px;box-shadow: 0 1px 2px rgba(0,0,0,.05);">
<!-- ## Code ## -->
<div class="pathways-inline-block">
<label class="" for="code_id">Code : </label>
<select id="code_id" name="search[code_id]" style="width: 200px;"type="text" maxlength="150" placeholder="Code" >
<option value=""></option>
<?php $sth = $dbh->query("select event_code from event where actived=1 and deleted=0 ") ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?= $ResultSet['event_code'] ?>"><?= $ResultSet['event_code'] ?></option>
<?php } ?>
</select>
</div>
<!-- ## Program ## -->
<div class="pathways-inline-block">
<?php $sth = $dbh->query('SELECT * FROM `program` WHERE `deleted` = 0 order by `sort`'); ?>
<label class="" for="program_id">Programme : </label>
<select id="programme_id" class="input-medium" name="search[programme_id]" style="width: 200px">
<?php echo '<option value=""></option>'; ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option <?php if (isset($_GET['search']['programme_id'])) if ($_GET['search']['programme_id'] == $ResultSet['program_id']) { ?>selected<?php } ?> value="<?= $ResultSet['program_id'] ?>"><?= $ResultSet['program_code'] ?></option>
<?php } ?>
</select>
</div>
<!-- ## Subject ## -->
<div class="pathways-inline-block">
<?php $sth = $dbh->query('SELECT * FROM `subject` WHERE `deleted` = 0 order by `sort`'); ?>
<label class="" for="subject_id">Subject : </label>
<select id="subject_id" class="input-medium" name="search[subject_id]"style="width: 200px">
<?php echo '<option value=""></option>'; ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option <?php if (isset($_GET['search']['subject_id'])) if ($_GET['search']['subject_id'] == $ResultSet['subject_id']) { ?>selected<?php } ?> value="<?= $ResultSet['subject_id'] ?>"><?= $ResultSet['sub_code'] ?></option>
<?php } ?>
</select>
</div>
<!-- ## Start Date ## -->
<div class="pathways-inline-block">
<label class="" for="startdate_id">Start Date : </label>
<div class="input-append date-picker" id="start_date_id">
<input id="start_date_input" style="width: 200px" class="dateISO" type="text" maxlength="200" placeholder="Start Date" data-format="yyyy-MM-dd" value="<?= (isset($_GET['search'])) ? $_GET['search']['startdate_id'] : "" ?>" name="search[startdate_id]">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
</div>
<!-- ## End Date ## -->
<div class="pathways-inline-block">
<label class="" for="enddate_id">End Date : </label>
<div class="input-append date-picker" id="end_date_id">
<input id="data_input_date_e" style="width: 200px" class="dateISO" type="text" maxlength="200" placeholder="End Date" data-format="yyyy-MM-dd" value="<?= (isset($_GET['search'])) ? $_GET['search']['enddate_id'] : "" ?>" name="search[enddate_id]">
<span class="add-on">
<i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
</span>
</div>
<!-- ## Search Button ## <i class="icon-info-sign" ></i>-->
</div>
<div class="pathways-inline-block">
<label>Student Name</label>
<select name="student_name" id="student_name" class="student_name" >
<option value=""></option>
<?php $sth = $dbh->query("SELECT root_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['root_id'] ?>"><?= $ResultSet['studentname'] ?> ( <?= $ResultSet['ch_name'] ?> )</option>
<?php } ?>
</select>
</div>
<div class="pathways-inline-block">
<label>Staff Name</label>
<select name="staff_name" id="staff_name" class="staff_name" style="width: 200px">
<option value=""></option>
<?php $sth = $dbh->query("SELECT CONCAT(`last_name`,' ',`first_name`) staffname, `ch_name` , `root_id` FROM `staff` WHERE `actived`=1 and `deleted`=0 group by root_id"); ?>
<?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?= $ResultSet['root_id'] ?>" ><?= $ResultSet['staffname'] ?> ( <?= $ResultSet['ch_name'] ?> )</option>
<?php } ?>
</select>
</div>
<div class="pathways-inline-block">
<label>Event Type</label>
<select name="event_type" style="width:200px;" id="event_type">
<option value=""></option>
<option <?= (isset($_GET['event_type'])) ? ($_GET['event_type'] == 1 ? "selected" : "" ) : "" ?> value="1">Activity</option>
<option <?= (isset($_GET['event_type'])) ? ($_GET['event_type'] === "0" ? "selected" : "" ) : "" ?> value="0">Course</option>
</select>
</div>
<button name="search[submit]" class="btn" style="margin-left:30px;" type="submit">Search</button>
</div>
<div style="height: 15px;"></div>
<div style="height: 15px;"></div>
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th style="width: 70px;"></th>
<th>Code</th>
<th>Programmme</th>
<th>Subject</th>
<th>Start Date</th>
<th>End Date</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php if (isset($_GET["search"])) { ?>
<?php foreach ($search_List as $arr) { ?>
<tr>
<td style="padding-left:5px;">
<?php if (($arr["event_type"]) == 0) { ?>
<a href="<?= 'Event_AddFrom.php?event_id=' . $arr[0] . "&view=1" ?>" class="btn"><i class="icon-eye-open"></i> View</a>
<?php } else { ?>
<a href="<?= "Event_AddActivityFrom.php?event_id=" . $arr[0] . "&view=1" ?>" class="btn"><i class="icon-eye-open"></i> View</a>
<?php } ?>
</td>
<td><?= $arr[1] ?></td>
<td><?= $arr[2] ?></td>
<td><?= $arr[3] ?></td>
<?php if ($arr['event_type'] == 0) { ?>
<?php $sth2 = $dbh->query("Select Min(date) min,Max(date) max from lesson where lesson_id in (SELECT `lesson_id` FROM `event_lesson` WHERE deleted=0 and `event_id` = " . $arr[0] . ")"); ?>
<?php while ($ResultSet2 = $sth2->fetch(PDO::FETCH_ASSOC)) { ?>
<td><?= $ResultSet2['min'] ?></td>
<td><?= $ResultSet2['max'] ?></td>
<?php } ?>
<?php } else { ?>
<td><?= $arr[5] ?></td>
<td><?= $arr[5] ?></td>
<?php } ?>
<td style="width: 80px">
<?php if (($arr["event_type"]) == 0) { ?>
<a class="btn" href="Event_DetailFrom.php?event_id=<?= $arr[0] ?>"><i class="icon-info-sign"></i> Detail</a>
<?php } else { ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</form>
</div> <!-- /container -->
</body>
</html>