public function preProcess() { $this->set('searchFormName', 'Custom'); $this->set('context', 'custom'); $csID = CRM_Utils_Request::retrieve('csid', 'Integer', $this); $ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this); $gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this); list($this->_customSearchID, $this->_customSearchClass, $formValues) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID); if (!$this->_customSearchID) { CRM_Core_Error::fatal('Could not get details for custom search.'); } // stash this as a hidden element so we can potentially go there if the session // is reset but this is available in the POST $this->addElement('hidden', 'csid', $csID); if (!empty($formValues)) { $this->_formValues = $formValues; } // set breadcrumb to return to Custom Search listings page $breadCrumb = array(array('title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1'))); CRM_Utils_System::appendBreadCrumb($breadCrumb); // use the custom selector self::$_selectorName = 'CRM_Contact_Selector_Custom'; $this->set('customSearchID', $this->_customSearchID); $this->set('customSearchClass', $this->_customSearchClass); parent::preProcess(); // instantiate the new class $this->_customClass = new $this->_customSearchClass($this->_formValues); // CRM-12747 if (isset($this->_customClass->_permissionedComponent) && !self::isPermissioned($this->_customClass->_permissionedComponent)) { CRM_Utils_System::permissionDenied(); } }
public function preProcess() { require_once 'CRM/Contact/BAO/SearchCustom.php'; $csID = CRM_Utils_Request::retrieve('csid', 'Integer', $this); $ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this); $gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this); list($this->_customSearchID, $this->_customSearchClass, $formValues) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID); if (!$this->_customSearchID) { CRM_Core_Error::fatal('Could not get details for custom search.'); } if (!empty($formValues)) { $this->_formValues = $formValues; } // set breadcrumb to return to Custom Search listings page $breadCrumb = array(array('title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1'))); CRM_Utils_System::appendBreadCrumb($breadCrumb); // use the custom selector require_once 'CRM/Contact/Selector/Custom.php'; $this->_selectorName = 'CRM_Contact_Selector_Custom'; $this->set('customSearchID', $this->_customSearchID); $this->set('customSearchClass', $this->_customSearchClass); parent::preProcess(); // instantiate the new class eval('$this->_customClass = new ' . $this->_customSearchClass . '( $this->_formValues );'); }