| 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/Event/ |
Upload File : |
<?php require_once '../include/DBConnect.php'; ?>
<!DOCTYPE html>
<?php
if (isset($_GET['event_id'])) {
$sth = $dbh->query("select e.`event_id`, a.`activity_id`, `event_code`, `program_id`, `subject_id`, `class_size`, `school_id`, `title`, `date`, `start_time`, `end_time`, `payment`, `number_attend` from activity a ,event e "
. "where e.actived = 1 and e.deleted = 0 and a.actived= 1 and a.deleted=0 and a.`event_id` = e.`event_id` and e.`event_id` = " . $_GET['event_id']);
$result = $sth->fetch(PDO::FETCH_ASSOC);
$code = $result['event_code'];
$class_size = $result['class_size'];
$school_type = $result['school_id'];
$programme = $result['program_id'];
$subject_id = $result['subject_id'];
$event_type = "";
$title = $result['title'];
$date = $result['date'];
$start_time = $result['start_time'];
$end_time = $result['end_time'];
$payment = $result['payment'];
$number_attend = $result['number_attend'];
$event_id = $result['event_id'];
$activity = $result['activity_id'];
} else {
$class_size = $_POST['class_size'];
$school_type = $_POST['school_type'];
$programme = $_POST['programme'];
$subject_id = $_POST['subject_id'];
$event_type = $_POST['event_type'];
$title = "";
$date = "";
$start_time = "";
$end_time = "";
$payment = "";
$number_attend = "";
}
?>
<html>
<head>
<?php require_once '../include/head.php'; ?>
<?php require_once '../include/checkuser.php'; ?>
<?php require_once '../include/Nav_bar.php'; ?>
<script>
$(function() {
$("#start_date_div").datetimepicker({autoclose: true, pickTime: false, startDate: new Date(), format: 'yyyy-MM-dd'});
$('#start_date_div').datetimepicker().on('changeDate', function(ev) {
$('#start_date_div').datetimepicker('hide');
});
$('#starttime').timepicker({'timeFormat': 'H:i', 'step': 5, 'minTime': '6:00', 'maxTime': '22:00'});
$('#endtime').timepicker({'timeFormat': 'H:i', 'step': 5, 'minTime': '6:00', 'maxTime': '22:00'});
});
function limit_time(e) {
var arr = $(e).val().split(":")[0] * 3600 + $(e).val().split(":")[1] * 60 + 15 * 60;
$(e).parent().next().next().next().next().children().timepicker('option', {disableTimeRanges: [['6:00', arr]]});
$(e).parent().next().next().next().next().children().focus();
$(e).blur();
}
</script>
</head>
<body>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<li><a href="Event_List.php">Event</a> <span class="divider">></span></li>
<li class="active"><?= isset($_GET['view']) ? "View " : "" ?>Activity</li>
</ul>
</div>
<div class="container-fluid pathways-container">
<h3><?= isset($_GET['view']) ? "View " : (isset($_GET['event_id'])?"Edit":"Add") ?> Activity</h3>
<form method="post" action="Event_AddActivityFrom_Save.php" autocomplete="off">
<input type="hidden" name="classsize" value="<?= $class_size ?>"/>
<input type="hidden" name="schoolid" value="<?= $school_type ?>"/>
<?php if (isset($event_id)) { ?>
<input type="hidden" name="event_id" value="<?= $event_id ?>"/>
<input type="hidden" name="activity_id" value="<?= $activity ?>"/>
<?php } ?>
<table style="width: 70%;">
<!-- // ### Code ### // -->
<?php
if (!isset($_GET['event_id'])) {
// ### Generate Event Code ### //
$sth = $dbh->query("SELECT `prog_short_form` FROM `program` WHERE program_id = " . $programme . " and actived = 1 and deleted=0 ");
$programe = $sth->fetch(PDO::FETCH_ASSOC);
$sth = $dbh->query("SELECT `sub_short_form` FROM `subject` WHERE actived = 1 and deleted = 0 and subject_id = " . $subject_id);
$subject = $sth->fetch(PDO::FETCH_ASSOC);
if (date("m", time()) >= 9) {
$NowDate = date("y", time()) . (date("y", time()) + 1);
} else {
$NowDate = (date("y", time()) - 1) . date("y", time());
}
$group = ($event_type == '0') ? "g" : "i";
$sth = $dbh->query("SELECT COUNT(*) countgroup FROM `event` WHERE actived=1 and deleted=0 and program_id=" . $programme . " and subject_id=" . $subject_id);
$ResultSet = $sth->fetch(PDO::FETCH_ASSOC);
if (($ResultSet['countgroup'] + 1) <= 9)
$count_event_group = '0' . ($ResultSet['countgroup'] + 1);
else
$count_event_group = ($ResultSet['countgroup'] + 1);
$code = $programe['prog_short_form'] . $subject['sub_short_form'] . $group . $NowDate . '-' . $count_event_group;
}
?>
<tr>
<td style="width: 200px;text-align: right;padding-bottom: 10px;">Code : </td>
<td style="width: 10px;"></td>
<td><input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" id="code" name="code" readonly value="<?= $code ?>"/></td>
</tr>
<tr style="height: 15px;"></tr>
<!-- // ### Programme && Subject ### // -->
<tr>
<?php
// ### Find programme ### //
$sth = $dbh->query("SELECT program_code FROM `program` WHERE actived=1 and deleted = 0 and program_id = " . $programme . " order by `sort`");
$result = $sth->fetch(PDO::FETCH_ASSOC);
$programme_name = $result['program_code'];
?>
<td style="width: 200px;text-align: right;padding-bottom: 10px;">Programme : </td>
<td style="width: 10px;"></td>
<td> <input type="text" id="programme" readonly value="<?= $programme_name ?>"/></td>
<td style="display:none"><input type="hidden" name="programme" value="<?= $programme ?>"/></td>
<?php
// ### Find Subject ### //
$sth = $dbh->query("SELECT sub_code FROM `subject` WHERE actived=1 and deleted=0 and subject_id=" . $subject_id . " order by `sort`");
$result = $sth->fetch(PDO::FETCH_ASSOC);
$subject = $result['sub_code'];
?>
<td style="width: 20px;"></td>
<td style="width: 200px;text-align: right;padding-bottom: 10px;">Subject : </td>
<td style="width: 10px;"></td>
<td><input type="text" id="subject" readonly value="<?= $subject ?>"/></td>
<td style="display:none"><input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="hidden" name="subject" value="<?= $subject_id ?>"/></td>
</tr>
<tr style="height: 15px;"></tr>
<!-- // ### Programme && Subject ### // -->
<tr>
<td style="width: 200px;text-align: right;padding-bottom: 10px;">Title : </td>
<td style="width: 10px;"></td>
<td colspan="5"><input <?= (isset($_GET['view'])) ? "readonly" : "" ?> <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" style="width: 100%;" id="title" name="title" value="<?= $title ?>"/></td>
</tr>
<tr style="height: 15px;"></tr>
<tr>
<td style="text-align: right;padding-bottom: 10px;">Date : </td>
<td></td>
<td>
<div class="input-append date" id="start_date_div">
<input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" value="<?= $date ?>" id="start_date_input" name="date"/>
<span <?= (isset($_GET['view'])) ? "style=\"display:none\"" : "" ?> class="add-on"><i class="icon-th"></i></span>
</div>
</td>
<td style="display:none;width: 100px;text-align: right;padding-bottom: 10px;">End Date : </td>
<td style="width: 10px;"></td>
<td style="display:none;">
<div class="input-append date" id="end_date_div">
<input type="text" value="" id="end_date_input" name="enddate">
<span class="add-on"><i class="icon-th"></i></span>
</div>
</td>
</tr>
<tr style="height: 15px;"></tr>
<tr>
<td style="text-align: right;padding-bottom: 10px;">Start Time : </td>
<td></td>
<td><input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" id="starttime" onchange="limit_time(this);" name="starttime" value="<?= $start_time ?>"/></td>
<td></td>
<td style="text-align: right;padding-bottom: 10px;">End Time : </td>
<td></td>
<td><input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" id="endtime" onchange="limit_time(this);" name="endtime"value="<?= $end_time ?>"/></td>
</tr>
<tr style="height: 15px;"></tr>
<tr>
<td style="text-align: right;">Payment :</td>
<td></td>
<td>
<div class="input-prepend" style="margin-bottom: 1px;">
<button type="button" class="btn" disabled>$</button>
<input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" style="text-align: right" name="payment" value="<?= $payment ?>"/>
</div>
</td>
<td style="width: 15px;"></td>
<td style="text-align: right;">Number of attend :</td>
<td></td>
<td>
<input <?= (isset($_GET['view'])) ? "readonly" : "" ?> type="text" name="numberofattend" onafterpaste="this.value=this.value.replace(/[^\d]/g,'')" onkeyup="this.value = this.value.replace(/[^\d]/g, '')" value="<?= $number_attend ?>"/>
</td>
</tr>
</table>
<hr/>
<?php if (!isset($_GET['view'])) { ?>
<button type="submit" class="btn btn-danger">Save</button>
<?php } else { ?>
<button type="button" class="btn btn-danger" onclick="document.location.href = 'Event_AddActivityFrom.php?event_id=' +<?= $_GET['event_id'] ?>;">Edit</button>
<?php } ?>
<button type="button" class="btn btn-danger" onclick="history.back();">Back</button>
</form>
</div> <!-- /container -->
</body>
</html>