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 the form object - it consists of * - displaying the QILL (query in local language) * - displaying elements for saving the search * * * @return void */ public function buildQuickForm() { // // just need to add a javacript to popup the window for printing // $this->addButtons(array( array( 'type' => 'next', 'name' => ts('Print Contact List'), 'js' => array('onclick' => 'window.print()'), 'isDefault' => TRUE, ), array( 'type' => 'back', 'name' => ts('Done'), ), ) ); } /** * Process the form after the input has been submitted and validated. * * * @return void */ public function postProcess() { // redirect to the main search page after printing is over } }