本文整理汇总了PHP中CRM_Core_SelectValues::contributeMode方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::contributeMode方法的具体用法?PHP CRM_Core_SelectValues::contributeMode怎么用?PHP CRM_Core_SelectValues::contributeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_SelectValues
的用法示例。
在下文中一共展示了CRM_Core_SelectValues::contributeMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _assignMessageVariablesToTemplate
/**
* Assign message variables to template but try to break the habit.
*
* In order to get away from leaky variables it is better to ensure variables are set in values and assign them
* from the send function. Otherwise smarty variables can leak if this is called more than once - e.g. processing
* multiple recurring payments for processors like IATS that use tokens.
*
* Apply variables for message to smarty template - this function is part of analysing what is in the huge
* function & breaking it down into manageable chunks. Eventually it will be refactored into something else
* Note we send directly from this function in some cases because it is only partly refactored.
*
* Don't call this function directly as the signature will change.
*
* @param $values
* @param $input
* @param CRM_Core_SMARTY $template
* @param bool $recur
* @param bool $returnMessageText
*
* @return mixed
*/
public function _assignMessageVariablesToTemplate(&$values, $input, &$template, $recur = FALSE, $returnMessageText = TRUE)
{
$template->assign('first_name', $this->_relatedObjects['contact']->first_name);
$template->assign('last_name', $this->_relatedObjects['contact']->last_name);
$template->assign('displayName', $this->_relatedObjects['contact']->display_name);
// For some unit tests contribution cannot contain paymentProcessor information
$billingMode = empty($this->_relatedObjects['paymentProcessor']) ? CRM_Core_Payment::BILLING_MODE_NOTIFY : $this->_relatedObjects['paymentProcessor']['billing_mode'];
$template->assign('contributeMode', CRM_Utils_Array::value($billingMode, CRM_Core_SelectValues::contributeMode()));
if (!empty($values['lineItem']) && !empty($this->_relatedObjects['membership'])) {
$values['useForMember'] = TRUE;
}
//assign honor information to receipt message
$softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id);
if (isset($softRecord['soft_credit'])) {
//if id of contribution page is present
if (!empty($values['id'])) {
$values['honor'] = array('honor_profile_values' => array(), 'honor_profile_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'uf_group_id', 'entity_id'), 'honor_id' => $softRecord['soft_credit'][1]['contact_id']);
$softCreditTypes = CRM_Core_OptionGroup::values('soft_credit_type');
$template->assign('soft_credit_type', $softRecord['soft_credit'][1]['soft_credit_type_label']);
$template->assign('honor_block_is_active', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'is_active', 'entity_id'));
} else {
//offline contribution
$softCreditTypes = $softCredits = array();
foreach ($softRecord['soft_credit'] as $key => $softCredit) {
$softCreditTypes[$key] = $softCredit['soft_credit_type_label'];
$softCredits[$key] = array('Name' => $softCredit['contact_name'], 'Amount' => CRM_Utils_Money::format($softCredit['amount'], $softCredit['currency']));
}
$template->assign('softCreditTypes', $softCreditTypes);
$template->assign('softCredits', $softCredits);
}
}
$dao = new CRM_Contribute_DAO_ContributionProduct();
$dao->contribution_id = $this->id;
if ($dao->find(TRUE)) {
$premiumId = $dao->product_id;
$template->assign('option', $dao->product_option);
$productDAO = new CRM_Contribute_DAO_Product();
$productDAO->id = $premiumId;
$productDAO->find(TRUE);
$template->assign('selectPremium', TRUE);
$template->assign('product_name', $productDAO->name);
$template->assign('price', $productDAO->price);
$template->assign('sku', $productDAO->sku);
}
$template->assign('title', CRM_Utils_Array::value('title', $values));
$values['amount'] = CRM_Utils_Array::value('total_amount', $input, CRM_Utils_Array::value('amount', $input), NULL);
if (!$values['amount'] && isset($this->total_amount)) {
$values['amount'] = $this->total_amount;
}
// add the new contribution values
if (strtolower($this->_component) == 'contribute') {
//PCP Info
$softDAO = new CRM_Contribute_DAO_ContributionSoft();
$softDAO->contribution_id = $this->id;
if ($softDAO->find(TRUE)) {
$template->assign('pcpBlock', TRUE);
$template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
$template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
$template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
//assign the pcp page title for email subject
$pcpDAO = new CRM_PCP_DAO_PCP();
$pcpDAO->id = $softDAO->pcp_id;
if ($pcpDAO->find(TRUE)) {
$template->assign('title', $pcpDAO->title);
}
}
}
if ($this->financial_type_id) {
$values['financial_type_id'] = $this->financial_type_id;
}
$template->assign('trxn_id', $this->trxn_id);
$template->assign('receive_date', CRM_Utils_Date::processDate($this->receive_date));
$values['receipt_date'] = empty($this->receipt_date) ? NULL : $this->receipt_date;
$template->assign('action', $this->is_test ? 1024 : 1);
$template->assign('receipt_text', CRM_Utils_Array::value('receipt_text', $values));
$template->assign('is_monetary', 1);
$template->assign('is_recur', (bool) $recur);
$template->assign('currency', $this->currency);
$template->assign('address', CRM_Utils_Address::format($input));
//.........这里部分代码省略.........