'display' => 'Phone:'
);
+ $e[] = array(
+ 'type' => 'date',
+ 'req' => false,
+ 'name' => 'arrive_date',
+ 'display' => 'Date Requested From:',
+ 'opts' => array(
+ 'language' => 'en',
+ 'format' => 'mdY',
+ 'minYear' => date('Y'),
+ 'maxYear' => date('Y') + 3,
+ 'addEmptyOption' => true
+ )
+ );
+ $e[] = array(
+ 'type' => 'date',
+ 'req' => false,
+ 'name' => 'depart_date',
+ 'display' => 'Date Requested To:',
+ 'opts' => array(
+ 'language' => 'en',
+ 'format' => 'mdY',
+ 'minYear' => date('Y'),
+ 'maxYear' => date('Y') + 3,
+ 'addEmptyOption' => true
+ )
+ );
+
$e[] = array(
'type' => 'select',
'req' => false,
$e[] = array(
'type' => 'textarea',
'req' => false,
- 'name' => 'comments',
+ 'name' => 'questions',
'display' => 'Additional Questions:'
);
$e[] = array(
protected function insertData($values)
{
unset($values['comments']);
- //$values['contact_type'] = ":{$this->contactType}:";
+ $values['contact_type'] = ":{$this->contactType}:";
if (is_array($values['interest']) && !empty($values['interest'])) {
foreach ($values['interest'] as $iGroup => $interests) {
$newInterest[] = implode(':', array_keys($interests));
$streamSend->addContact($values);
}
$values['unit_size'] = (!$values['unit_size']) ? null: $values['unit_size'];
+ // prep the dates
+ if ($values['arrive_date']) {
+ if (
+ $values['arrive_date']['m'] &&
+ $values['arrive_date']['d'] &&
+ $values['arrive_date']['Y']
+ ) {
+ $values['arrive_date'] =
+ $values['arrive_date']['m'] . '/'
+ . $values['arrive_date']['d'] . '/'
+ . $values['arrive_date']['Y'];
+ } else {
+ $values['arrive_date'] = null;
+ }
+ }
+ if ($values['depart_date']) {
+ if (
+ $values['depart_date']['m'] &&
+ $values['depart_date']['d'] &&
+ $values['depart_date']['Y']
+ ) {
+ $values['depart_date'] =
+ $values['depart_date']['m'] . '/'
+ . $values['depart_date']['d'] . '/'
+ . $values['depart_date']['Y'];
+ } else {
+ $values['depart_date'] = null;
+ }
+ }
// Check if we are updating an existing contact or not
// question: is this the best approach? what if someone else
try {
// Get all the existing contact type data
- /*
$sql = "
SELECT contact_type
FROM {$this->tableName}
if (!in_array($this->contactType, $existingTypes)) {
$values['contact_type'] = "$cType{$this->contactType}:";
}
- */
$sql = Toolkit_Common::createSQLUpdate(
$this->tableName,
--- /dev/null
+<?php
+// vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
+
+/**
+ * File Doc Comment
+ *
+ * PHP version 5
+ *
+ * @category Contacts
+ * @package Toolkit_Contacts
+ * @author Jamie Kahgee <jamie.kahgee@gmail.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version CVS: $Id: ENews.php,v 1.1 2010/01/17 15:29:11 jamie Exp $
+ * @link http://demo.gaslightmedia.com
+ */
+
+/**
+ * GLM Contact Us form
+ *
+ * This form handles rendering and processing the contact us form.
+ * Controls the email functionality of the form, whether the client
+ * has a contact DB to store contact records and how to insert/update
+ * submitted form values.
+ *
+ * @category Contacts
+ * @package Toolkit_Contacts
+ * @author Jamie Kahgee <jamie.kahgee@gmail.com>
+ * @copyright 2009 Jamie Kahgee
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @link http://demo.gaslightmedia.com
+ * @see Toolkit_FormBuilder
+ */
+class Toolkit_Contacts_ENews
+ extends Toolkit_Contacts_ContactUs
+{
+ // {{{ properties
+
+ /**
+ * Contact type to be inserted into the DB as when the form is submitted
+ *
+ * This property is only valid when the [hasContactDB] property is set
+ * to true.
+ *
+ * N.B.
+ * If you subclass this class out to other forms that are
+ * inserted into the contact db, be sure to make each one of their
+ * contactType properties unique. We don't check for duplicates.
+ *
+ * @var string
+ * @access protected
+ */
+ protected $contactType = '2';
+
+ /**
+ * Email subject and <h1> header in email
+ *
+ * It gets set in the constructor if you leave empty here, but you
+ * can set it to something different here to override that if you desire.
+ *
+ * @var string
+ * @access protected
+ */
+ public $subject = 'ENews Signup for Trout Creek';
+
+ /**
+ * Message to display if the form is successfully submitted
+ *
+ * @var string
+ * @access protected
+ */
+ protected $successMsg = '
+ <style type="text/css">
+ #category {display:none;}
+ .listings {display:none;}
+ </style>
+ <div id="form-success-top">
+ Thank you for signing up for our ENews!
+ </div>';
+
+ // }}}
+
+ // {{{ configureElements()
+
+ /**
+ * Form element definitions
+ *
+ * @return void
+ * @access public
+ */
+ public function configureElements()
+ {
+ $e = array();
+ $this->setInterestFields();
+ // Grouped Elements are defined here.
+ $this->interestsGroups =& $this->getInterestFields();
+
+ // All Elements are created here. This includes group element definitions.
+ $e[] = array(
+ 'type' => 'hidden',
+ 'req' => false,
+ 'name' => 'user_agent'
+ );
+ $e[] = array(
+ 'type' => 'hidden',
+ 'req' => false,
+ 'name' => 'remote_addr'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => false,
+ 'name' => 'fname',
+ 'display' => 'First Name:'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => false,
+ 'name' => 'lname',
+ 'display' => 'Last Name:'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => true,
+ 'name' => 'email',
+ 'display' => 'Email:'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => true,
+ 'name' => 'email_rmv',
+ 'display' => 'Verify Email:'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => false,
+ 'name' => 'address',
+ 'display' => 'Address:'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => false,
+ 'name' => 'city',
+ 'display' => 'City:'
+ );
+ $e[] = array(
+ 'type' => 'select',
+ 'req' => false,
+ 'name' => 'state',
+ 'display' => 'State/Province:',
+ 'opts' => $GLOBALS['states']
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => false,
+ 'name' => 'zip',
+ 'display' => 'ZIP/Postal Code:'
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => false,
+ 'name' => 'phone',
+ 'display' => 'Phone:'
+ );
+
+ if (is_array($this->interestsGroups)) {
+ foreach ($this->interestsGroups as $group => $gData) {
+ $this->myGroups[] = $gData;
+ $e[] = array(
+ 'type' => 'group',
+ 'req' => false,
+ 'name' => 'interest['.$group.']',
+ 'group' => $gData,
+ 'label' => $group,
+ 'seperator' => ' ',
+ 'appendName' => true
+ );
+ }
+ }
+
+ $e[] = array(
+ 'type' => 'textarea',
+ 'req' => false,
+ 'name' => 'questions',
+ 'display' => 'Additional Questions:'
+ );
+ $e[] = array(
+ 'type' => 'hidden',
+ 'req' => false,
+ 'name' => 'mail_ok',
+ 'val' => 1
+ );
+ $e[] = array(
+ 'type' => 'CAPTCHA_Image',
+ 'req' => false,
+ 'name' => 'captcha_question',
+ 'display' => 'Verification code:',
+ 'opts' => $this->captchaOptions
+ );
+ $e[] = array(
+ 'type' => 'text',
+ 'req' => true,
+ 'name' => 'captcha_rmv',
+ 'display' => 'Enter verification code:'
+ );
+ $e[] = array(
+ 'type' => 'submit',
+ 'req' => false,
+ 'name' => 'submit_rmv',
+ 'display' => 'Submit Form'
+ );
+
+ $this->setupElements($e);
+ }
+
+ // }}}
+}
+?>