本文整理汇总了PHP中ProspectList::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP ProspectList::retrieve方法的具体用法?PHP ProspectList::retrieve怎么用?PHP ProspectList::retrieve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProspectList
的用法示例。
在下文中一共展示了ProspectList::retrieve方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_addToProspectList
protected function action_addToProspectList()
{
global $beanList;
require_once 'modules/Relationships/Relationship.php';
require_once 'modules/ProspectLists/ProspectList.php';
$prospectList = new ProspectList();
$prospectList->retrieve($_REQUEST['prospect_id']);
$module = new $beanList[$this->bean->report_module]();
$key = Relationship::retrieve_by_modules($this->bean->report_module, 'ProspectLists', $GLOBALS['db']);
if (!empty($key)) {
$sql = $this->bean->build_report_query();
$result = $this->bean->db->query($sql);
$beans = array();
while ($row = $this->bean->db->fetchByAssoc($result)) {
if (isset($row[$module->table_name . '_id'])) {
$beans[] = $row[$module->table_name . '_id'];
}
}
if (!empty($beans)) {
foreach ($prospectList->field_defs as $field => $def) {
if ($def['type'] == 'link' && !empty($def['relationship']) && $def['relationship'] == $key) {
$prospectList->load_relationship($field);
$prospectList->{$field}->add($beans);
}
}
}
}
die;
}
示例2: action_add_to_list
public function action_add_to_list()
{
$ids = $_POST['subpanel_id'];
$event_id = $_POST['return_id'];
$type = $_POST['pop_up_type'];
if (!is_array($ids)) {
$ids = array($ids);
}
//Target lists. Can incliude contacts, leads and targets as part of the target list
if ($type = 'target_list') {
foreach ($ids as $list) {
$event = new FP_events();
$event->retrieve($event_id);
$event->load_relationship('fp_events_prospects_1');
$event->load_relationship('fp_events_contacts');
$event->load_relationship('fp_events_leads_1');
$target_list = new ProspectList();
$target_list->retrieve($list);
$target_list->load_relationship('prospects');
$target_list->load_relationship('contacts');
$target_list->load_relationship('leads');
//add prospects/targets
foreach ($target_list->prospects->getBeans() as $contact) {
$contact_id_list = $event->fp_events_prospects_1->get();
if (!in_array($contact->id, $contact_id_list)) {
//check if its already related
$event->fp_events_prospects_1->add($contact->id);
}
}
//add contacts
foreach ($target_list->contacts->getBeans() as $contact) {
$contact_id_list = $event->fp_events_contacts->get();
if (!in_array($contact->id, $contact_id_list)) {
$event->fp_events_contacts->add($contact->id);
}
}
//add leads
foreach ($target_list->leads->getBeans() as $contact) {
$contact_id_list = $event->fp_events_leads_1->get();
if (!in_array($contact->id, $contact_id_list)) {
$event->fp_events_leads_1->add($contact->id);
}
}
}
}
//Targets
if ($type = 'targets') {
foreach ($ids as $target) {
$event = new FP_events();
$event->retrieve($event_id);
$event->load_relationship('fp_events_prospects_1');
$contact_id_list = $event->fp_events_prospects_1->get();
//get array of currently linked targets
if (!in_array($target, $contact_id_list)) {
//check if its already in the array
$event->fp_events_prospects_1->add($target);
//if not add relationship
}
}
}
//leads
if ($type = 'leads') {
foreach ($ids as $lead) {
$event = new FP_events();
$event->retrieve($event_id);
$event->load_relationship('fp_events_leads_1');
$contact_id_list = $event->fp_events_leads_1->get();
//get array of currently linked leads
if (!in_array($lead, $contact_id_list)) {
//check if its already in the array
$event->fp_events_leads_1->add($lead);
//if not add relationship
}
}
}
//contacts
if ($type = 'contacts') {
foreach ($ids as $contact) {
$event = new FP_events();
$event->retrieve($event_id);
$event->load_relationship('fp_events_contacts');
$contact_id_list = $event->fp_events_contacts->get();
//get array of currently linked contacts
if (!in_array($contact, $contact_id_list)) {
$event->fp_events_contacts->add($contact);
}
}
}
die;
}
示例3: get_module_title
require_once 'data/Tracker.php';
require_once 'modules/ProspectLists/ProspectList.php';
require_once 'modules/ProspectLists/Forms.php';
global $timedate;
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
// Unimplemented until jscalendar language files are fixed
// global $current_language;
// global $default_language;
// global $cal_codes;
$focus = new ProspectList();
if (isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("Prospect List Edit View");
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
echo "\n</p>\n";
$xtpl = new XTemplate('modules/ProspectLists/EditView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$json = getJSONobj();
/// Users Popup
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
示例4: ProspectList
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings;
$focus = new ProspectList();
$focus->retrieve($_POST['record']);
if (isset($_POST['isDuplicate']) && $_POST['isDuplicate'] == true) {
$focus->id = '';
$focus->name = $mod_strings['LBL_COPY_PREFIX'] . ' ' . $focus->name;
$focus->save();
$return_id = $focus->id;
//duplicate the linked items.
$query = "select * from prospect_lists_prospects where prospect_list_id = '" . $_POST['record'] . "'";
$result = $focus->db->query($query);
if ($result != null) {
while (($row = $focus->db->fetchByAssoc($result)) != null) {
$iquery = "INSERT INTO prospect_lists_prospects (id,prospect_list_id, related_id, related_type,date_modified) ";
$iquery .= "VALUES (" . "'" . create_guid() . "'," . "'" . $focus->id . "'," . "'" . $row['related_id'] . "'," . "'" . $row['related_type'] . "'," . "'" . TimeDate::getInstance()->nowDb() . "')";
$focus->db->query($iquery);
//save the record.
}
示例5: clear_prospect_relationship
public function clear_prospect_relationship($id, $related_id)
{
$prospectList = new ProspectList();
//retrieve the bean and get counts before and after method execution for comparison.
$prospectList->retrieve($id);
$initial_count = (int) $prospectList->get_entry_count();
$prospectList->clear_prospect_relationship($id, $related_id, 'related');
$expected_count = (int) $prospectList->get_entry_count();
$this->assertEquals($initial_count - 1, $expected_count);
}
示例6: foreach
}
} else {
//this is not a newlsetter campaign, so fill in target list table
//create array for javascript, this will help to display the option text, not the value
$dom_txt = ' ';
foreach ($app_list_strings['prospect_list_type_dom'] as $key => $val) {
$dom_txt .= "if(trgt_type_text =='{$key}'){trgt_type_text='{$val}';}";
}
$ss->assign("PL_DOM_STMT", $dom_txt);
$trgt_count = 0;
$trgt_html = ' ';
if (count($prospect_lists) > 0) {
foreach ($prospect_lists as $pl_id) {
//retrieve prospect list
$pl = new ProspectList();
$pl_focus = $pl->retrieve($pl_id);
$trgt_html .= "<div id='existing_trgt" . $trgt_count . "'> <table class='tabDetailViewDL2' width='100%'>";
$trgt_html .= "<td width='25%'> <input id='existing_target_name" . $trgt_count . "' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name" . $trgt_count . "' value='" . $pl_focus->name . "' >" . $pl_focus->name . "</td>";
$trgt_html .= "<td width='25%'><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type" . $trgt_count . "' id='existing_tracker_list_type" . $trgt_count . "' value='" . $pl_focus->list_type . "' >" . $app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
$trgt_html .= "<input type='hidden' name='added_target_id" . $trgt_count . "' id='added_target_id" . $trgt_count . "' value='" . $pl_focus->id . "' ></td>";
$trgt_html .= "<td><a href='#' onclick=\"javascript:remove_existing_target('existing_trgt" . $trgt_count . "','" . $pl_focus->id . "'); \" > ";
$trgt_html .= "<img src='" . SugarThemeRegistry::current()->getImageURL("delete_inline.gif") . "' border='0' alt='rem' align='absmiddle' border='0' height='12' width='12'>" . $mod_strings['LBL_REMOVE'] . "</a></td></tr></table></div>";
$trgt_count = $trgt_count + 1;
}
$trgt_html .= "<div id='no_targets'></div>";
} else {
$trgt_html .= "<div id='no_targets'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>" . $mod_strings['LBL_NONE'] . "</td></tr></table></div>";
}
$ss->assign('EXISTING_TARGETS', $trgt_html);
}
/**************************** WIZARD UI DIV Stuff *******************/
示例7: create_target_summary
function create_target_summary($focus)
{
global $mod_strings, $app_strings, $app_list_strings;
$colorclass = '';
$camp_type = $focus->campaign_type;
//create schedule table
$pltbl = '';
//set the title based on campaign type
$target_title = $mod_strings['LBL_TARGET_LISTS'];
if ($camp_type == 'NewsLetter') {
$target_title = $mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS'];
}
$focus->load_relationship('prospectlists');
$pl_lists = $focus->prospectlists->get();
$pl_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
$pl_tbl .= "<tr class='detail view'><td colspan='4'><h4> " . $target_title . " </h4></td></tr>";
$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>";
$pl_tbl .= "<td width='15%' scope='col'><b>" . $mod_strings['LBL_TOTAL_ENTRIES'] . "</b></td><td width='5%' scope='col'> </td></tr>";
if (count($pl_lists) > 0) {
$pl_focus = new ProspectList();
foreach ($pl_lists as $pl_id) {
if ($colorclass == "class='evenListRowS1'") {
$colorclass = "class='oddListRowS1'";
} else {
$colorclass = "class='evenListRowS1'";
}
$pl_focus->retrieve($pl_id);
//set the list type if this is a newsletter
$type = $pl_focus->list_type;
if ($camp_type == 'NewsLetter') {
if ($pl_focus->list_type == 'default' || $pl_focus->list_type == 'seed') {
$type = $mod_strings['LBL_SUBSCRIPTION_TYPE_NAME'];
}
if ($pl_focus->list_type == 'exempt') {
$type = $mod_strings['LBL_UNSUBSCRIPTION_TYPE_NAME'];
}
if ($pl_focus->list_type == 'test') {
$type = $mod_strings['LBL_TEST_TYPE_NAME'];
}
} else {
$type = $app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
}
if (isset($pl_focus->id) && !empty($pl_focus->id)) {
$pl_tbl .= "<tr {$colorclass}>";
$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 . "'>";
$pl_tbl .= $pl_focus->name . "</a></td>";
$pl_tbl .= "<td scope='row' width='30%'>{$type}</td>";
$pl_tbl .= "<td scope='row' width='15%'>" . $pl_focus->get_entry_count() . "</td>";
$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 . "'>";
$pl_tbl .= SugarThemeRegistry::current()->getImage('edit_inline', 'border=0', null, null, ".gif", $mod_strings['LBL_EDIT_INLINE']) . "</a> ";
$pl_tbl .= "<a href='index.php?action=DetailView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" . $focus->id . "&record=" . $pl_focus->id . "'>";
$pl_tbl .= SugarThemeRegistry::current()->getImage('view_inline', 'border=0', null, null, ".gif", $mod_strings['LBL_VIEW_INLINE']) . "</a></td>";
}
}
} else {
$pl_tbl .= "<tr><td class='{$colorclass}' scope='row' colspan='2'>" . $mod_strings['LBL_NONE'] . "</td></tr>";
}
$pl_tbl .= "</table></p>";
return $pl_tbl;
}
示例8: javascript
$javascript = new javascript();
$javascript->setFormName('wizform');
$javascript->setSugarBean($mrkt_focus);
$javascript->addAllFields('');
echo $javascript->getScript();
/**************************** Final Step UI DIV *******************/
//Grab the prospect list of type default
$default_pl_focus = ' ';
$campaign_focus->load_relationship('prospectlists');
$prospectlists = $campaign_focus->prospectlists->get();
$pl_count = 0;
$pl_lists = 0;
if (!empty($prospectlists)) {
foreach ($prospectlists as $prospect_id) {
$pl_focus = new ProspectList();
$pl_focus->retrieve($prospect_id);
if ($pl_focus->list_type == 'default' || $pl_focus->list_type == 'seed') {
$default_pl_focus = $pl_focus;
// get count of all attached target types
$pl_count = $default_pl_focus->get_entry_count();
}
$pl_lists = $pl_lists + 1;
}
}
//if count is 0, then hide inputs and and print warning message
if ($pl_count == 0) {
if ($pl_lists == 0) {
//print no target list warning
$ss->assign("WARNING_MESSAGE", $mod_strings['LBL_NO_TARGETS_WARNING']);
} else {
//print no entries warning
示例9: process_subscriptions_from_request
function process_subscriptions_from_request($campaign_name)
{
global $mod_strings;
$pl_list = array();
//process default target list
$create_new = true;
$pl_subs = new ProspectList($campaign_name);
if (!empty($_REQUEST['wiz_step3_subscription_list_id'])) {
//if subscription list is specified then attach
$pl_subs->retrieve($_REQUEST['wiz_step3_subscription_list_id']);
//check to see name matches the bean, if not, then the user has chosen to create new bean
if ($pl_subs->name == $_REQUEST['wiz_step3_subscription_name']) {
$pl_list[] = $pl_subs;
$create_new = false;
}
}
//create new bio if one was not retrieved succesfully
if ($create_new) {
//use default name if one has not been specified
$name = $campaign_name . " " . $mod_strings['LBL_SUBSCRIPTION_LIST'];
if (isset($_REQUEST['wiz_step3_subscription_name']) && !empty($_REQUEST['wiz_step3_subscription_name'])) {
$name = $_REQUEST['wiz_step3_subscription_name'];
}
//if subscription list is not specified then create and attach default one
$pl_subs->name = $name;
$pl_subs->list_type = 'default';
$pl_subs->assigned_user_id = $GLOBALS['current_user']->id;
$pl_subs->save();
$pl_list[] = $pl_subs;
}
//process exempt target list
$create_new = true;
$pl_un_subs = new ProspectList();
if (!empty($_REQUEST['wiz_step3_unsubscription_list_id'])) {
//if unsubscription list is specified then attach
$pl_un_subs->retrieve($_REQUEST['wiz_step3_unsubscription_list_id']);
//check to see name matches the bean, if not, then the user has chosen to create new bean
if ($pl_un_subs->name == $_REQUEST['wiz_step3_unsubscription_name']) {
$pl_list[] = $pl_un_subs;
$create_new = false;
}
}
//create new bean if one was not retrieved succesfully
if ($create_new) {
//use default name if one has not been specified
$name = $campaign_name . " " . $mod_strings['LBL_UNSUBSCRIPTION_LIST'];
if (isset($_REQUEST['wiz_step3_unsubscription_name']) && !empty($_REQUEST['wiz_step3_unsubscription_name'])) {
$name = $_REQUEST['wiz_step3_unsubscription_name'];
}
//if unsubscription list is not specified then create and attach default one
$pl_un_subs->name = $name;
$pl_un_subs->list_type = 'exempt';
$pl_un_subs->assigned_user_id = $GLOBALS['current_user']->id;
$pl_un_subs->save();
$pl_list[] = $pl_un_subs;
}
//process test target list
$pl_test = new ProspectList();
$create_new = true;
if (!empty($_REQUEST['wiz_step3_test_list_id'])) {
//if test list is specified then attach
$pl_test->retrieve($_REQUEST['wiz_step3_test_list_id']);
//check to see name matches the bean, if not, then the user has chosen to create new bean
if ($pl_test->name == $_REQUEST['wiz_step3_test_name']) {
$pl_list[] = $pl_test;
$create_new = false;
}
}
//create new bio if one was not retrieved succesfully
if ($create_new) {
//use default name if one has not been specified
$name = $campaign_name . " " . $mod_strings['LBL_TEST_LIST'];
if (isset($_REQUEST['wiz_step3_test_name']) && !empty($_REQUEST['wiz_step3_test_name'])) {
$name = $_REQUEST['wiz_step3_test_name'];
}
//if test list is not specified then create and attach default one
$pl_test->name = $name;
$pl_test->list_type = 'test';
$pl_test->assigned_user_id = $GLOBALS['current_user']->id;
$pl_test->save();
$pl_list[] = $pl_test;
}
return $pl_list;
}
示例10: unsubscribe
function unsubscribe($campaign, $focus) {
$relationship = strtolower($focus->getObjectName()).'s';
//--grab all the list for this campaign id
$pl_qry ="select id, list_type from prospect_lists where id in (select prospect_list_id from prospect_list_campaigns ";
$pl_qry .= "where campaign_id = '$campaign') and deleted = 0 ";
$pl_qry_result = $focus->db->query($pl_qry);
//build the array with list information
$pl_arr = array();
$GLOBALS['log']->debug("In Campaigns Util, about to run query: ".$pl_qry);
while ($row = $focus->db->fetchByAssoc($pl_qry_result)){$pl_arr[] = $row;}
//retrieve lists that this user belongs to
$curr_pl_qry ="select prospect_list_id, related_id from prospect_lists_prospects ";
$curr_pl_qry .="where related_id = '$focus->id' and deleted = 0 ";
$GLOBALS['log']->debug("In Campaigns Util, unsubscribe function about to run query: ".$curr_pl_qry );
$curr_pl_qry_result = $focus->db->query($curr_pl_qry);
//build the array with current user list information
$curr_pl_arr = array();
while ($row = $focus->db->fetchByAssoc($curr_pl_qry_result)){$curr_pl_arr[] = $row;}
//check to see if user is already there in prospect list
$already_here = 'false';
$exempt_id = '';
foreach($curr_pl_arr as $user_list){
foreach($pl_arr as $v){
//if list is exempt list
if($v['list_type'] == 'exempt'){
//save the exempt list id for later use
$exempt_id = $v['id'];
//check to see if user is already in this exempt list
if(in_array($v['id'], $user_list)){
$already_here = 'true';
}
break 2;
}
}
}
//unsubscribe subscripted newsletter
foreach($pl_arr as $subscription_list){
//create a new instance of the prospect list
$exempt_list = new ProspectList();
$exempt_list->retrieve($subscription_list['id']);
$exempt_list->load_relationship($relationship);
//if list type is default, then delete the relationship
//if list type is exempt, then add the relationship to unsubscription list
if($subscription_list['list_type'] == 'exempt') {
$exempt_list->$relationship->add($focus->id);
}elseif($subscription_list['list_type'] == 'default' || $subscription_list['list_type'] == 'test'){
//if list type is default or test, then delete the relationship
//$exempt_list->$relationship->delete($subscription_list['id'],$focus->id);
}
}
if($already_here =='true'){
//do nothing, user is already exempted
}else{
//user is not exempted yet , so add to unsubscription list
$exempt_result = $exempt_list->retrieve($exempt_id);
if($exempt_result == null)
{//error happened while retrieving this list
return;
}
$GLOBALS['log']->debug("In Campaigns Util, loading relationship: ".$relationship);
$exempt_list->load_relationship($relationship);
$exempt_list->$relationship->add($focus->id);
}
}
示例11: Campaign
global $timedate;
global $current_user;
$campaign = new Campaign();
$campaign->retrieve($_REQUEST['record']);
$query = "SELECT prospect_list_id as id FROM prospect_list_campaigns WHERE campaign_id='{$campaign->id}' AND deleted=0";
$fromName = $_REQUEST['from_name'];
$fromEmail = $_REQUEST['from_address'];
$date_start = $_REQUEST['date_start'];
$time_start = $_REQUEST['time_start'];
$template_id = $_REQUEST['email_template'];
$dateval = $timedate->merge_date_time($date_start, $time_start);
$listresult = $campaign->db->query($query);
while ($list = $campaign->db->fetchByAssoc($listresult)) {
$prospect_list = $list['id'];
$focus = new ProspectList();
$focus->retrieve($prospect_list);
$query = "SELECT prospect_id,contact_id,lead_id FROM prospect_lists_prospects WHERE prospect_list_id='{$focus->id}' AND deleted=0";
$result = $focus->db->query($query);
while ($row = $focus->db->fetchByAssoc($result)) {
$prospect_id = $row['prospect_id'];
$contact_id = $row['contact_id'];
$lead_id = $row['lead_id'];
if ($prospect_id != '') {
$moduleName = "Prospects";
$moduleID = $row['prospect_id'];
}
if ($contact_id != '') {
$moduleName = "Contacts";
$moduleID = $row['contact_id'];
}
if ($lead_id != '') {
示例12: ProspectList
********************************************************************************/
$focus = new ProspectList();
$focus->retrieve($_POST['record']);
if (!empty($_POST['assigned_user_id']) && $focus->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) {
$check_notify = TRUE;
} else {
$check_notify = FALSE;
}
require_once 'include/formbase.php';
$focus = populateFromPost('', $focus);
$focus->save($check_notify);
$return_id = $focus->id;
//Bug 33675 Duplicate target list
if (!empty($_REQUEST['duplicateId'])) {
$copyFromProspectList = new ProspectList();
$copyFromProspectList->retrieve($_REQUEST['duplicateId']);
$relations = $copyFromProspectList->retrieve_relationships('prospect_lists_prospects', array('prospect_list_id' => $_REQUEST['duplicateId']), 'related_id, related_type');
if (count($relations) > 0) {
foreach ($relations as $rel) {
$rel['prospect_list_id'] = $return_id;
$focus->set_relationship('prospect_lists_prospects', $rel, true);
}
}
$focus->save();
}
if (isset($_POST['return_module']) && $_POST['return_module'] != "") {
$return_module = $_POST['return_module'];
} else {
$return_module = "ProspectLists";
}
if (isset($_POST['return_action']) && $_POST['return_action'] != "") {
示例13: track_campaign_prospects
function track_campaign_prospects($focus)
{
global $mod_strings;
//load target list relationships
$focus->load_relationship('prospectlists');
$target_lists = $focus->prospectlists->get();
$prospect_lists = array();
//retrieve the default target list if it exists
foreach ($target_lists as $list) {
//create subscription list
$p_list = new ProspectList();
$p_list->retrieve($list);
if ($p_list->list_type == 'default') {
$prospect_lists[] = $p_list;
}
}
//list does not exist, send back error message
if (count($prospect_lists) == 0) {
return $mod_strings['LBL_DEFAULT_LIST_NOT_FOUND'];
}
//iterate through each Prospect list and make sure entries exist.
$entry_count = 0;
foreach ($prospect_lists as $default_target_list) {
$entry_count = $entry_count + $default_target_list->get_entry_count();
}
//if no entries exist, then return error message.
if ($entry_count == 0) {
return $mod_strings['LBL_DEFAULT_LIST_ENTRIES_NOT_FOUND'];
}
//iterate through each member of list and enter campaign log
foreach ($prospect_lists as $default_target_list) {
//process targets/prospects
$rel_bean = new Prospect();
create_campaign_log_entry($focus->id, $default_target_list, 'prospects', $rel_bean);
//process users
$rel_bean = new User();
create_campaign_log_entry($focus->id, $default_target_list, 'users', $rel_bean);
//process contacts
$rel_bean = new Contact();
create_campaign_log_entry($focus->id, $default_target_list, 'contacts', $rel_bean);
//process leads
$rel_bean = new Lead();
create_campaign_log_entry($focus->id, $default_target_list, 'leads', $rel_bean);
//process accounts
$rel_bean = new Account();
create_campaign_log_entry($focus->id, $default_target_list, 'accounts', $rel_bean);
}
//return success message
return $mod_strings['LBL_DEFAULT_LIST_ENTRIES_WERE_PROCESSED'];
}