本文整理汇总了PHP中CRM_Contact_Form_Search::validContext方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_Form_Search::validContext方法的具体用法?PHP CRM_Contact_Form_Search::validContext怎么用?PHP CRM_Contact_Form_Search::validContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_Form_Search
的用法示例。
在下文中一共展示了CRM_Contact_Form_Search::validContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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->_tag =& CRM_Core_PseudoConstant::tag();
$this->_done = false;
/**
* set the button names
*/
$this->_searchButtonName = $this->getButtonName('refresh');
$this->_exportButtonName = $this->getButtonName('refresh', 'export');
$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
*/
$nullObject = null;
$this->_reset = CRM_Utils_Request::retrieve('reset', $nullObject);
$this->_force = CRM_Utils_Request::retrieve('force', $this, false);
// we only force stuff once :)
$this->set('force', false);
$this->_groupID = CRM_Utils_Request::retrieve('gid', $this);
$this->_amtgID = CRM_Utils_Request::retrieve('amtgID', $this);
$this->_ssID = CRM_Utils_Request::retrieve('ssID', $this);
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', $this);
// 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();
// CRM_Core_Error::debug( 'fv', $this->_formValues );
// also reset the sort by character
$this->_sortByCharacter = null;
$this->set('sortByCharacter', null);
} else {
$this->_formValues = $this->get('formValues');
}
// we only retrieve the saved search values if out current values are null
if (empty($this->_formValues) && isset($this->_ssID)) {
$this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
}
/*
* assign context to drive the template display, make sure context is valid
*/
$this->_context = CRM_Utils_Request::retrieve('context', $this, false, 'search');
if (!CRM_Utils_Array::value($this->_context, CRM_Contact_Form_Search::validContext())) {
$this->_context = 'search';
$this->set('context', $this->_context);
}
$this->assign('context', $this->_context);
$selector =& new CRM_Contact_Selector($this->_formValues, $this->_action);
$controller =& new CRM_Contact_Selector_Controller($selector, $this->get(CRM_UTILS_PAGER_PAGE_ID), $this->get(CRM_UTILS_SORT_SORT_ID), CRM_CORE_ACTION_VIEW, $this, CRM_CORE_SELECTOR_CONTROLLER_TRANSFER);
$controller->setEmbedded(true);
if ($this->_force) {
$this->postProcess();
/*
* Note that we repeat this, since the search creates and stores
* values that potentially change the controller behavior. i.e. things
* like totalCount etc
*/
$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));
}
$controller =& new CRM_Contact_Selector_Controller($selector, $this->get(CRM_UTILS_PAGER_PAGE_ID), $sortID, CRM_CORE_ACTION_VIEW, $this, CRM_CORE_SELECTOR_CONTROLLER_TRANSFER);
$controller->setEmbedded(true);
}
$controller->moveFromSessionToTemplate();
}