/** * build all the data structures needed to build the form * * @param * @return void * @access public */ function preProcess() { $values = $this->controller->exportValues('Search'); $this->_task = $values['task']; $campaignTasks = CRM_Campaign_Task::tasks(); $taskName = CRM_Utils_Array::value($this->_task, $campaignTasks); $this->assign('taskName', $taskName); $ids = array(); if ($values['radio_ts'] == 'ts_sel') { foreach ($values as $name => $value) { if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) { $ids[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN); } } } else { $queryParams = $this->get('queryParams'); $query = new CRM_Contact_BAO_Query($queryParams, null, null, false, false, CRM_Contact_BAO_Query::MODE_CAMPAIGN); $result = $query->searchQuery(0, 0, null); while ($result->fetch()) { $ids[] = $result->contact_id; } $this->assign('totalSelectedVoters', $this->get('rowCount')); } if (!empty($ids)) { $this->_componentClause = 'contact_a.id IN ( ' . implode(',', $ids) . ' ) '; $this->assign('totalSelectedVoters', count($ids)); } $this->_voterIds = $this->_contactIds = $this->_componentIds = $ids; $this->assign('totalSelectedContacts', count($this->_contactIds)); //set the context for redirection for any task actions $session = CRM_Core_Session::singleton(); require_once 'CRM/Utils/Rule.php'; $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= '&qfKey=' . $qfKey; } $session->replaceUserContext(CRM_Utils_System::url('civicrm/survey/search', $urlParams)); }
/** * Build all the data structures needed to build the form. */ public function preProcess() { $values = $this->controller->exportValues('Search'); $this->_task = $values['task']; $campaignTasks = CRM_Campaign_Task::tasks(); $taskName = CRM_Utils_Array::value($this->_task, $campaignTasks); $this->assign('taskName', $taskName); $ids = array(); if ($values['radio_ts'] == 'ts_sel') { foreach ($values as $name => $value) { if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) { $ids[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN); } } } else { $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); $cacheKey = "civicrm search {$qfKey}"; $allCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey, "getall"); $ids = array_keys($allCids[$cacheKey]); $this->assign('totalSelectedVoters', count($ids)); } if (!empty($ids)) { $this->_componentClause = 'contact_a.id IN ( ' . implode(',', $ids) . ' ) '; $this->assign('totalSelectedVoters', count($ids)); } $this->_voterIds = $this->_contactIds = $this->_componentIds = $ids; $this->assign('totalSelectedContacts', count($this->_contactIds)); //set the context for redirection for any task actions $session = CRM_Core_Session::singleton(); $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= '&qfKey=' . $qfKey; } $session->replaceUserContext(CRM_Utils_System::url('civicrm/survey/search', $urlParams)); }