当前位置: 首页>>代码示例>>PHP>>正文


PHP RGFormsModel::delete_leads_by_form方法代码示例

本文整理汇总了PHP中RGFormsModel::delete_leads_by_form方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::delete_leads_by_form方法的具体用法?PHP RGFormsModel::delete_leads_by_form怎么用?PHP RGFormsModel::delete_leads_by_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::delete_leads_by_form方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: leads_page


//.........这里部分代码省略.........
                        RGFormsModel::update_leads_property($leads, 'status', 'active');
                        $update_message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
                        break;
                    case 'spam':
                        RGFormsModel::update_leads_property($leads, 'status', 'spam');
                        $update_message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
                        break;
                    case 'mark_read':
                        RGFormsModel::update_leads_property($leads, 'is_read', 1);
                        $update_message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
                        break;
                    case 'mark_unread':
                        RGFormsModel::update_leads_property($leads, 'is_read', 0);
                        $update_message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
                        break;
                    case 'add_star':
                        RGFormsModel::update_leads_property($leads, 'is_starred', 1);
                        $update_message = sprintf(esc_html__('%s starred.', 'gravityforms'), $entry_count);
                        break;
                    case 'remove_star':
                        RGFormsModel::update_leads_property($leads, 'is_starred', 0);
                        $update_message = sprintf(esc_html__('%s unstarred.', 'gravityforms'), $entry_count);
                        break;
                }
                break;
            case 'change_columns':
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $columns = GFCommon::json_decode(stripslashes($_POST['grid_columns']), true);
                RGFormsModel::update_grid_column_meta($form_id, $columns);
                break;
        }
        if (rgpost('button_delete_permanently')) {
            if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                RGFormsModel::delete_leads_by_form($form_id, $filter);
            }
        }
        $sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
        $sort_direction = empty($_GET['dir']) ? 'DESC' : $_GET['dir'];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta['type'] == 'number';
        $page_size = gf_apply_filters('gform_entry_page_size', $form_id, 20, $form_id);
        $first_item_index = $page_index * $page_size;
        if (!empty($sort_field)) {
            $sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
        } else {
            $sorting = array();
        }
        $paging = array('offset' => $first_item_index, 'page_size' => $page_size);
        $total_count = 0;
        $leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging, $total_count);
        $summary = RGFormsModel::get_form_counts($form_id);
        $active_lead_count = $summary['total'];
        $unread_count = $summary['unread'];
        $starred_count = $summary['starred'];
        $spam_count = $summary['spam'];
        $trash_count = $summary['trash'];
        $columns = RGFormsModel::get_grid_columns($form_id, true);
        $search_qs = empty($search) ? '' : '&s=' . esc_attr(urlencode($search));
        $sort_qs = empty($sort_field) ? '' : '&sort=' . esc_attr($sort_field);
        $dir_qs = empty($sort_direction) ? '' : '&dir=' . esc_attr($sort_direction);
        $star_qs = $star !== null ? '&star=' . esc_attr($star) : '';
        $read_qs = $read !== null ? '&read=' . esc_attr($read) : '';
        $filter_qs = '&filter=' . esc_attr($filter);
        $search_field_id_qs = !isset($_GET['field_id']) ? '' : '&field_id=' . esc_attr($search_field_id);
        $search_operator_urlencoded = urlencode($search_operator);
        $search_operator_qs = empty($search_operator_urlencoded) ? '' : '&operator=' . esc_attr($search_operator_urlencoded);
开发者ID:kidaak,项目名称:gravityforms,代码行数:67,代码来源:entry_list.php

示例2: leads_page

    public static function leads_page($form_id)
    {
        global $wpdb;
        //quit if version of wp is not supported
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $action = RGForms::post("action");
        $filter = rgget("filter");
        $search = rgget("s");
        $page_index = empty($_GET["paged"]) ? 0 : intval($_GET["paged"]) - 1;
        $star = $filter == "star" ? 1 : null;
        // is_numeric(RGForms::get("star")) ? intval(RGForms::get("star")) : null;
        $read = $filter == "unread" ? 0 : null;
        //is_numeric(RGForms::get("read")) ? intval(RGForms::get("read")) : null;
        $status = in_array($filter, array("trash", "spam")) ? $filter : "active";
        $update_message = "";
        switch ($action) {
            case "delete":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $lead_id = $_POST["action_argument"];
                RGFormsModel::delete_lead($lead_id);
                $update_message = __("Entry deleted.", "gravityforms");
                break;
            case "bulk":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $bulk_action = !empty($_POST["bulk_action"]) ? $_POST["bulk_action"] : $_POST["bulk_action2"];
                $select_all = rgpost("all_entries");
                $leads = empty($select_all) ? $_POST["lead"] : GFFormsModel::get_lead_ids($form_id, $search, $star, $read, null, null, $status);
                $entry_count = count($leads) > 1 ? sprintf(__("%d entries", "gravityforms"), count($leads)) : __("1 entry", "gravityforms");
                switch ($bulk_action) {
                    case "delete":
                        RGFormsModel::delete_leads($leads);
                        $update_message = sprintf(__("%s deleted.", "gravityforms"), $entry_count);
                        break;
                    case "trash":
                        RGFormsModel::update_leads_property($leads, "status", "trash");
                        $update_message = sprintf(__("%s moved to Trash.", "gravityforms"), $entry_count);
                        break;
                    case "restore":
                        RGFormsModel::update_leads_property($leads, "status", "active");
                        $update_message = sprintf(__("%s restored from the Trash.", "gravityforms"), $entry_count);
                        break;
                    case "unspam":
                        RGFormsModel::update_leads_property($leads, "status", "active");
                        $update_message = sprintf(__("%s restored from the spam.", "gravityforms"), $entry_count);
                        break;
                    case "spam":
                        RGFormsModel::update_leads_property($leads, "status", "spam");
                        $update_message = sprintf(__("%s marked as spam.", "gravityforms"), $entry_count);
                        break;
                    case "mark_read":
                        RGFormsModel::update_leads_property($leads, "is_read", 1);
                        $update_message = sprintf(__("%s marked as read.", "gravityforms"), $entry_count);
                        break;
                    case "mark_unread":
                        RGFormsModel::update_leads_property($leads, "is_read", 0);
                        $update_message = sprintf(__("%s marked as unread.", "gravityforms"), $entry_count);
                        break;
                    case "add_star":
                        RGFormsModel::update_leads_property($leads, "is_starred", 1);
                        $update_message = sprintf(__("%s starred.", "gravityforms"), $entry_count);
                        break;
                    case "remove_star":
                        RGFormsModel::update_leads_property($leads, "is_starred", 0);
                        $update_message = sprintf(__("%s unstarred.", "gravityforms"), $entry_count);
                        break;
                }
                break;
            case "change_columns":
                check_admin_referer('gforms_entry_list', 'gforms_entry_list');
                $columns = GFCommon::json_decode(stripslashes($_POST["grid_columns"]), true);
                RGFormsModel::update_grid_column_meta($form_id, $columns);
                break;
        }
        if (rgpost("button_delete_permanently")) {
            RGFormsModel::delete_leads_by_form($form_id, $filter);
        }
        $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
        $sort_direction = empty($_GET["dir"]) ? "DESC" : $_GET["dir"];
        $form = RGFormsModel::get_form_meta($form_id);
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta["type"] == "number";
        $page_size = apply_filters("gform_entry_page_size", apply_filters("gform_entry_page_size_{$form_id}", 20, $form_id), $form_id);
        $first_item_index = $page_index * $page_size;
        $leads = RGFormsModel::get_leads($form_id, $sort_field, $sort_direction, $search, $first_item_index, $page_size, $star, $read, $is_numeric, null, null, $status);
        $lead_count = RGFormsModel::get_lead_count($form_id, $search, $star, $read, null, null, $status);
        $summary = RGFormsModel::get_form_counts($form_id);
        $active_lead_count = $summary["total"];
        $unread_count = $summary["unread"];
        $starred_count = $summary["starred"];
        $spam_count = $summary["spam"];
        $trash_count = $summary["trash"];
        $columns = RGFormsModel::get_grid_columns($form_id, true);
        $search_qs = empty($search) ? "" : "&s=" . urlencode($search);
        $sort_qs = empty($sort_field) ? "" : "&sort={$sort_field}";
        $dir_qs = empty($sort_field) ? "" : "&dir={$sort_direction}";
        $star_qs = $star !== null ? "&star={$star}" : "";
        $read_qs = $read !== null ? "&read={$read}" : "";
//.........这里部分代码省略.........
开发者ID:nikibrown,项目名称:2014-Nerd-presentation,代码行数:101,代码来源:entry_list.php

示例3: process_action

 /**
  * Processes a bulk or single action.
  */
 function process_action()
 {
     $single_action = rgpost('single_action');
     $bulk_action = $this->current_action();
     $delete_permanently = (bool) rgpost('button_delete_permanently');
     if (!($single_action || $bulk_action || $delete_permanently)) {
         return;
     }
     check_admin_referer('gforms_entry_list', 'gforms_entry_list');
     $form_id = $this->get_form_id();
     if ($delete_permanently) {
         if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
             RGFormsModel::delete_leads_by_form($form_id, $this->filter);
         }
         return;
     }
     if ($single_action) {
         $entry_id = rgpost('single_action_argument');
         switch ($single_action) {
             case 'delete':
                 if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                     RGFormsModel::delete_lead($entry_id);
                     $message = esc_html__('Entry deleted.', 'gravityforms');
                 } else {
                     $message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
                 }
                 break;
             case 'change_columns':
                 $columns = GFCommon::json_decode(stripslashes($_POST['grid_columns']), true);
                 RGFormsModel::update_grid_column_meta($form_id, $columns);
                 $this->set_columns();
                 break;
         }
     } elseif ($bulk_action) {
         $select_all = rgpost('all_entries');
         $search_criteria = $this->get_search_criteria();
         $entries = empty($select_all) ? $_POST['entry'] : GFFormsModel::search_lead_ids($form_id, $search_criteria);
         $entry_count = count($entries) > 1 ? sprintf(esc_html__('%d entries', 'gravityforms'), count($entries)) : esc_html__('1 entry', 'gravityforms');
         switch ($bulk_action) {
             case 'delete':
                 if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                     RGFormsModel::delete_leads($entries);
                     $message = sprintf(esc_html__('%s deleted.', 'gravityforms'), $entry_count);
                 } else {
                     $message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
                 }
                 break;
             case 'trash':
                 RGFormsModel::update_leads_property($entries, 'status', 'trash');
                 $message = sprintf(esc_html__('%s moved to Trash.', 'gravityforms'), $entry_count);
                 break;
             case 'restore':
                 RGFormsModel::update_leads_property($entries, 'status', 'active');
                 $message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count);
                 break;
             case 'unspam':
                 RGFormsModel::update_leads_property($entries, 'status', 'active');
                 $message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
                 break;
             case 'spam':
                 RGFormsModel::update_leads_property($entries, 'status', 'spam');
                 $message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
                 break;
             case 'mark_read':
                 RGFormsModel::update_leads_property($entries, 'is_read', 1);
                 $message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
                 break;
             case 'mark_unread':
                 RGFormsModel::update_leads_property($entries, 'is_read', 0);
                 $message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
                 break;
             case 'add_star':
                 RGFormsModel::update_leads_property($entries, 'is_starred', 1);
                 $message = sprintf(esc_html__('%s starred.', 'gravityforms'), $entry_count);
                 break;
             case 'remove_star':
                 RGFormsModel::update_leads_property($entries, 'is_starred', 0);
                 $message = sprintf(esc_html__('%s unstarred.', 'gravityforms'), $entry_count);
                 break;
         }
     }
     if (!empty($message)) {
         echo '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>';
     }
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:88,代码来源:entry_list.php

示例4: form_list_page

    public static function form_list_page()
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $action = RGForms::post("action");
        $bulk_action = RGForms::post("bulk_action");
        $bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
        if ($action == "delete") {
            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
            $form_id = RGForms::post("action_argument");
            RGFormsModel::delete_form($form_id);
        } else {
            if ($action == "duplicate") {
                check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                $form_id = RGForms::post("action_argument");
                RGFormsModel::duplicate_form($form_id);
            } else {
                if ($bulk_action == "delete") {
                    check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                    $form_ids = RGForms::post("form");
                    RGFormsModel::delete_forms($form_ids);
                } else {
                    if ($bulk_action == "reset_views") {
                        check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                        $form_ids = RGForms::post("form");
                        foreach ($form_ids as $form_id) {
                            RGFormsModel::delete_views($form_id);
                        }
                    } else {
                        if ($bulk_action == "delete_entries") {
                            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                            $form_ids = RGForms::post("form");
                            foreach ($form_ids as $form_id) {
                                RGFormsModel::delete_leads_by_form($form_id);
                            }
                        }
                    }
                }
            }
        }
        $active = RGForms::get("active") == "" ? null : RGForms::get("active");
        $forms = RGFormsModel::get_forms($active, "title");
        $form_count = RGFormsModel::get_form_count();
        ?>
        <script>
            function DeleteForm(form_id){
                jQuery("#action_argument").val(form_id);
                jQuery("#action").val("delete");
                jQuery("#forms_form")[0].submit();
            }

            function DuplicateForm(form_id){
                jQuery("#action_argument").val(form_id);
                jQuery("#action").val("duplicate");
                jQuery("#forms_form")[0].submit();
            }

            function ToggleActive(img, form_id){
                var is_active = img.src.indexOf("active1.png") >=0
                if(is_active){
                    img.src = img.src.replace("active1.png", "active0.png");
                    jQuery(img).attr('title','<?php 
        _e("Inactive", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Inactive", "gravityforms");
        ?>
');
                }
                else{
                    img.src = img.src.replace("active0.png", "active1.png");
                    jQuery(img).attr('title','<?php 
        _e("Active", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Active", "gravityforms");
        ?>
');
                }

                UpdateCount("active_count", is_active ? -1 : 1);
                UpdateCount("inactive_count", is_active ? 1 : -1);

                var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
" );
                mysack.execute = 1;
                mysack.method = 'POST';
                mysack.setVar( "action", "rg_update_form_active" );
                mysack.setVar( "rg_update_form_active", "<?php 
        echo wp_create_nonce("rg_update_form_active");
        ?>
" );
                mysack.setVar( "form_id", form_id);
                mysack.setVar( "is_active", is_active ? 0 : 1);
                mysack.encVar( "cookie", document.cookie, false );
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:form_list.php

示例5: form_list_page

    public static function form_list_page()
    {
        global $wpdb;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $action = RGForms::post("action");
        $bulk_action = RGForms::post("bulk_action");
        $bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
        if ($action == "delete") {
            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
            $form_id = RGForms::post("action_argument");
            RGFormsModel::delete_form($form_id);
            $message = __('Form deleted.', 'gravityforms');
        } else {
            if ($action == "duplicate") {
                check_admin_referer('gforms_update_forms', 'gforms_update_forms');
                $form_id = RGForms::post("action_argument");
                RGFormsModel::duplicate_form($form_id);
                $message = __('Form duplicated.', 'gravityforms');
            }
        }
        if ($bulk_action) {
            check_admin_referer('gforms_update_forms', 'gforms_update_forms');
            $form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
            $form_count = count($form_ids);
            switch ($bulk_action) {
                case 'delete':
                    RGFormsModel::delete_forms($form_ids);
                    $message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
                    break;
                case 'reset_views':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::delete_views($form_id);
                    }
                    $message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
                    break;
                case 'delete_entries':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::delete_leads_by_form($form_id);
                    }
                    $message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
                    break;
                case 'activate':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::update_form_active($form_id, 1);
                    }
                    $message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
                    break;
                case 'deactivate':
                    foreach ($form_ids as $form_id) {
                        RGFormsModel::update_form_active($form_id, 0);
                    }
                    $message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
                    break;
            }
            if (isset($message)) {
                $message = sprintf($message, $form_count);
            }
        }
        $active = RGForms::get("active") == "" ? null : RGForms::get("active");
        $forms = RGFormsModel::get_forms($active, "title");
        $form_count = RGFormsModel::get_form_count();
        // - new form modal - //
        wp_print_styles(array('thickbox'));
        ?>

        <script type="text/javascript" src="<?php 
        echo GFCommon::get_base_url() . '/js/form_admin.js';
        ?>
"></script>
        <script type="text/javascript">

            jQuery(document).ready(function($) {

                <?php 
        if (rgget('page') == 'gf_new_form') {
            ?>
                loadNewFormModal();
                <?php 
        }
        ?>

                $('.gf_form_action_has_submenu').hover(function(){
                    var l = jQuery(this).offset().left;
                    jQuery(this).find('.gf_submenu')
                        .toggle()
                        .offset({ left: l });
                }, function(){
                    jQuery(this).find('.gf_submenu').hide();
                });


            });

            function loadNewFormModal() {
                resetNewFormModal();
                tb_show('<?php 
        _e('Create a New Form', 'gravityforms');
//.........这里部分代码省略.........
开发者ID:kmzdn,项目名称:bootstrap,代码行数:101,代码来源:form_list.php


注:本文中的RGFormsModel::delete_leads_by_form方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。