<?php
-// vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
+// vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
/**
* New Event Form
extends Toolkit_FormBuilder
implements Toolkit_Form
{
- // {{{ properties
+ // {{{ properties
/**
* Table in Database which holds the contact data
#category {display:none};
.listings {display:none};
</style>
- <div id="form-sucess-top">
+ <div id="form-sucess-top">
Your event has been successfully added to the events calendar,
however will not be visible until it has been approved by
the Web site administrator. Thank You.
- </div>';
+ </div>';
/**
* Extra rules for processesing
protected $eventMapper;
- // }}}
- // {{{ __construct()
+ // }}}
+ // {{{ __construct()
/**
* Class constructor
* @param string $target (optional)Form's target defaults to '_self'
* @param mixed $attributes (optional)Extra attributes for <form> tag
* @param bool $trackSubmit (optional)Whether to track if the form was
- * submitted by adding a special hidden field
+ * submitted by adding a special hidden field
*
* @access public
*/
$this->eventMapper = $eventMapper;
if ($this->email !== false && empty($this->email)) {
- // Set to false to turn off email function.
+ // Set to false to turn off email function.
$this->email = ADD_EVENT_EMAIL;
}
if (empty($this->siteName)) {
);
}
- // }}}
+ // }}}
// {{{ checkDate()
/**
}
// }}}
- // {{{ configureElements()
+ // {{{ configureElements()
/**
* Form element definitions
{
$e = array();
- // All Elements are created here. This includes group element definitions.
+ // All Elements are created here. This includes group element definitions.
$e[] = array(
'type' => 'header',
'name' => 'eventNameHdr',
$this->setupElements($e);
}
- // }}}
- // {{{ configureFilters()
+ // }}}
+ // {{{ configureFilters()
/**
* Form filter definitions
$this->setupFilters($f);
}
- // }}}
+ // }}}
// {{{ configureForm()
/**
}
// }}}
- // {{{ configureRules()
+ // {{{ configureRules()
/**
* Form rule definitions
*/
public function configureRules()
{
- // Form Rules
+ // Form Rules
$r[] = array(
'element' => 'topicid',
'message' => 'ERROR: Invalid Category!',
$this->setupRules($r);
}
- // }}}
- // {{{ getTopicFields()
+ // }}}
+ // {{{ getTopicFields()
/**
* get event topics
return $categories;
}
- // }}}
+ // }}}
// {{{ hasEndDate()
/**
}
// }}}
- // {{{ emailOwner()
+ // {{{ emailOwner()
/**
* Emails the owner the submitted data from the submitted form
$template->compile('emailOwner.tpl');
$htmlMsg = $template->bufferedOutputObject($page);
- // Text version can't have HTML in it
+ // Text version can't have HTML in it
$msg = "{$page->subject}\n\n";
$msg .= "From {$page->fname} {$page->lname}\n\n";
$msg .= "Information\n\n";
}
}
- // }}}
+ // }}}
// {{{ formatValue()
/**
}
// }}}
- // {{{ insertData()
+ // {{{ insertData()
/**
* Inserts contact data into the contact db
}
}
- // }}}
+ // }}}
private function _geocode(array $values)
{
$geocoder = new GeocodeYahoo();
if (!$values['address'] && !$values['city'] && !$values['state']) {
return $values;
}
+ if ($values['lat'] && $values['lon']) {
+ return $values;
+ }
$address = array(
- 'city' => $values['city'],
- 'state' => $values['state'],
- 'zip' => $values['zip'],
- );
- if (!empty($values['address'])) {
- $address['street'] = $values['address'];
- }
+ 'city' => $values['city'],
+ 'state' => $values['state'],
+ 'zip' => $values['zip'],
+ );
+ if (!empty($values['address'])) {
+ $address['street'] = $values['address'];
+ }
try {
$response = $geocoder->geocodeAddress($address);
$responseArray = unserialize($response);
}
}
- // {{{ processData()
+ // {{{ processData()
/**
* Handles how to process the form when submitted
*/
public function processData($values)
{
- // Form data used for the insert/update sql queries and
- // the form email.
+ // Form data used for the insert/update sql queries and
+ // the form email.
$e = array();
$this->setFormData($e);
- // Get rid of any defined un-needed elements.
- // un-needed elements after the form is submitted are defined
- // by the ending _rmv name.
+ // Get rid of any defined un-needed elements.
+ // un-needed elements after the form is submitted are defined
+ // by the ending _rmv name.
foreach ($values as $k => &$v) {
if (!is_array($v)) {
$values[$k] = preg_replace("/\r/", "\n", $v);
return $this->insertData($values);
}
- // }}}
- // {{{ setupRenderers()
+ // }}}
+ // {{{ setupRenderers()
/**
* Custom rendering templates for special fields on the form
$this->template->compile($this->formTemplate);
}
- // }}}
- // {{{ toHtml()
+ // }}}
+ // {{{ toHtml()
/**
* Handles how to display the current step the user is at in the form
return $output;
}
- // }}}
+ // }}}
}
?>