From dfd64ba4f9acfd06c24d8c8ba348020094d024ce Mon Sep 17 00:00:00 2001 From: Josh North Date: Tue, 24 Feb 2015 14:21:01 -0500 Subject: [PATCH] mroe changes... --- config.inc.php.example | 1 + includes/footer.inc.php | 1 + includes/functions.inc.php | 4 ++++ includes/header.inc.php | 5 ++++- includes/side-menu.css | 19 +++++++++++++------ includes/time.inc.php | 1 + index.php | 2 ++ lib/time.inc.php | 1 + lib/timer.js | 19 +++++++++++++++++++ punchlog.php | 5 ++--- 10 files changed, 48 insertions(+), 10 deletions(-) create mode 100755 includes/time.inc.php create mode 100755 lib/time.inc.php create mode 100755 lib/timer.js diff --git a/config.inc.php.example b/config.inc.php.example index 4114c09..9eac69e 100755 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -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 diff --git a/includes/footer.inc.php b/includes/footer.inc.php index 7b360ff..9ff5067 100755 --- a/includes/footer.inc.php +++ b/includes/footer.inc.php @@ -4,5 +4,6 @@ + diff --git a/includes/functions.inc.php b/includes/functions.inc.php index 9d1647a..80f6002 100755 --- a/includes/functions.inc.php +++ b/includes/functions.inc.php @@ -1,5 +1,9 @@ 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 diff --git a/includes/header.inc.php b/includes/header.inc.php index 24d03f2..e2bf49f 100755 --- a/includes/header.inc.php +++ b/includes/header.inc.php @@ -6,6 +6,9 @@ <?php echo $yaptc_company . ">" . $yaptc_appname . ">" . $yaptc_pagename; ?> + + + - + diff --git a/includes/side-menu.css b/includes/side-menu.css index dbe4a1f..f52671b 100755 --- a/includes/side-menu.css +++ b/includes/side-menu.css @@ -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` `
` is the parent `
` that contains the `.pure-menu` thatappears on the left side of the page.*/ #menu { diff --git a/includes/time.inc.php b/includes/time.inc.php new file mode 100755 index 0000000..0c3d363 --- /dev/null +++ b/includes/time.inc.php @@ -0,0 +1 @@ + diff --git a/index.php b/index.php index ef1657a..436897d 100755 --- a/index.php +++ b/index.php @@ -10,6 +10,8 @@ killSession(); else: ?> + +

Current Status

diff --git a/lib/timer.js b/lib/timer.js new file mode 100755 index 0000000..943aa51 --- /dev/null +++ b/lib/timer.js @@ -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); + } diff --git a/punchlog.php b/punchlog.php index da8808b..072a9b1 100755 --- a/punchlog.php +++ b/punchlog.php @@ -13,7 +13,6 @@ else: ?> 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") {