]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Campaigns/views/view.detail.php
Release 6.2.0
[Github/sugarcrm.git] / modules / Campaigns / views / view.detail.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
4 /*********************************************************************************
5  * SugarCRM Community Edition is a customer relationship management program developed by
6  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7  * 
8  * This program is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU Affero General Public License version 3 as published by the
10  * Free Software Foundation with the addition of the following permission added
11  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14  * 
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
18  * details.
19  * 
20  * You should have received a copy of the GNU Affero General Public License along with
21  * this program; if not, see http://www.gnu.org/licenses or write to the Free
22  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23  * 02110-1301 USA.
24  * 
25  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27  * 
28  * The interactive user interfaces in modified source and object code versions
29  * of this program must display Appropriate Legal Notices, as required under
30  * Section 5 of the GNU Affero General Public License version 3.
31  * 
32  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33  * these Appropriate Legal Notices must retain the display of the "Powered by
34  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35  * technical reasons, the Appropriate Legal Notices must display the words
36  * "Powered by SugarCRM".
37  ********************************************************************************/
38
39 /*********************************************************************************
40
41  * Description: This file is used to override the default Meta-data DetailView behavior
42  * to provide customization specific to the Campaigns module.
43  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
44  * All Rights Reserved.
45  * Contributor(s): ______________________________________..
46  ********************************************************************************/
47
48 require_once('include/json_config.php');
49
50 require_once('include/MVC/View/views/view.detail.php');
51
52 class CampaignsViewDetail extends ViewDetail {
53
54         function CampaignsViewDetail(){
55
56         parent::ViewDetail();
57         //turn off normal display of subpanels
58         $this->options['show_subpanels'] = false;
59         
60         }
61         
62
63     function preDisplay(){
64         global $mod_strings;
65         if (isset($this->bean->campaign_type) && strtolower($this->bean->campaign_type) == 'newsletter'){
66             $mod_strings['LBL_MODULE_NAME'] = $mod_strings['LBL_NEWSLETTERS'];
67         }
68         parent::preDisplay();
69
70     }        
71
72         function display() {
73         
74         if (isset($_REQUEST['mode']) && $_REQUEST['mode']=='set_target'){
75             require_once('modules/Campaigns/utils.php');
76             //call function to create campaign logs
77             $mess = track_campaign_prospects($this->bean);
78             
79             $confirm_msg = "var ajax_C_LOG_Status = new SUGAR.ajaxStatusClass(); 
80             window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",1000); 
81             window.setTimeout('ajax_C_LOG_Status.hideStatus()', 1500); 
82             window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",2000); 
83             window.setTimeout('ajax_C_LOG_Status.hideStatus()', 5000); ";
84             $this->ss->assign("MSG_SCRIPT",$confirm_msg);
85             
86         }         
87         
88             if (($this->bean->campaign_type == 'Email') || ($this->bean->campaign_type == 'NewsLetter' )) {
89                 $this->ss->assign("ADD_BUTTON_STATE", "submit");
90                 $this->ss->assign("TARGET_BUTTON_STATE", "hidden");
91             } else {
92                 $this->ss->assign("ADD_BUTTON_STATE", "hidden");
93                 $this->ss->assign("DISABLE_LINK", "display:none");
94                 $this->ss->assign("TARGET_BUTTON_STATE", "submit");
95             }
96             
97             $currency = new Currency();
98             if(isset($this->bean->currency_id) && !empty($this->bean->currency_id))
99             {
100                 $currency->retrieve($this->bean->currency_id);
101                 if( $currency->deleted != 1){
102                         $this->ss->assign('CURRENCY', $currency->iso4217 .' '.$currency->symbol);
103                 }else {
104                     $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());   
105                 }
106             }else{
107                 $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());
108             }
109
110         parent::display();
111
112         //We want to display subset of available, panels, so we will call subpanel
113         //object directly instead of using sugarview.  
114         $GLOBALS['focus'] = $this->bean;
115         require_once('include/SubPanel/SubPanelTiles.php');
116         $subpanel = new SubPanelTiles($this->bean, $this->module);
117         //get available list of subpanels
118         $alltabs=$subpanel->subpanel_definitions->get_available_tabs();
119         if (!empty($alltabs)) {
120             //iterate through list, and filter out all but 3 subpanels
121             foreach ($alltabs as $key=>$name) {
122                 if ($name != 'prospectlists' && $name!='emailmarketing' && $name != 'tracked_urls') {
123                     //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls
124                     $subpanel->subpanel_definitions->exclude_tab($name);
125                 }   
126             }
127             //only show email marketing subpanel for email/newsletter campaigns
128             if ($this->bean->campaign_type != 'Email' && $this->bean->campaign_type != 'NewsLetter' ) {
129                 //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls
130                 $subpanel->subpanel_definitions->exclude_tab('emailmarketing');
131             }                       
132         }
133         //show filtered subpanel list
134         echo $subpanel->display();    
135
136     }
137 }
138 ?>