From 614d78e98430c2e7245f9efcb40032f9ff06b44c Mon Sep 17 00:00:00 2001 From: arzynik Date: Mon, 14 Oct 2013 13:42:53 -0700 Subject: [PATCH] added hours tester --- .../default/cockpit/test/index.php | 24 +++++++++---------- .../default/cockpit/tests/hours/index.php | 22 +++++++++++++++++ 2 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 include/controllers/default/cockpit/tests/hours/index.php diff --git a/include/controllers/default/cockpit/test/index.php b/include/controllers/default/cockpit/test/index.php index b734f8974..9b00bf1c3 100644 --- a/include/controllers/default/cockpit/test/index.php +++ b/include/controllers/default/cockpit/test/index.php @@ -2,22 +2,22 @@ class Controller_test extends Crunchbutton_Controller_Account { public function init() { - - $id = 'CC7kIW3yIIOJfFJl5fvDy8hG'; - c::balanced(); + $r = new Restaurant(21); - echo c::balanced()->cards->uri.'/'.$id; + $time = '2013-10-13 00:12:00'; +//$time = new DateTime($time, new DateTimeZone($r->timezone)); +//echo $time->format('Y-m-d H:i:s'); + + + if ($r->open($time)) { + echo 'open'; + } else { + echo 'closed'; + } + exit; - $card = Crunchbutton_Balanced_Card::byId($id); - echo $card->uri; - exit; - - - - die(c::balanced()->uri); - if (c::admin()->permission()->check(['test','testsss'])) { echo 'true'; } else { diff --git a/include/controllers/default/cockpit/tests/hours/index.php b/include/controllers/default/cockpit/tests/hours/index.php new file mode 100644 index 000000000..6aded9e48 --- /dev/null +++ b/include/controllers/default/cockpit/tests/hours/index.php @@ -0,0 +1,22 @@ +format('Y-m-d H:i:s'); + if (!$_REQUEST['t'] || $_REQUEST['t'] == 'NOW') { + $time = $now; + c::view()->now = true; + } else { + $time = $_REQUEST['t']; + } + + + c::view()->restaurant = $restaurant; + c::view()->open = $restaurant->open($time); + c::view()->time = new DateTime($time, new DateTimeZone($restaurant->timezone)); + + c::view()->display('tests/hours/index'); + } +} \ No newline at end of file