本文整理汇总了PHP中CRM_Contribute_PseudoConstant::contributionType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_PseudoConstant::contributionType方法的具体用法?PHP CRM_Contribute_PseudoConstant::contributionType怎么用?PHP CRM_Contribute_PseudoConstant::contributionType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Contribute_PseudoConstant::contributionType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
require_once 'CRM/Utils/Money.php';
$this->_first = true;
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage');
// name
$this->add('text', 'title', ts('Title'), $attributes['title'], true);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), true);
$this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']);
$this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']);
// is on behalf of an organization ?
$this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), null, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);"));
$options = array();
$options[] = HTML_QuickForm::createElement('radio', null, null, ts('Optional'), 1);
$options[] = HTML_QuickForm::createElement('radio', null, null, ts('Required'), 2);
$this->addGroup($options, 'is_for_organization', ts(''));
$this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']);
// collect goal amount
$this->add('text', 'goal_amount', ts('Goal Amount'), array('size' => 8, 'maxlength' => 12));
$this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// is this page active ?
$this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
// should the honor be enabled
$this->addElement('checkbox', 'honor_block_is_active', ts('Honoree Section Enabled'), null, array('onclick' => "showHonor()"));
$this->add('text', 'honor_block_title', ts('Honoree Section Title'), $attributes['honor_block_title']);
$this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']);
// add optional start and end dates
$this->addDateTime('start_date', ts('Start Date'));
$this->addDateTime('end_date', ts('End Date'));
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'));
parent::buildQuickForm();
}
示例2: __construct
function __construct()
{
$yearsInPast = 4;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0);
$count = $date['maxYear'];
$optionYear = array('' => ts('-- select --'));
$this->_yearStatisticsFrom = $date['minYear'];
$this->_yearStatisticsTo = $date['maxYear'];
while ($date['minYear'] <= $count) {
$optionYear[$date['minYear']] = $date['minYear'];
$date['minYear']++;
}
$relationTypeOp = array();
$relationshipTypes = CRM_Core_PseudoConstant::relationshipType();
foreach ($relationshipTypes as $rid => $rtype) {
if ($rtype['label_a_b'] != $rtype['label_b_a']) {
$relationTypeOp[$rid] = "{$rtype['label_a_b']}/{$rtype['label_b_a']}";
} else {
$relationTypeOp[$rid] = $rtype['label_a_b'];
}
}
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'default' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields', 'filters' => array('sort_name' => array('title' => ts('Contact Name')), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields')) + $this->addAddressFields(FALSE, FALSE, FALSE, array()) + array('civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'default' => TRUE), 'contact_id_a' => array('no_display' => TRUE), 'contact_id_b' => array('no_display' => TRUE)), 'filters' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $relationTypeOp, 'type' => CRM_Utils_Type::T_STRING)))) + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('total_amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'required' => TRUE, 'no_display' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'))), 'receive_date' => array('required' => TRUE, 'default' => TRUE, 'no_display' => TRUE)), 'grouping' => 'contri-fields', 'filters' => array('this_year' => array('title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => ''), 'other_year' => array('title' => ts('Other Years'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => ''), 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType()), 'total_amount' => array('title' => ts('Donation Amount')), 'total_sum' => array('title' => ts('Aggregate Amount'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE)))) + array('civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
$this->_columns['civicrm_contribution']['fields']['civicrm_upto_' . $this->_yearStatisticsFrom] = array('title' => ts('Up To %1 Donation', array(1 => $this->_yearStatisticsFrom)), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE);
$yearConter = $this->_yearStatisticsFrom;
$yearConter++;
while ($yearConter <= $this->_yearStatisticsTo) {
$this->_columns['civicrm_contribution']['fields'][$yearConter] = array('title' => ts('%1 Donation', array(1 => $yearConter)), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE);
$yearConter++;
}
$this->_columns['civicrm_contribution']['fields']['aggregate_amount'] = array('title' => ts('Aggregate Amount'), 'type' => CRM_Utils_Type::T_MONEY, 'is_statistics' => TRUE);
$this->_tagFilter = TRUE;
parent::__construct();
}
示例3: __construct
function __construct()
{
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-fields', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE, 'default' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('percentage_change' => array('title' => ts('Percentage Change'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, 'name' => 'percentage_change', 'dbAlias' => '( ( contribution_civireport2.total_amount_sum - contribution_civireport1.total_amount_sum ) * 100 / contribution_civireport1.total_amount_sum )')), 'group_bys' => array('id' => array('title' => ts('Contact'), 'default' => TRUE))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', 'fields' => array('country_id' => array('title' => ts('Country')), 'state_province_id' => array('title' => ts('State/Province'))), 'group_bys' => array('country_id' => array('title' => ts('Country')), 'state_province_id' => array('title' => ts('State/Province')))), 'civicrm_contribution_type' => array('dao' => 'CRM_Contribute_DAO_ContributionType', 'fields' => array('contribution_type' => NULL), 'grouping' => 'contri-fields', 'group_bys' => array('contribution_type' => array('name' => 'id', 'title' => 'Contribution Type'))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => NULL, 'total_amount1' => array('name' => 'total_amount', 'alias' => 'contribution1', 'title' => ts('Range One Stat'), 'type' => CRM_Utils_Type::T_MONEY, 'default' => TRUE, 'required' => TRUE, 'clause' => '
contribution_civireport1.total_amount_count as contribution1_total_amount_count,
contribution_civireport1.total_amount_sum as contribution1_total_amount_sum'), 'total_amount2' => array('name' => 'total_amount', 'alias' => 'contribution2', 'title' => ts('Range Two Stat'), 'type' => CRM_Utils_Type::T_MONEY, 'default' => TRUE, 'required' => TRUE, 'clause' => '
contribution_civireport2.total_amount_count as contribution2_total_amount_count,
contribution_civireport2.total_amount_sum as contribution2_total_amount_sum')), 'grouping' => 'contri-fields', 'filters' => array('receive_date1' => array('title' => ts('Date Range One'), 'default' => 'previous.year', 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, 'name' => 'receive_date'), 'receive_date2' => array('title' => ts('Date Range Two'), 'default' => 'this.year', 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, 'name' => 'receive_date'), 'total_amount1' => array('title' => ts('Range One Amount'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, 'name' => 'total_amount'), 'total_amount2' => array('title' => ts('Range Two Amount'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, 'name' => 'total_amount'), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1'))), 'group_bys' => array('contribution_source' => NULL)), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
$this->_tagFilter = TRUE;
parent::__construct();
}
示例4: buildQuickForm
/**
* Build the form
*
* @access public
* @return void
*/
public function buildQuickForm()
{
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'title');
$attributes['style'] = 'width: 90%';
$this->add('text', 'title', ts('Find'), $attributes);
$contribution_type = CRM_Contribute_PseudoConstant::contributionType();
foreach ($contribution_type as $contributionId => $contributionName) {
$this->addElement('checkbox', "contribution_type_id[{$contributionId}]", 'Contribution Type', $contributionName);
}
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true)));
}
示例5: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
function buildQuickForm()
{
$this->_first = true;
// name
$this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'title'), true);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType());
// intro_text and footer_text
$this->add('textarea', 'intro_text', ts('Introductory Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'intro_text'), true);
$this->add('textarea', 'footer_text', ts('Footer Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'footer_text'), false);
// is this group active ?
$this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
parent::buildQuickForm();
}
示例6: __construct
function __construct()
{
$yearsInPast = 10;
$yearsInFuture = 1;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
$count = $date['maxYear'];
while ($date['minYear'] <= $count) {
$optionYear[$date['minYear']] = $date['minYear'];
$date['minYear']++;
}
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone No'), 'default' => TRUE))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y')), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
$this->_tagFilter = TRUE;
parent::__construct();
}
示例7: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$values = $ids = array();
$params = array('id' => $this->get('id'));
CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
$values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
$dao = new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
$values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
}
$honor = CRM_Core_PseudoConstant::honor();
$values['honor_type'] = $honor[$values['honor_type_id']];
}
//handle custom data.
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
if (CRM_Utils_Array::value('contribution_page_id', $values)) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$values['contribution_type'] = CRM_Utils_Array::value($values['contribution_type_id'], CRM_Contribute_PseudoConstant::contributionType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
}
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
$displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
$this->assign('displayName', $displayName);
$title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['contribution_type'] . ')';
// add Pledge to Recent Items
CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], NULL, $recentOther);
//do check for campaigns
if ($campaignId = CRM_Utils_Array::value('campaign_id', $values)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$values['campaign'] = $campaigns[$campaignId];
}
$this->assign($values);
}
示例8: buildQuickForm
function buildQuickForm()
{
$this->addElement('hidden', 'batch_status', true);
$this->addElement('hidden', 'id', $_GET['id']);
$this->add('text', 'batch_title', ts('Batch Title'), array('size' => 35, 'maxlength' => 64, 'style' => 'text-align:right'), true);
$this->add('textarea', 'description', ts('Description'), null, false);
$emptySelect1[''] = '- select -';
$bankAccounts = $bankAccounts = CRM_Finance_BAO_BankAccount::getBankAccountsList($emptySelect1);
$this->add('select', 'banking_account', ts('Bank Account'), $bankAccounts, true);
$this->addDate('banking_date', ts('Banking Date'), true, array('formatType' => 'activityDate'));
$this->addElement('checkbox', 'exclude_from_posting', ts('Exclude from posting'), null, null);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType(), true);
$this->add('select', 'payment_instrument_id', ts('Payment Method'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), true);
$this->addFormRule(array($this, 'formRule'));
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->assign('formObject', $this);
}
示例9: __construct
function __construct()
{
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
}
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE), 'postal_greeting_display' => array('title' => ts('Postal Greeting')), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields', 'group_bys' => array('id' => array('title' => ts('Contact ID')), 'sort_name' => array('title' => ts('Contact Name')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution_type' => array('dao' => 'CRM_Contribute_DAO_ContributionType', 'fields' => array('contribution_type' => NULL), 'grouping' => 'contri-fields', 'group_bys' => array('contribution_type' => NULL)), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => NULL, 'total_amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'required' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'), 'count' => ts('Donations'), 'avg' => ts('Average')))), 'grouping' => 'contri-fields', 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Donation Amount')), 'total_sum' => array('title' => ts('Aggregate Amount'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE), 'total_count' => array('title' => ts('Donation Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_count', 'having' => TRUE), 'total_avg' => array('title' => ts('Average'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_avg', 'having' => TRUE)), 'group_bys' => array('receive_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'contribution_source' => NULL)), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group(), 'type' => CRM_Utils_Type::T_INT)))) + $this->addAddressFields();
$this->_tagFilter = TRUE;
if ($campaignEnabled && !empty($this->activeCampaigns)) {
$this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
$this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
$this->_columns['civicrm_contribution']['grouping']['campaign_id'] = 'contri-fields';
$this->_columns['civicrm_contribution']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
}
parent::__construct();
}
示例10: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
require_once 'CRM/Pledge/BAO/Pledge.php';
$values = $ids = array();
$params = array('id' => $this->get('id'));
CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
$values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
$values['eachPaymentAmount'] = floor($values['amount'] / $values['installments']);
if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
$dao =& new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
$values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
}
$honor = CRM_Core_PseudoConstant::honor();
$values['honor_type'] = $honor[$values['honor_type_id']];
}
//handle custom data.
$groupTree =& CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
if (CRM_Utils_Array::value('contribution_page_id', $values)) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$values['contribution_type'] = CRM_Utils_Array::value($values['contribution_type_id'], CRM_Contribute_PseudoConstant::contributionType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
}
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
require_once 'CRM/Utils/Money.php';
$displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
$this->assign('displayName', $displayName);
$title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['contribution_type'] . ')';
// add Pledge to Recent Items
CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], null);
$this->assign($values);
}
示例11: array
/**
* takes an associative array and creates a pledge object
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return object CRM_Pledge_BAO_Pledge object
* @access public
* @static
*/
static function &create(&$params)
{
require_once 'CRM/Utils/Date.php';
//FIXME: a cludgy hack to fix the dates to MySQL format
$dateFields = array('start_date', 'create_date', 'acknowledge_date', 'modified_date', 'cancel_date', 'end_date');
foreach ($dateFields as $df) {
if (isset($params[$df])) {
$params[$df] = CRM_Utils_Date::isoToMysql($params[$df]);
}
}
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
$paymentParams = array();
$paymentParams['status_id'] = $params['status_id'];
if (CRM_Utils_Array::value('installment_amount', $params)) {
$params['amount'] = $params['installment_amount'] * $params['installments'];
}
//get All Payments status types.
require_once 'CRM/Contribute/PseudoConstant.php';
$paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(null, 'name');
//update the pledge status only if it does NOT come from form
if (!isset($params['pledge_status_id'])) {
if (isset($params['contribution_id'])) {
if ($params['installments'] > 1) {
$params['status_id'] = array_search('In Progress', $paymentStatusTypes);
}
} else {
$params['status_id'] = array_search('Pending', $paymentStatusTypes);
}
}
$pledge = self::add($params);
if (is_a($pledge, 'CRM_Core_Error')) {
$pledge->rollback();
return $pledge;
}
//handle custom data.
if (CRM_Utils_Array::value('custom', $params) && is_array($params['custom'])) {
require_once 'CRM/Core/BAO/CustomValueTable.php';
CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_pledge', $pledge->id);
}
// skip payment stuff inedit mode
if (!isset($params['id']) || CRM_Utils_Array::value('is_pledge_pending', $params)) {
require_once 'CRM/Pledge/BAO/Payment.php';
//if pledge is pending delete all payments and recreate.
if (CRM_Utils_Array::value('is_pledge_pending', $params)) {
CRM_Pledge_BAO_Payment::deletePayments($pledge->id);
}
//building payment params
$paymentParams['pledge_id'] = $pledge->id;
$paymentKeys = array('amount', 'installments', 'scheduled_date', 'frequency_unit', 'frequency_day', 'frequency_interval', 'contribution_id', 'installment_amount', 'actual_amount');
foreach ($paymentKeys as $key) {
$paymentParams[$key] = CRM_Utils_Array::value($key, $params, null);
}
CRM_Pledge_BAO_Payment::create($paymentParams);
}
$transaction->commit();
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contribute/PseudoConstant.php';
require_once 'CRM/Contact/BAO/Contact.php';
require_once 'CRM/Core/Config.php';
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home");
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home");
}
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home");
}
$config = CRM_Core_Config::singleton();
require_once 'CRM/Utils/Money.php';
$contributionTypes = CRM_Contribute_PseudoConstant::contributionType();
$title = CRM_Contact_BAO_Contact::displayName($pledge->contact_id) . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($pledge->amount) . ' - ' . $contributionTypes[$pledge->contribution_type_id] . ')';
// add the recently created Pledge
CRM_Utils_Recent::add($title, $url, $pledge->id, 'Pledge', $pledge->contact_id, null, $recentOther);
return $pledge;
}
示例12: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
function buildQuickForm()
{
$this->applyFilter('__ALL__', 'trim');
if ($this->_action & CRM_CORE_ACTION_DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$this->buldPremiumForm($this);
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
$element =& $this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('-select-')) + CRM_Contribute_PseudoConstant::contributionType(), true);
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('select', 'payment_instrument_id', ts('Paid By'), array('' => ts('-select-')) + CRM_Contribute_PseudoConstant::paymentInstrument());
if ($this->_online) {
$element->freeze();
}
// add various dates
$element =& $this->add('date', 'receive_date', ts('Received'), CRM_Core_SelectValues::date('manual', 3, 1), false);
$this->addRule('receive_date', ts('Select a valid date.'), 'qfDate');
if ($this->_online) {
$this->assign("hideCalender", true);
$element->freeze();
}
$this->addElement('date', 'receipt_date', ts('Receipt Sent'), CRM_Core_SelectValues::date('manual', 3, 1));
$this->addRule('receipt_date', ts('Select a valid date.'), 'qfDate');
$this->addElement('date', 'thankyou_date', ts('Thank-you Sent'), CRM_Core_SelectValues::date('manual', 3, 1));
$this->addRule('thankyou_date', ts('Select a valid date.'), 'qfDate');
$this->addElement('date', 'cancel_date', ts('Cancelled'), CRM_Core_SelectValues::date('manual', 3, 1));
$this->addRule('cancel_date', ts('Select a valid date.'), 'qfDate');
$this->add('textarea', 'cancel_reason', ts('Cancellation Reason'), $attributes['cancel_reason']);
// add various amounts
$element =& $this->add('text', 'non_deductible_amount', ts('Non-deductible Amount'), $attributes['non_deductible_amount']);
$this->addRule('non_deductible_amount', ts('Please enter a valid amount.'), 'money');
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('text', 'total_amount', ts('Total Amount'), $attributes['total_amount'], true);
$this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('text', 'fee_amount', ts('Fee Amount'), $attributes['fee_amount']);
$this->addRule('fee_amount', ts('Please enter a valid amount.'), 'money');
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('text', 'net_amount', ts('Net Amount'), $attributes['net_amount']);
$this->addRule('net_amount', ts('Please enter a valid amount.'), 'money');
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('text', 'trxn_id', ts('Transaction ID'), $attributes['trxn_id']);
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('text', 'invoice_id', ts('Invoice ID'), $attributes['invoice_id']);
if ($this->_online) {
$element->freeze();
}
$element =& $this->add('text', 'source', ts('Source'), $attributes['source']);
if ($this->_online) {
$element->freeze();
}
$this->add('textarea', 'note', ts('Notes'), array("rows" => 4, "cols" => 60));
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_Contribute_Form_Contribution', 'formRule'), $this);
if ($this->_action & CRM_CORE_ACTION_VIEW) {
$this->freeze();
}
}
示例13: contribution
function contribution()
{
$config =& CRM_Core_Config::singleton();
if (!in_array('CiviContribute', $config->enableComponents)) {
return;
}
// process to / from date
$this->dateQueryBuilder('civicrm_contribution', 'contribution_date', 'receive_date', 'Contribution Date');
$qill = array();
if (isset($this->_params['contribution_date_from'])) {
$revDate = array_reverse($this->_params['contribution_date_from']);
$date = CRM_Utils_Date::format($revDate);
$format = CRM_Utils_Date::customFormat(CRM_Utils_Date::format($revDate, '-'));
if ($date) {
$this->_where[] = "civicrm_contribution.receive_date >= '{$date}'";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$qill[] = ts('greater than "%1"', array(1 => $format));
}
}
if (isset($this->_params['contribution_date_to'])) {
$revDate = array_reverse($this->_params['contribution_date_to']);
$date = CRM_Utils_Date::format($revDate);
$format = CRM_Utils_Date::customFormat(CRM_Utils_Date::format($revDate, '-'));
if ($date) {
$this->_where[] = " ( civicrm_contribution.receive_date <= '{$date}' ) ";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$qill[] = ts('less than "%1"', array(1 => $format));
}
}
if (!empty($qill)) {
$this->_qill[] = ts('Contribution Date - %1', array(1 => implode(' ' . ts('and') . ' ', $qill)));
}
// process min/max amount
$qill = array();
if (isset($this->_params['contribution_min_amount'])) {
$amount = $this->_params['contribution_min_amount'];
if ($amount > 0) {
$this->_where[] = "civicrm_contribution.total_amount >= {$amount}";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$qill[] = ts('greater than "%1"', array(1 => $amount));
}
}
if (isset($this->_params['contribution_max_amount'])) {
$amount = $this->_params['contribution_max_amount'];
if ($amount > 0) {
$this->_where[] = "civicrm_contribution.total_amount <= {$amount}";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$qill[] = ts('less than "%1"', array(1 => $amount));
}
}
if (!empty($qill)) {
$this->_qill[] = ts('Contribution Amount - %1', array(1 => implode(' ' . ts('and') . ' ', $qill)));
}
if (CRM_Utils_Array::value('contribution_thankyou_date_isnull', $this->_params)) {
$this->_where[] = "civicrm_contribution.thankyou_date is null";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$this->_qill[] = ts('Contribution Thank-you date is null');
}
if (CRM_Utils_Array::value('contribution_receipt_date_isnull', $this->_params)) {
$this->_where[] = "civicrm_contribution.receipt_date is null";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$this->_qill[] = ts('Contribution Receipt date is null');
}
if (CRM_Utils_Array::value('contribution_type_id', $this->_params)) {
require_once 'CRM/Contribute/PseudoConstant.php';
$cType = $this->_params['contribution_type_id'];
$types = CRM_Contribute_PseudoConstant::contributionType();
$this->_where[] = "civicrm_contribution.contribution_type_id = {$cType}";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$this->_qill[] = ts('Contribution Type - %1', array(1 => $types[$cType]));
}
if (CRM_Utils_Array::value('payment_instrument_id', $this->_params)) {
require_once 'CRM/Contribute/PseudoConstant.php';
$pi = $this->_params['payment_instrument_id'];
$pis = CRM_Contribute_PseudoConstant::paymentInstrument();
$this->_where[] = "civicrm_contribution.payment_instrument_id = {$pi}";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$this->_qill[] = ts('Paid By - %1', array(1 => $pis[$pi]));
}
if (isset($this->_params['contribution_status'])) {
switch ($this->_params['contribution_status']) {
case 'Valid':
$this->_where[] = "civicrm_contribution.cancel_date is null";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$this->_qill[] = ts('Contribution Status - Valid');
break;
case 'Cancelled':
$this->_where[] = "civicrm_contribution.cancel_date is not null";
$this->_tables['civicrm_contribution'] = $this->_whereTables['civicrm_contribution'] = 1;
$this->_qill[] = ts('Contribution Status - Cancelled');
break;
}
}
}
示例14: buildQuickFormCommon
/**
* add all the elements shared between this and advnaced search
*
* @access public
* @return void
* @static
*/
function buildQuickFormCommon(&$form)
{
// Date selects for date
$form->add('date', 'contribution_date_from', ts('Contribution Dates - From'), CRM_Core_SelectValues::date('relative'));
$form->addRule('contribution_date_from', ts('Select a valid date.'), 'qfDate');
$form->add('date', 'contribution_date_to', ts('To'), CRM_Core_SelectValues::date('relative'));
$form->addRule('contribution_date_to', ts('Select a valid date.'), 'qfDate');
$form->add('text', 'contribution_min_amount', ts('Minimum Amount'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_min_amount', ts('Please enter a valid money value (e.g. 9.99).'), 'money');
$form->add('text', 'contribution_max_amount', ts('Maximum Amount'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_max_amount', ts('Please enter a valid money value (e.g. 99.99).'), 'money');
$form->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$form->add('select', 'payment_instrument_id', ts('Payment Instrument'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument());
$status = array();
$status[] = $form->createElement('radio', null, null, ts('Valid'), 'Valid');
$status[] = $form->createElement('radio', null, null, ts('Cancelled'), 'Cancelled');
$status[] = $form->createElement('radio', null, null, ts('All'), 'All');
$form->addGroup($status, 'contribution_status', ts('Contribution Status'));
$form->setDefaults(array('contribution_status' => 'All'));
// add null checkboxes for thank you and receipt
$form->addElement('checkbox', 'contribution_thankyou_date_isnull', ts('Thank-you date not set?'));
$form->addElement('checkbox', 'contribution_receipt_date_isnull', ts('Receipt date not set?'));
// add all the custom searchable fields
require_once 'CRM/Core/BAO/CustomGroup.php';
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, array('Contribution'));
if ($groupDetails) {
require_once 'CRM/Core/BAO/CustomField.php';
$form->assign('contributeGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, false, false, true);
}
}
}
}
示例15: buildProfile
//.........这里部分代码省略.........
$contID = $contactId;
if (!$contID) {
$contID = $form->get('id');
}
$form->addRule($name, ts('External ID already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Contact', $contID, 'external_identifier'));
} else {
if ($fieldName === 'group') {
require_once 'CRM/Contact/Form/Edit/TagsAndGroups.php';
CRM_Contact_Form_Edit_TagsAndGroups::buildQuickForm($form, $contactId, CRM_Contact_Form_Edit_TagsAndGroups::GROUP, true, $required, $title, null, $name);
} else {
if ($fieldName === 'tag') {
require_once 'CRM/Contact/Form/Edit/TagsAndGroups.php';
CRM_Contact_Form_Edit_TagsAndGroups::buildQuickForm($form, $contactId, CRM_Contact_Form_Edit_TagsAndGroups::TAG, false, $required, null, $title, $name);
} else {
if ($fieldName === 'home_URL') {
$form->addElement('text', $name, $title, array_merge(CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL'), array('onfocus' => "if (!this.value) this.value='http://'; else return false", 'onblur' => "if ( this.value == 'http://') this.value=''; else return false")));
$form->addRule($name, ts('Enter a valid Website.'), 'url');
} else {
if (substr($fieldName, 0, 6) === 'custom') {
$customFieldID = CRM_Core_BAO_CustomField::getKeyID($fieldName);
if ($customFieldID) {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $name, $customFieldID, false, $required, $search, $title);
}
} else {
if (in_array($fieldName, array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date'))) {
$form->addDate($name, $title, $required, array('formatType' => 'custom'));
} else {
if ($fieldName == 'payment_instrument') {
require_once "CRM/Contribute/PseudoConstant.php";
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), $required);
} else {
if ($fieldName == 'contribution_type') {
require_once "CRM/Contribute/PseudoConstant.php";
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType(), $required);
} else {
if ($fieldName == 'contribution_status_id') {
require_once "CRM/Contribute/PseudoConstant.php";
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionStatus(), $required);
} else {
if ($fieldName == 'participant_register_date') {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
} else {
if ($fieldName == 'participant_status_id') {
require_once "CRM/Event/PseudoConstant.php";
$cond = null;
if ($online == true) {
$cond = "visibility_id = 1";
}
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantStatus(null, $cond), $required);
} else {
if ($fieldName == 'participant_role_id') {
require_once "CRM/Event/PseudoConstant.php";
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantRole(), $required);
} else {
if ($fieldName == 'scholarship_type_id') {
$form->add('select', $name, $title, array("" => "-- Select -- ") + array_flip(CRM_Core_OptionGroup::values('scholarship_type', true)));
} else {
if ($fieldName == 'applicant_status_id') {
$form->add('select', $name, $title, array("" => "-- Select -- ") + array_flip(CRM_Core_OptionGroup::values('applicant_status', true)));
} else {
if ($fieldName == 'highschool_gpa_id') {
$form->add('select', $name, $title, array("" => "-- Select -- ") + CRM_Core_OptionGroup::values('highschool_gpa'));
} else {
if ($fieldName == 'world_region') {
require_once "CRM/Core/PseudoConstant.php";
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Core_PseudoConstant::worldRegion(), $required);