From: Steve Sutton Date: Wed, 16 Jul 2014 14:10:22 +0000 (-0400) Subject: update order form X-Git-Tag: v1.0^2~10 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a2e4bef8f6848c3292fd79bbf00a7b4d3b90a649;p=web%2FBigFore.git update order form add the order form to the main template on the website. It does goto the second page on the form with the fields all setup. --- diff --git a/Toolkit/Page.php b/Toolkit/Page.php index af96920..232821a 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -147,6 +147,8 @@ class Toolkit_Page $GLOBALS['styleSheets'] = array(); // Resources needed for every page. $GLOBALS['topScripts'][] = JQUERY_CDN_JS; + $GLOBALS['topScripts'][] = JQUERY_UI_CDN_JS; + $GLOBALS['styleSheets'][] = JQUERY_UI_CDN_CSS; } private function _video() @@ -412,6 +414,9 @@ class Toolkit_Page */ public function fetchPage() { + $nextWeek = mktime(0, 0, 0, date('m'), date('d') + 7, date('Y')); + $this->arrivalDate = date('m').'/'.date('d').'/'.date('Y'); + $this->departureDate = date('m', $nextWeek).'/'.date('d', $nextWeek).'/'.date('Y', $nextWeek); if (defined('MEMBERS_DB') && MEMBERS_DB) { // check to see if this page is a member only page $memberOnlyPage = Toolkit_Template_Page::isMemberOnly( diff --git a/priceQuoteForm.inc b/priceQuoteForm.inc index bd64d9e..0211dae 100644 --- a/priceQuoteForm.inc +++ b/priceQuoteForm.inc @@ -9,8 +9,29 @@ require_once 'HTML/QuickForm/Action/Back.php'; require_once 'HTML/QuickForm/Action/Jump.php'; require_once 'HTML/QuickForm/Action/Display.php'; -// Start the session, form-page values will be kept there -//session_start(); +$arrival = filter_var($_REQUEST['arrival']); +$departure = filter_var($_REQUEST['departure']); +if ($arrival && $departure) { + if (!is_array($arrival) && !is_array($departure)) { + $pattern = '%([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})%'; + if (preg_match($pattern, $arrival, $matches)) { + $_POST['arrival'] = array(); + $_POST['arrival']['m'] = (int)$matches[1]; + $_POST['arrival']['d'] = $matches[2]; + $_POST['arrival']['Y'] = $matches[3]; + $_SESSION['_spacey_container']['values']['page1']['arrival'] + = $_POST['arrival']; + } + if (preg_match($pattern, $departure, $matches)) { + $_POST['departure'] = array(); + $_POST['departure']['m'] = (int)$matches[1]; + $_POST['departure']['d'] = $matches[2]; + $_POST['departure']['Y'] = $matches[3]; + $_SESSION['_spacey_container']['values']['page1']['departure'] + = $_POST['departure']; + } + } +} // Check to make sure the end date is the // same as the start date or later in the year. @@ -47,7 +68,7 @@ function checkCountryState($data) function date_difference($m0, $d0, $y0, $m1, $d1, $y1) { - $arrival = gregoriantojd($m0, $d0, $y0); + $arrival = gregoriantojd($m0, $d0, $y0); $departure = gregoriantojd($m1, $d1, $y1); $diff = $departure - $arrival; @@ -135,7 +156,7 @@ class PageFirst extends PageBase $nextWeek = mktime(0, 0, 0, date('m'), date('d') + 7, date('Y')); $defaults = array( - 'arrival' => array('m' => date('m'), 'd' => date('d'), 'Y' => date('Y')), + 'arrival' => array('m' => date('m'), 'd' => date('d'), 'Y' => date('Y')), 'departure' => array('m' => date('m', $nextWeek), 'd' => date('d', $nextWeek), 'Y' => date('Y', $nextWeek)), ); $golfers = array('' => '-- Select --') + range(0, 20); @@ -167,7 +188,7 @@ class PageSecond extends PageBase { $this->_formBuilt = true; - $golfers= $this->controller->exportValue('page1', 'golfers'); + $golfers = $this->controller->exportValue('page1', 'golfers'); $nongolfers = $this->controller->exportValue('page1', 'nongolfers'); $attendees = $golfers + $nongolfers; @@ -177,8 +198,7 @@ class PageSecond extends PageBase $singles = array('' => '-- Select --') + range(0, $attendees); $accomodations = array('' => '-- Select --') + range(0, $attendees); $bathrooms = range(1, $attendees); - foreach ($bathrooms as $k => $v) - { + foreach ($bathrooms as $k => $v) { $temp[++$k] = $v; } unset($bathrooms); @@ -188,18 +208,18 @@ class PageSecond extends PageBase $lodging[] = array('type' => 'radio', 'req' => true, 'name' => 'lodging', 'display' => null, 'opts' => 'Hamlet Village', 'att' => 'Hamlet Village Condominiums'); $lodging[] = array('type' => 'radio', 'req' => true, 'name' => 'lodging', 'display' => null, 'opts' => 'Trout Creek', 'att' => 'Trout Creek Condominiums'); - $bedOptions[] = array('type' => 'checkbox', 'req' => false, 'name' => 'twin', 'display' => null, 'opts' => 'Twin Bed is OK'); - $bedOptions[] = array('type' => 'checkbox', 'req' => false, 'name' => 'sleeper', 'display' => null, 'opts' => 'Sleeper Sofa is OK'); + $bedOptions[] = array('type' => 'checkbox', 'req' => false, 'name' => 'twin', 'display' => null, 'opts' => 'Twin Bed is OK'); + $bedOptions[] = array('type' => 'checkbox', 'req' => false, 'name' => 'sleeper', 'display' => null, 'opts' => 'Sleeper Sofa is OK'); - $elements[] = array('type' => 'header', 'req' => false, 'name' => 'header_rmv', 'display' => 'Package Price Quote Request page 2 of 4'); - $elements[] = array('type' => 'group', 'req' => true, 'name' => 'accommodation', 'group' => $lodging, 'label' => 'Lodging:', 'appendName' => false); - $elements[] = array('type' => 'select', 'req' => true, 'name' => 'couples', 'display' => 'Number of Couples:', 'opts' => $couples); - $elements[] = array('type' => 'select', 'req' => true, 'name' => 'singles', 'display' => 'Number of Singles:', 'opts' => $singles); - $elements[] = array('type' => 'select', 'req' => false, 'name' => 'bathrooms', 'display' => 'Number of Bathrooms:','opts' => $bathrooms); - $elements[] = array('type' => 'header', 'req' => false, 'name' => 'accomodation_rmv', 'display' => 'Accommodation Type Preference'); - $elements[] = array('type' => 'select', 'req' => true, 'name' => 'rooms', 'display' => 'Number of Rooms:', 'opts' => $accomodations); - $elements[] = array('type' => 'select', 'req' => true, 'name' => 'beds', 'display' => 'Number of Beds:', 'opts' => $accomodations); - $elements[] = array('type' => 'group', 'req' => false, 'name' => 'bedOptions', 'group' => $bedOptions, 'label' => 'Bed Options:', 'separator' => '
', 'appendName' => false); + $elements[] = array('type' => 'header', 'req' => false, 'name' => 'header_rmv', 'display' => 'Package Price Quote Request page 2 of 4'); + $elements[] = array('type' => 'group', 'req' => true, 'name' => 'accommodation', 'group' => $lodging, 'label' => 'Lodging:', 'appendName' => false); + $elements[] = array('type' => 'select', 'req' => true, 'name' => 'couples', 'display' => 'Number of Couples:', 'opts' => $couples); + $elements[] = array('type' => 'select', 'req' => true, 'name' => 'singles', 'display' => 'Number of Singles:', 'opts' => $singles); + $elements[] = array('type' => 'select', 'req' => false, 'name' => 'bathrooms', 'display' => 'Number of Bathrooms:','opts' => $bathrooms); + $elements[] = array('type' => 'header', 'req' => false, 'name' => 'accomodation_rmv', 'display' => 'Accommodation Type Preference'); + $elements[] = array('type' => 'select', 'req' => true, 'name' => 'rooms', 'display' => 'Number of Rooms:', 'opts' => $accomodations); + $elements[] = array('type' => 'select', 'req' => true, 'name' => 'beds', 'display' => 'Number of Beds:', 'opts' => $accomodations); + $elements[] = array('type' => 'group', 'req' => false, 'name' => 'bedOptions', 'group' => $bedOptions, 'label' => 'Bed Options:', 'separator' => '
', 'appendName' => false); $prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Next step >>'); @@ -213,8 +233,8 @@ class PageSecond extends PageBase $defaults = array( 'couples' => '', 'singles' => '', - 'rooms' => '', - 'beds' =>'', + 'rooms' => '', + 'beds' => '', ); $this->setDefaults($defaults); } diff --git a/templates/template.html b/templates/template.html index 137d44c..b9162f4 100644 --- a/templates/template.html +++ b/templates/template.html @@ -27,9 +27,29 @@

Quote Request

-
+ + + + + + +
+