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