From: Steve Sutton Date: Thu, 11 Feb 2010 20:17:38 +0000 (+0000) Subject: update for streamsend fields and for referrby and unitsize X-Git-Tag: v1.0.0~65 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5444dd10abd8664a4abb00044d9853a82e5f6287;p=web%2FTroutCreek.git update for streamsend fields and for referrby and unitsize --- diff --git a/Toolkit/Contacts/ContactUs.php b/Toolkit/Contacts/ContactUs.php index 16ce556..fa25b02 100755 --- a/Toolkit/Contacts/ContactUs.php +++ b/Toolkit/Contacts/ContactUs.php @@ -394,29 +394,12 @@ class Toolkit_Contacts_ContactUs $this->setInterestFields(); // Grouped Elements are defined here. $this->interestsGroups =& $this->getInterestFields(); - + // referred by + $this->setReferredBy(); // unit sizes - $unit_size2[''] = "-- Select --"; - $unit_size2[6] = "5 bedroom & loft, 3.5 bathroom (sleeps 12)"; - $unit_size2[0] = "3 bedroom & loft, 2 bathroom (sleeps 8-10)"; - $unit_size2[1] = "2 bedroom & loft, 2 bathroom (sleeps 6-8)"; - $unit_size2[2] = "2 bedroom, 2 bathroom + (sleeps 4-6)"; - $unit_size2[3] = "2 bedroom, 2 bathroom (sleeps 4-6)"; - $unit_size2[4] = "2 bedroom, 1 bathroom (sleeps 4-6)"; - $unit_size2[5] = "1 bedroom, 1 bathroom (sleeps 2-4)"; + $this->setUnitSize(); + - // referred by - $referred_by2[''] = "-- Select --"; - $referred_by2[0] = "AAA"; - $referred_by2[1] = "Big Fore"; - $referred_by2[2] = "Chamber/Visitors Bureau"; - $referred_by2[3] = "Detroit Free Press"; - $referred_by2[4] = "Friends/Relatives"; - $referred_by2[5] = "Great Rentals Web Site"; - $referred_by2[6] = "Internet"; - $referred_by2[7] = "Nubs Nob"; - $referred_by2[8] = "Other"; - $referred_by2[9] = "Past Guest"; // All Elements are created here. This includes group element definitions. $e[] = array( 'type' => 'hidden', @@ -516,14 +499,14 @@ class Toolkit_Contacts_ContactUs 'req' => false, 'name' => 'unit_size', 'display' => 'Unit Size:', - 'opts' => $unit_size2 + 'opts' => $this->unit_size ); $e[] = array( 'type' => 'select', 'req' => true, 'name' => 'referred_by', 'display' => 'How did you hear about Trout Creek?', - 'opts' => $referred_by2 + 'opts' => $this->referred_by ); $e[] = array( 'type' => 'textarea', @@ -802,6 +785,8 @@ class Toolkit_Contacts_ContactUs } $page->formData['interest']['element'] = implode('
', $interests); } + $page->formData['referred_by'] = ($page->formData['referred_by'] != '') ? $this->referred_by[$page->formData['referred_by']]: null; + $page->formData['unit_size'] = ($page->formData['unit_size'] != '') ? $this->unit_size[$page->formData['unit_size']]: null; if ($this->elementExists('mail_ok')) { // Clean up the mail_ok flag so its human readable @@ -992,9 +977,27 @@ class Toolkit_Contacts_ContactUs && STREAMSEND_FORMS_API && $values['mail_ok'] ) { + //echo '
'.print_r($values, true).'
'; + // Insert the record into the streamsend server + $ssData = $values; + $ssData['referred_by'] = ($ssData['referred_by'] != '') ? $this->referred_by[$ssData['referred_by']]: null; + $ssData['unit_size'] = ($ssData['unit_size'] != '') ? $this->unit_size[$ssData['unit_size']]: null; + if (!empty($ssData['interest'])) { + foreach ($ssData['interest']['Let us know what you are interested in'] as $intId => $intTrue) { + $interest[] = $this->inquiries['Let us know what you are interested in'][$intId]; + } + if (!empty($interest)) { + $ssData['interest'] = implode("|", $interest); + } + } + $ssData['arrive_date'] = ($ssData['arrive_date']['m']) ? implode("/", $ssData['arrive_date']): null; + $ssData['depart_date'] = ($ssData['depart_date']['m']) ? implode("/", $ssData['depart_date']): null; + + //echo '
'.print_r($ssData, true).'
';exit; + $streamSend = new Toolkit_Contacts_StreamSend(); - $streamSend->addContact($values); + $streamSend->addContact($ssData); } $values['unit_size'] = (!$values['unit_size']) ? null: $values['unit_size']; // prep the dates @@ -1074,6 +1077,37 @@ class Toolkit_Contacts_ContactUs } // }}} + // {{{ setReferredBy() + function setReferredBy() + { + $referred_by[''] = "-- Select --"; + $referred_by[0] = "AAA"; + $referred_by[1] = "Big Fore"; + $referred_by[2] = "Chamber/Visitors Bureau"; + $referred_by[3] = "Detroit Free Press"; + $referred_by[4] = "Friends/Relatives"; + $referred_by[5] = "Great Rentals Web Site"; + $referred_by[6] = "Internet"; + $referred_by[7] = "Nubs Nob"; + $referred_by[8] = "Other"; + $referred_by[9] = "Past Guest"; + $this->referred_by = $referred_by; + } + // }}} + // {{{ setUnitSize() + function setUnitSize() + { + $unit_size[''] = "-- Select --"; + $unit_size[6] = "5 bedroom & loft, 3.5 bathroom (sleeps 12)"; + $unit_size[0] = "3 bedroom & loft, 2 bathroom (sleeps 8-10)"; + $unit_size[1] = "2 bedroom & loft, 2 bathroom (sleeps 6-8)"; + $unit_size[2] = "2 bedroom, 2 bathroom + (sleeps 4-6)"; + $unit_size[3] = "2 bedroom, 2 bathroom (sleeps 4-6)"; + $unit_size[4] = "2 bedroom, 1 bathroom (sleeps 4-6)"; + $unit_size[5] = "1 bedroom, 1 bathroom (sleeps 2-4)"; + $this->unit_size = $unit_size; + } + // }}} // {{{ setupRenderers() // @codeCoverageIgnoreStart diff --git a/Toolkit/Contacts/StreamSend.php b/Toolkit/Contacts/StreamSend.php index dd7658c..c0deb6e 100755 --- a/Toolkit/Contacts/StreamSend.php +++ b/Toolkit/Contacts/StreamSend.php @@ -70,15 +70,21 @@ class Toolkit_Contacts_StreamSend * @access protected */ protected $streamSendFields = array( - 'email' => 'email-address', - 'fname' => 'first-name', - 'lname' => 'last-name', - 'address' => 'address1', - 'address2' => 'address2', - 'city' => 'city', - 'state' => 'stateprovince', - 'zip' => 'postal-code', - 'phone' => 'phone-number' + 'email' => 'email-address', + 'fname' => 'first-name', + 'lname' => 'last-name', + 'address' => 'address1', + 'address2' => 'address2', + 'city' => 'city', + 'state' => 'stateprovince', + 'zip' => 'postal-code', + 'phone' => 'phone-numberd', + 'referred_by' => 'referred-by', + 'interest' => 'interests', + 'arrive_date' => 'arrival-date', + 'depart_date' => 'departure-date', + 'questions' => 'questions', + 'unit_size' => 'unit-size' ); /**