From accc804040abbf945a95a4bd4a54aaf9d45584a9 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 28 Jun 2017 16:11:35 -0600 Subject: [PATCH] Add total hours this week on the Punch Card screen --- lang/en_us.php | 4 +++- pages/punches.php | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lang/en_us.php b/lang/en_us.php index a28ab15..2620fcb 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -40,5 +40,7 @@ define("STRINGS", [ "out" => "Out", "notes" => "Notes", "view punch card" => "View punch card", - "na" => "N/A" + "na" => "N/A", + "this week" => "This week", + "x on the clock" => "{time} on the clock" ]); \ No newline at end of file diff --git a/pages/punches.php b/pages/punches.php index a38f74f..0202678 100644 --- a/pages/punches.php +++ b/pages/punches.php @@ -3,6 +3,32 @@ require_once __DIR__ . '/../required.php'; redirectifnotloggedin(); ?> +
+
+
+
+

+ +

+
+
+

+ select('punches', ['in', 'out'], ['AND' => ['uid' => $_SESSION['uid'], 'in[>]' => $weekstart]]); + $punchtimes = []; + foreach ($punches as $p) { + $punchtimes[] = [$p['in'], $p['out']]; + } + $totalseconds = sumelapsedtimearray($punchtimes); + lang2("x on the clock", ["time" => seconds2string($totalseconds, false)]); + ?> +

+
+
+
+