3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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-2014
39 class CRM_Campaign_Form_Search_Campaign
extends CRM_Core_Form
{
42 * Are we forced to run a search
50 * processing needed for buildForm and later
54 */ function preProcess() {
55 $this->_search
= CRM_Utils_Array
::value('search', $_GET);
56 $this->_force
= CRM_Utils_Request
::retrieve('force', 'Boolean', $this, FALSE, FALSE);
57 $this->_searchTab
= CRM_Utils_Request
::retrieve('type', 'String', $this, FALSE, 'campaign');
59 //when we do load tab, lets load the default objects.
60 $this->assign('force', ($this->_force ||
$this->_searchTab
) ?
TRUE : FALSE);
61 $this->assign('searchParams', json_encode($this->get('searchParams')));
62 $this->assign('buildSelector', $this->_search
);
63 $this->assign('searchFor', $this->_searchTab
);
64 $this->assign('campaignTypes', json_encode($this->get('campaignTypes')));
65 $this->assign('campaignStatus', json_encode($this->get('campaignStatus')));
66 $this->assign('suppressForm', TRUE);
69 CRM_Utils_System
::setTitle(ts('Find Campaigns'));
79 function buildQuickForm() {
84 $attributes = CRM_Core_DAO
::getAttribute('CRM_Campaign_DAO_Campaign');
85 $this->add('text', 'campaign_title', ts('Title'), $attributes['title']);
87 //campaign description.
88 $this->add('text', 'description', ts('Description'), $attributes['description']);
90 //campaign start date.
91 $this->addDate('start_date', ts('From'), FALSE, array('formatType' => 'searchDate'));
94 $this->addDate('end_date', ts('To'), FALSE, array('formatType' => 'searchDate'));
97 $campaignTypes = CRM_Campaign_PseudoConstant
::campaignType();
98 $this->add('select', 'campaign_type_id', ts('Campaign Type'),
100 '' => ts('- select -')) +
$campaignTypes
103 $this->set('campaignTypes', $campaignTypes);
104 $this->assign('campaignTypes', json_encode($campaignTypes));
107 $campaignStatus = CRM_Campaign_PseudoConstant
::campaignStatus();
108 $this->addElement('select', 'status_id', ts('Campaign Status'),
110 '' => ts('- select -')) +
$campaignStatus
112 $this->set('campaignStatus', $campaignStatus);
113 $this->assign('campaignStatus', json_encode($campaignStatus));
115 //build the array of all search params.
116 $this->_searchParams
= array();
117 foreach ($this->_elements
as $element) {
118 $name = $element->_attributes
['name'];
119 $label = $element->_label
;
120 if ($name == 'qfKey') {
123 $this->_searchParams
[$name] = ($label) ?
$label : $name;
125 $this->set('searchParams', $this->_searchParams
);
126 $this->assign('searchParams', json_encode($this->_searchParams
));