mroe changes...

This commit is contained in:
Josh North 2015-02-24 14:21:01 -05:00
parent 986051529a
commit dfd64ba4f9
10 changed files with 48 additions and 10 deletions

View File

@ -6,6 +6,7 @@ $yaptc_webpath = 'http://server-ip/yaptc/'; // Absolute URL to the root of
$yaptc_appname = 'Timecard System'; // Program name to display in title bar
$yaptc_company = 'Widgets, Inc.'; // Your company name
$yaptc_db = new PDO('mysql:host=localhost;dbname=YOUR_DATABASE;charset=utf8', 'YOUR_USER', 'YOUR_PASSWORD'); // Database connection string
$db = new PDO('mysql:host=localhost;dbname=YOUR_DATABASE;charset=utf8', 'YOUR_USER', 'YOUR_PASSWORD'); // Database connection string
$yaptc_adminmsg = ''; // Message will display on all pages!
$yaptc_allowadvancedpunch = 'yes'; // Should we allow users to make manual punch entries? set to yes or no
$yaptc_min_password = '8'; // Minimum password length

View File

@ -4,5 +4,6 @@
</div>
</div>
<script src="<?php echo $yaptc_libweb; ?>ui.js"></script>
</body>
</html>

View File

@ -1,5 +1,9 @@
<?php
// Current Time
$timenow = date('Y-m-d H:i:s');
// Get user list for users management page
function listUsers($yaptc_db) {
$stmt = $yaptc_db->query("SELECT users.id as userid, users.username as username, users.email as email, users.created as created, users.firstname as firstname, users.lastname as lastname, users.usertype as usertypeid, usertypes.typename as usertype

View File

@ -6,6 +6,9 @@
<meta name="description" content="YAPTC Timecard system is a time recording application for small businesses.">
<title><?php echo $yaptc_company . ">" . $yaptc_appname . ">" . $yaptc_pagename; ?></title>
<link rel="stylesheet" href="<?php echo $yaptc_libweb; ?>pure/pure.css">
<script type="text/javascript" src="<?php echo $yaptc_libweb; ?>date_time.js"></script>
<!--[if lte IE 8]>
<link rel="stylesheet" href="<?php echo $yaptc_incweb; ?>side-menu-old-ie.css">
@ -22,4 +25,4 @@
<!--<![endif]-->
</head>
<body>
<body onLoad="startclock();">

View File

@ -34,32 +34,39 @@ body {
margin:0;
padding:0;
max-width:800px;
margin-bottom:50px;
margin-bottom:1em;
line-height:1em;
}
.header {
margin:0;
margin:.25em 0 0 0;
color:#333;
padding:.0;
border-bottom:2px solid #eee;
}
.header h1 {
margin:0;
font-size:3em;
margin:0;
font-size:2em;
font-weight:300;
padding:0;
}
.header h2 {
margin:0;
margin:0;
font-size:1em;
font-weight:300;
padding:0;
color:#888;
}
.content-subhead {
margin:1em 0 0 0;
margin:.25em 0 0 0;
font-weight:300;
color: #888;
font-size:1.5em;
}
.content p {
margin:.25em 0 1em 0;
font-weight:300;
color: #888;
font-size:1em;
}
/*The `#menu` `<div>` is the parent `<div>` that contains the `.pure-menu` thatappears on the left side of the page.*/
#menu {

1
includes/time.inc.php Executable file
View File

@ -0,0 +1 @@
<?php echo date('F d, Y H:i:s') ?>

View File

@ -10,6 +10,8 @@ killSession();
else: ?>
<!-- ********** BEGIN CONTENT ********** -->
<h2 class="content-subhead">Current Status</h2>
<?php
$timenow = date('Y-m-d H:i');

1
lib/time.inc.php Executable file
View File

@ -0,0 +1 @@
<?php echo date('F d, Y H:i:s') ?>

19
lib/timer.js Executable file
View File

@ -0,0 +1,19 @@
function doAjaxGet(dataSource) {
if(navigator.appName == "Microsoft Internet Explorer") {
objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
} else {
objHTTP = new XMLHttpRequest();
}
objHTTP.open("POST", dataSource, true);
objHTTP.onreadystatechange = function()
{
if (objHTTP.readyState == 4 && objHTTP.status == 200) {
document.getElementById('oClock').innerHTML = objHTTP.responseText;
}
}
objHTTP.send('null');
}
function startclock() {
doAjaxGet('time.inc.php');
setTimeout('startclock()',1000);
}

View File

@ -13,7 +13,6 @@ else: ?>
<?php
$userid = $_SESSION['user_id'];
$timenow = date('Y-m-d H:i');
// This is to get the current user status - in or out - and the notes and times associated for use in the form
$result = $yaptc_db->prepare("SELECT punches.id as punchid, users.id as user, punches.intime as intime, punches.outtime as outtime, punches.notes as notes FROM punches INNER JOIN users ON punches.userid = users.id WHERE users.id = $userid ORDER BY punches.id DESC LIMIT 1");
@ -64,8 +63,8 @@ if (isset($_POST['notes'])) { if (!empty($_POST['notes'])) { $p_notes = $_POST['
// Is the punch time field set? If so, use, otherwise set to now
if (isset($_POST['punchtime'])) {
if (!empty($_POST['punchtime'])) { $p_punchtime = $_POST['punchtime'] . ':00'; $p_modified = "1"; } else { $p_punchtime = $timenow . ':00'; $p_modified = "0"; }
} else { $p_punchtime = $timenow . ':00'; $p_modified = "0"; }
if (!empty($_POST['punchtime'])) { $p_punchtime = $_POST['punchtime'] . ':00'; $p_modified = "1"; } else { $p_punchtime = $timenow; $p_modified = "0"; }
} else { $p_punchtime = $timenow; $p_modified = "0"; }
// Is the user currently punched in? If so, insert the punch out record, otherwise, insert a new punch in
if ($status=="In") {