<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
/**
- * the type of pcp component.
+ * The type of pcp component.
*
* @var int
- * @protected
*/
public $_component = 'contribute';
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @access public
*
* @return void
*/
$defaults['is_tellfriend_enabled'] = 1;
$defaults['tellfriend_limit'] = 5;
$defaults['link_text'] = ts('Create your own fundraising page');
+ $defaults['owner_notify_id'] = CRM_Core_OptionGroup::getDefaultValue('pcp_owner_notify');
if ($ccReceipt = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'cc_receipt')) {
$defaults['notify_email'] = $ccReceipt;
}
/**
- * Build the form object
+ * Build the form object.
*
* @return void
- * @access public
*/
public function buildQuickForm() {
+ $this->_last = TRUE;
CRM_PCP_BAO_PCP::buildPCPForm($this);
$this->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages? (for this contribution page)'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','table-row','radio',false);"));
}
/**
- * validation
+ * Validation.
*
- * @param array $params (ref.) an assoc array of name/value pairs
+ * @param array $params
+ * (ref.) an assoc array of name/value pairs.
*
* @param $files
* @param $self
*
- * @return mixed true or array of errors
- * @access public
- * @static
+ * @return bool|array
+ * mixed true or array of errors
*/
public static function formRule($params, $files, $self) {
$errors = array();
}
/**
- * Process the form submission
+ * Process the form submission.
*
- * @access public
*
* @return void
*/
$params['target_entity_type'] = CRM_Utils_Array::value('target_entity_type', $params, 'contribute');
$params['target_entity_id'] = $this->_id;
- $dao = new CRM_PCP_DAO_PCPBlock();
+ $dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = $params['entity_table'];
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
$params['id'] = $dao->id;
$params['is_active'] = CRM_Utils_Array::value('pcp_active', $params, FALSE);
* Return a descriptive name for the page, used in wizard header
*
* @return string
- * @access public
*/
public function getTitle() {
return ts('Enable Personal Campaign Pages');
}
-}
+}