/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
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(); }
/** * 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(); }
/** * 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(); }
/** * 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'); }
/** * 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'); }
/** * 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(); }
/** * 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); $this->set('summary', $summary); $this->assign('contributionSummary', $summary); $controller->run(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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); $controller->setEmbedded(true); $controller->set('id', $this->_id); $controller->set('cid', $this->_contactId); $controller->run(); $this->assign('caseId', $this->_id); require_once 'CRM/Activity/Selector/Activity.php'; require_once 'CRM/Core/Selector/Controller.php'; $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'); }
/** * run this page (figure out the action needed and perform it). * * @return void */ function run($newArgs) { $this->preProcess(); if (isset($_GET['runJobs']) || CRM_Utils_Array::value('2', $newArgs) == 'queue') { require_once 'CRM/Mailing/BAO/Job.php'; $config =& CRM_Core_Config::singleton(); CRM_Mailing_BAO_Job::runJobs_pre($config->mailerJobSize); CRM_Mailing_BAO_Job::runJobs(); CRM_Mailing_BAO_Job::runJobs_post(); } $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this); if ($this->_sortByCharacter == 1 || !empty($_POST)) { $this->_sortByCharacter = ''; $this->set('sortByCharacter', ''); } if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') { $this->_unscheduled = true; } $this->set('unscheduled', $this->_unscheduled); if (CRM_Utils_Array::value(3, $newArgs) == 'archived') { $this->_archived = true; } $this->set('archived', $this->_archived); if (CRM_Utils_Array::value(3, $newArgs) == 'scheduled') { $this->_scheduled = true; } $this->set('scheduled', $this->_scheduled); $this->_createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false, 0); if ($this->_createdId) { $this->set('createdId', $this->_createdId); } $session = CRM_Core_Session::singleton(); $context = $session->readUserContext(); if ($this->_action & CRM_Core_Action::DISABLE) { if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) { require_once 'CRM/Mailing/BAO/Job.php'; CRM_Mailing_BAO_Job::cancel($this->_mailingId); CRM_Utils_System::redirect($context); } else { $controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Cancel Mailing'), $this->_action); $controller->setEmbedded(true); $controller->run(); } } else { if ($this->_action & CRM_Core_Action::DELETE) { if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) { // check for action permissions. if (!CRM_Core_Permission::checkActionPermission('CiviMail', $this->_action)) { CRM_Core_Error::fatal(ts('You do not have permission to access this page')); } require_once 'CRM/Mailing/BAO/Mailing.php'; CRM_Mailing_BAO_Mailing::del($this->_mailingId); CRM_Utils_System::redirect($context); } else { $controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Delete Mailing'), $this->_action); $controller->setEmbedded(true); $controller->run(); } } else { if ($this->_action & CRM_Core_Action::RENEW) { //archive this mailing, CRM-3752. if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) { //set is_archived to 1 CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId, 'is_archived', true); CRM_Utils_System::redirect($context); } else { $controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Archive Mailing'), $this->_action); $controller->setEmbedded(true); $controller->run(); } } } } $selector = new CRM_Mailing_Selector_Browse(); $selector->setParent($this); $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $this->get(CRM_Utils_Sort::SORT_ID) . $this->get(CRM_Utils_Sort::SORT_DIRECTION), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE); $controller->setEmbedded(true); $controller->run(); //hack to display results as per search $rows = $controller->getRows($controller); $this->assign('rows', $rows); $urlParams = 'reset=1'; $urlString = 'civicrm/mailing/browse'; if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') { $urlString .= '/unscheduled'; $urlParams .= '&scheduled=false'; $this->assign('unscheduled', true); CRM_Utils_System::setTitle(ts('Draft and Unscheduled Mailings')); } else { if (CRM_Utils_Array::value(3, $newArgs) == 'archived') { $urlString .= '/archived'; $this->assign('archived', true); CRM_Utils_System::setTitle(ts('Archived Mailings')); } else { if (CRM_Utils_Array::value(3, $newArgs) == 'scheduled') { $urlString .= '/scheduled'; $urlParams .= '&scheduled=true'; CRM_Utils_System::setTitle(ts('Scheduled and Sent Mailings')); } else { CRM_Utils_System::setTitle(ts('Find Mailings')); } } } $crmRowCount = CRM_Utils_Request::retrieve('crmRowCount', 'Integer', CRM_Core_DAO::$_nullObject); $crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject); if ($crmRowCount || $crmPID) { $urlParams .= '&force=1'; $urlParams .= $crmRowCount ? '&crmRowCount=' . $crmRowCount : ''; $urlParams .= $crmPID ? '&crmPID=' . $crmPID : ''; } $crmSID = CRM_Utils_Request::retrieve('crmSID', 'Integer', CRM_Core_DAO::$_nullObject); if ($crmSID) { $urlParams .= '&crmSID=' . $crmSID; } $session = CRM_Core_Session::singleton(); $url = CRM_Utils_System::url($urlString, $urlParams); $session->pushUserContext($url); //CRM-6862 -run form cotroller after //selector, since it erase $_POST $this->search(); return parent::run(); }
/** * This function is used for the to show the associated * contribution for the booking * return null */ function associatedContribution($booking_id = NULL) { //get contributionId from booking_payment $contributionId = NULL; $bookingPaymentResult = civicrm_api3('BookingPayment', 'get', array('booking_id' => $booking_id)); if ($bookingPaymentResult['count'] == 0) { return NULL; } else { $bookingPaymentValues = CRM_Utils_Array::value('values', $bookingPaymentResult); $contributionId = CRM_Utils_Array::value('contribution_id', current($bookingPaymentValues)); } //get contribution record by selector controller framework //REMARK: consider CiviCRM CORE dependency $this->_formValues['contribution_id'] = $contributionId; $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $selector = new CRM_Contribute_Selector_Search($this->_queryParams, NULL, NULL, NULL, NULL, NULL); $controller = new CRM_Core_Selector_Controller($selector, NULL, NULL, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER, NULL); $controller->setEmbedded(TRUE); $controller->run(); }
/** * 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 contributions in Contact Summary / User Dashboard // in Search mode by default we hide test contributions if (!CRM_Utils_Array::value('pledge_test', $this->_formValues)) { $this->_formValues["pledge_test"] = 0; } 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); } 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_Pledge_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(); }
/** * 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 memberships in Contact Summary / User Dashboard // in Search mode by default we hide test memberships if (!CRM_Utils_Array::value('member_test', $this->_formValues)) { $this->_formValues["member_test"] = 0; } require_once 'CRM/Core/BAO/CustomValue.php'; CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues); 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'; $this->_queryParams =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues); require_once "CRM/Member/Selector/Search.php"; $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(); }
/** * 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; $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); } //search for civicase if (!$this->_force) { if (array_key_exists('case_owner', $this->_formValues) && !$this->_formValues['case_owner']) { $this->_formValues['case_owner'] = 0; } } if (empty($this->_formValues['case_deleted'])) { $this->_formValues['case_deleted'] = 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_Case_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(); }
/** * 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(); // we don't show test contributions in Contact Summary / User Dashboard // in Search mode by default we hide test contributions if (!CRM_Utils_Array::value('contribution_test', $this->_formValues)) { $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]); } } 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_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(); }
/** * 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(); }
/** * 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); } $this->fixFormValues(); //format params as per task. $this->formatParams(); $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)); } //get the voter clause. $voterClause = $this->voterClause(); $selector = new CRM_Campaign_Selector_Search($this->_queryParams, $this->_action, $voterClause, $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(); }