_search = CRM_Utils_Array::value('search', $_GET); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE); $this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'petition'); //when we do load tab, lets load the default objects. $this->assign('force', ($this->_force || $this->_searchTab) ? TRUE : FALSE); $this->assign('searchParams', json_encode($this->get('searchParams'))); $this->assign('buildSelector', $this->_search); $this->assign('searchFor', $this->_searchTab); $this->assign('petitionCampaigns', json_encode($this->get('petitionCampaigns'))); $this->assign('suppressForm', TRUE); //set the form title. CRM_Utils_System::setTitle(ts('Find Petition')); } /** * Build the form object. * * * @return void */ public function buildQuickForm() { if ($this->_search) { return; } $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey'); $this->add('text', 'petition_title', ts('Title'), $attributes['title']); //campaigns $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $this->add('select', 'petition_campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns); $this->set('petitionCampaigns', $campaigns); $this->assign('petitionCampaigns', json_encode($campaigns)); //build the array of all search params. $this->_searchParams = array(); foreach ($this->_elements as $element) { $name = $element->_attributes['name']; $label = $element->_label; if ($name == 'qfKey') { continue; } $this->_searchParams[$name] = ($label) ? $label : $name; } $this->set('searchParams', $this->_searchParams); $this->assign('searchParams', json_encode($this->_searchParams)); } }