Exemplo n.º 1
0
     //if param is set to "addcampaignlog", then we need to create a campaign log entry
     //for each campaign id passed in.
     //get list of campaign's selected'
     if (isset($_REQUEST['subpanel_id']) && !empty($_REQUEST['subpanel_id'])) {
         $campaign_ids = $_REQUEST['subpanel_id'];
         global $beanFiles;
         global $beanList;
         //retrieve current bean
         $bean_name = $beanList[$_REQUEST['module']];
         require_once $beanFiles[$bean_name];
         $focus = new $bean_name();
         $focus->retrieve($_REQUEST['record']);
         require_once 'modules/Campaigns/utils.php';
         //call util function to create the campaign log entry
         foreach ($campaign_ids as $id) {
             create_campaign_log_entry($id, $focus, $focus->module_dir, $focus, $focus->id);
         }
         $refreshsubpanel = true;
     }
 } else {
     global $beanFiles, $beanList;
     $bean_name = $beanList[$_REQUEST['module']];
     require_once $beanFiles[$bean_name];
     $focus = new $bean_name();
     $focus->retrieve($_REQUEST['record']);
     // If the user selected "All records" from the selection menu, we pull up the list
     // based on the query they used on that popup to relate them to the parent record
     if (!empty($_REQUEST['select_entire_list']) && $_REQUEST['select_entire_list'] != 'undefined' && isset($_REQUEST['current_query_by_page'])) {
         $order_by = '';
         $current_query_by_page = $_REQUEST['current_query_by_page'];
         $current_query_by_page_array = unserialize(base64_decode($current_query_by_page));
Exemplo n.º 2
0
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'];
}