]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Campaigns/views/view.detail.php
Release 6.5.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-2012 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         $this->options['show_subpanels'] = false;
70
71     }        
72
73         function display() {
74         
75         if (isset($_REQUEST['mode']) && $_REQUEST['mode']=='set_target'){
76             require_once('modules/Campaigns/utils.php');
77             //call function to create campaign logs
78             $mess = track_campaign_prospects($this->bean);
79             
80             $confirm_msg = "var ajax_C_LOG_Status = new SUGAR.ajaxStatusClass(); 
81             window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",1000); 
82             window.setTimeout('ajax_C_LOG_Status.hideStatus()', 1500); 
83             window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",2000); 
84             window.setTimeout('ajax_C_LOG_Status.hideStatus()', 5000); ";
85             $this->ss->assign("MSG_SCRIPT",$confirm_msg);
86             
87         }         
88         
89             if (($this->bean->campaign_type == 'Email') || ($this->bean->campaign_type == 'NewsLetter' )) {
90                 $this->ss->assign("ADD_BUTTON_STATE", "submit");
91                 $this->ss->assign("TARGET_BUTTON_STATE", "hidden");
92             } else {
93                 $this->ss->assign("ADD_BUTTON_STATE", "hidden");
94                 $this->ss->assign("DISABLE_LINK", "display:none");
95                 $this->ss->assign("TARGET_BUTTON_STATE", "submit");
96             }
97             
98             $currency = new Currency();
99             if(isset($this->bean->currency_id) && !empty($this->bean->currency_id))
100             {
101                 $currency->retrieve($this->bean->currency_id);
102                 if( $currency->deleted != 1){
103                         $this->ss->assign('CURRENCY', $currency->iso4217 .' '.$currency->symbol);
104                 }else {
105                     $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());   
106                 }
107             }else{
108                 $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());
109             }
110
111         parent::display();
112
113         //We want to display subset of available, panels, so we will call subpanel
114         //object directly instead of using sugarview.  
115         $GLOBALS['focus'] = $this->bean;
116         require_once('include/SubPanel/SubPanelTiles.php');
117         $subpanel = new SubPanelTiles($this->bean, $this->module);
118         //get available list of subpanels
119         $alltabs=$subpanel->subpanel_definitions->get_available_tabs();
120         if (!empty($alltabs)) {
121             //iterate through list, and filter out all but 3 subpanels
122             foreach ($alltabs as $key=>$name) {
123                 if ($name != 'prospectlists' && $name!='emailmarketing' && $name != 'tracked_urls') {
124                     //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls
125                     $subpanel->subpanel_definitions->exclude_tab($name);
126                 }   
127             }
128             //only show email marketing subpanel for email/newsletter campaigns
129             if ($this->bean->campaign_type != 'Email' && $this->bean->campaign_type != 'NewsLetter' ) {
130                 //exclude emailmarketing subpanel if not on an email or newsletter campaign
131                 $subpanel->subpanel_definitions->exclude_tab('emailmarketing');
132                 // Bug #49893  - 20120120 - Captivea (ybi) - Remove trackers subpanels if not on an email/newsletter campaign (useless subpannl)
133                 $subpanel->subpanel_definitions->exclude_tab('tracked_urls');
134             }                       
135         }
136         //show filtered subpanel list
137         echo $subpanel->display();    
138
139     }
140 }
141 ?>