/** * 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(); }
/** * 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 * * @param * @return void * @access public */ function preProcess() { //special case for custom search, directly give option to download csv file $customSearchID = $this->get('customSearchID'); if ($customSearchID) { require_once 'CRM/Export/BAO/Export.php'; CRM_Export_BAO_Export::exportCustom($this->get('customSearchClass'), $this->get('formValues'), $this->get(CRM_Utils_Sort::SORT_ORDER)); } $this->_selectAll = false; $this->_exportMode = self::CONTACT_EXPORT; // get the submitted values based on search if ($this->_action == CRM_Core_Action::ADVANCED) { $values = $this->controller->exportValues('Advanced'); } else { if ($this->_action == CRM_Core_Action::PROFILE) { $values = $this->controller->exportValues('Builder'); } else { if ($this->_action == CRM_Core_Action::COPY) { $values = $this->controller->exportValues('Custom'); } else { // we need to determine component export $stateMachine =& $this->controller->getStateMachine(); $formName = CRM_Utils_System::getClassName($stateMachine); $componentName = explode('_', $formName); $components = array('Contribute', 'Member', 'Event', 'Pledge', 'Case'); if (in_array($componentName[1], $components)) { eval('$this->_exportMode = self::' . strtoupper($componentName[1]) . '_EXPORT;'); require_once "CRM/{$componentName[1]}/Form/Task.php"; eval('CRM_' . $componentName[1] . '_Form_Task::preprocess();'); $values = $this->controller->exportValues('Search'); } else { $values = $this->controller->exportValues('Basic'); } } } } require_once 'CRM/Contact/Task.php'; $this->_task = $values['task']; if ($this->_exportMode == self::CONTACT_EXPORT) { $contactTasks = CRM_Contact_Task::taskTitles(); $taskName = $contactTasks[$this->_task]; require_once "CRM/Contact/Form/Task.php"; CRM_Contact_Form_Task::preprocess(); } else { $this->assign('taskName', "Export {$componentName['1']}"); eval('$componentTasks = CRM_' . $componentName[1] . '_Task::tasks();'); $taskName = $componentTasks[$this->_task]; } $this->assign('totalSelectedRecords', count($this->_componentIds)); $this->assign('taskName', $taskName); // all records actions = save a search if ($values['radio_ts'] == 'ts_all' || $this->_task == CRM_Contact_Task::SAVE_SEARCH) { $this->_selectAll = true; $this->assign('totalSelectedRecords', $this->get('rowCount')); } $this->set('componentIds', $this->_componentIds); $this->set('selectAll', $this->_selectAll); $this->set('exportMode', $this->_exportMode); $this->set('componentClause', $this->_componentClause); }