本文整理汇总了PHP中CRM_Core_BAO_CustomOption::getAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomOption::getAssoc方法的具体用法?PHP CRM_Core_BAO_CustomOption::getAssoc怎么用?PHP CRM_Core_BAO_CustomOption::getAssoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomOption
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomOption::getAssoc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
// current contribution page id
$this->_id = $this->get('id');
// get all the values from the dao object
$params = array('id' => $this->_id);
$this->_values = array();
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
// get the amounts and the label
require_once 'CRM/Core/BAO/CustomOption.php';
CRM_Core_BAO_CustomOption::getAssoc('civicrm_contribution_page', $this->_id, $this->_values);
// get the profile ids
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1);
$this->_values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
$ufJoinParams['weight'] = 2;
$this->_values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
}
示例3: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
$config =& CRM_Core_Config::singleton();
$session =& CRM_Core_Session::singleton();
// make sure we have a valid payment class, else abort
if (!$config->paymentClass) {
CRM_Utils_System::setUFMessage(ts('%1 is not set in the config file.', array(1 => 'CIVICRM_CONTRIBUTE_PAYMENT_PROCESSOR')));
CRM_Utils_System::redirect($config->userFrameworkBaseURL);
}
// current contribution page id
$this->_id = CRM_Utils_Request::retrieve('id', $this);
if (!$this->_id) {
$pastContributionId = $session->get('pastContributionId');
if (!$pastContributionId) {
CRM_Core_Error::fatal(ts('We could not find contribution details for your request. Please try your request again.'));
} else {
CRM_Core_Error::fatal(ts('This contribution has already been submitted. Click <a href="%1">here</a> if you want to make another contribution.', array(1 => CRM_Utils_System::url('civicrm/contribute/transact', 'reset=1&id=' . $pastContributionId))));
}
} else {
$session->set('pastContributionId', $this->_id);
}
// we do not want to display recently viewed items, so turn off
$this->assign('displayRecent', false);
// action
$this->_action = CRM_Utils_Request::retrieve('action', $this, false, 'add');
$this->assign('action', $this->_action);
// current mode
$this->_mode = $this->_action == 1024 ? 'test' : 'live';
$this->_values = $this->get('values');
$this->_fields = $this->get('fields');
if (!$this->_values) {
// get all the values from the dao object
$params = array('id' => $this->_id);
$this->_values = array();
$this->_fields = array();
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
// check if form is active
if (!$this->_values['is_active']) {
// form is inactive, bounce user back to front page of CMS
CRM_Utils_System::setUFMessage(ts('The page you requested is currently unavailable.'));
CRM_Utils_System::redirect($config->userFrameworkBaseURL);
}
// get the amounts and the label
require_once 'CRM/Core/BAO/CustomOption.php';
CRM_Core_BAO_CustomOption::getAssoc('civicrm_contribution_page', $this->_id, $this->_values);
// get the profile ids
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1);
$this->_values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
$ufJoinParams['weight'] = 2;
$this->_values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
if ($config->paymentBillingMode & CRM_CONTRIBUTE_PAYMENT_BILLING_MODE_FORM) {
$this->setCreditCardFields();
}
$this->set('values', $this->_values);
$this->set('fields', $this->_fields);
}
$this->_contributeMode = $this->get('contributeMode');
$this->assign('contributeMode', $this->_contributeMode);
// assigning title to template in case someone wants to use it, also setting CMS page title
$this->assign('title', $this->_values['title']);
CRM_Utils_System::setTitle($this->_values['title']);
$this->_defaults = array();
}