本文整理汇总了PHP中CRM_Core_Selector_Controller类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Selector_Controller类的具体用法?PHP CRM_Core_Selector_Controller怎么用?PHP CRM_Core_Selector_Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Selector_Controller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$selector =& new CRM_Mailing_Selector_Event(CRM_Utils_Request::retrieve('event', 'String', $this), CRM_Utils_Request::retrieve('distinct', 'Boolean', $this), CRM_Utils_Request::retrieve('mid', 'Positive', $this), CRM_Utils_Request::retrieve('jid', 'Positive', $this), CRM_Utils_Request::retrieve('uid', 'Positive', $this));
$mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
//assign backurl
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
if ($context == 'activitySelector') {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
$backUrlTitle = ts('Back to Activities');
} elseif ($context == 'mailing') {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
$backUrlTitle = ts('Back to Mailing');
} else {
$backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}");
$backUrlTitle = ts('Back to Report');
}
$this->assign('backUrl', $backUrl);
$this->assign('backUrlTitle', $backUrlTitle);
CRM_Utils_System::setTitle($selector->getTitle());
$this->assign('title', $selector->getTitle());
$this->assign('mailing_id', $mailing_id);
$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_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE);
$controller->setEmbedded(TRUE);
$controller->run();
return parent::run();
}
示例2: run
/**
* List activities as dashlet
*
* @return none
*
* @access public
*/
function run()
{
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
// a user can always view their own activity
// if they have access CiviCRM permission
$permission = CRM_Core_Permission::VIEW;
// make the permission edit if the user has edit permission on the contact
require_once 'CRM/Contact/BAO/Contact/Permission.php';
if (CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::EDIT)) {
$permission = CRM_Core_Permission::EDIT;
}
$admin = CRM_Core_Permission::check('view all activities') || CRM_Core_Permission::check('administer CiviCRM');
require_once 'CRM/Core/Selector/Controller.php';
$output = CRM_Core_Selector_Controller::SESSION;
require_once 'CRM/Activity/Selector/Activity.php';
$selector = new CRM_Activity_Selector_Activity($contactID, $permission, $admin, 'home');
$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_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, $output);
$controller->setEmbedded(true);
$controller->run();
$controller->moveFromSessionToTemplate();
return parent::run();
}
示例3: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
parent::preprocess();
// set print view, so that print templates are called
$this->controller->setPrint(1);
$this->assign('id', $this->get('id'));
$this->assign('pageTitle', ts('CiviCRM Contact Listing'));
// create the selector, controller and run - store results in session
$fv = $this->get('formValues');
$params = $this->get('queryParams');
$returnProperties = $this->get('returnProperties');
$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));
}
$includeContactIds = false;
if ($fv['radio_ts'] == 'ts_sel') {
$includeContactIds = true;
}
$selectorName = $this->controller->selectorName();
require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php';
$returnP = isset($returnPropeties) ? $returnPropeties : "";
$customSearchClass = $this->get('customSearchClass');
eval('$selector = new ' . $selectorName . '( $customSearchClass,
$fv,
$params,
$returnP,
$this->_action,
$includeContactIds );');
$controller = new CRM_Core_Selector_Controller($selector, null, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
$controller->setEmbedded(true);
$controller->run();
}
示例4: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
parent::preprocess();
// set print view, so that print templates are called
$this->controller->setPrint(1);
$this->assign('id', $this->get('id'));
$this->assign('pageTitle', ts('CiviCRM Contact Listing'));
$params = $this->get('queryParams');
if (!empty($this->_contactIds)) {
//using _contactIds field for creating params for query so that multiple selections on multiple pages
//can be printed.
foreach ($this->_contactIds as $contactId) {
$params[] = array(CRM_Core_Form::CB_PREFIX . $contactId, '=', 1, 0, 0);
}
}
// create the selector, controller and run - store results in session
$fv = $this->get('formValues');
$returnProperties = $this->get('returnProperties');
$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));
}
$includeContactIds = FALSE;
if ($fv['radio_ts'] == 'ts_sel') {
$includeContactIds = TRUE;
}
$selectorName = $this->controller->selectorName();
require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php';
$returnP = isset($returnPropeties) ? $returnPropeties : "";
$customSearchClass = $this->get('customSearchClass');
$selector = new $selectorName($customSearchClass, $fv, $params, $returnP, $this->_action, $includeContactIds);
$controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
$controller->setEmbedded(TRUE);
$controller->run();
}
示例5: preProcess
function preProcess()
{
CRM_Utils_Request::retrieve('id', 'Int', $this, false);
$readonly = CRM_Utils_Request::retrieve('readonly', 'Boolean', $this, false);
$this->assign('readonly', $readonly);
$id = $this->get('id');
$params = $this->controller->exportValues();
$selector = new CRM_Finance_Selector_Import($id, $params);
$this->assign('importId', $id);
$dataExchange = new CRM_Finance_Utils_DataExchange();
$processData = $dataExchange->getProcessById($id);
if (isset($processData['data']['status'])) {
$this->assign('validationSummary', $processData['data']['status']);
}
require_once 'CRM/Finance/BAO/Import/Source.php';
$sourceOptions = CRM_Finance_BAO_Import_Source::getAllAsOptions();
$processData['sourceName'] = $sourceOptions[$processData['source']];
$this->assign('importSummary', $processData);
$output = CRM_Core_Selector_Controller::TEMPLATE;
$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_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, $output);
$controller->setEmbedded(true);
$controller->run();
}
示例6: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$selector =& new CRM_Mailing_Selector_Event(CRM_Utils_Request::retrieve('event', 'String', $this), CRM_Utils_Request::retrieve('distinct', 'Boolean', $this), CRM_Utils_Request::retrieve('mid', 'Positive', $this), CRM_Utils_Request::retrieve('jid', 'Positive', $this), CRM_Utils_Request::retrieve('uid', 'Positive', $this));
$mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
CRM_Utils_System::setTitle($selector->getTitle());
$this->assign('title', $selector->getTitle());
$this->assign('mailing_id', $mailing_id);
$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_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE);
$controller->setEmbedded(TRUE);
$controller->run();
return parent::run();
}
示例7: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
parent::preprocess();
// set print view, so that print templates are called
$this->controller->setPrint(1);
// get the formatted params
$queryParams = $this->get('queryParams');
$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));
}
$selector = new CRM_Grant_Selector_Search($queryParams, $this->_action, $this->_componentClause);
$controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
$controller->setEmbedded(TRUE);
$controller->run();
}
示例8: browse
/**
* Browse all activities for a particular contact
*
* @return none
*
* @access public
*/
function browse()
{
require_once 'CRM/Core/Selector/Controller.php';
$output = CRM_Core_Selector_Controller::SESSION;
require_once 'CRM/Activity/Selector/Activity.php';
$selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission);
$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_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, $output);
$controller->setEmbedded(true);
$controller->run();
$controller->moveFromSessionToTemplate();
// check if case is enabled
require_once 'CRM/Core/BAO/Preferences.php';
$viewOptions = CRM_Core_BAO_Preferences::valueOptions('contact_view_options', true, null, true);
$enableCase = false;
if (CRM_Utils_Array::value('CiviCase', $viewOptions)) {
$enableCase = true;
}
$this->assign('enableCase', $enableCase);
$this->assign('context', 'activity');
}
示例9: view
/**
* View details of a case
*
* @return void
* @access public
*/
function view()
{
$controller = new CRM_Core_Controller_Simple('CRM_Case_Form_CaseView', 'View Case', $this->_action, FALSE, FALSE, TRUE);
$controller->setEmbedded(TRUE);
$controller->set('id', $this->_id);
$controller->set('cid', $this->_contactId);
$controller->run();
$this->assign('caseId', $this->_id);
$output = CRM_Core_Selector_Controller::SESSION;
$selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission, FALSE, 'case');
$controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), NULL, CRM_Core_Action::VIEW, $this, $output, NULL, $this->_id);
$controller->setEmbedded(TRUE);
$controller->run();
$controller->moveFromSessionToTemplate();
$this->assign('context', 'case');
}
示例10: 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.
*/
public function postProcess()
{
if ($this->_done) {
return;
}
$this->_done = TRUE;
if (!empty($_POST)) {
$this->_formValues = $this->controller->exportValues($this->_name);
foreach (array('activity_type_id', 'status_id', 'activity_subject') as $element) {
$value = CRM_Utils_Array::value($element, $this->_formValues);
if ($value) {
if (is_array($value)) {
if ($element == 'status_id') {
unset($this->_formValues[$element]);
$this->_formValues['activity_' . $element] = $value;
}
} else {
$this->_formValues[$element] = array('LIKE' => "%{$value}%");
}
}
}
}
$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['activity_test']) && $this->_force) {
$this->_formValues["activity_test"] = 0;
}
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_Activity_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);
}
$controller->run();
}
示例11: 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');
foreach ($specialParams as $element) {
$value = CRM_Utils_Array::value($element, $this->_formValues);
if ($value) {
if (is_array($value)) {
$this->_formValues[$element] = array('IN' => $value);
} else {
$this->_formValues[$element] = array('LIKE' => "%{$value}%");
}
}
}
$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 (!$config->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::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_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);
//.........这里部分代码省略.........
示例12: 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();
}
示例13: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$this->preProcess();
$this->assign('recentlyViewed', false);
if ($this->_gid) {
$ufgroupDAO = new CRM_Core_DAO_UFGroup();
$ufgroupDAO->id = $this->_gid;
if (!$ufgroupDAO->find(true)) {
CRM_Core_Error::fatal();
}
}
if ($this->_gid) {
// set the title of the page
if ($ufgroupDAO->title) {
CRM_Utils_System::setTitle($ufgroupDAO->title);
}
}
$this->assign('isReset', true);
$formController = new CRM_Core_Controller_Simple('CRM_Profile_Form_Search', ts('Search Profile'), CRM_Core_Action::ADD);
$formController->setEmbedded(true);
$formController->set('gid', $this->_gid);
$formController->process();
$searchError = false;
// check if there is a POST
if (!empty($_POST)) {
if ($formController->validate() !== true) {
$searchError = true;
}
}
// also get the search tpl name
$this->assign('searchTPL', $formController->getTemplateFileName());
$this->assign('search', $this->_search);
// search if search returned a form error?
if ((!CRM_Utils_Array::value('reset', $_GET) || CRM_Utils_Array::value('force', $_GET)) && !$searchError) {
$this->assign('isReset', false);
$gidString = $this->_gid;
if (empty($this->_profileIds)) {
$gids = $this->_gid;
} else {
$gids = $this->_profileIds;
$gidString = implode(',', $this->_profileIds);
}
$map = 0;
$linkToUF = 0;
$editLink = false;
if ($this->_gid) {
$map = $ufgroupDAO->is_map;
$linkToUF = $ufgroupDAO->is_uf_link;
$editLink = $ufgroupDAO->is_edit_link;
}
if ($map) {
$this->assign('mapURL', CRM_Utils_System::url('civicrm/profile/map', "map=1&gid={$gidString}&reset=1"));
}
if (CRM_Utils_Array::value('group', $this->_params)) {
foreach ($this->_params['group'] as $key => $val) {
if (!$val) {
unset($this->_params['group'][$key]);
}
}
}
// the selector will override this if the user does have
// edit permissions as determined by the mask, CRM-4341
// do not allow edit for anon users in joomla frontend, CRM-4668
$config = CRM_Core_Config::singleton();
if (!CRM_Core_Permission::check('access CiviCRM') || $config->userFrameworkFrontend == 1) {
$editLink = false;
}
$selector = new CRM_Profile_Selector_Listings($this->_params, $this->_customFields, $gids, $map, $editLink, $linkToUF);
$controller = new CRM_Core_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::TEMPLATE);
$controller->setEmbedded(true);
$controller->run();
}
//CRM-6862 -run form cotroller after
//selector, since it erase $_POST
$formController->run();
return parent::run();
}
示例14: 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;
if (!empty($_POST)) {
$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);
}
if (CRM_Utils_Array::value('activity_survey_id', $this->_formValues)) {
// if the user has choosen a survey but not any activity type, we force the activity type
$sid = CRM_Utils_Array::value('activity_survey_id', $this->_formValues);
$activity_type_id = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $sid, 'activity_type_id');
$this->_formValues['activity_type_id'][$activity_type_id] = 1;
}
if (!CRM_Utils_Array::value('activity_test', $this->_formValues)) {
$this->_formValues["activity_test"] = 0;
}
if (!CRM_Utils_Array::value('activity_contact_name', $this->_formValues) && !CRM_Utils_Array::value('contact_id', $this->_formValues)) {
$this->_formValues['activity_role'] = NULL;
}
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 || $buttonName == $this->_printButtonName) {
// 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_Activity_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);
}
$controller->run();
}
示例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
* @access public
*/
function postProcess()
{
if ($this->_done) {
return;
}
$this->_done = true;
$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);
}
require_once 'CRM/Contact/BAO/Query.php';
$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 || $buttonName == $this->_printButtonName) {
// 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));
}
require_once 'CRM/Contact/BAO/Query.php';
$selector = new CRM_Grant_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);
}
$controller->run();
}