| 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/onesupportsys.onesolution.hk/report/ |
Upload File : |
<?php
require_once(__DIR__ . '/../checkuser.php');
function index() {
global $dbh;
// Check permission
if (!Util::isAdmin()) {
redirectAndExit(Util::link(__DIR__ . '/../main.php'));
}
$sql = "
SELECT staff.*, SEC_TO_TIME(SUM(TIME_TO_SEC(SUBTIME(job.actual_end_time, job.actual_start_time)))) AS staff_man_hour
FROM sys_login staff
LEFT JOIN sup_job job ON job.staff_id = staff.id AND job.actived = 1 AND job.deleted = 0 AND job.status <> 3
GROUP BY staff.id
ORDER BY role, username
";
$parameters = array();
$pagination = new MySqlPagination($sql, $parameters);
$sql .= $pagination->getSqlLimitAndOffset();
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
$staffs = $sth->fetchAll();
return array(
'staffs' => $staffs,
'roleOptions' => Staff::roleOptions(),
'pagination' => $pagination->toString(),
);
}
extract(index());
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require(__DIR__ . '/../inc/_head_meta.php'); ?>
<?php require(__DIR__ . '/../inc/_head_css.php'); ?>
<style type="text/css">
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
padding-bottom: 40px;
}
</style>
<?php require(__DIR__ . '/../inc/_head_script.php'); ?>
</head>
<body>
<?php require(__DIR__ . '/../inc/_navbar.php'); ?>
<div class="container">
<?php if (isset($message) && !empty($message)): ?>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h5 class="alert-heading">Note:</h5>
<p><?=$message?></p>
</div>
<?php endif; ?>
<h2>Staff Man Hours</h2>
<?=$pagination?>
<table class="table table-striped">
<caption class="text-left hide"><h2>Staff Man Hours</h2></caption>
<thead>
<tr>
<th> </th>
<th>User Name</th>
<th>Role</th>
<th>Status</th>
<th>Man Hours</th>
</tr>
</thead>
<tbody>
<?php foreach ($staffs as $staff): ?>
<tr>
<td><a href="modifyform.php?id=<?=$staff['id']?>" class="btn"><i class="icon-pencil"></i></a></td>
<td><?=h($staff['username'])?></td>
<td><?=h($roleOptions[$staff['role']])?></td>
<td>
<a href="javascript:void(0)">
<i class="<?=$staff['actived'] == 1 ? 'icon-ok' : 'icon-remove'?>"></i>
<?=$staff['actived'] == 1 ? 'Enable' : 'Disable'?>
</a>
</td>
<td><?=h($staff['staff_man_hour'])?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?=$pagination?>
<div class="scroll_to_top">
<a href="#" class="btn btn-link btn-mini scroll-to-top">Scroll to Top</a>
</div>
<script type="text/javascript">
$(function() {
$('.scroll-to-top').click(function(event) {
event.preventDefault();
scrollToTop();
});
});
</script>
<?php require(__DIR__ . '/../inc/_footer.php'); ?>
</div> <!-- /container -->
</body>
</html>