本文整理汇总了PHP中CRM_Contact_BAO_Query::processSpecialFormValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Query::processSpecialFormValue方法的具体用法?PHP CRM_Contact_BAO_Query::processSpecialFormValue怎么用?PHP CRM_Contact_BAO_Query::processSpecialFormValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Query
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Query::processSpecialFormValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* The post processing of the form gets done here.
*
* Key things done during post processing are
* - check for reset or next request. if present, skip post processing.
* - now check if user requested running a saved search, if so, then
* the form values associated with the saved search are used for searching.
* - if user has done a submit with new values the regular post submission is
* done.
* The processing consists of using a Selector / Controller framework for getting the
* search results.
*/
public function postProcess()
{
if ($this->_done) {
return;
}
$this->_done = TRUE;
if (!empty($_POST)) {
$this->_formValues = $this->controller->exportValues($this->_name);
}
$this->fixFormValues();
// We don't show test records in summaries or dashboards
if (empty($this->_formValues['contribution_test']) && $this->_force && !empty($this->_context) && $this->_context == 'dashboard') {
$this->_formValues["contribution_test"] = 0;
}
foreach (array('contribution_amount_low', 'contribution_amount_high') as $f) {
if (isset($this->_formValues[$f])) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
}
}
$config = CRM_Core_Config::singleton();
if (!empty($_POST)) {
$specialParams = array('financial_type_id', 'contribution_soft_credit_type_id', 'contribution_status_id', 'contribution_source', 'contribution_trxn_id', 'contribution_page_id', 'contribution_product_id', 'invoice_id', 'payment_instrument_id');
CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, $specialParams);
$tags = CRM_Utils_Array::value('contact_tags', $this->_formValues);
if ($tags && !is_array($tags)) {
unset($this->_formValues['contact_tags']);
$this->_formValues['contact_tags'][$tags] = 1;
}
if ($tags && is_array($tags)) {
unset($this->_formValues['contact_tags']);
foreach ($tags as $notImportant => $tagID) {
$this->_formValues['contact_tags'][$tagID] = 1;
}
}
if (!defined('CIVICRM_GROUPTREE')) {
$group = CRM_Utils_Array::value('group', $this->_formValues);
if ($group && !is_array($group)) {
unset($this->_formValues['group']);
$this->_formValues['group'][$group] = 1;
}
if ($group && is_array($group)) {
unset($this->_formValues['group']);
foreach ($group as $notImportant => $groupID) {
$this->_formValues['group'][$groupID] = 1;
}
}
}
}
CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
$this->set('formValues', $this->_formValues);
$this->set('queryParams', $this->_queryParams);
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->_actionButtonName) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
// hack, make sure we reset the task values
$stateMachine = $this->controller->getStateMachine();
$formName = $stateMachine->getTaskFormName();
$this->controller->resetPage($formName);
return;
}
$sortID = NULL;
if ($this->get(CRM_Utils_Sort::SORT_ID)) {
$sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION));
}
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
$selector = new CRM_Contribute_Selector_Search($this->_queryParams, $this->_action, NULL, $this->_single, $this->_limit, $this->_context);
$selector->setKey($this->controller->_key);
$prefix = NULL;
if ($this->_context == 'basic' || $this->_context == 'user') {
$prefix = $this->_prefix;
}
$controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SESSION, $prefix);
$controller->setEmbedded(TRUE);
$query =& $selector->getQuery();
if ($this->_context == 'user') {
$query->setSkipPermission(TRUE);
}
$summary =& $query->summaryContribution($this->_context);
$this->set('summary', $summary);
$this->assign('contributionSummary', $summary);
$controller->run();
}
示例2: postProcess
/**
* The post processing of the form gets done here.
*
* Key things done during post processing are
* - check for reset or next request. if present, skip post procesing.
* - now check if user requested running a saved search, if so, then
* the form values associated with the saved search are used for searching.
* - if user has done a submit with new values the regular post submissing is
* done.
* The processing consists of using a Selector / Controller framework for getting the
* search results.
*
* @param
*
* @return void
*/
public function postProcess()
{
if ($this->_done) {
return;
}
$this->_done = TRUE;
if (!empty($_POST)) {
$this->_formValues = $this->controller->exportValues($this->_name);
CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, array('participant_status_id'));
}
if (empty($this->_formValues)) {
$this->_formValues = $this->controller->exportValues($this->_name);
}
$this->fixFormValues();
if (isset($this->_ssID) && empty($_POST)) {
// if we are editing / running a saved search and the form has not been posted
$this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
}
// We don't show test records in summaries or dashboards
if (empty($this->_formValues['participant_test']) && $this->_force) {
$this->_formValues["participant_test"] = 0;
}
CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$this->set('formValues', $this->_formValues);
$this->set('queryParams', $this->_queryParams);
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->_actionButtonName) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
// hack, make sure we reset the task values
$stateMachine = $this->controller->getStateMachine();
$formName = $stateMachine->getTaskFormName();
$this->controller->resetPage($formName);
return;
}
$sortID = NULL;
if ($this->get(CRM_Utils_Sort::SORT_ID)) {
$sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION));
}
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$selector = new CRM_Event_Selector_Search($this->_queryParams, $this->_action, NULL, $this->_single, $this->_limit, $this->_context);
$selector->setKey($this->controller->_key);
$prefix = NULL;
if ($this->_context == 'user') {
$prefix = $this->_prefix;
}
$this->assign("{$prefix}limit", $this->_limit);
$this->assign("{$prefix}single", $this->_single);
$controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SESSION, $prefix);
$controller->setEmbedded(TRUE);
$query = $selector->getQuery();
if ($this->_context == 'user') {
$query->setSkipPermission(TRUE);
}
$controller->run();
}
示例3: normalizeFormValues
/**
* Normalize the form values to make it look similar to the advanced form values.
*
* This prevents a ton of work downstream and allows us to use the same code for
* multiple purposes (queries, save/edit etc)
*/
public function normalizeFormValues()
{
$contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
if ($contactType && is_array($contactType)) {
unset($this->_formValues['contact_type']);
foreach ($contactType as $key => $value) {
$this->_formValues['contact_type'][$value] = 1;
}
}
$config = CRM_Core_Config::singleton();
$specialParams = array('financial_type_id', 'contribution_soft_credit_type_id', 'contribution_status', 'contribution_status_id', 'contribution_source', 'membership_status_id', 'participant_status_id', 'contribution_trxn_id', 'activity_type_id', 'status_id', 'activity_subject', 'contribution_page_id', 'contribution_product_id', 'payment_instrument_id', 'group', 'contact_tags', 'preferred_communication_method');
$changeNames = array('status_id' => 'activity_status_id');
CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, $specialParams, $changeNames);
$taglist = CRM_Utils_Array::value('contact_taglist', $this->_formValues);
if ($taglist && is_array($taglist)) {
unset($this->_formValues['contact_taglist']);
foreach ($taglist as $value) {
if ($value) {
$value = explode(',', $value);
foreach ($value as $tId) {
if (is_numeric($tId)) {
$this->_formValues['contact_tags'][] = $tId;
}
}
}
}
}
}