function wpleads_lead_automation_get_fields() { /* New structure */ $automation_fields['automation_if'] = array('label' => __('IF condition', 'leads'), 'id' => 'automation_if', 'position' => 'conditions', 'priority' => 10, 'type' => 'dropdown', 'class' => 'automation_dropdown', 'show' => true, 'tooltip' => __("This condition allows us to set the primary criteria for lead sorting or points awarding.", 'leads'), 'options' => array('page_views_general' => __('Visitor views any page', 'leads'), 'page_views_category_specific' => __('Visitor views category specific page', 'leads'), 'page_conversions_general' => __('Visitor converts on any page', 'leads'), 'page_conversions_category_specific' => __('Visitor converts on category specific page', 'leads'), 'automation_executed' => __('Total number of successful rule matches is at least', 'leads'))); $automation_if_options = apply_filters('automation_if_options', $automation_fields['automation_if']['options']); $automation_fields['condition_count'] = array('label' => __('# Action Requirments', 'leads'), 'id' => 'automation_condition_number', 'position' => 'conditions', 'priority' => 20, 'type' => 'text', 'class' => 'automation_text_input', 'show' => true, 'tooltip' => __("This condition sets the standard that the IF statement above must achieve before a rule is executed.", 'leads'), 'options' => array('page_views_general' => __('Visitor views any page', 'leads'), 'page_views_category_specific' => __('Visitor views category specific page', 'leads'), 'page_conversions_general' => __('Visitor converts on any page', 'leads'), 'page_conversions_category_specific' => __('Visitor converts on category specific page', 'leads'), 'automation_executed' => __('Total number of successful rule matches is at least', 'leads'))); $categories_option_array = automation_get_categories_array(); $automation_fields['condition_category'] = array('label' => __('Category Condition', 'leads'), 'id' => 'automation_condition_category', 'position' => 'conditions', 'priority' => 30, 'type' => 'dropdown', 'class' => 'automation_dropdown', 'show' => false, 'tooltip' => __("When an IF statment requires category specific reader behavior this dropdown helps us target our category of interest.", 'leads'), 'options' => $categories_option_array); $automation_fields['condition_meta_automation_check'] = array('label' => __('Rule Limitation', 'leads'), 'id' => 'automation_condition_automation_check', 'position' => 'actions', 'default' => 'on', 'priority' => 40, 'type' => 'checkbox', 'class' => 'automation_dropdown', 'show' => true, 'tooltip' => __("To protect rule actions from firing multiple times on the same user turn this setting to on.", 'leads'), 'options' => array('on' => __('Only run rule on lead once.', 'leads'))); $list_options = wpleads_get_lead_lists_as_array(); $automation_fields['condition_list_add'] = array('label' => __('Add to List(s)', 'leads'), 'id' => 'automation_condition_list_add', 'position' => 'actions', 'priority' => 50, 'type' => 'checkbox', 'class' => 'automation_dropdown', 'show' => true, 'tooltip' => __("When all rule conditions are met by a lead then sort the lead into these lead lists.", 'leads'), 'options' => $list_options); $automation_fields['condition_list_remove'] = array('label' => __('Remove from List(s)', 'leads'), 'id' => 'automation_condition_list_remove', 'position' => 'actions', 'priority' => 51, 'type' => 'checkbox', 'class' => 'automation_dropdown', 'show' => true, 'tooltip' => __("When all rule conditions are met by a lead then remove the lead out of these lead lists.", 'leads'), 'options' => $list_options); $automation_fields['condition_points'] = array('label' => __('Adjust Lead Score', 'leads'), 'id' => 'automation_condition_points', 'position' => 'actions', 'priority' => 60, 'type' => 'text', 'class' => 'automation_input', 'show' => true, 'tooltip' => __("When all rule conditions are met by a lead then award the user this many points. You may use - symbols before an interger for point removal.", 'leads')); $automation_fields = apply_filters('wpleads_automation_fields', $automation_fields); foreach ($automation_fields as $key => $array) { $automation_array_prioritized[$key] = $array['priority']; } asort($automation_array_prioritized); foreach ($automation_array_prioritized as $key => $value) { $automation_fields_final[$key] = $automation_fields[$key]; } return $automation_fields_final; }
/** * Adds additiona options to bulk edit fields */ public static function register_bulk_edit_fields() { global $post_type; if ($post_type != 'wp-lead') { return; } $lists = wpleads_get_lead_lists_as_array(); $html = "<select id='wordpress_list_select' name='action_wordpress_list_id'>"; foreach ($lists as $id => $label) { $html .= "<option value='" . $id . "'>" . $label . "</option>"; } $html .= "</select>"; ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery('<option>').val('add-to-list').text('<?php _e('Add to Contact List', 'lp'); ?> ').appendTo("select[name='action']"); jQuery('<option>').val('add-to-list').text('<?php _e('Add to Contact List', 'lp'); ?> ').appendTo("select[name='action2']"); jQuery('<option>').val('export-csv').text('<?php _e('Export CSV'); ?> ').appendTo("select[name='action']"); jQuery('<option>').val('export-csv').text('<?php _e('Export CSV'); ?> ').appendTo("select[name='action2']"); jQuery('<option>').val('export-xml').text('<?php _e('Export XML'); ?> ').appendTo("select[name='action']"); jQuery('<option>').val('export-xml').text('<?php _e('Export XML'); ?> ').appendTo("select[name='action2']"); jQuery(document).on('change', 'select[name=action]', function () { var this_id = jQuery(this).val(); if (this_id.indexOf("export-csv") >= 0) { jQuery('#posts-filter').prop('target', '_blank'); } else if (this_id.indexOf("export-xml") >= 0) { jQuery('#posts-filter').prop('target', '_blank'); } else if (this_id.indexOf("add-to-list") >= 0) { var html = "<?php echo $html; ?> "; jQuery("select[name='action']").after(html); } else { jQuery('#posts-filter').prop('target', 'self'); jQuery('#wordpress_list_select').remove(); } }); }); </script> <?php }
} /* * Render */ function wp_lead_dashboard_list() { $admin_url = get_admin_url(); //wplead_list_category /* Get All Lead Lists */ $lead_lists = wpleads_get_lead_lists_as_array(); if (!$lead_lists) { return; } echo "<div id='leads-list'>"; echo "<h4 class='marketing-widget-header'>" . __('Lists', 'leads') . "<span class='toggle-lead-list'>-</span></h4>"; echo "<ul id='lead-ul' class='dashboard-lead-lists'>"; foreach ($lead_lists as $id => $label) { $leads_count[$id]['list_name'] = $label; $leads_count[$id]['count'] = wpleads_count_associated_lead_items($id); } foreach ($leads_count as $lead_id => $lead) { echo '<li>'; echo '<a href="' . $admin_url . 'post.php?post=' . $lead_id . '&action=edit">' . $lead['list_name'] . '</a> <span class="lead-list-count">' . $lead['count'] . '</span>'; echo '</li>';