quote($campaign_id)."'"); $where = ""; foreach($where_clauses as $clause) { if($where != "") $where .= " and "; $where .= $clause; } $GLOBALS['log']->info("Here is the where clause for the list view: $where"); } $ListView = new ListView(); $ListView->initNewXTemplate('modules/Campaigns/Schedule.html',$current_module_strings); if ($test) { $ListView->xTemplateAssign("SCHEDULE_MESSAGE_HEADER",$current_module_strings['LBL_SCHEDULE_MESSAGE_TEST']); } else { $ListView->xTemplateAssign("SCHEDULE_MESSAGE_HEADER",$current_module_strings['LBL_SCHEDULE_MESSAGE_EMAILS']); } //force multi-select popup $ListView->process_for_popups=true; $ListView->multi_select_popup=true; //end $ListView->mergeduplicates = false; $ListView->show_export_button = false; $ListView->show_select_menu = false; $ListView->show_delete_button = false; $ListView->setDisplayHeaderAndFooter(false); $ListView->xTemplateAssign("RETURN_MODULE",$_POST['return_module']); $ListView->xTemplateAssign("RETURN_ACTION",$_POST['return_action']); $ListView->xTemplateAssign("RETURN_ID",$_POST['record']); $ListView->setHeaderTitle($current_module_strings['LBL_LIST_FORM_TITLE']); $ListView->setQuery($where, "", "name", "EMAILMARKETING"); if ($test) { $ListView->xTemplateAssign("MODE",$_POST['mode']); //finds all marketing messages that have an association with prospect list of the test. //this query can be siplified using sub-selects. $query="select distinct email_marketing.id email_marketing_id from email_marketing "; $query.=" inner join email_marketing_prospect_lists empl on empl.email_marketing_id = email_marketing.id "; $query.=" inner join prospect_lists on prospect_lists.id = empl.prospect_list_id "; $query.=" inner join prospect_list_campaigns plc on plc.prospect_list_id = empl.prospect_list_id "; $query.=" where empl.deleted=0 "; $query.=" and prospect_lists.deleted=0 "; $query.=" and prospect_lists.list_type='test' "; $query.=" and plc.deleted=0 "; $query.=" and plc.campaign_id='$campaign_id'"; $query.=" and email_marketing.campaign_id='$campaign_id'"; $query.=" and email_marketing.deleted=0 "; $query.=" and email_marketing.all_prospect_lists=0 "; $seed=array(); $result=$focus->db->query($query); while(($row=$focus->db->fetchByAssoc($result)) != null) { $bean = new EmailMarketing(); $bean->retrieve($row['email_marketing_id']); $bean->mode='test'; $seed[]=$bean; } $query=" select email_marketing.id email_marketing_id from email_marketing "; $query.=" WHERE email_marketing.campaign_id='$campaign_id'"; $query.=" and email_marketing.deleted=0 "; $query.=" and email_marketing.all_prospect_lists=1 "; $result=$focus->db->query($query); while(($row=$focus->db->fetchByAssoc($result)) != null) { $bean = new EmailMarketing(); $bean->retrieve($row['email_marketing_id']); $bean->mode='test'; $seed[]=$bean; } $ListView->processListView($seed, "main", "EMAILMARKETING"); } else { $ListView->processListView($focus, "main", "EMAILMARKETING"); } ?>