]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Emails/SubPanelViewRecipients.php
Release 6.4.0
[Github/sugarcrm.git] / modules / Emails / SubPanelViewRecipients.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-2011 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  * Description:  TODO: To be written.
41  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42  * All Rights Reserved.
43  * Contributor(s): ______________________________________..
44  ********************************************************************************/
45
46
47
48
49 global $currentModule;
50
51 global $mod_strings;
52 global $app_strings;
53
54 global $theme;
55 global $focus;
56 global $action;
57
58 // focus_list is the means of passing data to a SubPanelView.
59 global $focus_list;
60
61 $button  = "<table cellspacing='0' cellpadding='1' border='0'><form border='0' action='index.php' method='post' name='form' id='form'>\n";
62 $button .= "<input type='hidden' name='module' value='Contacts'>\n";
63 if ($currentModule == 'Accounts') $button .= "<input type='hidden' name='account_id' value='$focus->id'>\n<input type='hidden' name='account_name' value='$focus->name'>\n";
64 $button .= "<input type='hidden' name='return_module' value='".$currentModule."'>\n";
65 $button .= "<input type='hidden' name='return_action' value='".$action."'>\n";
66 $button .= "<input type='hidden' name='return_id' value='".$focus->id."'>\n";
67 $button .= "<input type='hidden' name='action'>\n";
68 $button .= "<tr><td>&nbsp;</td>";
69 if ($focus->parent_type == "Accounts") $button .= "<td><input title='".$app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_SELECT_CONTACT_BUTTON_KEY']."' type='button' class='button' value='".$app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='window.open(\"index.php?module=Contacts&action=Popup&html=Popup_picker&form=DetailView&form_submit=true&query=true&account_id=$focus->parent_id&account_name=".urlencode($focus->parent_name)."\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'></td>\n";
70 else $button .= "<td><input title='".$app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_SELECT_CONTACT_BUTTON_KEY']."' type='button' class='button' value='".$app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='window.open(\"index.php?module=Contacts&action=Popup&html=Popup_picker&form=DetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'></td>\n";
71 $button .= "<td><input title='".$app_strings['LBL_SELECT_USER_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_SELECT_USER_BUTTON_KEY']."' type='button' class='button' value='".$app_strings['LBL_SELECT_USER_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='window.open(\"index.php?module=Users&action=Popup&html=Popup_picker&form=DetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'></td>\n";
72 $button .= "</tr></form></table>\n";
73
74 // Stick the form header out there.
75 echo get_form_header($mod_strings['LBL_INVITEE'], $button, false);
76 $xtpl=new XTemplate ('modules/Emails/SubPanelViewRecipients.html');
77 $xtpl->assign("MOD", $mod_strings);
78 $xtpl->assign("APP", $app_strings);
79 $xtpl->assign("RETURN_URL", "&return_module=$currentModule&return_action=DetailView&return_id=$focus->id");
80 $xtpl->assign("EMAIL_ID", $focus->id);
81 $xtpl->assign("DELETE_INLINE_PNG",  SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LNK_REMOVE']));
82 $xtpl->assign("EDIT_INLINE_PNG",  SugarThemeRegistry::current()->getImage('edit_inline','align="absmiddle" border="0"', null,null,'.gif',$app_strings['LNK_EDIT']));
83 $oddRow = true;
84 foreach($focus_users_list as $user)
85 {
86         $user_fields = array(
87                 'USER_NAME' => $user->user_name,
88                 'FULL_NAME' => $user->first_name." ".$user->last_name,
89                 'ID' => $user->id,
90                 'EMAIL' => $user->email1,
91                 'PHONE_WORK' => $user->phone_work
92         );
93
94         $xtpl->assign("USER", $user_fields);
95
96         if($oddRow)
97     {
98         //todo move to themes
99                 $xtpl->assign("ROW_COLOR", 'oddListRow');
100     }
101     else
102     {
103         //todo move to themes
104                 $xtpl->assign("ROW_COLOR", 'evenListRow');
105     }
106     $oddRow = !$oddRow;
107
108         $xtpl->parse("users.row");
109 // Put the rows in.
110 }
111
112 $xtpl->parse("users");
113 $xtpl->out("users");
114
115 $oddRow = true;
116 print count($focus_contacts_list);
117
118 foreach($focus_contacts_list as $contact)
119 {
120         $contact_fields = array(
121                 'FIRST_NAME' => $contact->first_name,
122                 'LAST_NAME' => $contact->last_name,
123                 'ACCOUNT_NAME' => $contact->account_name,
124                 'ID' => $contact->id,
125                 'EMAIL' => $contact->email1,
126                 'PHONE_WORK' => $contact->phone_work
127         );
128
129         $xtpl->assign("CONTACT", $contact_fields);
130
131         if($oddRow)
132     {
133         //todo move to themes
134                 $xtpl->assign("ROW_COLOR", 'oddListRow');
135     }
136     else
137     {
138         //todo move to themes
139                 $xtpl->assign("ROW_COLOR", 'evenListRow');
140     }
141     $oddRow = !$oddRow;
142
143         $xtpl->parse("contacts.row");
144 // Put the rows in.
145 }
146
147 $xtpl->parse("contacts");
148 $xtpl->out("contacts");
149
150 ?>