From 16b87fafe48532f3551e8985ba88eca8cc71af7b Mon Sep 17 00:00:00 2001 From: Josh North Date: Tue, 24 Feb 2015 15:37:29 -0500 Subject: [PATCH] mroe changes, moving to language file --- includes/footer.inc.php | 3 +-- includes/functions.inc.php | 18 +++++++++++++- includes/header.inc.php | 4 ++-- includes/time.inc.php | 1 - index.php | 49 ++++++++++++++++++++++++-------------- lang/en.lang.php | 11 +++++++++ lib/date_time.js | 29 ---------------------- lib/time.inc.php | 1 - lib/timer.js | 19 --------------- 9 files changed, 62 insertions(+), 73 deletions(-) delete mode 100755 includes/time.inc.php create mode 100644 lang/en.lang.php delete mode 100755 lib/date_time.js delete mode 100755 lib/time.inc.php delete mode 100755 lib/timer.js diff --git a/includes/footer.inc.php b/includes/footer.inc.php index 9ff5067..2f6f4a7 100755 --- a/includes/footer.inc.php +++ b/includes/footer.inc.php @@ -1,9 +1,8 @@
-

Server Time:

+

- diff --git a/includes/functions.inc.php b/includes/functions.inc.php index 80f6002..859973b 100755 --- a/includes/functions.inc.php +++ b/includes/functions.inc.php @@ -1,9 +1,25 @@ 'You have no recorded punches', + 'OUT' => 'Out', + 'IN' => 'In', + 'SINCE' => 'since', + 'PUNCH_STATUS' => 'Punch Status', + 'SERVER_TIME' => 'Server Time', + 'QUICK_PUNCH_PARAGRAPH' => 'Click below to immediately punch your time. You may enter notes for your administrator to review.', + 'YOU_HAVE_BEEN_PUNCHED' => 'You have been punched', + 'QUICK_PUNCH' => 'Quick Punch' + ); + return $lang[$phrase]; +} + + // 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 diff --git a/includes/header.inc.php b/includes/header.inc.php index e2bf49f..546b68e 100755 --- a/includes/header.inc.php +++ b/includes/header.inc.php @@ -9,7 +9,6 @@ - @@ -25,4 +24,5 @@ - + + diff --git a/includes/time.inc.php b/includes/time.inc.php deleted file mode 100755 index 0c3d363..0000000 --- a/includes/time.inc.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/index.php b/index.php index 436897d..0aea51c 100755 --- a/index.php +++ b/index.php @@ -10,30 +10,43 @@ killSession(); else: ?> - - -

Current Status

-

You do not appear to have any punches on record.

- -

You have been Punched since .

- +if (!isset($session_punch['0']['intime'])): + $session_status = lang('OUT'); + $session_message = lang('PUNCH_STATUS') . ": " . lang('NO_PUNCHES'); +else: + if (!empty($session_punch['0']['outtime'])): + $session_status = lang('OUT'); + $statustime = $session_punch['0']['outtime']; + $session_message = lang('PUNCH_STATUS') . ": " . $session_status . " " . lang('SINCE') . " " . date('g:i a \o\n M jS, Y', strtotime($statustime)); + else: + $session_status = lang('IN'); + $statustime = $session_punch['0']['intime']; + $punchid = $session_punch['0']['punchid']; + $notes = $session_punch['0']['notes']; + $session_message = lang('PUNCH_STATUS') . ": " . $session_status . " " . lang('SINCE') . " " . date('g:i a \o\n M jS, Y', strtotime($statustime)); + endif; +endif; +?> -

Quick Punch

-

Clicking the button below will immediately enter a new punch for you depending on your current status. Any notes you enter will be attached to the punch for your administrator to review.

+ + + + + + + +

+

+

- + - + @@ -48,8 +61,8 @@ if (!isset($session_punch['0']['intime'])): $status = "Out"; ?> $punchtime = date('Y-m-d H:i:s'); if (!empty($_POST)): if (!empty($_POST['notes'])): $notes = $_POST['notes']; else: $notes = NULL; endif; - if ($status == "In"): punchOut($yaptc_db, $punchid, $notes, $punchtime, NULL); - elseif ($status == "Out"): punchIn($yaptc_db, $_SESSION['user_id'], $notes, $punchtime, NULL); + if ($session_status == lang('IN')): punchOut($yaptc_db, $punchid, $notes, $punchtime, NULL); + elseif ($session_status == lang('OUT')): punchIn($yaptc_db, $_SESSION['user_id'], $notes, $punchtime, NULL); endif; header('Location: ' . $_SERVER['PHP_SELF']); endif; diff --git a/lang/en.lang.php b/lang/en.lang.php new file mode 100644 index 0000000..055515c --- /dev/null +++ b/lang/en.lang.php @@ -0,0 +1,11 @@ + 'You have no recorded punches' + 'QUICK_PUNCH' => 'Quick Punch' + + + + + +// EOF +); ?> diff --git a/lib/date_time.js b/lib/date_time.js deleted file mode 100755 index c6e40f3..0000000 --- a/lib/date_time.js +++ /dev/null @@ -1,29 +0,0 @@ -function date_time(id) -{ - date = new Date; - year = date.getFullYear(); - month = date.getMonth(); - months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); - d = date.getDate(); - day = date.getDay(); - days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); - h = date.getHours(); - if(h<10) - { - h = "0"+h; - } - m = date.getMinutes(); - if(m<10) - { - m = "0"+m; - } - s = date.getSeconds(); - if(s<10) - { - s = "0"+s; - } - result = ''+days[day]+' '+months[month]+' '+d+' '+year+' '+h+':'+m+':'+s; - document.getElementById(id).innerHTML = result; - setTimeout('date_time("'+id+'");','1000'); - return true; -} diff --git a/lib/time.inc.php b/lib/time.inc.php deleted file mode 100755 index 0c3d363..0000000 --- a/lib/time.inc.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/timer.js b/lib/timer.js deleted file mode 100755 index 943aa51..0000000 --- a/lib/timer.js +++ /dev/null @@ -1,19 +0,0 @@ - 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); - }