3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2018
37 class CRM_Campaign_Form_Search_Petition
extends CRM_Core_Form
{
40 * Are we forced to run a search.
47 * Processing needed for buildForm and later.
49 public function preProcess() {
50 $this->_search
= CRM_Utils_Array
::value('search', $_GET);
51 $this->_force
= CRM_Utils_Request
::retrieve('force', 'Boolean', $this, FALSE, FALSE);
52 $this->_searchTab
= CRM_Utils_Request
::retrieve('type', 'String', $this, FALSE, 'petition');
54 //when we do load tab, lets load the default objects.
55 $this->assign('force', ($this->_force ||
$this->_searchTab
) ?
TRUE : FALSE);
56 $this->assign('searchParams', json_encode($this->get('searchParams')));
57 $this->assign('buildSelector', $this->_search
);
58 $this->assign('searchFor', $this->_searchTab
);
59 $this->assign('petitionCampaigns', json_encode($this->get('petitionCampaigns')));
60 $this->assign('suppressForm', TRUE);
63 CRM_Utils_System
::setTitle(ts('Find Petition'));
67 * Build the form object.
69 public function buildQuickForm() {
74 $attributes = CRM_Core_DAO
::getAttribute('CRM_Campaign_DAO_Survey');
75 $this->add('text', 'petition_title', ts('Title'), $attributes['title']);
78 $campaigns = CRM_Campaign_BAO_Campaign
::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
79 $this->add('select', 'petition_campaign_id', ts('Campaign'), array('' => ts('- select -')) +
$campaigns);
80 $this->set('petitionCampaigns', $campaigns);
81 $this->assign('petitionCampaigns', json_encode($campaigns));
83 //build the array of all search params.
84 $this->_searchParams
= array();
85 foreach ($this->_elements
as $element) {
86 $name = $element->_attributes
['name'];
87 $label = $element->_label
;
88 if ($name == 'qfKey') {
91 $this->_searchParams
[$name] = ($label) ?
$label : $name;
93 $this->set('searchParams', $this->_searchParams
);
94 $this->assign('searchParams', json_encode($this->_searchParams
));