本文整理汇总了PHP中CRM_Contribute_PseudoConstant::contributionPage方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_PseudoConstant::contributionPage方法的具体用法?PHP CRM_Contribute_PseudoConstant::contributionPage怎么用?PHP CRM_Contribute_PseudoConstant::contributionPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Contribute_PseudoConstant::contributionPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
// Check if CiviCampaign is a) enabled and b) has active campaigns
$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), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), '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_financial_type' => array('dao' => 'CRM_Financial_DAO_FinancialType', 'fields' => array('financial_type' => null), 'grouping' => 'contri-fields', 'group_bys' => array('financial_type' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => array('title' => ts('Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'total_amount' => array('title' => ts('Contribution Amount Stats'), 'default' => TRUE, 'statistics' => array('sum' => ts('Contributions Aggregate'), 'count' => ts('Contributions'), 'avg' => ts('Contributions Avg')))), '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), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount')), 'total_sum' => array('title' => ts('Contributions Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE), 'total_count' => array('title' => ts('Contributions Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_count', 'having' => TRUE), 'total_avg' => array('title' => ts('Contributions Avg'), '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_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_amount' => array('title' => ts('Soft Credit Amount Stats'), 'name' => 'amount', 'statistics' => array('sum' => ts('Soft Credit Aggregate'), 'count' => ts('Soft Credits'), 'avg' => ts('Soft Credit Avg')))), 'grouping' => 'contri-fields', 'filters' => array('amount' => array('title' => ts('Soft Credit Amount')), 'soft_sum' => array('title' => ts('Soft Credit Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum', 'having' => TRUE), 'soft_count' => array('title' => ts('Soft Credits Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count', 'having' => TRUE), 'soft_avg' => array('title' => ts('Soft Credit Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg', 'having' => TRUE))), '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();
// If we have a campaign, build out the relevant elements
$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']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
}
$this->_currencyColumn = 'civicrm_contribution_currency';
parent::__construct();
}
示例2: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
$session =& CRM_Core_Session::singleton();
$config =& CRM_Core_Config::singleton();
$permissionCheck = false;
$statusMessage = '';
if ($config->userFramework != 'Joomla') {
$permissionCheck = CRM_Core_Permission::check('administer CiviCRM');
}
//get the pcp id.
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
$prms = array('id' => $this->_id);
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCP', $prms, $pcpInfo);
if (empty($pcpInfo)) {
$statusMessage = ts('The personal campaign page you requested is currently unavailable.');
CRM_Core_Error::statusBounce($statusMessage, $config->userFrameworkBaseURL);
}
CRM_Utils_System::setTitle($pcpInfo['title']);
$this->assign('pcp', $pcpInfo);
require_once 'CRM/Contribute/PseudoConstant.php';
require_once 'CRM/Core/OptionGroup.php';
$pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
$approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
// check if PCP is created by anonymous user
$anonymousPCP = CRM_Utils_Request::retrieve('ap', 'Boolean', $this);
if ($anonymousPCP) {
$loginUrl = $config->userFrameworkBaseURL;
switch (ucfirst($config->userFramework)) {
case 'Joomla':
$loginUrl = str_replace('administrator/', '', $loginUrl);
$loginUrl .= 'index.php?option=com_user&view=login';
break;
case 'Drupal':
$loginUrl .= 'user';
break;
}
$anonMessage = ts('Once you\'ve received your new account welcome email, you can <a href=%1>click here</a> to login and promote your campaign page.', array(1 => $loginUrl));
CRM_Core_Session::setStatus($anonMessage);
} else {
$statusMessage = ts('The personal campaign page you requested is currently unavailable. However you can still support the campaign by making a contribution here.');
}
if (!$pcpInfo['is_active']) {
// form is inactive, forward to main contribution page
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
} else {
if ($pcpInfo['status_id'] != $approvedId && !$permissionCheck) {
if ($pcpInfo['contact_id'] != $session->get('userID')) {
// PCP not approved. Forward everyone except admin and owner to main contribution page
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
}
} else {
$getStatus = CRM_Contribute_BAO_PCP::getStatus($this->_id);
if (!$getStatus) {
// PCP not enabled for this contribution page. Forward everyone to main contribution page
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
}
}
}
$default = array();
CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', $pcpInfo['contribution_page_id'], $default, array('start_date', 'end_date'));
require_once "CRM/Contribute/PseudoConstant.php";
$this->assign('pageName', CRM_Contribute_PseudoConstant::contributionPage($pcpInfo['contribution_page_id'], true));
if ($pcpInfo['contact_id'] == $session->get('userID')) {
$owner = $default[$pcpInfo['contribution_page_id']];
$owner['status'] = CRM_Utils_Array::value($pcpInfo['status_id'], $pcpStatus);
$this->assign('owner', $owner);
require_once 'CRM/Contribute/BAO/PCP.php';
$link = CRM_Contribute_BAO_PCP::pcpLinks();
unset($link['all'][CRM_Core_Action::ENABLE]);
$hints = array(CRM_Core_Action::UPDATE => ts('Change the content and appearance of your page'), CRM_Core_Action::DETACH => ts('Send emails inviting your friends to support your campaign!'), CRM_Core_Action::BROWSE => ts('Update your personal contact information'), CRM_Core_Action::DISABLE => ts('De-activate the page (you can re-activate it later)'), CRM_Core_Action::DELETE => ts('Remove the page (this cannot be undone!)'));
CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_PCPBlock', $pcpInfo['contribution_page_id'], 'entity_id', $blockValues, array('is_tellfriend_enabled'));
$blockId = array_pop($blockValues);
$replace = array('id' => $this->_id, 'block' => $blockId['id']);
if (!CRM_Utils_Array::value('is_tellfriend_enabled', $blockId) || CRM_Utils_Array::value('status_id', $pcpInfo) != $approvedId) {
unset($link['all'][CRM_Core_Action::DETACH]);
}
$this->assign('links', $link['all']);
$this->assign('hints', $hints);
$this->assign('replace', $replace);
}
$honor = CRM_Contribute_BAO_PCP::honorRoll($this->_id);
if ($file_id = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $this->_id, 'file_id', 'entity_id')) {
$image = '<img src="' . CRM_Utils_System::url('civicrm/file', "reset=1&id={$file_id}&eid={$this->_id}") . '" />';
$this->assign('image', $image);
}
$totalAmount = CRM_Contribute_BAO_PCP::thermoMeter($this->_id);
$achieved = round($totalAmount / $pcpInfo['goal_amount'] * 100, 2);
if ($linkText = CRM_Contribute_BAO_PCP::getPcpBlockStatus($pcpInfo['contribution_page_id'])) {
//.........这里部分代码省略.........
示例3: browse
/**
* Browse all custom data groups.
*
*
* @return void
* @access public
* @static
*/
function browse($action = null)
{
require_once 'CRM/Contact/BAO/GroupNesting.php';
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
if ($this->_sortByCharacter == 1 || !empty($_POST)) {
$this->_sortByCharacter = '';
}
require_once 'CRM/Contribute/PseudoConstant.php';
$status = CRM_Contribute_PseudoConstant::pcpstatus();
$contribution_page = CRM_Contribute_PseudoConstant::contributionPage();
$pcpSummary = $params = array();
$whereClause = null;
if (!empty($_POST)) {
if ($_POST['status_id'] != 0) {
$whereClause = ' AND cp.status_id = %1';
$params['1'] = array($_POST['status_id'], 'Integer');
}
if ($_POST['contibution_page_id'] != 0) {
$whereClause .= ' AND cp.contribution_page_id = %2';
$params['2'] = array($_POST['contibution_page_id'], 'Integer');
}
if ($_POST['status_id'] != 0 || $_POST['contibution_page_id'] != 0) {
$this->set('whereClause', $whereClause);
$this->set('params', $params);
} else {
$this->set('whereClause', null);
$this->set('params', null);
}
}
$approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
//check for delete CRM-4418
require_once 'CRM/Core/Permission.php';
$allowToDelete = CRM_Core_Permission::check('delete in CiviContribute');
$params = $this->get('params') ? $this->get('params') : array();
$title = ' AND cp.title LIKE %3';
$params['3'] = array($this->_sortByCharacter . '%', 'String');
$query = "\n SELECT cp.id as id, contact_id , status_id, cp.title as title, contribution_page_id, start_date, end_date, cp.is_active as active\n FROM civicrm_pcp cp, civicrm_contribution_page cpp\n WHERE cp.contribution_page_id = cpp.id {$title}" . $this->get('whereClause') . " ORDER BY status_id";
$dao = CRM_Core_DAO::executeQuery($query, $params, true, 'CRM_Contribute_DAO_PCP');
while ($dao->fetch()) {
$pcpSummary[$dao->id] = array();
$action = array_sum(array_keys($this->links()));
CRM_Core_DAO::storeValues($dao, $pcpSummary[$dao->id]);
require_once 'CRM/Contact/BAO/Contact.php';
$contact = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
$class = '';
if ($dao->status_id != $approvedId || $dao->active != 1) {
$class = 'disabled';
}
switch ($dao->status_id) {
case 2:
$action -= CRM_Core_Action::RENEW;
break;
case 3:
$action -= CRM_Core_Action::REVERT;
break;
}
if (!$allowToDelete) {
$action -= CRM_Core_Action::DELETE;
}
$pcpSummary[$dao->id]['id'] = $dao->id;
$pcpSummary[$dao->id]['start_date'] = $dao->start_date;
$pcpSummary[$dao->id]['end_date'] = $dao->end_date;
$pcpSummary[$dao->id]['supporter'] = $contact['0'];
$pcpSummary[$dao->id]['supporter_id'] = $dao->contact_id;
$pcpSummary[$dao->id]['status_id'] = $status[$dao->status_id];
$pcpSummary[$dao->id]['contribution_page_id'] = $dao->contribution_page_id;
$pcpSummary[$dao->id]['contribution_page_title'] = $contribution_page[$dao->contribution_page_id];
$pcpSummary[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
$pcpSummary[$dao->id]['class'] = $class;
}
$this->search();
$this->pagerAToZ($this->get('whereClause'), $params);
if ($pcpSummary) {
$this->assign('rows', $pcpSummary);
}
// Let template know if user has run a search or not
if ($this->get('whereClause')) {
$this->assign('isSearch', 1);
} else {
$this->assign('isSearch', 0);
}
}
示例4: preProcess
public function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviMember Component Settings'));
$this->_varNames = array(CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME => array('default_renewal_contribution_page' => array('html_type' => 'select', 'title' => ts('Default online membership renewal page'), 'option_values' => array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage(), 'weight' => 1, 'description' => ts('If you select a default online contribution page for self-service membership renewals, a "renew" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.'))));
parent::preProcess();
}
示例5: buildProfile
//.........这里部分代码省略.........
$form->addElement('checkbox', $name, $title);
} elseif ($fieldName == 'soft_credit') {
$form->addEntityRef("soft_credit_contact_id[{$rowNumber}]", ts('Soft Credit To'), array('create' => TRUE));
$form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
} elseif ($fieldName == 'product_name') {
list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
$sel =& $form->addElement('hierselect', $name, $title);
$products = array('0' => ts('- select -')) + $products;
$sel->setOptions(array($products, $options));
} elseif ($fieldName == 'payment_instrument') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), $required);
} elseif ($fieldName == 'financial_type') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), $required);
} elseif ($fieldName == 'contribution_status_id') {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus();
$statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
foreach (array('In Progress', 'Overdue', 'Refunded') as $suppress) {
unset($contributionStatuses[CRM_Utils_Array::key($suppress, $statusName)]);
}
$form->add('select', $name, $title, array('' => ts('- select -')) + $contributionStatuses, $required);
} elseif ($fieldName == 'soft_credit_type') {
$name = "soft_credit_type[{$rowNumber}]";
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Core_OptionGroup::values("soft_credit_type"));
//CRM-15350: choose SCT field default value as 'Gift' for membership use
//else (for contribution), use configured SCT default value
$SCTDefaultValue = CRM_Core_OptionGroup::getDefaultValue("soft_credit_type");
if ($field['field_type'] == 'Membership') {
$SCTDefaultValue = CRM_Core_OptionGroup::getValue('soft_credit_type', 'Gift', 'name');
}
$form->addElement('hidden', 'sct_default_id', $SCTDefaultValue, array('id' => 'sct_default_id'));
} elseif ($fieldName == 'currency') {
$form->addCurrency($name, $title, $required);
} elseif ($fieldName == 'contribution_page_id') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage(), $required, 'class="big"');
} elseif ($fieldName == 'participant_register_date') {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
} elseif ($fieldName == 'activity_status_id') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Core_PseudoConstant::activityStatus(), $required);
} elseif ($fieldName == 'activity_engagement_level') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Campaign_PseudoConstant::engagementLevel(), $required);
} elseif ($fieldName == 'activity_date_time') {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
} elseif ($fieldName == 'participant_status') {
$cond = NULL;
if ($online == TRUE) {
$cond = 'visibility_id = 1';
}
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantStatus(NULL, $cond, 'label'), $required);
} elseif ($fieldName == 'participant_role') {
if (!empty($field['is_multiple'])) {
$form->addCheckBox($name, $title, CRM_Event_PseudoConstant::participantRole(), NULL, NULL, NULL, NULL, ' ', TRUE);
} else {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantRole(), $required);
}
} elseif ($fieldName == 'world_region') {
$form->add('select', $name, $title, CRM_Core_PseudoConstant::worldRegion(), $required, $selectAttributes);
} elseif ($fieldName == 'signature_html') {
$form->add('wysiwyg', $name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName));
} elseif ($fieldName == 'signature_text') {
$form->add('textarea', $name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName));
} elseif (substr($fieldName, -11) == 'campaign_id') {
if (CRM_Campaign_BAO_Campaign::isCampaignEnable()) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value($contactId, $form->_componentCampaigns));
$form->add('select', $name, $title, array('' => ts('- select -')) + $campaigns, $required, 'class="crm-select2 big"');
}
} elseif ($fieldName == 'activity_details') {
示例6: alterDisplay
/**
* Alter display of rows.
*
* Iterate through the rows retrieved via SQL and make changes for display purposes,
* such as rendering contacts as links.
*
* @param array $rows
* Rows generated by SQL, with an array for each row.
*/
public function alterDisplay(&$rows)
{
$checkList = array();
$entryFound = FALSE;
$display_flag = $prev_cid = $cid = 0;
$contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
$contributionPages = CRM_Contribute_PseudoConstant::contributionPage();
foreach ($rows as $rowNum => $row) {
if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
// don't repeat contact details if its same as the previous row
if (array_key_exists('civicrm_contact_id', $row)) {
if ($cid = $row['civicrm_contact_id']) {
if ($rowNum == 0) {
$prev_cid = $cid;
} else {
if ($prev_cid == $cid) {
$display_flag = 1;
$prev_cid = $cid;
} else {
$display_flag = 0;
$prev_cid = $cid;
}
}
if ($display_flag) {
foreach ($row as $colName => $colVal) {
// Hide repeats in no-repeat columns, but not if the field's a section header
if (in_array($colName, $this->_noRepeats) && !array_key_exists($colName, $this->_sections)) {
unset($rows[$rowNum][$colName]);
}
}
}
$entryFound = TRUE;
}
}
}
if (CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) == 'Contribution') {
unset($rows[$rowNum]['civicrm_contribution_soft_soft_credit_type_id']);
}
// convert donor sort name to link
if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) && array_key_exists('civicrm_contact_id', $row)) {
$url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $row['civicrm_contact_id'], $this->_absoluteUrl);
$rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
$rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contact Summary for this Contact.");
}
if ($value = CRM_Utils_Array::value('civicrm_contribution_financial_type_id', $row)) {
$rows[$rowNum]['civicrm_contribution_financial_type_id'] = $contributionTypes[$value];
$entryFound = TRUE;
}
if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_status_id', $row)) {
$rows[$rowNum]['civicrm_contribution_contribution_status_id'] = $contributionStatus[$value];
$entryFound = TRUE;
}
if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_page_id', $row)) {
$rows[$rowNum]['civicrm_contribution_contribution_page_id'] = $contributionPages[$value];
$entryFound = TRUE;
}
if ($value = CRM_Utils_Array::value('civicrm_contribution_payment_instrument_id', $row)) {
$rows[$rowNum]['civicrm_contribution_payment_instrument_id'] = $paymentInstruments[$value];
$entryFound = TRUE;
}
if (array_key_exists('civicrm_batch_batch_id', $row)) {
if ($value = $row['civicrm_batch_batch_id']) {
$rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $value, 'title');
}
$entryFound = TRUE;
}
// Contribution amount links to viewing contribution
if (($value = CRM_Utils_Array::value('civicrm_contribution_total_amount_sum', $row)) && CRM_Core_Permission::check('access CiviContribute')) {
$url = CRM_Utils_System::url("civicrm/contact/view/contribution", "reset=1&id=" . $row['civicrm_contribution_contribution_id'] . "&cid=" . $row['civicrm_contact_id'] . "&action=view&context=contribution&selectedChild=contribute", $this->_absoluteUrl);
$rows[$rowNum]['civicrm_contribution_total_amount_sum_link'] = $url;
$rows[$rowNum]['civicrm_contribution_total_amount_sum_hover'] = ts("View Details of this Contribution.");
$entryFound = TRUE;
}
// convert campaign_id to campaign title
if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
if ($value = $row['civicrm_contribution_campaign_id']) {
$rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns[$value];
$entryFound = TRUE;
}
}
// soft credits
if (array_key_exists('civicrm_contribution_soft_credits', $row) && 'Contribution' == CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) && array_key_exists('civicrm_contribution_contribution_id', $row)) {
$query = "\nSELECT civicrm_contact_id, civicrm_contact_sort_name, civicrm_contribution_total_amount_sum, civicrm_contribution_currency\nFROM civireport_contribution_detail_temp2\nWHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribution_id']}";
$dao = CRM_Core_DAO::executeQuery($query);
$string = '';
$separator = $this->_outputMode !== 'csv' ? "<br/>" : ' ';
while ($dao->fetch()) {
$url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $dao->civicrm_contact_id);
$string = $string . ($string ? $separator : '') . "<a href='{$url}'>{$dao->civicrm_contact_sort_name}</a> " . CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->civicrm_contribution_currency);
//.........这里部分代码省略.........
示例7: buildSearchForm
/**
* add all the elements shared between contribute search and advnaced search
*
* @access public
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
require_once 'CRM/Utils/Money.php';
//added contribution source
$form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
$form->addDate('contribution_date_low', ts('Contribution Dates - From'), false, array('formatType' => 'searchDate'));
$form->addDate('contribution_date_high', ts('To'), false, array('formatType' => 'searchDate'));
$form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
require_once 'CRM/Contribute/PseudoConstant.php';
$form->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$form->add('select', 'contribution_page_id', ts('Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
$form->add('select', 'contribution_payment_instrument_id', ts('Payment Instrument'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument());
$form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::pcPage());
$status = array();
require_once "CRM/Core/OptionGroup.php";
$statusValues = CRM_Core_OptionGroup::values("contribution_status");
// Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue).
unset($statusValues['5']);
unset($statusValues['6']);
foreach ($statusValues as $key => $val) {
$status[] = $form->createElement('advcheckbox', $key, null, $val);
}
$form->addGroup($status, 'contribution_status_id', ts('Contribution Status'));
// 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 not sent?'));
//add fields for honor search
$form->addElement('text', 'contribution_in_honor_of', ts("In Honor Of"));
$form->addElement('checkbox', 'contribution_test', ts('Find Test Contributions?'));
$form->addElement('checkbox', 'contribution_pay_later', ts('Find Pay Later Contributions?'));
//add field for transaction ID search
$form->addElement('text', 'contribution_transaction_id', ts("Transaction ID"));
$form->addElement('checkbox', 'contribution_recurring', ts('Find Recurring Contributions?'));
$form->addElement('text', 'contribution_check_number', ts('Check Number'));
//add field for pcp display in roll search
$form->addYesNo('contribution_pcp_display_in_roll', ts('Display In Roll ?'));
// add all the custom searchable fields
require_once 'CRM/Core/BAO/CustomGroup.php';
$contribution = array('Contribution');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, $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);
}
}
}
$form->assign('validCiviContribute', true);
}
示例8: sendMail
//.........这里部分代码省略.........
//for display profile need to get individual contact id,
//hence get it from related_contact if on behalf of org true CRM-3767
//CRM-5001 Contribution/Membership:: On Behalf of Organization,
//If profile GROUP contain the Individual type then consider the
//profile is of Individual ( including the custom data of membership/contribution )
//IF Individual type not present in profile then it is consider as Organization data.
$userID = $contactID;
if ($preID = CRM_Utils_Array::value('custom_pre_id', $values)) {
if (!empty($values['related_contact'])) {
$preProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($preID);
//@todo - following line should not refer to undefined $postProfileTypes? figure out way to test
if (in_array('Individual', $preProfileTypes) || in_array('Contact', $postProfileTypes)) {
//Take Individual contact ID
$userID = CRM_Utils_Array::value('related_contact', $values);
}
}
self::buildCustomDisplay($preID, 'customPre', $userID, $template, $params['custom_pre_id']);
}
$userID = $contactID;
if ($postID = CRM_Utils_Array::value('custom_post_id', $values)) {
if (!empty($values['related_contact'])) {
$postProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($postID);
if (in_array('Individual', $postProfileTypes) || in_array('Contact', $postProfileTypes)) {
//Take Individual contact ID
$userID = CRM_Utils_Array::value('related_contact', $values);
}
}
self::buildCustomDisplay($postID, 'customPost', $userID, $template, $params['custom_post_id']);
}
if (isset($values['honor'])) {
$honorValues = $values['honor'];
CRM_Contribute_BAO_ContributionSoft::formatHonoreeProfileFields($template, $honorValues['honor_profile_values'], $honorValues['honor_profile_id'], $honorValues['honor_id']);
}
$title = isset($values['title']) ? $values['title'] : CRM_Contribute_PseudoConstant::contributionPage($values['contribution_page_id']);
// set email in the template here
$tplParams = array('email' => $email, 'receiptFromEmail' => CRM_Utils_Array::value('receipt_from_email', $values), 'contactID' => $contactID, 'displayName' => $displayName, 'contributionID' => CRM_Utils_Array::value('contribution_id', $values), 'contributionOtherID' => CRM_Utils_Array::value('contribution_other_id', $values), 'lineItem' => CRM_Utils_Array::value('lineItem', $values), 'priceSetID' => CRM_Utils_Array::value('priceSetID', $values), 'title' => $title, 'isShare' => CRM_Utils_Array::value('is_share', $values), 'thankyou_title' => CRM_Utils_Array::value('thankyou_title', $values));
if ($contributionTypeId = CRM_Utils_Array::value('financial_type_id', $values)) {
$tplParams['contributionTypeId'] = $contributionTypeId;
$tplParams['contributionTypeName'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $contributionTypeId);
}
if ($contributionPageId = CRM_Utils_Array::value('id', $values)) {
$tplParams['contributionPageId'] = $contributionPageId;
}
// address required during receipt processing (pdf and email receipt)
if ($displayAddress = CRM_Utils_Array::value('address', $values)) {
$tplParams['address'] = $displayAddress;
}
// CRM-6976
$originalCCReceipt = CRM_Utils_Array::value('cc_receipt', $values);
// cc to related contacts of contributor OR the one who
// signs up. Is used for cases like - on behalf of
// contribution / signup ..etc
if (array_key_exists('related_contact', $values)) {
list($ccDisplayName, $ccEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($values['related_contact']);
$ccMailId = "{$ccDisplayName} <{$ccEmail}>";
//@todo - this is the only place in this function where $values is altered - but I can't find any evidence it is used
$values['cc_receipt'] = !empty($values['cc_receipt']) ? $values['cc_receipt'] . ',' . $ccMailId : $ccMailId;
// reset primary-email in the template
$tplParams['email'] = $ccEmail;
$tplParams['onBehalfName'] = $displayName;
$tplParams['onBehalfEmail'] = $email;
$ufJoinParams = array('module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $values['id']);
$OnBehalfProfile = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$profileId = $OnBehalfProfile[0];
$userID = $contactID;
self::buildCustomDisplay($profileId, 'onBehalfProfile', $userID, $template, $params['onbehalf_profile'], $fieldTypes);
示例9: buildAdditionalDetail
/**
* Function to build the form for Additional Details.
*
* @access public
* @return None
*/
function buildAdditionalDetail(&$form)
{
//Additional information section
$form->add('hidden', 'hidden_AdditionalDetail', 1);
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
$this->addDateTime('thankyou_date', ts('Thank-you Sent'), false, array('formatType' => 'activityDateTime'));
// add various amounts
$element =& $form->add('text', 'non_deductible_amount', ts('Non-deductible Amount'), $attributes['non_deductible_amount']);
$form->addRule('non_deductible_amount', ts('Please enter a valid amount.'), 'money');
if ($form->_online) {
$element->freeze();
}
$element =& $form->add('text', 'fee_amount', ts('Fee Amount'), $attributes['fee_amount']);
$form->addRule('fee_amount', ts('Please enter a valid amount.'), 'money');
if ($form->_online) {
$element->freeze();
}
$element =& $form->add('text', 'net_amount', ts('Net Amount'), $attributes['net_amount']);
$form->addRule('net_amount', ts('Please enter a valid amount.'), 'money');
if ($form->_online) {
$element->freeze();
}
$element =& $form->add('text', 'invoice_id', ts('Invoice ID'), $attributes['invoice_id']);
if ($form->_online) {
$element->freeze();
} else {
$form->addRule('invoice_id', ts('This Invoice ID already exists in the database.'), 'objectExists', array('CRM_Contribute_DAO_Contribution', $form->_id, 'invoice_id'));
}
$form->add('select', 'contribution_page_id', ts('Online Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
$form->add('textarea', 'note', ts('Notes'), array("rows" => 4, "cols" => 60));
}
示例10: buildProfile
//.........这里部分代码省略.........
} elseif ($fieldName == 'note') {
$form->add('textarea', $name, $title, $attributes, $required);
} elseif (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);
}
} elseif (substr($fieldName, 0, 14) === 'address_custom') {
list($fName, $locTypeId) = CRM_Utils_System::explode('-', $fieldName, 2);
$customFieldID = CRM_Core_BAO_CustomField::getKeyID(substr($fName, 8));
if ($customFieldID) {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $name, $customFieldID, FALSE, $required, $search, $title);
}
} elseif (in_array($fieldName, array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date'))) {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
} elseif ($fieldName == 'send_receipt') {
$form->addElement('checkbox', $name, $title);
} elseif ($fieldName == 'soft_credit') {
CRM_Contact_Form_NewContact::buildQuickForm($form, $rowNumber, NULL, FALSE, 'soft_credit_');
} elseif ($fieldName == 'product_name') {
list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
$sel =& $form->addElement('hierselect', $name, $title);
$products = array('0' => ts('- select -')) + $products;
$sel->setOptions(array($products, $options));
} elseif ($fieldName == 'payment_instrument') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), $required);
} elseif ($fieldName == 'contribution_type') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType(), $required);
} elseif ($fieldName == 'contribution_status_id') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionStatus(), $required);
} elseif ($fieldName == 'currency') {
$form->addCurrency($name, $title, $required);
} elseif ($fieldName == 'contribution_page_id') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage(), $required, 'class="big"');
} elseif ($fieldName == 'participant_register_date') {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
} elseif ($fieldName == 'activity_status_id') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Core_PseudoConstant::activityStatus(), $required);
} elseif ($fieldName == 'activity_engagement_level') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Campaign_PseudoConstant::engagementLevel(), $required);
} elseif ($fieldName == 'activity_date_time') {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
} elseif ($fieldName == 'participant_status') {
$cond = NULL;
if ($online == TRUE) {
$cond = 'visibility_id = 1';
}
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantStatus(NULL, $cond, 'label'), $required);
} elseif ($fieldName == 'participant_role') {
if (CRM_Utils_Array::value('is_multiple', $field)) {
$form->addCheckBox($name, $title, CRM_Event_PseudoConstant::participantRole(), NULL, NULL, NULL, NULL, ' ', TRUE);
} else {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantRole(), $required);
}
} elseif ($fieldName == 'scholarship_type_id') {
$form->add('select', $name, $title, array('' => '-- Select -- ') + array_flip(CRM_Core_OptionGroup::values('scholarship_type', TRUE)));
} elseif ($fieldName == 'applicant_status_id') {
$form->add('select', $name, $title, array('' => '-- Select -- ') + array_flip(CRM_Core_OptionGroup::values('applicant_status', TRUE)));
} elseif ($fieldName == 'highschool_gpa_id') {
$form->add('select', $name, $title, array('' => '-- Select -- ') + CRM_Core_OptionGroup::values('highschool_gpa'));
} elseif ($fieldName == 'world_region') {
$form->add('select', $name, $title, array('' => ts('- select -')) + CRM_Core_PseudoConstant::worldRegion(), $required);
} elseif ($fieldName == 'signature_html') {
$form->addWysiwyg($name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName));
} elseif ($fieldName == 'signature_text') {
$form->add('textarea', $name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName));
示例11: buildQuickForm
/**
* Function to actually build the form
*
* @param null
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Campaign'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
} else {
$status = array('' => ts('- select -')) + CRM_Core_OptionGroup::values("pcp_status");
$types = array('' => ts('- select -'), 'contribute' => ts('Contribution'), 'event' => ts('Event'));
$contribPages = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage();
$eventPages = array('' => ts('- select -')) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$this->addElement('select', 'status_id', ts('Status'), $status);
$this->addElement('select', 'page_type', ts('Source Type'), $types);
$this->addElement('select', 'page_id', ts('Contribution Page'), $contribPages);
$this->addElement('select', 'event_id', ts('Event Page'), $eventPages);
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'spacing' => ' ', 'isDefault' => TRUE)));
parent::buildQuickForm();
}
}
示例12: buildSearchForm
/**
* add all the elements shared between contribute search and advnaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
//added contribution source
$form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
//adding select option for curreny type -- CRM-4711
$form->add('select', 'contribution_currency_type', ts('Currency Type'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::currencySymbols('name'));
$form->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$form->add('select', 'contribution_page_id', ts('Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
$form->add('select', 'contribution_payment_instrument_id', ts('Payment Instrument'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument());
$form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::pcPage());
$status = array();
$statusValues = CRM_Core_OptionGroup::values("contribution_status");
// Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue).
unset($statusValues['5']);
unset($statusValues['6']);
foreach ($statusValues as $key => $val) {
$status[] = $form->createElement('advcheckbox', $key, NULL, $val);
}
$form->addGroup($status, 'contribution_status_id', ts('Contribution Status'));
// 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 not sent?'));
//add fields for honor search
$form->addElement('text', 'contribution_in_honor_of', ts("In Honor Of"));
$form->addElement('checkbox', 'contribution_test', ts('Find Test Contributions?'));
$form->addElement('checkbox', 'contribution_pay_later', ts('Find Pay Later Contributions?'));
//add field for transaction ID search
$form->addElement('text', 'contribution_transaction_id', ts("Transaction ID"));
$form->addElement('checkbox', 'contribution_recurring', ts('Find Recurring Contributions?'));
$form->addElement('checkbox', 'contribution_recurring_isnull', ts('Find Non Recurring Contributions?'));
$form->addElement('text', 'contribution_check_number', ts('Check Number'));
//add field for pcp display in roll search
$form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?'));
// add all the custom searchable fields
$contribution = array('Contribution');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution);
if ($groupDetails) {
$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);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
// add batch select
$batches = CRM_Core_BAO_Batch::getBatches();
if (!empty($batches)) {
$form->add('select', 'contribution_batch_id', ts('Batch Name'), array('' => ts('- select -')) + $batches);
}
$form->assign('validCiviContribute', TRUE);
}
示例13: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
function buildQuickForm()
{
$this->add('select', 'default_renewal_contribution_page', ts('Default Online Membership Renewal Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
parent::buildQuickForm();
}
示例14: buildQuickForm
/**
* Function to actually build the form
*
* @param null
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Campaign'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
} else {
require_once 'CRM/Contribute/PseudoConstant.php';
$status = array_merge(array(ts('- select -')), CRM_Contribute_PseudoConstant::pcpstatus());
$contribution_page = array_merge(array(ts('- select -')), CRM_Contribute_PseudoConstant::contributionPage());
$this->addElement('select', 'status_id', ts('Personal Campaign Pages Status'), $status);
$this->addElement('select', 'contibution_page_id', ts('Contribution Page'), $contribution_page);
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Show'), 'spacing' => ' ', 'isDefault' => true)));
parent::buildQuickForm();
}
}
示例15: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$id = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
if (CRM_PCP_BAO_PCP::checkEmailProfile($id)) {
$this->assign('profileDisplay', TRUE);
}
$fields = NULL;
if ($this->_contactID) {
if (CRM_Core_BAO_UFGroup::filterUFGroups($id, $this->_contactID)) {
$fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
}
$this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
} else {
CRM_Core_BAO_CMSUser::buildForm($this, $id, TRUE);
$fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
}
if ($fields) {
$this->assign('fields', $fields);
$addCaptcha = FALSE;
foreach ($fields as $key => $field) {
if (isset($field['data_type']) && $field['data_type'] == 'File') {
// ignore file upload fields
continue;
}
CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
$this->_fields[$key] = $field;
// CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
if ($field['add_captcha'] && !$this->_contactID) {
$addCaptcha = TRUE;
}
}
if ($addCaptcha) {
$captcha =& CRM_Utils_ReCAPTCHA::singleton();
$captcha->add($this);
$this->assign('isCaptcha', TRUE);
}
}
if ($this->_component == 'contribute') {
$this->assign('campaignName', CRM_Contribute_PseudoConstant::contributionPage($this->_pageId));
} elseif ($this->_component == 'event') {
$this->assign('campaignName', CRM_Event_PseudoConstant::event($this->_pageId));
}
if ($this->_single) {
$button = array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
} else {
$button[] = array('type' => 'next', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE);
}
$this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
$this->addButtons($button);
}