| 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/staff/ |
Upload File : |
<?php
define("UPLOAD_DIR", "upload/");
require_once '../include/head.php';
class Staff {
public static function statusOptions() {
return array(
1 => 'Active',
2 => 'Inactive',
);
}
public static function workingModeOptions() {
return array(
1 => 'Monthly based',
2 => 'Hourly based',
3 => 'Volunteer'
);
}
public static function attendanceLeaveOptions() {
return array(
1 => 'Teacher Sick Leave',
2 => 'Annual Leave',
3 => 'Casual Leave',
4 => 'Students absent',
5 => 'No pay Lesson',
);
}
}
class General {
public static function fields() {
return array(
'id', 'createby', 'createdate', 'lastupby', 'lastupdate',
);
}
public static function genderOptions() {
return array(
1 => 'Male',
2 => 'Female',
);
}
}
class FileLimite {
public static function MaxSize() {
$MaxFileSize = 1024 * 1024; //1MB
return $MaxFileSize;
}
public static function FileType() {
return array(
1 => 'pdf',
2 => 'doc',
3 => 'jpg',
4 => 'sql'
);
}
}
/////Connect DB here~~
include_once '../include/DBConnect.php';
$deleted = 0;
date_default_timezone_set("Hongkong");
$today = date("Y-m-d");
$currentLocation = 'KL';
$action = 'Edit';
// Select Campus option from mis_campus
$query = "select * from campus where deleted = ? ORDER BY sort";
$result = $dbh->prepare($query);
$result->bindParam(1, $deleted);
$result->execute();
$campuses = $result->fetchAll();
// Select Position option from staff_position
$query = "select * from position where deleted = ? ORDER BY sort";
$result = $dbh->prepare($query);
$result->bindParam(1, $deleted);
$result->execute();
$staff_positions = $result->fetchAll();
// Select Program option from program
$query = "select * from program where deleted = ? ORDER BY sort";
$result = $dbh->prepare($query);
$result->bindParam(1, $deleted);
$result->execute();
$programs = $result->fetchAll();
// Select Subject option from subject
$query = "select * from subject where deleted = ? ORDER BY sort";
$result = $dbh->prepare($query);
$result->bindParam(1, $deleted);
$result->execute();
$subjects = $result->fetchAll();
// Set Staff Status Options
$staffStatusOptions = Staff::statusOptions();
// Set F/M option
$genderOptions = General::genderOptions();
if ($_GET) {
$seachID = $_GET['staff_id']; //Root_ID of staff
$CurrentID = $seachID;
//var_dump($seachID);
$query = "SELECT * FROM `staff` WHERE `root_id` = '$seachID' AND `deleted` = '$deleted'";
$result = $dbh->prepare($query);
$result->execute();
while ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
$RootID = $ResultSet['root_id'];
$staff_code = $ResultSet['staff_code'];
$status = $ResultSet['status'];
$last_name = $ResultSet['last_name'];
$first_name = $ResultSet['first_name'];
$ch_name = $ResultSet['ch_name'];
$gender = $ResultSet['gender'];
$refer_by = $ResultSet['refer_by'];
}
/////////////////////////
//Addition Information///
/////////////////////////
$query = "SELECT root_id FROM `staff` WHERE `root_id` = '$RootID'";
$result = $dbh->prepare($query);
$result->execute();
$SIDGroup = $result->fetchAll();
//var_dump($SIDGroup);
$count = 0;
$realRecord = array();
//$realRecord[];
foreach ($SIDGroup as $SID) {
$staff_id = $SID['root_id'];
$query = "SELECT * FROM `staff_salary_history` WHERE `staff_id` = '$staff_id' AND `deleted` = '$deleted' order by `version`"; //
$result = $dbh->prepare($query);
$result->execute();
while ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
$count=$ResultSet['version'];
$realRecord[$count] = array(
"SID" => $staff_id,
"date" => $ResultSet['createdate'],
"SHID" => $ResultSet['staff_his_id'],
"count" => $count-1
);
}
}
//var_dump($realRecord);
}
?>
<!DOCTYPE html>
<html>
<head>
<?php require_once '../include/checkuser.php'; ?>
<?php require_once '../include/Nav_bar.php'; ?>
<script>
$(function() {
$('div input').height(20); //fix size for input box
$('.date-picker').datetimepicker({pickTime: false});
$('#registration_date').val('<?= $today ?>'); //Generate by system
<?php if ($_GET) { ?>
$('#TempRootID').val(<?= $RootID ?>);
$('.staff_code').val('<?= $staff_code ?>');
$('#TempRootID').val(<?= $RootID ?>);
$('#status').val(<?= $status ?>);
$('#last_name').val('<?= $last_name ?>');
$('#first_name').val('<?= $first_name ?>');
$('#zh_name').val('<?= $ch_name ?>');
$('#gender').val(<?= $gender ?>);
$('.refer_by').val('<?= $refer_by ?>');
$('.staff_code').val('<?= $staff_code ?>')
$('#delete_btn').click(function()
{
bootbox.dialog('Are you sure todelete this records?', [
{
'label': 'Delete',
'class': 'btn-danger',
'callback': function() {
DeleteID = <?= $seachID ?>;
$.ajax({
url: 'delete/delete.php', //This is the current doc
type: "POST",
data: {Data: DeleteID},
success: function(data) {
var obj = $.parseJSON(data);
location.href = 'index.php'; //reload this page
}
});
}
},
{
'label': 'Cancel',
'class': 'btn'
}
]);
})
;
<?php } ?>
});
</script>
</head>
<body>
<!-- line between nav bar and content -->
<div class="text-right">
<ul class="breadcrumb">
<!--<li><a href="#">Master</a> <span class="divider">></span></li>-->
<li><a href="index.php">Staff</a> <span class="divider">></span></li>
<li class="active">Staff History</li>
</ul>
</div>
<!-- line between nav bar and content -->
<div class="container-fluid pathways-container">
<!-- table
<button id="check">check</button>-->
<h3>Staff History</h3>
<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
<h5> Staff Information </h5>
<div class="control-group">
<?php
$attribute = 'staff_code';
$label = 'Staff Code'
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="" class="<?= $attribute ?>" value="<?= $_GET ? '' : 'generate after submit' ?>" placeholder="<?= $label ?>" maxlength="200" disabled="disabled"/>
<input type="hidden" id="<?= $attribute ?>" name="<?= $attribute ?>" class="<?= $attribute ?>" value="" placeholder="<?= $label ?>" maxlength="200"/>
<?php
$attribute = 'refer_by';
$label = 'Refer By';
?>
<label class="control-label" style="float:none" for="<?= $attribute ?>"><?= $label ?></label>
<input type="hidden" id="<?= $attribute ?>" style="margin-left:15px" name="<?= $attribute ?>" class="<?= $attribute ?>" value="<?= $_GET ? '' : $_SESSION['MIS_login']['username']; ?>" placeholder="<?= $label ?>" maxlength="200"/>
<input type="text" id="<?= $attribute ?>" style="margin-left:15px" name="" class="<?= $attribute ?>" value="<?= $_GET ? '' : $_SESSION['MIS_login']['username']; ?>" placeholder="<?= $label ?>" maxlength="200" disabled="disabled"/>
</div>
</div>
<hr />
<div class="control-group">
<?php
$attribute = 'last_name';
$label = 'Last Name';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<!-- Store the Root ID here, and pass to $_Post after submited -->
<input type="hidden" id="TempRootID" name="TempRootID" value="0" />
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="required" value="" placeholder="<?= $label ?>" disabled="disabled" maxlength="200" />
<?php
$attribute = 'first_name';
$label = 'First Name';
?>
<label class="control-label" style="float:none" for="<?= $attribute ?>"><?= $label ?></label>
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="required" style="margin-left:15px" value="" placeholder="<?= $label ?>" disabled="disabled" maxlength="200" />
</div>
</div>
<div class="control-group">
<?php
$attribute = 'zh_name';
$label = '中文姓名';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="" value="" placeholder="<?= $label ?>" disabled="disabled" maxlength="200" />
<?php
$attribute = 'gender';
$label = 'Gender';
?>
<label class="control-label" style="float:none" for="<?= $attribute ?>"><?= $label ?></label>
<select id="<?= $attribute ?>" name="<?= $attribute ?>" class="" style="margin-left:15px" disabled="disabled" placeholder="<?= $label ?>">
<option value=""></option>
<?php foreach ($genderOptions as $genderValue => $genderLabel) { ?>
<option value="<?= $genderValue ?>"><?= $genderLabel ?></option>
<?php } ?>
</select>
</div>
</div>
<hr />
<?php
if(isset($realRecord)){
?>
<ul id="myTab" class=" nav-tabs">
<?php
foreach ($realRecord as $value) {
$date = substr($value['date'], 0, 10);
//var_dump($value['SHID'] );
print '<li class=""><a href="#' . $value['SHID'] . '" data-toggle="tab">' . $date . '</a></li>';
}
?>
</ul>
<div id="myTabContent" class="tab-content">
<?php
foreach ($realRecord as $value) {
$seachID = $value['SID'];
$ShowCount = $value['count'];
$date = substr($value['date'], 0, 10);
//var_dump($value['SHID']);
$deleted=0;
$StaffHistoryID = $value['SHID'];
$query = "SELECT * FROM `staff_salary_history` WHERE `staff_his_id` = '$StaffHistoryID' AND `deleted` = '$deleted' ";
$result = $dbh->prepare($query);
$result->execute();
if ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) {
$position_id = $ResultSet['position_id'];
$is_monthly = $ResultSet['is_monthly'];
$is_volunteer = $ResultSet['is_volunteer'];
$is_hourly = $ResultSet['is_hourly'];
$SVersion = $ResultSet['version'];
$salary = $ResultSet['salary'];
$rate1 = $ResultSet['rate1'];
$rate2 = $ResultSet['rate2'];
$rate3 = $ResultSet['rate3'];
$rate4 = $ResultSet['rate4'];
$rate5 = $ResultSet['rate5'];
$rate6 = $ResultSet['rate6'];
$other_rate = $ResultSet['other_rate_desc'];
}
$query = "SELECT * FROM `staff_program` WHERE `staff_id` = '$StaffHistoryID' AND `deleted` = '$deleted'";
$result = $dbh->prepare($query);
$result->execute();
$SPro = $result->fetchAll();
$query = "SELECT * FROM `staff_subject` WHERE `staff_id` = '$StaffHistoryID' AND `deleted` = '$deleted'";
$result = $dbh->prepare($query);
$result->execute();
$SSub = $result->fetchAll();
?>
<div class="tab-pane fade <?= ($count==$SVersion)?'active in':''?>" style="margin-left:<?= $ShowCount*25 ?>px" id="<?= $value['SHID']?>">
<h5>Additional Information</h5>
<div class="control-group">
<?php
$attribute = 'position_id';
$label = 'Position';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<select id="<?= $attribute ?>" name="<?= $attribute ?>" class="" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> placeholder="">
<option value=""></option>
<?php
foreach ($staff_positions as $staff_position) {
$selected = ($position_id == $staff_position['position_id']) ? 'selected' : '';
print '<option value="' . $staff_position['position_id'] . '" ' . $selected . '>' . $staff_position['position_name'] . '</option>';
}
?>
</select>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'programs';
$label = 'Programs';
?>
<label class="control-label"><?= $label ?></label>
<div class="controls form-inline">
<?php foreach ($programs as $program) {
$checked = "";
foreach ($SPro as $Sprog) {
if($Sprog['program_id']==$program['program_id'])
$checked = "checked";
};
?>
<input type="checkbox" id="program_<?= $program['program_id'] ?>" name="programs[]" <?= $checked ?> value="<?= $program['program_id'] ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> />
<label for="program_<?= $program['program_id'] ?>"><?= $program['program_code'] ?></label>
<?php } ?>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'subjects';
$label = 'Subjects';
?>
<label class="control-label"><?= $label ?></label>
<div class="controls form-inline">
<?php
foreach ($subjects as $subject){
$checked = "";
foreach ($SSub as $Ssubjec) {
if($Ssubjec['subject_id']==$subject['subject_id'])
$checked = "checked";
};
?>
<input type="checkbox" id="subject_<?= $subject['subject_id'] ?>" name="subjects[]" <?= $checked ?> value="<?= $subject['subject_id'] ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> />
<label for="subject_<?= $subject['subject_id'] ?>"><?= $subject['sub_code'] ?></label>
<?php }; ?>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'working_mode';
$label = 'Working Mode';
?>
<label class="control-label"><?= $label ?></label>
<div class="controls form-inline">
<?php
foreach (Staff::workingModeOptions() as $value => $label) {
$checked = "";
if ($value == 1 && $is_monthly == 1)
$checked = "checked";
if ($value == 2 && $is_hourly == 1)
$checked = "checked";
if ($value == 3 && $is_volunteer == 1)
$checked = "checked";
?>
<input type="checkbox" id="workingMode<?= $value ?>" name="workingMode[]" <?= $checked ?> value="<?= $value ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> />
<label for="<?= $label ?>"><?= $label ?></label>
<?php } ?>
</div>
</div>
<hr />
<h5>Salary</h5>
<div class="control-group">
<?php
$attribute = 'salary';
$label = 'Salary';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $salary ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<span>By Month</span>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'rate1';
$label = 'Rate 1';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $rate1 ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<span>Teacher (In House)</span>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'rate2';
$label = 'Rate 2';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $rate2 ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<span>Teacher (Outside School)</span>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'rate3';
$label = 'Rate 3';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $rate3 ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<span>Teaching Assistant (In House)</span>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'rate4';
$label = 'Rate 4';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $rate4 ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<span>Teaching Assistant (Outside School)</span>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'rate5';
$label = 'Rate 5';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $rate5 ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<span>Traveling</span>
</div>
</div>
<div class="control-group">
<?php
$attribute = 'rate6';
$label = 'Rate 6';
?>
<label class="control-label" for="<?= $attribute ?>"><?= $label ?></label>
<div class="controls form-inline">
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="number" value="<?= $rate6 ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
<?php
$attribute = 'rate6_other';
$label = 'Other';
?>
<label class="" for="<?= $attribute ?>"><?= $label ?></label>
<input type="text" id="<?= $attribute ?>" name="<?= $attribute ?>" class="" style="margin-left:15px" value="<?= $other_rate ?>" placeholder="<?= $label ?>" <?= empty($_GET) ? '' : 'disabled="disabled"' ?> maxlength="200" />
</div>
</div>
<a href="form.php?staff_id=<?= $seachID ?>&action=AdminEidt" class="btn">Edit (<?= $date ?>)</a>
</div>
<?php
}
?>
</div>
<?php
}
?>
</form>
<!--<button class="btn btn-danger" id="submit">Save(AJax)</button>-->
</div> <!-- /container -->
</body>
</html>