]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Campaigns/WizardHome.php
Release 6.4.0
[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-2011 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)){
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     
251     return $cmpgn_tbl ;
252 }
253
254 function create_marketing_summary  ($focus){
255     global $mod_strings,$app_strings;
256     $colorclass = '';
257     
258     //create new marketing button input
259     $new_mrkt_input =  "<input id='wiz_new_mrkt_button' name='SUBMIT' ";  
260     $new_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns';";
261     $new_mrkt_input .= "this.form.module.value='Campaigns';";
262     $new_mrkt_input .= "this.form.record.value='';";
263     $new_mrkt_input .= "this.form.return_module.value='Campaigns';";    
264     $new_mrkt_input .= "this.form.action.value='WizardMarketing';";
265     $new_mrkt_input .= "this.form.return_action.value='WizardHome';";
266     $new_mrkt_input .= "this.form.direct_step.value='1';";
267     $new_mrkt_input .= "this.form.campaign_id.value='".$focus->id."';";
268     $new_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" "; 
269     $new_mrkt_input .= "class='button' value='".$mod_strings['LBL_CREATE_NEW_MARKETING_EMAIL']."' type='submit'>";        
270        
271         //create marketing email table
272     $mrkt_tbl='';
273     
274     $focus->load_relationship('emailmarketing');
275     $mrkt_lists = $focus->emailmarketing->get();
276     
277     
278     $mrkt_tbl = "<p><table  class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
279     $mrkt_tbl .= "<tr class='detail view'><td colspan='3'><h4> ".$mod_strings['LBL_WIZ_MARKETING_TITLE']." </h4></td>" .
280                  "<td colspan=2 align='right'>$new_mrkt_input</td></tr>";
281     $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>";
282     
283     if(count($mrkt_lists)>0){
284     
285             
286             $mrkt_focus = new EmailMarketing();
287             foreach($mrkt_lists as $mrkt_id){
288                 $mrkt_focus->retrieve($mrkt_id);    
289     
290                 //create send test marketing button input
291                 $test_mrkt_input =  "<input id='wiz_new_mrkt_button' name='SUBMIT'  ";  
292                 $test_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns'; ";
293                 $test_mrkt_input .= "this.form.module.value='Campaigns'; ";
294                 $test_mrkt_input .= "this.form.record.value='';";
295                 $test_mrkt_input .= "this.form.return_module.value='Campaigns'; ";    
296                 $test_mrkt_input .= "this.form.action.value='QueueCampaign'; ";
297                 $test_mrkt_input .= "this.form.return_action.value='WizardHome'; ";
298                 $test_mrkt_input .= "this.form.wiz_mass.value='".$mrkt_focus->id."'; ";
299                 $test_mrkt_input .= "this.form.mode.value='test'; ";    
300                 $test_mrkt_input .= "this.form.direct_step.value='1'; ";
301                 $test_mrkt_input .= "this.form.record.value='".$focus->id."'; ";
302                 $test_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" "; 
303                 $test_mrkt_input .= "class='button' value='".$mod_strings['LBL_TEST_BUTTON_LABEL']."' type='submit'>";        
304             
305                 //create send marketing button input
306                 $send_mrkt_input =  "<input id='wiz_new_mrkt_button' name='SUBMIT'  ";  
307                 $send_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns'; ";
308                 $send_mrkt_input .= "this.form.module.value='Campaigns'; ";
309                 $send_mrkt_input .= "this.form.record.value='';";
310                 $send_mrkt_input .= "this.form.return_module.value='Campaigns'; ";    
311                 $send_mrkt_input .= "this.form.action.value='QueueCampaign'; ";
312                 $send_mrkt_input .= "this.form.return_action.value='WizardHome'; ";
313                 $send_mrkt_input .= "this.form.wiz_mass.value='".$mrkt_focus->id."'; ";
314                 $send_mrkt_input .= "this.form.mode.value='send'; ";    
315                 $send_mrkt_input .= "this.form.direct_step.value='1'; ";
316                 $send_mrkt_input .= "this.form.record.value='".$focus->id."'; ";
317                 $send_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" "; 
318                 $send_mrkt_input .= "class='button' value='".$mod_strings['LBL_SEND_EMAIL']."' type='submit'>";        
319             
320     
321     
322              if( $colorclass== "class='evenListRowS1'"){
323                     $colorclass= "class='oddListRowS1'";
324                 }else{ 
325                     $colorclass= "class='evenListRowS1'";
326                 }        
327     
328               if(isset($mrkt_focus->name) && !empty($mrkt_focus->name)){
329                 $mrkt_tbl  .= "<tr $colorclass>";
330                 $mrkt_tbl  .= "<td scope='row' width='40%'><a href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
331                 $mrkt_tbl  .= "&return_id=" .$focus->id. "&campaign_id=" .$focus->id."&record=".$mrkt_focus->id."'>".$mrkt_focus->name."</a></td>";
332                 $mrkt_tbl  .= "<td scope='row' width='25%'>".$mrkt_focus->from_name."</td>";
333                 $mrkt_tbl  .= "<td scope='row' width='15%'>".$mrkt_focus->status."</td>";
334                 $mrkt_tbl  .= "<td scope='row' width='10%'>$test_mrkt_input</td>";
335                 $mrkt_tbl  .= "<td scope='row' width='10%'>$send_mrkt_input</td>";
336                 $mrkt_tbl  .= "</tr>";
337           
338               }
339             }        
340     }else{
341         $mrkt_tbl  .= "<tr><td colspan='3'>".$mod_strings['LBL_NONE']."</td></tr>";   
342     }
343     $mrkt_tbl .= "</table></p>";
344     return $mrkt_tbl ;
345 }
346
347 function create_target_summary  ($focus){
348     global $mod_strings,$app_strings,$app_list_strings;
349     $colorclass = '';
350     $camp_type = $focus->campaign_type;
351
352
353     //create schedule table
354     $pltbl='';
355     //set the title based on campaign type
356     $target_title = $mod_strings['LBL_TARGET_LISTS'];
357     if($camp_type=='NewsLetter'){
358         $target_title = $mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS'];
359     }
360     
361     
362     $focus->load_relationship('prospectlists');
363     $pl_lists = $focus->prospectlists->get();
364
365     $pl_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
366     $pl_tbl .= "<tr class='detail view'><td colspan='4'><h4> ".$target_title." </h4></td></tr>";
367     $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>";
368     $pl_tbl .= "<td width='15%' scope='col'><b>".$mod_strings['LBL_TOTAL_ENTRIES']."</b></td><td width='5%' scope='col'>&nbsp;</td></tr>";
369    
370     if(count($pl_lists)>0){
371
372             
373             $pl_focus = new ProspectList();
374             foreach($pl_lists as $pl_id){
375                 
376              if( $colorclass== "class='evenListRowS1'"){
377                     $colorclass= "class='oddListRowS1'";
378                 }else{ 
379                     $colorclass= "class='evenListRowS1'";
380                 }         
381                                     
382               $pl_focus->retrieve($pl_id);
383               //set the list type if this is a newsletter
384               $type=$pl_focus->list_type;    
385               if($camp_type=='NewsLetter'){ 
386                   if (($pl_focus->list_type == 'default') || ($pl_focus->list_type == 'seed')){$type = $mod_strings['LBL_SUBSCRIPTION_TYPE_NAME'];}
387                   if($pl_focus->list_type == 'exempt'){$type = $mod_strings['LBL_UNSUBSCRIPTION_TYPE_NAME'];}
388                   if($pl_focus->list_type == 'test'){$type = $mod_strings['LBL_TEST_TYPE_NAME'];}
389               }else{
390                 $type = $app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
391               }
392               if(isset($pl_focus->id) && !empty($pl_focus->id)){
393                 $pl_tbl  .= "<tr $colorclass>";
394                 $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."'>";
395                 $pl_tbl  .=  $pl_focus->name."</a></td>";
396                 $pl_tbl  .= "<td scope='row' width='30%'>$type</td>";
397                 $pl_tbl  .= "<td scope='row' width='15%'>".$pl_focus->get_entry_count()."</td>";
398                 $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."'>";
399                 $pl_tbl  .= SugarThemeRegistry::current()->getImage('edit_inline', 'border=0', null, null, ".gif", $mod_strings['LBL_EDIT_INLINE']) . "</a>&nbsp;";
400
401
402                 $pl_tbl  .= "<a href='index.php?action=DetailView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
403                 $pl_tbl  .= SugarThemeRegistry::current()->getImage('view_inline', 'border=0', null, null, ".gif", $mod_strings['LBL_VIEW_INLINE'])."</a></td>";
404
405
406               }
407             }        
408     }else{
409      $pl_tbl .= "<tr><td class='$colorclass' scope='row' colspan='2'>".$mod_strings['LBL_NONE']."</td></tr>";   
410     }
411
412     $pl_tbl .= "</table></p>";
413     return $pl_tbl;        
414     
415 }
416
417 function create_tracker_summary  ($focus){
418     global $mod_strings,$app_strings;
419     $colorclass = '';
420     $trkr_tbl='';
421     //create tracker table
422     $focus->load_relationship('tracked_urls');
423     $trkr_lists = $focus->tracked_urls->get();
424
425     $trkr_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
426     $trkr_tbl .= "<tr class='detail view'><td colspan='6'><h4> ".$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']." </h4></td></tr>";
427     $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>";
428     
429     if(count($trkr_lists)>0){
430             
431         foreach($trkr_lists as $trkr_id){
432              if( $colorclass== "class='evenListRowS1'"){
433                     $colorclass= "class='oddListRowS1'";
434                 }else{ 
435                     $colorclass= "class='evenListRowS1'";
436                 }        
437             
438             
439             $ct_focus = new CampaignTracker();
440             $ct_focus->retrieve($trkr_id);
441           if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
442             if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
443             $trkr_tbl  .= "<tr $colorclass>";
444             $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."'>";
445             $trkr_tbl  .= $ct_focus->tracker_name."</a></td>";
446             $trkr_tbl  .= "<td scope='row' width='15%'>".$ct_focus->tracker_url."</td>";
447             $trkr_tbl  .= "<td scope='row' width='15%'>&nbsp;&nbsp;<input type='checkbox' class='checkbox' $opt disabled></td>";
448             $trkr_tbl  .= "</tr>";
449           }
450         }
451     }else{
452         $trkr_tbl  .= "<tr ><td colspan='3'>".$mod_strings['LBL_NONE']."</td>";
453     }
454     $trkr_tbl .= "</table></p>";
455     return $trkr_tbl ;
456     
457 }
458
459
460 function create_wiz_menu_items($type,$mrkt_string,$camp_url,$summ_url){
461     global $mod_strings;
462     
463     $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';
464     $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';
465     $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';
466     if($type == 'newsletter'){
467         $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';
468     }else{
469         $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';
470     }    
471
472     $nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >';
473     if(isset($steps)  && !empty($steps)){
474         $i=1;
475         foreach($steps as $name=>$step){
476             $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step$i'><a href='".$camp_url.$i."'>$name</a></div></td></tr>";
477             $i=$i+1;
478         }
479     }
480
481     if($type == 'newsletter'  ||  $type == 'email'){
482         $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
483         $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></td></tr>";
484         $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
485     }else{
486      $nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";   
487     }
488     
489     $nav_html .= '</table>';
490   
491     return $nav_html;
492 }
493
494 ?>