本文整理汇总了PHP中CRM_Contribute_Form_ContributionPage::setDefaultValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_Form_ContributionPage::setDefaultValues方法的具体用法?PHP CRM_Contribute_Form_ContributionPage::setDefaultValues怎么用?PHP CRM_Contribute_Form_ContributionPage::setDefaultValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_Form_ContributionPage
的用法示例。
在下文中一共展示了CRM_Contribute_Form_ContributionPage::setDefaultValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* Set default values for the form.
*
* Note that in edit/view mode the default values are retrieved from the database.
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$defaults['custom_pre_id'] = $this->_values['custom_pre_id'];
$defaults['custom_post_id'] = $this->_values['custom_post_id'];
return $defaults;
}
示例2: setDefaultValues
/**
* Set default values for the form.
*
* Note that in edit/view mode the default values are retrieved from the database.
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$ufJoinParams = array('module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
list($defaults['custom_pre_id'], $second) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$defaults['custom_post_id'] = $second ? array_shift($second) : '';
return $defaults;
}
示例3: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return void
*/
function setDefaultValues()
{
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Title and Settings (%1)', array(1 => $title)));
} else {
CRM_Utils_System::setTitle(ts('Title and Settings'));
}
return parent::setDefaultValues();
}
示例4: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1);
$defaults['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
$ufJoinParams['weight'] = 2;
$defaults['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
return $defaults;
}
示例5: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Include Profiles (%1)', array(1 => $title)));
}
$ufJoinParams = array('module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
list($defaults['custom_pre_id'], $defaults['custom_post_id']) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
return $defaults;
}
示例6: setDefaultValues
/**
* Set default values for the form.
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Title and Settings') . " ({$title})");
foreach (array('on_behalf', 'soft_credit') as $module) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = $module;
$ufJoinDAO->entity_id = $this->_id;
$ufJoinDAO->entity_table = 'civicrm_contribution_page';
if ($ufJoinDAO->find(TRUE)) {
$jsonData = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoinDAO->module_data, TRUE, $module);
if ($module == 'soft_credit') {
$defaults['honoree_profile'] = $ufJoinDAO->uf_group_id;
$defaults = array_merge($defaults, $jsonData);
$defaults['honor_block_is_active'] = $ufJoinDAO->is_active;
} else {
$defaults['onbehalf_profile_id'] = $ufJoinDAO->uf_group_id;
$defaults = array_merge($defaults, $jsonData);
$defaults['is_organization'] = $ufJoinDAO->is_active;
}
} else {
if ($module == 'soft_credit') {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'on_behalf_organization';
if ($ufGroupDAO->find(TRUE)) {
$defaults['onbehalf_profile_id'] = $ufGroupDAO->id;
}
$defaults['for_organization'] = ts('I am contributing on behalf of an organization.');
$defaults['is_for_organization'] = 1;
}
}
}
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
return $defaults;
}
示例7: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Title and Settings (%1)', array(1 => $title)));
$ufJoinParams = array('module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$defaults['onbehalf_profile_id'] = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
} else {
CRM_Utils_System::setTitle(ts('Title and Settings'));
}
return $defaults;
}
示例8: setDefaultValues
/**
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
*
* @return void
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Include Profiles') . " ({$title})");
}
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->assign('perm', 1);
}
$ufJoinParams = array('module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
list($defaults['custom_pre_id'], $second) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$defaults['custom_post_id'] = $second ? array_shift($second) : '';
return $defaults;
}
示例9: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
require_once 'CRM/Core/BAO/CustomOption.php';
CRM_Core_BAO_CustomOption::getAssoc('civicrm_contribution_page', $this->_id, $defaults);
if (CRM_Utils_Array::value('value', $defaults)) {
foreach ($defaults['value'] as $i => $v) {
if ($v == $defaults['default_amount']) {
$defaults['default'] = $i;
break;
}
}
}
return $defaults;
}
示例10: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Title and Settings (%1)', array(1 => $title)));
$ufJoinParams = array('module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$onBehalfIDs = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
if ($onBehalfIDs) {
// get the first one only
$defaults['onbehalf_profile_id'] = $onBehalfIDs[0];
}
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $this->_id;
if ($ufJoinDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufJoinDAO->uf_group_id;
$jsonData = json_decode($ufJoinDAO->module_data);
if ($jsonData) {
foreach ($jsonData->soft_credit as $index => $value) {
$defaults[$index] = $value;
}
}
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
} else {
CRM_Utils_System::setTitle(ts('Title and Settings'));
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
return $defaults;
}
示例11: setDefaultValues
/**
* Set default values for the form.
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$ufJoinParams = array('module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$onBehalfIDs = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
if ($onBehalfIDs) {
// get the first one only
$defaults['onbehalf_profile_id'] = $onBehalfIDs[0];
}
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $this->_id;
if ($ufJoinDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufJoinDAO->uf_group_id;
$jsonData = CRM_Contribute_BAO_ContributionPage::formatMultilingualHonorParams($ufJoinDAO->module_data, TRUE);
$defaults = array_merge($defaults, $jsonData);
$defaults['honor_block_is_active'] = $ufJoinDAO->is_active;
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
return $defaults;
}
示例12: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Contribution Amounts (%1)', array(1 => $title)));
if (!CRM_Utils_Array::value('pay_later_text', $defaults)) {
$defaults['pay_later_text'] = ts('I will send payment by check');
}
if (CRM_Utils_Array::value('amount_block_is_active', $defaults)) {
// don't allow other amount option when price set present.
$this->assign('priceSetID', $this->_priceSetID);
if ($this->_priceSetID) {
return $defaults;
}
require_once 'CRM/Core/OptionGroup.php';
CRM_Core_OptionGroup::getAssoc("civicrm_contribution_page.amount.{$this->_id}", $this->_amountBlock);
$hasAmountBlock = false;
if (!empty($this->_amountBlock)) {
$hasAmountBlock = true;
$defaults = array_merge($defaults, $this->_amountBlock);
}
if (CRM_Utils_Array::value('value', $defaults) && is_array($defaults['value'])) {
if (CRM_Utils_Array::value('default_amount_id', $defaults) && CRM_Utils_Array::value('amount_id', $defaults) && is_array($defaults['amount_id'])) {
foreach ($defaults['value'] as $i => $v) {
if ($defaults['amount_id'][$i] == $defaults['default_amount_id']) {
$defaults['default'] = $i;
break;
}
}
}
// CRM-4038: fix value display
foreach ($defaults['value'] as &$amount) {
$amount = trim(CRM_Utils_Money::format($amount, ' '));
}
}
}
// fix the display of the monetary value, CRM-4038
require_once 'CRM/Utils/Money.php';
if (isset($defaults['min_amount'])) {
$defaults['min_amount'] = CRM_Utils_Money::format($defaults['min_amount'], null, '%a');
}
if (isset($defaults['max_amount'])) {
$defaults['max_amount'] = CRM_Utils_Money::format($defaults['max_amount'], null, '%a');
}
return $defaults;
}
示例13: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Thank-you and Receipting (%1)', array(1 => $title)));
return parent::setDefaultValues();
}
示例14: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Contribution Amounts (%1)', array(1 => $title)));
if (!CRM_Utils_Array::value('pay_later_text', $defaults)) {
$defaults['pay_later_text'] = ts('I will send payment by check');
}
if (CRM_Utils_Array::value('amount_block_is_active', $defaults)) {
if ($priceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, NULL)) {
if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config')) {
$this->assign('isQuick', $isQuick);
//$priceField = CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_Field', $priceSetId, 'id', 'price_set_id' );
$options = $pFIDs = array();
$priceFieldParams = array('price_set_id' => $priceSetId);
$priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_Field', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'is_active'));
foreach ($priceFields as $priceField) {
if ($priceField['id'] && $priceField['html_type'] == 'Radio' && $priceField['name'] == 'contribution_amount') {
$defaults['price_field_id'] = $priceField['id'];
$priceFieldOptions = CRM_Price_BAO_FieldValue::getValues($priceField['id'], $options, 'id', 1);
$countRow = 0;
foreach ($options as $optionId => $optionValue) {
$countRow++;
$defaults['value'][$countRow] = $optionValue['amount'];
$defaults['label'][$countRow] = CRM_Utils_Array::value('label', $optionValue);
$defaults['name'][$countRow] = CRM_Utils_Array::value('name', $optionValue);
$defaults['weight'][$countRow] = $optionValue['weight'];
$defaults["price_field_value"][$countRow] = $optionValue['id'];
if ($optionValue['is_default']) {
$defaults['default'] = $countRow;
}
}
} elseif ($priceField['id'] && $priceField['html_type'] == 'Text' && ($priceField['name'] = 'other_amount' && $priceField['is_active'])) {
$defaults['price_field_other'] = $priceField['id'];
}
}
}
}
if (CRM_Utils_Array::value('value', $defaults) && is_array($defaults['value'])) {
// CRM-4038: fix value display
foreach ($defaults['value'] as &$amount) {
$amount = trim(CRM_Utils_Money::format($amount, ' '));
}
}
}
// fix the display of the monetary value, CRM-4038
if (isset($defaults['min_amount'])) {
$defaults['min_amount'] = CRM_Utils_Money::format($defaults['min_amount'], NULL, '%a');
}
if (isset($defaults['max_amount'])) {
$defaults['max_amount'] = CRM_Utils_Money::format($defaults['max_amount'], NULL, '%a');
}
if (CRM_Utils_Array::value('payment_processor', $defaults)) {
$defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['payment_processor']), '1');
}
return $defaults;
}
示例15: setDefaultValues
/**
* Set default values for the form.
*
* Note that in edit/view mode the default values are retrieved from the database.
*/
public function setDefaultValues()
{
return parent::setDefaultValues();
}