diff --git a/.gitignore b/.gitignore
index 07fe371..2b4bcaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
vendor
settings.php
nbproject/private
-*.sync-conflict*
\ No newline at end of file
+*.sync-conflict*
+database.mwb.bak
\ No newline at end of file
diff --git a/action.php b/action.php
index f4f4851..4512c08 100644
--- a/action.php
+++ b/action.php
@@ -3,7 +3,6 @@
/**
* Make things happen when buttons are pressed and forms submitted.
*/
-
require_once __DIR__ . "/required.php";
dieifnotloggedin();
@@ -25,6 +24,10 @@ function returnToSender($msg, $arg = "") {
}
switch ($VARS['action']) {
+ case "time":
+ $out = ["status" => "OK", "time" => date(TIME_FORMAT), "date" => date(LONG_DATE_FORMAT), "seconds" => date("s")];
+ header('Content-Type: application/json');
+ exit(json_encode($out));
case "signout":
session_destroy();
header('Location: index.php');
diff --git a/api.php b/api.php
index 963268c..c4af15c 100644
--- a/api.php
+++ b/api.php
@@ -31,6 +31,6 @@ switch ($VARS['action']) {
$out = ["status" => "OK", "maxresults" => $max, "pong" => true];
exit(json_encode($out));
default:
- header("HTTP/1.1 400 Bad Request");
- die("\"400 Bad Request\"");
+ http_response_code(404);
+ die("\"404 Action not found\"");
}
\ No newline at end of file
diff --git a/database.mwb b/database.mwb
new file mode 100644
index 0000000..8aa40df
Binary files /dev/null and b/database.mwb differ
diff --git a/lang/en_us.php b/lang/en_us.php
index 0c69d14..5cebf56 100644
--- a/lang/en_us.php
+++ b/lang/en_us.php
@@ -25,4 +25,7 @@ define("STRINGS", [
"login server user data error" => "The login server refused to provide account information. Try again or contact technical support.",
"captcha error" => "There was a problem with the CAPTCHA (robot test). Try again.",
"home" => "Home",
+ "punch in out" => "Punch In/Out",
+ "you are punched in" => "You are punched in.",
+ "you are not punched in" => "You are not on the clock."
]);
\ No newline at end of file
diff --git a/pages.php b/pages.php
index 6c876d4..d1180b4 100644
--- a/pages.php
+++ b/pages.php
@@ -5,7 +5,10 @@ define("PAGES", [
"home" => [
"title" => "home",
"navbar" => true,
- "icon" => "home"
+ "icon" => "home",
+ "scripts" => [
+ "static/js/home.js"
+ ]
],
"404" => [
"title" => "404 error"
diff --git a/pages/home.php b/pages/home.php
index 9a1eb8d..ff832c1 100644
--- a/pages/home.php
+++ b/pages/home.php
@@ -1 +1,40 @@
-
Hello World
\ No newline at end of file
+
\ No newline at end of file
diff --git a/pages/punches.php b/pages/punches.php
new file mode 100644
index 0000000..9a1eb8d
--- /dev/null
+++ b/pages/punches.php
@@ -0,0 +1 @@
+Hello World
\ No newline at end of file
diff --git a/settings.template.php b/settings.template.php
index 7f774eb..8f16382 100644
--- a/settings.template.php
+++ b/settings.template.php
@@ -35,6 +35,17 @@ define("PORTAL_KEY", "123");
// For supported values, see http://php.net/manual/en/timezones.php
define("TIMEZONE", "America/Denver");
+// See http://php.net/manual/en/function.date.php
+define("TIME_FORMAT", "g:i A"); // 12 hour time
+#define("TIME_FORMAT", "G:i"); // 24 hour time
+
+// Used in many places
+define("DATETIME_FORMAT", "M j Y g:i:s A"); // 12 hour time
+#define("DATETIME_FORMAT", "M j Y G:i:s"); // 24 hour time
+
+// Used on the clock widget
+define("LONG_DATE_FORMAT", "l F j");
+
// Base URL for site links.
define('URL', 'http://localhost/qwikclock');
diff --git a/static/img/logo.png b/static/img/logo.png
index d950420..e6f4fe4 100644
Binary files a/static/img/logo.png and b/static/img/logo.png differ
diff --git a/static/img/logo.svg b/static/img/logo.svg
index 410fb09..3a7d045 100644
--- a/static/img/logo.svg
+++ b/static/img/logo.svg
@@ -16,19 +16,11 @@
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.svg"
- inkscape:export-filename="/home/skylar/Documents/Projects/Sources/WebAppTemplate/static/img/logo.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
+ inkscape:export-filename="/home/skylar/Documents/Projects/Assets/QwikClock/logo_64.png"
+ inkscape:export-xdpi="11.25"
+ inkscape:export-ydpi="11.25">
-
-
+ id="defs4" />
-
+
+
+
+
+
+
+
+
+
+
diff --git a/static/js/home.js b/static/js/home.js
new file mode 100644
index 0000000..5884e00
--- /dev/null
+++ b/static/js/home.js
@@ -0,0 +1,45 @@
+function setClock() {
+ $.getJSON("action.php", {
+ action: "time"
+ }, function (resp) {
+ if (resp.status == "OK") {
+ $('#server_time').text(resp.time);
+ $('#server_date').text(resp.date);
+ var seconds = resp.seconds * 1;
+ var interval = 60 - seconds;
+ console.log(interval);
+ if (interval > 5) {
+ interval = 5;
+ }
+ console.log(interval);
+ console.log((((seconds + interval) / 60) * 100));
+ $('#seconds_bar div').animate({
+ width: (((seconds + interval) / 60) * 100) + "%"
+ }, 1000 * interval, "linear", function () {
+ if (interval < 5) {
+ $('#seconds_bar div').animate({
+ width: "0%"
+ }, 1000, "linear", function () {
+ $('#seconds_bar div').animate({
+ width: (((5 - interval - 1) / 60) * 100) + "%"
+ }, 1000 * (5 - interval - 1), "linear");
+ });
+ }
+ });
+ }
+ });
+}
+
+function setSeconds() {
+ //$('#seconds_bar div').css("width", ((seconds / 60) * 100) + "%");
+ $('#seconds_bar div').animate({
+ width: ((seconds / 60) * 100) + "%"
+ }, 1000, "linear", function () {
+ seconds++;
+ });
+}
+
+$(document).ready(function () {
+ setClock();
+ setInterval(setClock, 5000);
+});
\ No newline at end of file