From 63822bacd44d964df3596f928f44a56ab5625d4f Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 13 Apr 2010 13:33:26 +0300 Subject: Better everything --- public/css/screen.css | 7 +-- public/day.php | 121 +++++++++++++++++++++++++++++++++++++------------- public/index.php | 3 ++ public/js/atwork.js | 13 +++--- system/init.php | 2 +- system/ma.db | Bin 4096 -> 0 bytes 6 files changed, 104 insertions(+), 42 deletions(-) delete mode 100644 system/ma.db diff --git a/public/css/screen.css b/public/css/screen.css index 38fef4b..3240d3b 100644 --- a/public/css/screen.css +++ b/public/css/screen.css @@ -1,4 +1,5 @@ /** + * atwork/css/screen.css * */ body { @@ -21,7 +22,6 @@ body { .day { width:110px; height:110px; - background-color:#cacaca; float:left; margin:2px; padding:5px; @@ -30,6 +30,7 @@ body { -webkit-border-radius:5px; color:#000; font-weight:bold; + background-color:#cdcdcd; } .day:hover { cursor:pointer; @@ -72,8 +73,8 @@ h2 { color:#999; } textarea { - width:360px; + width:358px; resize:none; padding:3px; height:80px; -} \ No newline at end of file +} diff --git a/public/day.php b/public/day.php index 1c21f1b..9dd5377 100644 --- a/public/day.php +++ b/public/day.php @@ -5,14 +5,21 @@ require_once '../system/init.php'; - $sql = 'SELECT * FROM atwork WHERE user = ? AND start <= ? AND finish >= ?'; + $tmp = explode('.', $_POST['d']); + $date = sprintf('%d-%02d-%02d', $tmp[2], $tmp[1], $tmp[0]); + + // Find this day + $sql = "SELECT * FROM atwork WHERE user = ? + AND date(?) BETWEEN date(start) AND date(finish);"; $stmt = $db->prepare($sql); - $stmt->execute(array($_SESSION['user'], $_POST['d'], $_POST['d'])); -// print_r($stmt->fetchAll()); + $stmt->execute(array($_SESSION['user'], $date)); + $day = $stmt->fetchAll(); + $day = array_pad($day, 5, array()); ?> +
- + @@ -22,50 +29,83 @@ - + - - + - + - + + + + + + + -
-
+ - : - + : + - - + + :
Merkinnät -
-
+ +
Merkinnät
+
+ Lounastauko +
\ No newline at end of file diff --git a/public/index.php b/public/index.php index 2886540..8ca60a6 100644 --- a/public/index.php +++ b/public/index.php @@ -2,12 +2,15 @@ //// // atwork/index.php + require_once '../system/init.php'; if (!empty($_POST['date'])) { $format = '%d-%02d-%02d %02d:%02d'; $date = explode('.', $_POST['date']); + // First we check if we insert or update + $sql = 'INSERT INTO atwork (user, start, finish) VALUES (?, ?, ?)'; $stmt = $db->prepare($sql); diff --git a/public/js/atwork.js b/public/js/atwork.js index f4a306b..145636a 100644 --- a/public/js/atwork.js +++ b/public/js/atwork.js @@ -1,6 +1,5 @@ -/** - * atwork/js/atwork.js - */ +//// +// atwork/js/atwork.js function lpad(str, pad, len) { @@ -37,9 +36,9 @@ $(function() $('#dialog').dialog({ autoOpen: false, - height:340, - width:400, - modal:true, + height:380, + width:395, + modal:false, draggable:false, resizable:false, buttons: { @@ -48,6 +47,8 @@ $(function() }, 'Oletus': function() { // Sets default hours + $('#type').val('1'); + $('#lunch').attr('checked', 'checked'); $('.start_h:first').val('10'); $('.start_m:first').val('00'); $('.finish_h:first').val('18'); diff --git a/system/init.php b/system/init.php index aa9672a..193a05b 100644 --- a/system/init.php +++ b/system/init.php @@ -13,6 +13,6 @@ $_SESSION['user'] = 'filipp'; $basedir = realpath(__FILE__ . '/../../'); - $db = new PDO("sqlite:{$basedir}/system/ma.db"); + $db = new PDO("sqlite:{$basedir}/system/atwork.db"); ?> diff --git a/system/ma.db b/system/ma.db deleted file mode 100644 index 4ae2dd2..0000000 Binary files a/system/ma.db and /dev/null differ -- cgit v1.2.3