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.
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;
$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);
{
$this->_formBuilt = true;
- $golfers= $this->controller->exportValue('page1', 'golfers');
+ $golfers = $this->controller->exportValue('page1', 'golfers');
$nongolfers = $this->controller->exportValue('page1', 'nongolfers');
$attendees = $golfers + $nongolfers;
$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);
$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' => '<br>', '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' => '<br>', 'appendName' => false);
$prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Next step >>');
$defaults = array(
'couples' => '',
'singles' => '',
- 'rooms' => '',
- 'beds' =>'',
+ 'rooms' => '',
+ 'beds' => '',
);
$this->setDefaults($defaults);
}