]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Campaigns/WizardHome.php
Release 6.5.1
[Github/sugarcrm.git] / modules / Campaigns / WizardHome.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 /************** general UI Stuff *************/
47
48
49 require_once('modules/Campaigns/utils.php');
50
51
52
53 $focus = new Campaign();
54 if(isset($_REQUEST['record']) &&  !empty($_REQUEST['record'])) {
55     $focus->retrieve($_REQUEST['record']);
56
57 global $mod_strings;
58 global $app_list_strings;
59 global $app_strings;
60 global $current_user;
61
62
63 //if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
64 //account for use within wizards
65 if($focus->campaign_type == 'NewsLetter'){
66     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_NEWSLETTER_WIZARD_START_TITLE'].$focus->name), true, false);
67 }else{
68     echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_CAMPAIGN_WIZARD_START_TITLE'].$focus->name), true, false);
69 }
70
71 global $theme;
72 global $currentModule;
73
74
75
76
77
78   
79     $ss = new Sugar_Smarty();
80     $ss->assign("MOD", $mod_strings);
81     $ss->assign("APP", $app_strings);
82
83     //if this page has been refreshed as a result of sending emails, then display status 
84     if(isset($_REQUEST['from'])){
85         $mess = $mod_strings['LBL_TEST_EMAILS_SENT'];
86         if($_REQUEST['from']=='send'){ $mess = $mod_strings['LBL_EMAILS_SCHEDULED'];  }
87         $confirm_msg = "var ajaxWizStatus = new SUGAR.ajaxStatusClass(); ";
88         $confirm_msg .= "window.setTimeout(\"ajaxWizStatus.showStatus('".$mess."')\",1000); ";
89         $confirm_msg .= "window.setTimeout('ajaxWizStatus.hideStatus()', 1500); ";
90         $confirm_msg .= "window.setTimeout(\"ajaxWizStatus.showStatus('".$mess."')\",2000); ";
91         $confirm_msg .= "window.setTimeout('ajaxWizStatus.hideStatus()', 5000); ";        
92         $ss->assign("MSG_SCRIPT",$confirm_msg);
93     }
94     
95     if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
96     if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
97     if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
98     if (isset($_REQUEST['record'])) $ss->assign("ID", $_REQUEST['record']);    
99     // handle Create $module then Cancel
100     if (empty($_REQUEST['return_id'])) {
101         $ss->assign("RETURN_ACTION", 'index');
102     }
103         
104     
105     
106     $ss->assign("CAMPAIGN_TBL", create_campaign_summary ($focus));
107     $ss->assign("TARGETS_TBL", create_target_summary ($focus));
108     $ss->assign("TRACKERS_TBL", create_tracker_summary ($focus));
109     if($focus->campaign_type =='NewsLetter' || $focus->campaign_type =='Email'){
110         $ss->assign("MARKETING_TBL", create_marketing_summary ($focus));
111     }
112     
113     $camp_url = "index.php?action=WizardNewsletter&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
114     $camp_url .= "&return_id=".$focus->id."&record=".$focus->id."&direct_step=";
115     $ss->assign("CAMP_WIZ_URL", $camp_url);
116
117     $mrkt_string = $mod_strings['LBL_NAVIGATION_MENU_MARKETING'];
118     if(!empty($focus->id)){
119         $mrkt_url = "<a  href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
120         $mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
121         $mrkt_url .= "'>". $mrkt_string."</a>";
122         $mrkt_string = $mrkt_url;
123     }
124         
125         $mrkt_url = "<a  href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
126         $mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
127         $mrkt_url .= "'>". $mod_strings['LBL_NAVIGATION_MENU_MARKETING']."</a>";
128     $ss->assign("MRKT_WIZ_URL", $mrkt_url);
129
130     $summ_url = "<a  href='index.php?action=WizardHome&module=Campaigns";
131     $summ_url .= "&return_id=".$focus->id."&record=".$focus->id;
132     $summ_url .= "'> ". $mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";    
133
134
135     //Create the html to fill in the wizard steps
136     if($focus->campaign_type == 'NewsLetter'){
137         $ss->assign('NAV_ITEMS',create_wiz_menu_items('newsletter',$mrkt_string,$camp_url,$summ_url ));
138         $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
139     }elseif($focus->campaign_type == 'Email'){
140         $ss->assign('NAV_ITEMS',create_wiz_menu_items('email',$mrkt_string,$camp_url,$summ_url ));
141         $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
142      }else{
143         $ss->assign('NAV_ITEMS',create_wiz_menu_items('general',$mrkt_string,$camp_url,$summ_url ));
144     }    
145     
146             
147     /********** FINAL END OF PAGE UI Stuff ********/
148     $ss->display(file_exists('custom/modules/Campaigns/WizardHome.html') ? 'custom/modules/Campaigns/WizardHome.html' : 'modules/Campaigns/WizardHome.html');
149     
150 }else{
151     //there is no record to retrieve, so ask which type of campaign wizard to launch
152 /*    $header_URL = "Location: index.php?module=Campaigns&action=index";
153     $GLOBALS['log']->debug("about to post header URL of: $header_URL");
154     header($header_URL);            
155 */
156     global $mod_strings;
157     global $app_list_strings;
158     global $app_strings;
159     global $current_user;
160     
161     //if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
162     //account for use within wizards
163         echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_CAMPAIGN_WIZARD'].$focus->name), true, false);
164              
165
166     $ss = new Sugar_Smarty();
167     $ss->assign("MOD", $mod_strings);
168     $ss->assign("APP", $app_strings);
169     $ss->display(file_exists('custom/modules/Campaigns/tpls/WizardHomeStart.tpl') ? 'custom/modules/Campaigns/tpls/WizardHomeStart.tpl' : 'modules/Campaigns/tpls/WizardHomeStart.tpl');
170        
171 }
172
173
174
175
176 function create_campaign_summary  ($focus){
177     global $mod_strings,$app_strings;
178     $fields = array();
179     $fields[] = 'name';
180     $fields[] = 'assigned_user_name';
181     $fields[] = 'status';
182     $fields[] = 'team_name';
183     $fields[] = 'start_date';
184     $fields[] = 'end_date';
185     if($focus->campaign_type=='NewsLetter'){
186         $fields[] = 'frequency';
187     }
188     $fields[] = 'content';
189     $fields[] = 'budget';
190     $fields[] = 'actual_cost';
191     $fields[] = 'expected_revenue';
192     $fields[] = 'expected_cost';
193     $fields[] = 'impressions';
194     $fields[] = 'objective';  
195     
196     //create edit view status and input buttons
197     $cmp_input = '';
198
199     //create edit campaign button
200     $cmp_input =  "<input id='wiz_next_button' name='SUBMIT'  ";  
201     $cmp_input.= "onclick=\"this.form.return_module.value='Campaigns';";
202     $cmp_input.= "this.form.module.value='Campaigns';";
203     $cmp_input.= "this.form.action.value='WizardNewsletter';";
204     $cmp_input.= "this.form.return_action.value='WizardHome';";
205     $cmp_input.= "this.form.direct_step.value='1';";
206     $cmp_input.= "this.form.record.value='".$focus->id."';";
207     $cmp_input.= "this.form.return_id.value='".$focus->id."';\" "; 
208     $cmp_input.= "class='button' value='".$mod_strings['LBL_EDIT_EXISTING']."' type='submit'> ";
209           
210     //create view status button      
211     if(($focus->campaign_type == 'NewsLetter') || ($focus->campaign_type == 'Email')){
212         $cmp_input .=  " <input id='wiz_status_button' name='SUBMIT'  ";  
213         $cmp_input.= "onclick=\"this.form.return_module.value='Campaigns';";
214         $cmp_input.= "this.form.module.value='Campaigns';";
215         $cmp_input.= "this.form.action.value='TrackDetailView';";
216         $cmp_input.= "this.form.return_action.value='WizardHome';";
217         $cmp_input.= "this.form.record.value='".$focus->id."';";
218         $cmp_input.= "this.form.return_id.value='".$focus->id."';\" "; 
219         $cmp_input.= "class='button' value='".$mod_strings['LBL_TRACK_BUTTON_TITLE']."' type='submit'>";
220     }
221     //create view roi button
222     $cmp_input .=  " <input id='wiz_status_button' name='SUBMIT'  ";  
223     $cmp_input.= "onclick=\"this.form.return_module.value='Campaigns';";
224     $cmp_input.= "this.form.module.value='Campaigns';";
225     $cmp_input.= "this.form.action.value='RoiDetailView';";
226     $cmp_input.= "this.form.return_action.value='WizardHome';";
227     $cmp_input.= "this.form.record.value='".$focus->id."';";
228     $cmp_input.= "this.form.return_id.value='".$focus->id."';\" "; 
229     $cmp_input.= "class='button' value='".$mod_strings['LBL_TRACK_ROI_BUTTON_LABEL']."' type='submit'>";
230           
231     //Create Campaign Header    
232     $cmpgn_tbl = "<p><table class='edit view' width='100%' border='0' cellspacing='0' cellpadding='0'>";
233     $cmpgn_tbl .= "<tr><td class='dataField' align='left'><h4 class='dataLabel'> ".$mod_strings['LBL_LIST_CAMPAIGN_NAME'].'  '. $mod_strings['LBL_WIZ_NEWSLETTER_TITLE_SUMMARY']." </h4></td>";
234     $cmpgn_tbl .= "<td align='right'>$cmp_input</td></tr>";
235     $colorclass = '';
236     foreach($fields as $key){
237
238                 if(!empty($focus->$key) && !empty($mod_strings[$focus->field_name_map[$key]['vname']])){
239                     $cmpgn_tbl .= "<tr><td scope='row' width='15%'>".$mod_strings[$focus->field_name_map[$key]['vname']]."</td>\n";
240                     if($key == 'team_name') {
241                                            require_once('modules/Teams/TeamSetManager.php');
242                                            $cmpgn_tbl .= "<td scope='row'>".TeamSetManager::getCommaDelimitedTeams($focus->team_set_id, $focus->team_id, true)."</td></tr>\n";
243                             } else {
244                        $cmpgn_tbl .= "<td scope='row'>".$focus->$key."</td></tr>\n";
245                     }
246                 }            
247     }
248     $cmpgn_tbl .= "</table></p>";
249     
250     return $cmpgn_tbl ;
251 }
252
253 function create_marketing_summary  ($focus){
254     global $mod_strings,$app_strings;
255     $colorclass = '';
256     
257     //create new marketing button input
258     $new_mrkt_input =  "<input id='wiz_new_mrkt_button' name='SUBMIT' ";  
259     $new_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns';";
260     $new_mrkt_input .= "this.form.module.value='Campaigns';";
261     $new_mrkt_input .= "this.form.record.value='';";
262     $new_mrkt_input .= "this.form.return_module.value='Campaigns';";    
263     $new_mrkt_input .= "this.form.action.value='WizardMarketing';";
264     $new_mrkt_input .= "this.form.return_action.value='WizardHome';";
265     $new_mrkt_input .= "this.form.direct_step.value='1';";
266     $new_mrkt_input .= "this.form.campaign_id.value='".$focus->id."';";
267     $new_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" "; 
268     $new_mrkt_input .= "class='button' value='".$mod_strings['LBL_CREATE_NEW_MARKETING_EMAIL']."' type='submit'>";        
269        
270         //create marketing email table
271     $mrkt_tbl='';
272     
273     $focus->load_relationship('emailmarketing');
274     $mrkt_lists = $focus->emailmarketing->get();
275     
276     
277     $mrkt_tbl = "<p><table  class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
278     $mrkt_tbl .= "<tr class='detail view'><td colspan='3'><h4> ".$mod_strings['LBL_WIZ_MARKETING_TITLE']." </h4></td>" .
279                  "<td colspan=2 align='right'>$new_mrkt_input</td></tr>";
280     $mrkt_tbl .= "<tr  class='listViewHRS1'><td scope='col' width='15%'><b>".$mod_strings['LBL_MRKT_NAME']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_FROM_MAILBOX_NAME']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_STATUS_TEXT']."</b></td><td scope='col' colspan=2>&nbsp;</td></tr>";
281     
282     if(count($mrkt_lists)>0){
283     
284             
285             $mrkt_focus = new EmailMarketing();
286             foreach($mrkt_lists as $mrkt_id){
287                 $mrkt_focus->retrieve($mrkt_id);    
288     
289                 //create send test marketing button input
290                 $test_mrkt_input =  "<input id='wiz_new_mrkt_button' name='SUBMIT'  ";  
291                 $test_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns'; ";
292                 $test_mrkt_input .= "this.form.module.value='Campaigns'; ";
293                 $test_mrkt_input .= "this.form.record.value='';";
294                 $test_mrkt_input .= "this.form.return_module.value='Campaigns'; ";    
295                 $test_mrkt_input .= "this.form.action.value='QueueCampaign'; ";
296                 $test_mrkt_input .= "this.form.return_action.value='WizardHome'; ";
297                 $test_mrkt_input .= "this.form.wiz_mass.value='".$mrkt_focus->id."'; ";
298                 $test_mrkt_input .= "this.form.mode.value='test'; ";    
299                 $test_mrkt_input .= "this.form.direct_step.value='1'; ";
300                 $test_mrkt_input .= "this.form.record.value='".$focus->id."'; ";
301                 $test_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" "; 
302                 $test_mrkt_input .= "class='button' value='".$mod_strings['LBL_TEST_BUTTON_LABEL']."' type='submit'>";        
303             
304                 //create send marketing button input
305                 $send_mrkt_input =  "<input id='wiz_new_mrkt_button' name='SUBMIT'  ";  
306                 $send_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns'; ";
307                 $send_mrkt_input .= "this.form.module.value='Campaigns'; ";
308                 $send_mrkt_input .= "this.form.record.value='';";
309                 $send_mrkt_input .= "this.form.return_module.value='Campaigns'; ";    
310                 $send_mrkt_input .= "this.form.action.value='QueueCampaign'; ";
311                 $send_mrkt_input .= "this.form.return_action.value='WizardHome'; ";
312                 $send_mrkt_input .= "this.form.wiz_mass.value='".$mrkt_focus->id."'; ";
313                 $send_mrkt_input .= "this.form.mode.value='send'; ";    
314                 $send_mrkt_input .= "this.form.direct_step.value='1'; ";
315                 $send_mrkt_input .= "this.form.record.value='".$focus->id."'; ";
316                 $send_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" "; 
317                 $send_mrkt_input .= "class='button' value='".$mod_strings['LBL_SEND_EMAIL']."' type='submit'>";        
318             
319     
320     
321              if( $colorclass== "class='evenListRowS1'"){
322                     $colorclass= "class='oddListRowS1'";
323                 }else{ 
324                     $colorclass= "class='evenListRowS1'";
325                 }        
326     
327               if(isset($mrkt_focus->name) && !empty($mrkt_focus->name)){
328                 $mrkt_tbl  .= "<tr $colorclass>";
329                 $mrkt_tbl  .= "<td scope='row' width='40%'><a href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
330                 $mrkt_tbl  .= "&return_id=" .$focus->id. "&campaign_id=" .$focus->id."&record=".$mrkt_focus->id."'>".$mrkt_focus->name."</a></td>";
331                 $mrkt_tbl  .= "<td scope='row' width='25%'>".$mrkt_focus->from_name."</td>";
332                 $mrkt_tbl  .= "<td scope='row' width='15%'>".$mrkt_focus->status."</td>";
333                 $mrkt_tbl  .= "<td scope='row' width='10%'>$test_mrkt_input</td>";
334                 $mrkt_tbl  .= "<td scope='row' width='10%'>$send_mrkt_input</td>";
335                 $mrkt_tbl  .= "</tr>";
336           
337               }
338             }        
339     }else{
340         $mrkt_tbl  .= "<tr><td colspan='3'>".$mod_strings['LBL_NONE']."</td></tr>";   
341     }
342     $mrkt_tbl .= "</table></p>";
343     return $mrkt_tbl ;
344 }
345
346 function create_target_summary  ($focus){
347     global $mod_strings,$app_strings,$app_list_strings;
348     $colorclass = '';
349     $camp_type = $focus->campaign_type;
350
351
352     //create schedule table
353     $pltbl='';
354     //set the title based on campaign type
355     $target_title = $mod_strings['LBL_TARGET_LISTS'];
356     if($camp_type=='NewsLetter'){
357         $target_title = $mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS'];
358     }
359     
360     
361     $focus->load_relationship('prospectlists');
362     $pl_lists = $focus->prospectlists->get();
363
364     $pl_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
365     $pl_tbl .= "<tr class='detail view'><td colspan='4'><h4> ".$target_title." </h4></td></tr>";
366     $pl_tbl .= "<tr class='listViewHRS1'><td width='50%' scope='col'><b>".$mod_strings['LBL_LIST_NAME']."</b></td><td width='30%' scope='col'><b>".$mod_strings['LBL_LIST_TYPE']."</b></td>";
367     $pl_tbl .= "<td width='15%' scope='col'><b>".$mod_strings['LBL_TOTAL_ENTRIES']."</b></td><td width='5%' scope='col'>&nbsp;</td></tr>";
368    
369     if(count($pl_lists)>0){
370
371             
372             $pl_focus = new ProspectList();
373             foreach($pl_lists as $pl_id){
374                 
375              if( $colorclass== "class='evenListRowS1'"){
376                     $colorclass= "class='oddListRowS1'";
377                 }else{ 
378                     $colorclass= "class='evenListRowS1'";
379                 }         
380                                     
381               $pl_focus->retrieve($pl_id);
382               //set the list type if this is a newsletter
383               $type=$pl_focus->list_type;    
384               if($camp_type=='NewsLetter'){ 
385                   if (($pl_focus->list_type == 'default') || ($pl_focus->list_type == 'seed')){$type = $mod_strings['LBL_SUBSCRIPTION_TYPE_NAME'];}
386                   if($pl_focus->list_type == 'exempt'){$type = $mod_strings['LBL_UNSUBSCRIPTION_TYPE_NAME'];}
387                   if($pl_focus->list_type == 'test'){$type = $mod_strings['LBL_TEST_TYPE_NAME'];}
388               }else{
389                 $type = $app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
390               }
391               if(isset($pl_focus->id) && !empty($pl_focus->id)){
392                 $pl_tbl  .= "<tr $colorclass>";
393                 $pl_tbl  .= "<td scope='row' width='50%'><a href='index.php?action=DetailView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
394                 $pl_tbl  .=  $pl_focus->name."</a></td>";
395                 $pl_tbl  .= "<td scope='row' width='30%'>$type</td>";
396                 $pl_tbl  .= "<td scope='row' width='15%'>".$pl_focus->get_entry_count()."</td>";
397                 $pl_tbl  .= "<td scope='row' width='5%' align='right'><a href='index.php?action=EditView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
398                 $pl_tbl  .= SugarThemeRegistry::current()->getImage('edit_inline', 'border=0', null, null, ".gif", $mod_strings['LBL_EDIT_INLINE']) . "</a>&nbsp;";
399
400
401                 $pl_tbl  .= "<a href='index.php?action=DetailView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
402                 $pl_tbl  .= SugarThemeRegistry::current()->getImage('view_inline', 'border=0', null, null, ".gif", $mod_strings['LBL_VIEW_INLINE'])."</a></td>";
403
404
405               }
406             }        
407     }else{
408      $pl_tbl .= "<tr><td class='$colorclass' scope='row' colspan='2'>".$mod_strings['LBL_NONE']."</td></tr>";   
409     }
410
411     $pl_tbl .= "</table></p>";
412     return $pl_tbl;        
413     
414 }
415
416 function create_tracker_summary  ($focus){
417     global $mod_strings,$app_strings;
418     $colorclass = '';
419     $trkr_tbl='';
420     //create tracker table
421     $focus->load_relationship('tracked_urls');
422     $trkr_lists = $focus->tracked_urls->get();
423
424     $trkr_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
425     $trkr_tbl .= "<tr class='detail view'><td colspan='6'><h4> ".$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']." </h4></td></tr>";
426     $trkr_tbl .= "<tr class='listViewHRS1'><td width='15%' scope='col'><b>".$mod_strings['LBL_EDIT_TRACKER_NAME']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_EDIT_TRACKER_URL']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_EDIT_OPT_OUT']."</b></td></tr>";
427     
428     if(count($trkr_lists)>0){
429             
430         foreach($trkr_lists as $trkr_id){
431              if( $colorclass== "class='evenListRowS1'"){
432                     $colorclass= "class='oddListRowS1'";
433                 }else{ 
434                     $colorclass= "class='evenListRowS1'";
435                 }        
436             
437             
438             $ct_focus = new CampaignTracker();
439             $ct_focus->retrieve($trkr_id);
440           if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
441             if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
442             $trkr_tbl  .= "<tr $colorclass>";
443             $trkr_tbl  .= "<td scope='row' ><a href='index.php?action=DetailView&module=CampaignTrackers&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$ct_focus->id."'>";
444             $trkr_tbl  .= $ct_focus->tracker_name."</a></td>";
445             $trkr_tbl  .= "<td scope='row' width='15%'>".$ct_focus->tracker_url."</td>";
446             $trkr_tbl  .= "<td scope='row' width='15%'>&nbsp;&nbsp;<input type='checkbox' class='checkbox' $opt disabled></td>";
447             $trkr_tbl  .= "</tr>";
448           }
449         }
450     }else{
451         $trkr_tbl  .= "<tr ><td colspan='3'>".$mod_strings['LBL_NONE']."</td>";
452     }
453     $trkr_tbl .= "</table></p>";
454     return $trkr_tbl ;
455     
456 }
457
458
459 function create_wiz_menu_items($type,$mrkt_string,$camp_url,$summ_url){
460     global $mod_strings;
461     
462     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignHeader.tpl' : 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
463     $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']]          = file_exists('custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignBudget.tpl' : 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
464     $steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']]      = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTracker.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTracker.tpl' : 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
465     if($type == 'newsletter'){
466         $steps[$mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS']] = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetList.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetList.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetList.tpl';
467     }else{
468         $steps[$mod_strings['LBL_TARGET_LISTS']]                  = file_exists('custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl') ? 'custom/modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl' : 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
469     }    
470
471     $nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >';
472     if(isset($steps)  && !empty($steps)){
473         $i=1;
474         foreach($steps as $name=>$step){
475             $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step$i'><a href='".$camp_url.$i."'>$name</a></div></td></tr>";
476             $i=$i+1;
477         }
478     }
479
480     if($type == 'newsletter'  ||  $type == 'email'){
481         $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
482         $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></td></tr>";
483         $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
484     }else{
485      $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";   
486     }
487     
488     $nav_html .= '</table>';
489   
490     return $nav_html;
491 }
492
493 ?>