From 05bf1f96825dc09ab0761392136b832bd546171e Mon Sep 17 00:00:00 2001 From: Josh North Date: Thu, 26 Feb 2015 12:44:21 -0500 Subject: [PATCH] Updated Pure to 0.6, added pagination, don't think I broke anything... --- config.inc.php.example | 9 +- includes/functions.inc.php | 26 +- includes/menu.inc.php | 18 +- lang/en.lang.php | 0 lib/pure/HISTORY.md | 439 ++++++++++ lib/pure/README.md | 177 ++++ lib/pure/base-context-min.css | 8 +- lib/pure/base-context.css | 475 +++++------ lib/pure/base-min.css | 8 +- lib/pure/base.css | 557 ++++++------- lib/pure/bower.json | 5 +- lib/pure/buttons-core-min.css | 6 +- lib/pure/buttons-core.css | 10 +- lib/pure/buttons-min.css | 6 +- lib/pure/buttons.css | 14 +- lib/pure/forms-min.css | 6 +- lib/pure/forms-nr-min.css | 6 +- lib/pure/forms-nr.css | 53 +- lib/pure/forms.css | 53 +- lib/pure/grids-core-min.css | 6 +- lib/pure/grids-core.css | 11 +- lib/pure/grids-min.css | 6 +- lib/pure/grids-responsive-min.css | 4 +- lib/pure/grids-responsive-old-ie-min.css | 6 +- lib/pure/grids-responsive-old-ie.css | 640 +-------------- lib/pure/grids-responsive.css | 4 +- lib/pure/grids-units-min.css | 4 +- lib/pure/grids-units.css | 4 +- lib/pure/grids.css | 11 +- lib/pure/menus-core-min.css | 6 +- lib/pure/menus-core.css | 147 +--- lib/pure/menus-dropdown-min.css | 7 + lib/pure/menus-dropdown.css | 44 + lib/pure/menus-horizontal-min.css | 7 + lib/pure/menus-horizontal.css | 25 + lib/pure/menus-min.css | 6 +- lib/pure/menus-nr-min.css | 7 - lib/pure/menus-nr.css | 285 ------- lib/pure/menus-paginator-min.css | 7 - lib/pure/menus-paginator.css | 61 -- lib/pure/menus-scrollable-min.css | 7 + lib/pure/menus-scrollable.css | 33 + lib/pure/menus-skin-min.css | 7 + lib/pure/menus-skin.css | 57 ++ lib/pure/menus.css | 348 +++----- lib/pure/pure-min.css | 8 +- lib/pure/pure-nr-min.css | 8 +- lib/pure/pure-nr.css | 966 +++++++++------------- lib/pure/pure.css | 977 +++++++++-------------- lib/pure/tables-min.css | 6 +- lib/pure/tables.css | 14 +- manualpunch.php | 123 +-- profile.php | 21 +- reports.php | 6 +- users.php | 92 ++- 55 files changed, 2459 insertions(+), 3388 deletions(-) mode change 100644 => 100755 lang/en.lang.php create mode 100755 lib/pure/HISTORY.md create mode 100755 lib/pure/README.md create mode 100755 lib/pure/menus-dropdown-min.css create mode 100755 lib/pure/menus-dropdown.css create mode 100755 lib/pure/menus-horizontal-min.css create mode 100755 lib/pure/menus-horizontal.css delete mode 100755 lib/pure/menus-nr-min.css delete mode 100755 lib/pure/menus-nr.css delete mode 100755 lib/pure/menus-paginator-min.css delete mode 100755 lib/pure/menus-paginator.css create mode 100755 lib/pure/menus-scrollable-min.css create mode 100755 lib/pure/menus-scrollable.css create mode 100755 lib/pure/menus-skin-min.css create mode 100755 lib/pure/menus-skin.css diff --git a/config.inc.php.example b/config.inc.php.example index b717be7..787ad5b 100755 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -5,11 +5,12 @@ $yaptc_dirpath = '/usr/share/nginx/html/yaptc/'; // Absolute directory path to $yaptc_webpath = 'http://server-ip/yaptc/'; // Absolute URL to the root of this program $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_allowadvancedpunch = 'yes'; // Should we allow users to make manual punch entries? set to yes or no +$db = new PDO('mysql:host=localhost;dbname=YOUR_DATABASE;charset=utf8', 'YOUR_USER', 'YOUR_PASSWORD'); // Database connection string +$yaptc_allowuseradvancedpunch = 'yes'; // Should we allow users to make manual punch entries? $yaptc_min_password = '8'; // Minimum password length -$yaptc_language = 'en'; // 2-character language code. Used to set HTML header and language template +$yaptc_language = 'en'; // 2-character language code for header and template. See http://www.w3schools.com/tags/ref_language_codes.asp +$timezone = 'America/New_York'; // Primary timezone of system - eventually to work across timezones... +$rowsperpage = '25'; // How many rows per page for tables? diff --git a/includes/functions.inc.php b/includes/functions.inc.php index 9a426e8..d1e15b3 100755 --- a/includes/functions.inc.php +++ b/includes/functions.inc.php @@ -12,6 +12,7 @@ function lang($phrase){ 'NO_PUNCHES' => 'You have no recorded punches', 'NOT_AUTHORIZED' => 'Not Authorized!', 'OUT' => 'Out', + 'PAGE' => 'Page', 'IN' => 'In', 'ADD_USER' => 'Add User', 'ADD_USER_DESC' => 'All fields are required! Username and email must be unique. Minimum password length is ', @@ -24,7 +25,9 @@ function lang($phrase){ 'ACCOUNT' => 'Account', 'META_DESC' => 'YAPTC Timecard system is a time recording application for small businesses.', 'USERS' => 'Manage Users', + 'SAVE_PUNCH_WARNING' => 'Are you sure you want to save the edit to this user punch?', 'SAVE' => 'Save', + 'DELETE' => 'Delete', 'NEW' => 'New', 'NAME' => 'Name', 'CONFIRM' => 'Confirm', @@ -51,6 +54,8 @@ function lang($phrase){ 'EMAIL' => 'E-Mail', 'USER_INFORMATION' => 'User Information', 'PUNCH_EDITOR' => 'Punch Edit', + 'EDIT_PUNCH_HEADER' => 'User Punches', + 'EDIT_PUNCH_DESC' => 'Edit or delete existing punches for users if needed. WARNING - there is NO UNDO for these actions!!!', 'PLEASE_LOG_IN' => 'Please log in to use the timecard system', 'REPORTS' => 'Reports', 'SINCE' => 'since', @@ -73,6 +78,9 @@ $timenow = date('Y-m-d H:i:s'); // This Version $yaptc_version = 'yaptc 0.8-beta'; +// Timezone from config +date_default_timezone_set("$timezone"); + // 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 @@ -162,10 +170,8 @@ function getPunchStatus($yaptc_db, $userid) return array ($result['punchid'], $result['userid'], $result['intime'], $result['outtime'], $result['notes']); } - - -// List punches sorted by intime. Pass uid or % for all. Pass limit to restrict row results. Default is set to tons of 9's because no wildcard exists for limit in mysql or pgsql -function listPunches($db, $uid, $limit = "999999999999999") { +// List punches sorted by intime. Pass uid or % for all. Pass limit to restrict row results. Default is set to tons of 9's because no wildcard exists for limit in mysql or pgsql. Limit can also include offset for pagination, i.e. "20,10" for a result of 10 records starting 20 records in +function listPunches($db, $uid, $limit = "999999999999999", $offset = "0") { $stmt = $db->prepare(' SELECT ROUND(TIME_TO_SEC(TIMEDIFF(punches.outtime, punches.intime))/3600,2) AS punchhours, @@ -181,17 +187,18 @@ function listPunches($db, $uid, $limit = "999999999999999") { INNER JOIN yaptc.users ON punches.userid = users.id WHERE users.id LIKE :uid ORDER BY punches.intime DESC - LIMIT :limit + LIMIT :limit OFFSET :offset '); $stmt->execute(array( ':uid' => $uid, ':limit' => $limit, + ':offset' => $offset )); return $stmt->fetchAll(PDO::FETCH_ASSOC); } // Get user info from user id. Pass uid or % for all. -function getUserInfo($db, $uid) { +function getUserInfo($db, $uid, $limit = "999999999999999", $offset = "0") { $stmt = $db->prepare(' SELECT users.id AS userid, @@ -206,10 +213,13 @@ function getUserInfo($db, $uid) { FROM yaptc.users INNER JOIN yaptc.usertypes ON users.usertype = usertypes.id WHERE users.id LIKE :uid - ORDER BY users.lastname ASC; + ORDER BY users.lastname ASC + LIMIT :limit OFFSET :offset '); $stmt->execute(array( - ':uid' => $uid + ':uid' => $uid, + ':limit' => $limit, + ':offset' => $offset )); return $stmt->fetchAll(PDO::FETCH_ASSOC); } diff --git a/includes/menu.inc.php b/includes/menu.inc.php index 5005061..02d3927 100755 --- a/includes/menu.inc.php +++ b/includes/menu.inc.php @@ -1,5 +1,5 @@ @@ -7,22 +7,22 @@ $session_status = getSessionStatus();