]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Campaigns/Popup_picker.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Campaigns / Popup_picker.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38
39
40
41 global $theme;
42
43
44
45
46
47
48
49
50
51 class Popup_Picker
52 {
53         
54         
55         /*
56          * 
57          */
58         function Popup_Picker()
59         {
60                 ;
61         }
62         
63         /*
64          * 
65          */
66                 function _get_where_clause()
67         {
68                 $where = '';
69                 if(isset($_REQUEST['query']))
70                 {
71                         $where_clauses = array();
72                   
73                         append_where_clause($where_clauses, "name", "campaigns.name");
74                         append_where_clause($where_clauses, "campaign_type", "campaign_type");                  
75                         $where = generate_where_statement($where_clauses);
76                 }
77                 
78                 return $where;
79         }
80         
81         /**
82          *
83          */
84         function process_page()
85         {
86                 global $theme;
87                 global $mod_strings;
88                 global $app_strings;
89                 global $app_list_strings;
90                 global $currentModule;
91                 global $sugar_version, $sugar_config;
92                 
93                 $output_html = '';
94                 $where = '';
95                 
96                 $where = $this->_get_where_clause();
97                 
98                 
99                 
100                 $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
101                 $status = empty($_REQUEST['status']) ? '' : $_REQUEST['status'];
102                 $campaign_type = empty($_REQUEST['campaign_type']) ? '' : $_REQUEST['campaign_type'];
103                 
104                 $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
105                 $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
106                 
107                 $button  = "<form action='index.php' method='post' name='form' id='form'>\n";
108                 //START:FOR MULTI-SELECT
109                 $multi_select=false;
110                 if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
111                         $multi_select=true;
112                         $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Prospects',document.MassUpdate,'mass[]','" .$app_strings['ERR_NOTHING_SELECTED']."');\" title='"
113                                 .$app_strings['LBL_SELECT_BUTTON_TITLE']."' value='  "
114                                 .$app_strings['LBL_SELECT_BUTTON_LABEL']."  ' />\n";
115                 }
116                 //END:FOR MULTI-SELECT
117                 if(!$hide_clear_button)
118                 {
119                         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
120                                 .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
121                                 .$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
122                 }
123                 $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
124                         .$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
125                         .$app_strings['LBL_CANCEL_BUTTON_KEY']."' value='  "
126                         .$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
127                 $button .= "</form>\n";
128
129                 $form = new XTemplate('modules/Campaigns/Popup_picker.html');
130                 $form->assign('MOD', $mod_strings);
131                 $form->assign('APP', $app_strings);
132                 $form->assign('THEME', $theme);
133                 $form->assign('MODULE_NAME', $currentModule);
134                 
135                 $form->assign('request_data', $request_data);
136
137         $form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'],""));
138                 ob_start();
139                 insert_popup_header($theme);
140                 $output_html .= ob_get_contents();
141                 ob_end_clean();
142                 
143                 $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
144                 
145                 $form->parse('main.SearchHeader');
146                 $output_html .= $form->text('main.SearchHeader');
147                 
148                 // Reset the sections that are already in the page so that they do not print again later.
149                 $form->reset('main.SearchHeader');
150
151                 // create the listview
152                 $seed_bean = new Campaign();
153                 $ListView = new ListView();
154                 $ListView->show_export_button = false;
155                 $ListView->process_for_popups = true;
156                 $ListView->setXTemplate($form);
157                 $ListView->multi_select_popup=$multi_select;  //FOR MULTI-SELECT        
158                 $ListView->xTemplate->assign("TAG_TYPE","A"); //FOR MULTI-SELECT
159                 $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); //FOR MULTI-SELECT
160                 $ListView->setHeaderText($button); //FOR MULTI-SELECT
161                 $ListView->setQuery($where, '', 'name', 'CAMPAIGN');
162                 $ListView->setModStrings($mod_strings);
163
164                 ob_start();
165                 //$output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT              
166                 $ListView->processListView($seed_bean, 'main', 'CAMPAIGN');
167                 $output_html .= ob_get_contents();
168                 ob_end_clean();
169                                 
170                 $output_html .= insert_popup_footer();
171                 return $output_html;
172         }
173 } // end of class Popup_Picker
174 ?>