]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/EmailMarketing/DetailView.php
Release 6.5.0
[Github/sugarcrm.git] / modules / EmailMarketing / DetailView.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  * 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
72 $xtpl=new XTemplate ('modules/EmailMarketing/DetailView.html');
73
74 $xtpl->assign("MOD", $mod_strings);
75 $xtpl->assign("APP", $app_strings);
76
77 if (isset($_REQUEST['return_module'])) {
78         $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
79 } else {
80         $xtpl->assign("RETURN_MODULE", 'Campaigns');
81 }
82 if (isset($_REQUEST['return_action'])) { 
83         $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
84 } else {
85         $xtpl->assign("RETURN_ACTION", 'DetailView');
86 }       
87 if (isset($_REQUEST['return_id'])) {
88         $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
89 } else {
90         if (!empty($focus->campaign_id)) {
91                 $xtpl->assign("RETURN_ID", $focus->campaign_id);
92         }
93 }
94
95
96 if($focus->campaign_id) {
97         $campaign_id=$focus->campaign_id;
98 }
99 else {
100         $campaign_id=$_REQUEST['campaign_id'];
101 }
102 $xtpl->assign("CAMPAIGN_ID", $campaign_id);
103
104
105 $xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
106 $xtpl->assign("JAVASCRIPT", get_set_focus_js());
107 $xtpl->assign("DATE_ENTERED", $focus->date_entered);
108 $xtpl->assign("DATE_MODIFIED", $focus->date_modified);
109 $xtpl->assign("ID", $focus->id);
110 $xtpl->assign("NAME", $focus->name);
111 $xtpl->assign("FROM_NAME", $focus->from_name);
112 $xtpl->assign("FROM_ADDR", $focus->from_addr);
113 $xtpl->assign("REPLY_TO_NAME", $focus->reply_to_name);
114 $xtpl->assign("REPLY_TO_ADDR", $focus->reply_to_addr);
115 $xtpl->assign("DATE_START", $focus->date_start);
116 $xtpl->assign("TIME_START", $focus->time_start);
117
118 $email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name');
119 if($focus->template_id) {
120         $xtpl->assign("EMAIL_TEMPLATE", $email_templates_arr[$focus->template_id]);
121 }
122
123 //include campaign utils..
124 require_once('modules/Campaigns/utils.php');
125 if (empty($_REQUEST['campaign_name'])) {
126         
127         $campaign = new Campaign();
128         $campaign->retrieve($campaign_id);
129         $campaign_name=$campaign->name;
130 } else {
131         $campaign_name=$_REQUEST['campaign_name'];
132 }
133
134 $params = array();
135 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LNK_CAMPAIGN_LIST']}</a>";
136 $params[] = "<a href='index.php?module=Campaigns&action=DetailView&record={$campaign_id}'>{$campaign_name}</a>";
137 $params[] = $focus->name;
138
139 echo getClassicModuleTitle($focus->module_dir, $params, true);
140
141 if (!empty($focus->all_prospect_lists)) {
142         $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_ALL_PROSPECT_LISTS']);
143 } else {
144         $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_RELATED_PROSPECT_LISTS']);
145 }
146
147 if (!empty($focus->status)) {
148         $xtpl->assign("STATUS",$app_list_strings['email_marketing_status_dom'][$focus->status]);
149 }
150 $emails=array();
151 $mailboxes=get_campaign_mailboxes($emails);
152 //_ppd($emails[$focus->inbound_email_id]);
153 if (!empty($focus->inbound_email_id) && isset($mailboxes[$focus->inbound_email_id])) {
154         $xtpl->assign("FROM_MAILBOX_NAME", $mailboxes[$focus->inbound_email_id]."&nbsp;&lt;{$emails[$focus->inbound_email_id]}&gt;");
155 }
156
157 $xtpl->parse("main");
158 $xtpl->out("main");
159
160
161 $javascript = new javascript();
162 $javascript->setFormName('EditView');
163 $javascript->setSugarBean($focus);
164 $javascript->addAllFields('');
165 echo $javascript->getScript();
166
167 require_once('include/SubPanel/SubPanelTiles.php');
168 $subpanel = new SubPanelTiles($focus, 'EmailMarketing');
169
170 if ($focus->all_prospect_lists == 1) {
171         $subpanel->subpanel_definitions->exclude_tab('prospectlists');
172 }
173 else {
174         $subpanel->subpanel_definitions->exclude_tab('allprospectlists');
175
176 }
177
178 echo $subpanel->display();
179
180 ?>