当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contact_BAO_Query::convertFormValues方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_Query::convertFormValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Query::convertFormValues方法的具体用法?PHP CRM_Contact_BAO_Query::convertFormValues怎么用?PHP CRM_Contact_BAO_Query::convertFormValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_Query的用法示例。


在下文中一共展示了CRM_Contact_BAO_Query::convertFormValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testConvertEntityFieldMultipleValueEntityRefDoubleRun

 /**
  * Check that running convertFormValues more than one doesn't mangle the array.
  *
  * Unfortunately the convertFormValues & indeed much of the query code is run in pre-process AND post-process.
  *
  * The convertFormValues function should cope with this until such time as we can rationalise that.
  */
 public function testConvertEntityFieldMultipleValueEntityRefDoubleRun()
 {
     $formValues = array('membership_type_id' => '1,2');
     $params = CRM_Contact_BAO_Query::convertFormValues($formValues, 0, FALSE, NULL, array('membership_type_id'));
     $this->assertEquals(array('membership_type_id', 'IN', array(1, 2), 0, 0), $params[0]);
     $params = CRM_Contact_BAO_Query::convertFormValues($params, 0, FALSE, NULL, array('membership_type_id'));
     $this->assertEquals(array('membership_type_id', 'IN', array(1, 2), 0, 0), $params[0]);
     $obj = new CRM_Contact_BAO_Query($params);
     $this->assertEquals(array('civicrm_membership.membership_type_id IN ("1", "2")'), $obj->_where[0]);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:17,代码来源:QueryTest.php

示例2: __construct

 function __construct(&$formValues)
 {
     parent::__construct($formValues);
     $this->normalize();
     $this->_columns = array(ts('') => 'contact_type', ts('Name') => 'sort_name', ts('Address') => 'street_address', ts('City') => 'city', ts('State') => 'state_province', ts('Postal') => 'postal_code', ts('Country') => 'country', ts('Email') => 'email', ts('Phone') => 'phone');
     $params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $returnProperties = array();
     foreach ($this->_columns as $name => $field) {
         $returnProperties[$field] = 1;
     }
     $this->_query =& new CRM_Contact_BAO_Query($params, $returnProperties, null, false, false, 1, false, false);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:12,代码来源:Basic.php

示例3: testSelectorQuery

 /**
  * Test the query from the selector class is consistent with the dataset expectation.
  *
  * @param array $dataSet
  *   The data set to be tested. Note that when adding new datasets often only form_values and expected where
  *   clause will need changing.
  *
  * @dataProvider querySets
  */
 public function testSelectorQuery($dataSet)
 {
     $params = CRM_Contact_BAO_Query::convertFormValues($dataSet['form_values'], 0, FALSE, NULL, array());
     foreach ($dataSet['settings'] as $setting) {
         $this->callAPISuccess('Setting', 'create', array($setting['name'] => $setting['value']));
     }
     $selector = new CRM_Contact_Selector($dataSet['class'], $dataSet['form_values'], $params, $dataSet['return_properties'], $dataSet['action'], $dataSet['includeContactIds'], $dataSet['searchDescendentGroups'], $dataSet['context']);
     $queryObject = $selector->getQueryObject();
     $sql = $queryObject->query();
     $this->wrangleDefaultClauses($dataSet['expected_query']);
     foreach ($dataSet['expected_query'] as $index => $queryString) {
         $this->assertEquals($this->strWrangle($queryString), $this->strWrangle($sql[$index]));
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:23,代码来源:SelectorTest.php

示例4: testSearch

 /**
  *  Test CRM_Contact_BAO_Query::searchQuery()
  *  @dataProvider dataProvider
  */
 function testSearch($fv, $count, $ids, $full)
 {
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/queryDataset.xml'));
     $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     $obj = new CRM_Contact_BAO_Query($params);
     $obj->_useGroupBy = TRUE;
     $dao = $obj->searchQuery();
     $contacts = array();
     while ($dao->fetch()) {
         $contacts[] = $dao->contact_id;
     }
     sort($contacts, SORT_NUMERIC);
     $this->assertEquals($ids, $contacts, 'In line ' . __LINE__);
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:19,代码来源:QueryTest.php

示例5: testSearch

 /**
  *  Test CRM_Contact_BAO_Query::searchQuery()
  * @dataProvider dataProvider
  * @param $fv
  * @param $count
  * @param $ids
  * @param $full
  */
 public function testSearch($fv, $count, $ids, $full)
 {
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/queryDataset.xml'));
     $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     $obj = new CRM_Contact_BAO_Query($params);
     // let's set useGroupBy=true since we are listing contacts here who might belong to
     // more than one group / tag / notes etc.
     $obj->_useGroupBy = TRUE;
     $dao = $obj->searchQuery();
     $contacts = array();
     while ($dao->fetch()) {
         $contacts[] = $dao->contact_id;
     }
     sort($contacts, SORT_NUMERIC);
     $this->assertEquals($ids, $contacts);
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:25,代码来源:QueryTest.php

示例6: __construct

 /**
  * Class constructor.
  *
  * @param array $formValues
  */
 public function __construct(&$formValues)
 {
     parent::__construct($formValues);
     $this->_columns = array('' => 'contact_type', ts('Name') => 'sort_name', ts('Address') => 'street_address', ts('City') => 'city', ts('State') => 'state_province', ts('Postal') => 'postal_code', ts('Country') => 'country', ts('Email') => 'email', ts('Phone') => 'phone');
     $params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $returnProperties = array();
     $returnProperties['contact_sub_type'] = 1;
     $addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options', TRUE, NULL, TRUE);
     foreach ($this->_columns as $name => $field) {
         if (in_array($field, array('street_address', 'city', 'state_province', 'postal_code', 'country')) && empty($addressOptions[$field])) {
             unset($this->_columns[$name]);
             continue;
         }
         $returnProperties[$field] = 1;
     }
     $this->_query = new CRM_Contact_BAO_Query($params, $returnProperties, NULL, FALSE, FALSE, 1, FALSE, FALSE);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:22,代码来源:Basic.php

示例7: postProcess

 /**
  * This method is called for processing a submitted search form.
  */
 public function postProcess()
 {
     $this->set('isAdvanced', '0');
     $this->set('isSearchBuilder', '0');
     // get user submitted values
     // get it from controller only if form has been submitted, else preProcess has set this
     if (!empty($_POST)) {
         $this->_formValues = $this->controller->exportValues($this->_name);
     }
     if (isset($this->_groupID) && empty($this->_formValues['group'])) {
         $this->_formValues['group'] = $this->_groupID;
     } elseif (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);
         //fix for CRM-1505
         if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID, 'mapping_id')) {
             $this->_params = CRM_Contact_BAO_SavedSearch::getSearchParams($this->_ssID);
         }
     }
     // we dont want to store the sortByCharacter in the formValue, it is more like
     // a filter on the result set
     // this filter is reset if we click on the search button
     if ($this->_sortByCharacter !== NULL && empty($_POST)) {
         if (strtolower($this->_sortByCharacter) == 'all') {
             $this->_formValues['sortByCharacter'] = NULL;
         } else {
             $this->_formValues['sortByCharacter'] = $this->_sortByCharacter;
         }
     } else {
         $this->_sortByCharacter = NULL;
     }
     $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $this->_returnProperties =& $this->returnProperties();
     parent::postProcess();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:38,代码来源:Basic.php

示例8: preProcess

 /**
  * processing needed for buildForm and later
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /**
      * set the varios class variables
      */
     $this->_group =& CRM_Core_PseudoConstant::group();
     $this->_groupIterator =& CRM_Core_PseudoConstant::groupIterator();
     $this->_tag =& CRM_Core_PseudoConstant::tag();
     $this->_done = false;
     /**
      * set the button names
      */
     $this->_searchButtonName = $this->getButtonName('refresh');
     $this->_printButtonName = $this->getButtonName('next', 'print');
     $this->_actionButtonName = $this->getButtonName('next', 'action');
     /*
      * we allow the controller to set force/reset externally, useful when we are being
      * driven by the wizard framework
      */
     $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
     $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
     $this->_groupID = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     $this->_amtgID = CRM_Utils_Request::retrieve('amtgID', 'Positive', $this);
     $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     $this->_ufGroupID = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     // reset from session, CRM-3526
     $session =& CRM_Core_Session::singleton();
     if ($this->_force && $session->get('selectedSearchContactIds')) {
         $session->resetScope('selectedSearchContactIds');
     }
     // if we dont get this from the url, use default if one exsts
     $config =& CRM_Core_Config::singleton();
     if ($this->_ufGroupID == null && $config->defaultSearchProfileID != null) {
         $this->_ufGroupID = $config->defaultSearchProfileID;
     }
     /*
      * assign context to drive the template display, make sure context is valid
      */
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, false, 'search');
     if (!CRM_Utils_Array::value($this->_context, self::validContext())) {
         $this->_context = 'search';
         $this->set('context', $this->_context);
     }
     $this->assign('context', $this->_context);
     $this->set('selectorName', $this->_selectorName);
     // get user submitted values
     // get it from controller only if form has been submitted, else preProcess has set this
     // $this->controller->isModal( ) returns true if page is
     // valid, i.e all the validations are true
     if (!empty($_POST) && !$this->controller->isModal()) {
         $this->_formValues = $this->controller->exportValues($this->_name);
         $this->normalizeFormValues();
         $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
         $this->_returnProperties =& $this->returnProperties();
         // also get the uf group id directly from the post value
         $this->_ufGroupID = CRM_Utils_Array::value('uf_group_id', $_POST, $this->_ufGroupID);
         $this->_formValues['uf_group_id'] = $this->_ufGroupID;
         $this->set('id', $this->_ufGroupID);
     } else {
         $this->_formValues = $this->get('formValues');
         $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
         $this->_returnProperties =& $this->returnProperties();
     }
     if (empty($this->_formValues)) {
         //check if group is a smart group (fix for CRM-1255)
         if ($this->_groupID) {
             if ($ssId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID, 'saved_search_id')) {
                 $this->_ssID = $ssId;
             }
         }
         // fix for CRM-1907
         if (isset($this->_ssID) && $this->_context != 'smog') {
             // we only retrieve the saved search values if out current values are null
             $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
             //fix for CRM-1505
             if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID, 'mapping_id')) {
                 $this->_params =& CRM_Contact_BAO_SavedSearch::getSearchParams($this->_ssID);
             } else {
                 $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
             }
             $this->_returnProperties =& $this->returnProperties();
         } else {
             if (isset($this->_ufGroupID)) {
                 // also set the uf group id if not already present
                 $this->_formValues['uf_group_id'] = $this->_ufGroupID;
             }
         }
     }
     $this->assign('id', CRM_Utils_Array::value('uf_group_id', $this->_formValues));
     require_once 'CRM/Contact/BAO/Contact.php';
     $menuItems = CRM_Contact_BAO_Contact::contextMenu();
     $primaryActions = CRM_Utils_Array::value('primaryActions', $menuItems, array());
     $this->_contextMenu = CRM_Utils_Array::value('moreActions', $menuItems, array());
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Search.php

示例9: 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
  * @access public
  */
 function postProcess()
 {
     $this->set('isAdvanced', '1');
     // get user submitted values
     // get it from controller only if form has been submitted, else preProcess has set this
     if (!empty($_POST)) {
         $this->_formValues = $this->controller->exportValues($this->_name);
         $this->normalizeFormValues();
         // FIXME: couldn't figure out a good place to do this,
         // FIXME: so leaving this as a dependency for now
         if (array_key_exists('contribution_amount_low', $this->_formValues)) {
             foreach (array('contribution_amount_low', 'contribution_amount_high') as $f) {
                 $this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
             }
         }
         // set the group if group is submitted
         if (!empty($this->_formValues['uf_group_id'])) {
             $this->set('id', $this->_formValues['uf_group_id']);
         } else {
             $this->set('id', '');
         }
     }
     // retrieve ssID values only if formValues is null, i.e. form has never been posted
     if (empty($this->_formValues) && isset($this->_ssID)) {
         $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
     }
     if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) {
         $this->_formValues['group'] = array($this->_groupID => 1);
     }
     //search for civicase
     if (is_array($this->_formValues)) {
         $allCases = FALSE;
         if (array_key_exists('case_owner', $this->_formValues) && !$this->_formValues['case_owner'] && !$this->_force) {
             foreach (array('case_type_id', 'case_status_id', 'case_deleted', 'case_tags') as $caseCriteria) {
                 if (CRM_Utils_Array::value($caseCriteria, $this->_formValues)) {
                     $allCases = TRUE;
                     $this->_formValues['case_owner'] = 1;
                     continue;
                 }
             }
             if ($allCases) {
                 if (CRM_Core_Permission::check('access all cases and activities')) {
                     $this->_formValues['case_owner'] = 1;
                 } else {
                     $this->_formValues['case_owner'] = 2;
                 }
             } else {
                 $this->_formValues['case_owner'] = 0;
             }
         }
     }
     // we dont want to store the sortByCharacter in the formValue, it is more like
     // a filter on the result set
     // this filter is reset if we click on the search button
     if ($this->_sortByCharacter !== NULL && empty($_POST)) {
         if (strtolower($this->_sortByCharacter) == 'all') {
             $this->_formValues['sortByCharacter'] = NULL;
         } else {
             $this->_formValues['sortByCharacter'] = $this->_sortByCharacter;
         }
     } else {
         $this->_sortByCharacter = NULL;
     }
     CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
     $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $this->_returnProperties =& $this->returnProperties();
     parent::postProcess();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:85,代码来源:Advanced.php

示例10: buildClause

 /**
  * Given a saved search compute the clause and the tables and store it for future use.
  */
 public function buildClause()
 {
     $fv = unserialize($this->form_values);
     if ($this->mapping_id) {
         $params = CRM_Core_BAO_Mapping::formattedFields($fv);
     } else {
         $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     }
     if (!empty($params)) {
         $tables = $whereTables = array();
         $this->where_clause = CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables);
         if (!empty($tables)) {
             $this->select_tables = serialize($tables);
         }
         if (!empty($whereTables)) {
             $this->where_tables = serialize($whereTables);
         }
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:22,代码来源:SavedSearch.php

示例11: _civicrm_api3_get_using_query_object

function _civicrm_api3_get_using_query_object($object_type, $params, $additional_options = array(), $getCount = null)
{
    // Convert id to e.g. contact_id
    if (empty($params[$object_type . '_id']) && isset($params['id'])) {
        $params[$object_type . '_id'] = $params['id'];
    }
    unset($params['id']);
    $options = _civicrm_api3_get_options_from_params($params, TRUE);
    $inputParams = array_merge(CRM_Utils_Array::value('input_params', $options, array()), CRM_Utils_Array::value('input_params', $additional_options, array()));
    $returnProperties = array_merge(CRM_Utils_Array::value('return', $options, array()), CRM_Utils_Array::value('return', $additional_options, array()));
    if (empty($returnProperties)) {
        $returnProperties = null;
    }
    $options = array_merge($options, $additional_options);
    $sort = CRM_Utils_Array::value('sort', $options, NULL);
    $offset = CRM_Utils_Array::value('offset', $options, NULL);
    $limit = CRM_Utils_Array::value('limit', $options, NULL);
    $smartGroupCache = CRM_Utils_Array::value('smartGroupCache', $params);
    if ($getCount) {
        $limit = NULL;
        $returnProperties = NULL;
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
    list($entities, $options) = CRM_Contact_BAO_Query::apiQuery($newParams, $returnProperties, NULL, $sort, $offset, $limit, $smartGroupCache, $getCount);
    if ($getCount) {
        // only return the count of contacts
        return $entities[0];
    }
    return $entities;
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:30,代码来源:utils.php

示例12: getProfileContact

 /**
  * Function to get the list of contacts for a profile
  * 
  * @param $form object 
  *
  * @access public
  */
 function getProfileContact($gid)
 {
     $session =& CRM_Core_Session::singleton();
     $params = $session->get('profileParams');
     $details = array();
     $ufGroupParam = array('id' => $gid);
     require_once "CRM/Core/BAO/UFGroup.php";
     CRM_Core_BAO_UFGroup::retrieve($ufGroupParam, $details);
     // make sure this group can be mapped
     if (!$details['is_map']) {
         CRM_Core_Error::statusBounce(ts('This profile does not have the map feature turned on.'));
     }
     $groupId = CRM_Utils_Array::value('limit_listings_group_id', $details);
     // add group id to params if a uf group belong to a any group
     if ($groupId) {
         if (CRM_Utils_Array::value('group', $params)) {
             $params['group'][$groupId] = 1;
         } else {
             $params['group'] = array($groupId => 1);
         }
     }
     $fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $gid);
     $returnProperties =& CRM_Contact_BAO_Contact::makeHierReturnProperties($fields);
     $returnProperties['contact_type'] = 1;
     $returnProperties['sort_name'] = 1;
     $queryParams =& CRM_Contact_BAO_Query::convertFormValues($params, 1);
     $query =& new CRM_Contact_BAO_Query($queryParams, $returnProperties, $fields);
     $ids = $query->searchQuery(0, 0, null, false, false, false, true, false);
     $contactIds = explode(',', $ids);
     return $contactIds;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:38,代码来源:Listings.php

示例13: 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
  * @access public
  */
 function postProcess()
 {
     if ($this->_done) {
         return;
     }
     $this->_done = TRUE;
     $this->_formValues = $this->controller->exportValues($this->_name);
     $this->fixFormValues();
     // We don't show test records in summaries or dashboards
     if (empty($this->_formValues['member_test']) && $this->_force) {
         $this->_formValues["member_test"] = 0;
     }
     CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($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_Member_Selector_Search($this->_queryParams, $this->_action, NULL, $this->_single, $this->_limit, $this->_context);
     $selector->setKey($this->controller->_key);
     $prefix = NULL;
     if ($this->_context == 'basic') {
         $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();
     $controller->run();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:58,代码来源:Search.php

示例14: buildClause

 /**
  * given a saved search compute the clause and the tables
  * and store it for future use
  */
 function buildClause()
 {
     $fv = unserialize($this->form_values);
     if ($this->mapping_id) {
         require_once 'CRM/Core/BAO/Mapping.php';
         $params = CRM_Core_BAO_Mapping::formattedFields($fv);
     } else {
         require_once 'CRM/Contact/BAO/Query.php';
         $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     }
     if (!empty($params)) {
         $tables = $whereTables = array();
         $this->where_clause = CRM_Contact_BAO_Query::getWhereClause($params, null, $tables, $whereTables);
         if (!empty($tables)) {
             $this->select_tables = serialize($tables);
         }
         if (!empty($whereTables)) {
             $this->where_tables = serialize($whereTables);
         }
     }
     return;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:26,代码来源:SavedSearch.php

示例15: 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();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:72,代码来源:Search.php


注:本文中的CRM_Contact_BAO_Query::convertFormValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。