<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_PCP_Form_PCPAccount extends CRM_Core_Form {
/**
- *Variable defined for Contribution Page Id
- *
+ * Variable defined for Contribution Page Id
*/
public $_pageId = NULL;
public $_component = NULL;
/**
- * are we in single form mode or wizard mode?
+ * Are we in single form mode or wizard mode?
*
* @var boolean
- * @access protected
*/
public $_single;
/**
- * the default values for the form
+ * The default values for the form
*
* @var array
- * @protected
*/
protected $_defaults;
public function preProcess() {
- $session = CRM_Core_Session::singleton();
- $config = CRM_Core_Config::singleton();
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
- $this->_pageId = CRM_Utils_Request::retrieve('pageId', 'Positive', $this);
+ $session = CRM_Core_Session::singleton();
+ $config = CRM_Core_Config::singleton();
+ $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
+ $this->_pageId = CRM_Utils_Request::retrieve('pageId', 'Positive', $this);
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this);
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if (!$this->_pageId && $config->userFramework == 'Joomla' && $config->userFrameworkFrontend) {
$this->_pageId = $this->_id;
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$this->_defaults = array();
if ($this->_contactID) {
foreach ($this->_fields as $name => $dontcare) {
CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactID, $fields, $this->_defaults);
}
- $stateCountryMap = array();
//set custom field defaults
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
);
}
}
- if ((substr($name, 0, 14) === 'state_province') || (substr($name, 0, 7) === 'country') || (substr($name, 0, 6) === 'county')) {
- list($fieldName, $index) = CRM_Utils_System::explode('-', $name, 2);
- if (!array_key_exists($index, $stateCountryMap)) {
- $stateCountryMap[$index] = array();
- }
- $stateCountryMap[$index][$fieldName] = $name;
- }
-
- // also take care of state country widget
- if (!empty($stateCountryMap)) {
- CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap, $this->_defaults);
- }
}
- // now fix all state country selectors
- CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults);
return $this->_defaults;
}
/**
- * Function to build the form
+ * Build the form object
*
* @return void
- * @access public
*/
public function buildQuickForm() {
$id = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
}
}
-
if ($this->_component == 'contribute') {
$this->assign('campaignName', CRM_Contribute_PseudoConstant::contributionPage($this->_pageId));
}
if ($this->_single) {
$button = array(
- array('type' => 'next',
+ array(
+ 'type' => 'next',
'name' => ts('Save'),
'spacing' => ' ',
'isDefault' => TRUE,
else {
$button[] = array(
'type' => 'next',
- 'name' => ts('Continue >>'),
+ 'name' => ts('Continue'),
'spacing' => ' ',
'isDefault' => TRUE,
);
}
/**
- * global form rule
+ * Global form rule
*
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
+ * @param array $fields
+ * The input form values.
+ * @param array $files
+ * The uploaded files if any.
* @param $self
*
- * @internal param array $options additional user data
*
- * @return true if no errors, else array of errors
- * @access public
- * @static
+ * @return bool|array
+ * true if no errors, else array of errors
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
foreach ($fields as $key => $value) {
if (strpos($key, 'email-') !== FALSE && !empty($value)) {
}
/**
- * Function to process the form
+ * Process the form submission
*
- * @access public
*
* @return void
*/
CRM_Contribute_BAO_Contribution_Utils::createCMSUser($params, $contactID, 'email');
}
}
-