]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/EmailMarketing/DetailView.php
Release 6.1.4
[Github/sugarcrm.git] / modules / EmailMarketing / DetailView.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM 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 require_once('modules/EmailMarketing/Forms.php');
49
50 global $app_strings;
51 global $app_list_strings;
52 global $mod_strings;
53 global $current_user;
54
55 // Unimplemented until jscalendar language files are fixed
56 // global $current_language;
57 // global $default_language;
58 // global $cal_codes;
59
60 $focus = new EmailMarketing();
61
62 if(isset($_REQUEST['record'])) {
63     $focus->retrieve($_REQUEST['record']);
64 }
65
66 global $theme;
67
68
69
70 $GLOBALS['log']->info("EmailMarketing Edit View");
71 //echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
72
73 $xtpl=new XTemplate ('modules/EmailMarketing/DetailView.html');
74
75 $xtpl->assign("MOD", $mod_strings);
76 $xtpl->assign("APP", $app_strings);
77
78 if (isset($_REQUEST['return_module'])) {
79         $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
80 } else {
81         $xtpl->assign("RETURN_MODULE", 'Campaigns');
82 }
83 if (isset($_REQUEST['return_action'])) { 
84         $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
85 } else {
86         $xtpl->assign("RETURN_ACTION", 'DetailView');
87 }       
88 if (isset($_REQUEST['return_id'])) {
89         $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
90 } else {
91         if (!empty($focus->campaign_id)) {
92                 $xtpl->assign("RETURN_ID", $focus->campaign_id);
93         }
94 }
95
96
97 if($focus->campaign_id) {
98         $campaign_id=$focus->campaign_id;
99 }
100 else {
101         $campaign_id=$_REQUEST['campaign_id'];
102 }
103 $xtpl->assign("CAMPAIGN_ID", $campaign_id);
104
105
106 $xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
107 $xtpl->assign("JAVASCRIPT", get_set_focus_js());
108 $xtpl->assign("DATE_ENTERED", $focus->date_entered);
109 $xtpl->assign("DATE_MODIFIED", $focus->date_modified);
110 $xtpl->assign("ID", $focus->id);
111 $xtpl->assign("NAME", $focus->name);
112 $xtpl->assign("FROM_NAME", $focus->from_name);
113 $xtpl->assign("FROM_ADDR", $focus->from_addr);
114 $xtpl->assign("DATE_START", $focus->date_start);
115 $xtpl->assign("TIME_START", $focus->time_start);
116
117 $email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name');
118 if($focus->template_id) {
119         $xtpl->assign("EMAIL_TEMPLATE", $email_templates_arr[$focus->template_id]);
120 }
121
122 //include campaign utils..
123 require_once('modules/Campaigns/utils.php');
124 if (empty($_REQUEST['campaign_name'])) {
125         
126         $campaign = new Campaign();
127         $campaign->retrieve($campaign_id);
128         $campaign_name=$campaign->name;
129 } else {
130         $campaign_name=$_REQUEST['campaign_name'];
131 }
132
133 $params = array();
134 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LNK_CAMPAIGN_LIST']}</a>";
135 $params[] = "<a href='index.php?module=Campaigns&action=DetailView&record={$campaign_id}'>{$campaign_name}</a>";
136 $params[] = $focus->name;
137
138 echo getClassicModuleTitle($focus->module_dir, $params, true);
139
140 if (!empty($focus->all_prospect_lists)) {
141         $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_ALL_PROSPECT_LISTS']);
142 } else {
143         $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_RELATED_PROSPECT_LISTS']);
144 }
145
146 if (!empty($focus->status)) {
147         $xtpl->assign("STATUS",$app_list_strings['email_marketing_status_dom'][$focus->status]);
148 }
149 $emails=array();
150 $mailboxes=get_campaign_mailboxes($emails);
151 //_ppd($emails[$focus->inbound_email_id]);
152 if (!empty($focus->inbound_email_id) && isset($mailboxes[$focus->inbound_email_id])) {
153         $xtpl->assign("FROM_MAILBOX_NAME", $mailboxes[$focus->inbound_email_id]."&nbsp;&lt;{$emails[$focus->inbound_email_id]}&gt;");
154 }
155
156 $xtpl->parse("main");
157 $xtpl->out("main");
158
159
160 $javascript = new javascript();
161 $javascript->setFormName('EditView');
162 $javascript->setSugarBean($focus);
163 $javascript->addAllFields('');
164 echo $javascript->getScript();
165
166 require_once('include/SubPanel/SubPanelTiles.php');
167 $subpanel = new SubPanelTiles($focus, 'EmailMarketing');
168
169 if ($focus->all_prospect_lists == 1) {
170         $subpanel->subpanel_definitions->exclude_tab('prospectlists');
171 }
172 else {
173         $subpanel->subpanel_definitions->exclude_tab('allprospectlists');
174
175 }
176
177 echo $subpanel->display();
178
179 ?>