} // handle Create $module then Cancel $ss->assign('CAMPAIGN_ID', $campaign_focus->id); $seps = get_number_seperators(); $ss->assign("NUM_GRP_SEP", $seps[0]); $ss->assign("DEC_SEP", $seps[1]); /**************************** MARKETING UI DIV Stuff *******************/ //$campaign_focus->load_relationship('emailmarketing'); //$mrkt_ids = $campaign_focus->emailmarketing->get(); $mrkt_focus = new EmailMarketing(); //if record param exists and it is not empty, then retrieve this bean if (isset($_REQUEST['record']) and !empty($_REQUEST['record'])) { $mrkt_focus->retrieve($_REQUEST['record']); } else { //check to see if this campaign has an email marketing already attached, and if so, create duplicate $campaign_focus->load_relationship('emailmarketing'); $mrkt_lists = $campaign_focus->emailmarketing->get(); if (!empty($mrkt_lists)) { //reverse array so we always use the most recent one: $mrkt_lists = array_reverse($mrkt_lists); $mrkt_focus->retrieve($mrkt_lists[0]); $mrkt_focus->id = ''; $mrkt_focus->name = $mod_strings['LBL_COPY_OF'] . ' ' . $mrkt_focus->name; } } $ss->assign("CALENDAR_LANG", "en"); $ss->assign("USER_DATEFORMAT", '(' . $timedate->get_user_date_format() . ')'); $ss->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format()); $ss->assign("TIME_MERIDIEM", $timedate->AMPMMenu('', $mrkt_focus->time_start)); $ss->assign("MRKT_ID", $mrkt_focus->id); $ss->assign("MRKT_NAME", $mrkt_focus->name);
} //assign the modified dropdown for general campaign creation $ss->assign("CAMPAIGN_TYPE_OPTIONS", $type_option_html); $ss->assign("SHOULD_TYPE_BE_DISABLED", "select"); } elseif ($campaign_type == 'email') { //Assign Email as type of campaign being created an disable the select widget $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_EMAIL']); $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='Email'"); } else { //Assign NewsLetter as type of campaign being created an disable the select widget $ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_NEWSLETTER']); $ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='NewsLetter'"); } /*************** TRACKER UI DIV Stuff ***************/ //retrieve the trackers $focus->load_relationship('tracked_urls'); $trkr_lists = $focus->tracked_urls->get(); $trkr_html = ''; $ss->assign('TRACKER_COUNT', count($trkr_lists)); if (count($trkr_lists) > 0) { global $odd_bg, $even_bg, $hilite_bg; $trkr_count = 0; //create the html to create tracker table foreach ($trkr_lists as $trkr_id) { $ct_focus = new CampaignTracker(); $ct_focus->retrieve($trkr_id); if (isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)) { if ($ct_focus->is_optout) { $opt = 'checked'; } else { $opt = '';
$check_notify = FALSE; } require_once 'include/formbase.php'; $focus = populateFromPost('', $focus); //store preformatted dates for 2nd save $preformat_start_date = $focus->start_date; $preformat_end_date = $focus->end_date; //_ppd($preformat_end_date); $focus->save($check_notify); $return_id = $focus->id; $GLOBALS['log']->debug("Saved record with id of " . $return_id); //copy compaign targets on duplicate if (!empty($_REQUEST['duplicateSave']) && !empty($_REQUEST['duplicateId'])) { $copyFromCompaign = new Campaign(); $copyFromCompaign->retrieve($_REQUEST['duplicateId']); $copyFromCompaign->load_relationship('prospectlists'); $focus->load_relationship('prospectlists'); $target_lists = $copyFromCompaign->prospectlists->get(); if (count($target_lists) > 0) { foreach ($target_lists as $prospect_list_id) { $focus->prospectlists->add($prospect_list_id); } } $focus->save(); } //if type is set to newsletter then make sure there are propsect lists attached if ($focus->campaign_type == 'NewsLetter') { //if this is a duplicate, and the "relate_to" and "relate_id" elements are not cleared out, //then prospect lists will get related to the original campaign on save of the prospect list, and then //will get related to the new newsletter campaign, meaning the same (un)subscription list will belong to //two campaigns, which is wrong