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.
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.
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
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
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.
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.
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 ********************************************************************************/
38 /*********************************************************************************
40 * Description: TODO: To be written.
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
48 global $app_list_strings;
51 global $currentModule;
60 $current_module_strings = return_module_language($current_language, 'Users');
61 $seed_object = new User();
64 if(isset($_REQUEST['query']))
66 $search_fields = Array("first_name", "last_name", "user_name");
68 $where_clauses = Array();
70 append_where_clause($where_clauses, "first_name", "users.first_name");
71 append_where_clause($where_clauses, "last_name", "users.last_name");
72 append_where_clause($where_clauses, "user_name", "users.user_name");
74 $where = generate_where_statement($where_clauses);
79 ////////////////////////////////////////////////////////
81 ////////////////////////////////////////////////////////
83 $from_form = empty($_REQUEST['form']) ? '' : $_REQUEST['form'];
84 $form_submit = !empty($_REQUEST['form_submit']) && $_REQUEST['form_submit'] != 'false' ? true : false;
85 $parent_id = empty($_REQUEST['parent_id']) ? 'parent_id' : $_REQUEST['parent_id'];
86 $parent_name = empty($_REQUEST['parent_name']) ? 'parent_name' : $_REQUEST['parent_name'];
88 $button = "<form action='index.php' method='post' name='form' id='form'>\n";
89 $button .= "<input type='hidden' name='record' value='". $_REQUEST['record'] ."'>\n";
90 $button .= "<input type='hidden' name='module' value='Roles'>\n";
91 $button .= "<input type='hidden' name='action' value='SaveUserRelationship'>\n";
92 $button .= "<input type='submit' name='button' class='button' title='".$current_module_strings['LBL_SELECT_CHECKED_BUTTON_TITLE']."' value=' ".$current_module_strings['LBL_SELECT_CHECKED_BUTTON_LABEL']." ' />\n";
93 $button .= "<input type='submit' name='button' class='button' title='".$app_strings['LBL_DONE_BUTTON_TITLE']."' onclick=\"window.close();\" value=' ".$app_strings['LBL_DONE_BUTTON_LABEL']." ' />\n";
95 $form =new XTemplate ('modules/Users/Popup_Users_picker.html');
96 $GLOBALS['log']->debug("using file modules/Users/Popup_Users_picker.html");
97 $form->assign("MOD", $mod_strings);
98 $form->assign("APP", $app_strings);
99 $form->assign("MODULE_NAME", $currentModule);
100 $form->assign("parent_id", $parent_id);
101 $form->assign("parent_name", $parent_name);
102 if (isset($_REQUEST['form_submit'])) $form->assign("FORM_SUBMIT", $_REQUEST['form_submit']);
103 $form->assign("FORM", $from_form);
104 $form->assign("RECORD_VALUE", $_REQUEST['record']);
106 if (isset($_REQUEST['first_name'])) $last_search['FIRST_NAME'] = $_REQUEST['first_name'];
107 if (isset($_REQUEST['last_name'])) $last_search['LAST_NAME'] = $_REQUEST['last_name'];
108 if (isset($_REQUEST['user_name'])) $last_search['USER_NAME'] = $_REQUEST['user_name'];
110 insert_popup_header($theme);
114 echo get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], "", false);
116 $form->parse("main.SearchHeader");
117 $form->out("main.SearchHeader");
119 $form->parse("main.SearchHeaderEnd");
120 $form->out("main.SearchHeaderEnd");
122 // Reset the sections that are already in the page so that they do not print again later.
123 $form->reset("main.SearchHeader");
124 $form->reset("main.SearchHeaderEnd");
126 $ListView = new ListView();
127 $ListView->setXTemplate($form);
128 $ListView->setHeaderTitle($current_module_strings['LBL_LIST_FORM_TITLE']);
129 $ListView->setHeaderText($button);
130 $ListView->setQuery($where, "", "user_name", "USER");
131 $ListView->setModStrings($current_module_strings);
132 $ListView->processListViewMulti($seed_object, "main", "USER");
134 insert_popup_footer();