]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/ACLRoles/Popup_picker.php
Release 6.5.0
[Github/sugarcrm.git] / modules / ACLRoles / 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
42
43
44
45
46 class Popup_Picker
47 {
48         
49         
50         /*
51          * 
52          */
53         function Popup_Picker()
54         {
55                 ;
56         }
57         
58         /*
59          * 
60          */
61         function _get_where_clause()
62         {
63                 $where = '';
64                 if(isset($_REQUEST['query']))
65                 {
66                         $where_clauses = array();
67                         append_where_clause($where_clauses, "name", "acl_roles.name");
68                         $where = generate_where_statement($where_clauses);
69                 }
70                 
71                 return $where;
72         }
73         
74         /**
75          *
76          */
77         function process_page()
78         {
79                 global $mod_strings;
80                 global $app_strings;
81                 global $currentModule;
82                 global $sugar_version, $sugar_config;
83                 
84                 $output_html = '';
85                 $where = '';
86                 
87                 $where = $this->_get_where_clause();
88                 
89                 $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
90                 $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
91                 $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
92
93                 $button  = "<form action='index.php' method='post' name='form' id='form'>\n";
94                 if(!$hide_clear_button)
95                 {
96                         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
97                                 .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
98                                 .$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
99                 }
100                 $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
101                         .$app_strings['LBL_CANCEL_BUTTON_TITLE']."'  value='  "
102                         .$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
103                 $button .= "</form>\n";
104
105                 $form = new XTemplate('modules/ACLRoles/Popup_picker.html');
106                 $form->assign('MOD', $mod_strings);
107                 $form->assign('APP', $app_strings);
108                 $form->assign('MODULE_NAME', $currentModule);
109                 $form->assign('NAME', $name);
110                 $form->assign('request_data', $request_data);
111                 
112                 ob_start();
113                 insert_popup_header();
114                 $output_html .= ob_get_contents();
115                 ob_end_clean();
116                 
117                 $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
118                 
119                 $form->parse('main.SearchHeader');
120                 $output_html .= $form->text('main.SearchHeader');
121                 
122                 // Reset the sections that are already in the page so that they do not print again later.
123                 $form->reset('main.SearchHeader');
124
125                 // create the listview
126                 $seed_bean = new ACLRole();
127                 $ListView = new ListView();
128                 $ListView->show_export_button = false;
129                 $ListView->process_for_popups = true;
130                 $ListView->setXTemplate($form);
131                 $ListView->setHeaderTitle($mod_strings['LBL_ROLE']);
132                 $ListView->setHeaderText($button);
133                 $ListView->setQuery($where, '', 'name', 'ROLE');
134                 $ListView->setModStrings($mod_strings);
135
136                 ob_start();
137                 $ListView->processListView($seed_bean, 'main', 'ROLE');
138                 $output_html .= ob_get_contents();
139                 ob_end_clean();
140                                 
141                 $output_html .= insert_popup_footer();
142                 return $output_html;
143         }
144 } // end of class Popup_Picker
145 ?>