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


PHP GFEntryList::get_filter_links方法代码示例

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


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

示例1: lead_detail_page

    public static function lead_detail_page()
    {
        global $current_user;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $form = RGFormsModel::get_form_meta(absint($_GET['id']));
        $form_id = absint($form['id']);
        $form = gf_apply_filters(array('gform_admin_pre_render', $form_id), $form);
        $lead_id = rgpost('entry_id') ? absint(rgpost('entry_id')) : absint(rgget('lid'));
        $filter = rgget('filter');
        $status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
        $position = rgget('pos') ? rgget('pos') : 0;
        $sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
        $sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta['type'] == 'number';
        $search_criteria['status'] = $status;
        require_once 'entry_list.php';
        $filter_links = GFEntryList::get_filter_links($form, false);
        foreach ($filter_links as $filter_link) {
            if ($filter == $filter_link['id']) {
                $search_criteria['field_filters'] = $filter_link['field_filters'];
                break;
            }
        }
        $search_field_id = rgget('field_id');
        if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
            $key = $search_field_id;
            $val = rgget('s');
            $strpos_row_key = strpos($search_field_id, '|');
            if ($strpos_row_key !== false) {
                //multi-row likert
                $key_array = explode('|', $search_field_id);
                $key = $key_array[0];
                $val = $key_array[1] . ':' . $val;
            }
            $search_criteria['field_filters'][] = array('key' => $key, 'operator' => rgempty('operator', $_GET) ? 'is' : rgget('operator'), 'value' => $val);
            $type = rgget('type');
            if (empty($type)) {
                if (rgget('field_id') == '0') {
                    $search_criteria['type'] = 'global';
                }
            }
        }
        /**
         * Allow the entry list search criteria to be overridden.
         *
         * @since  1.9.14.30
         *
         * @param array $search_criteria An array containing the search criteria.
         * @param int $form_id The ID of the current form.
         */
        $search_criteria = gf_apply_filters(array('gform_search_criteria_entry_list', $form_id), $search_criteria, $form_id);
        $paging = array('offset' => $position, 'page_size' => 1);
        if (!empty($sort_field)) {
            $sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
        } else {
            $sorting = array();
        }
        $total_count = 0;
        $leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
        $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
        $next_pos = !rgblank($position) && $position < $total_count - 1 ? $position + 1 : false;
        // unread filter requires special handling for pagination since entries are filter out of the query as they are read
        if ($filter == 'unread') {
            $next_pos = $position;
            if ($next_pos + 1 == $total_count) {
                $next_pos = false;
            }
        }
        if (!$lead_id) {
            $lead = !empty($leads) ? $leads[0] : false;
        } else {
            $lead = GFAPI::get_entry($lead_id);
        }
        if (!$lead) {
            esc_html_e("Oops! We couldn't find your entry. Please try again", 'gravityforms');
            return;
        }
        RGFormsModel::update_lead_property($lead['id'], 'is_read', 1);
        switch (RGForms::post('action')) {
            case 'update':
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                //Loading files that have been uploaded to temp folder
                $files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
                if (!is_array($files)) {
                    $files = array();
                }
                $original_entry = $lead;
                GFFormsModel::$uploaded_files[$form_id] = $files;
                GFFormsModel::save_lead($form, $lead);
                /**
                 * Fires after the Entry is updated from the entry detail page.
                 *
                 * @param array $form The form object for the entry.
                 * @param integer $lead['id'] The entry ID.
                 * @param array $original_entry The entry object before being updated.
                 */
//.........这里部分代码省略.........
开发者ID:slavic18,项目名称:cats,代码行数:101,代码来源:entry_detail.php

示例2: get_current_entry

 public static function get_current_entry()
 {
     if (isset(self::$_entry)) {
         return self::$_entry;
     }
     $form = self::get_current_form();
     $form_id = absint($form['id']);
     $lead_id = rgpost('entry_id') ? absint(rgpost('entry_id')) : absint(rgget('lid'));
     $filter = rgget('filter');
     $status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
     $position = rgget('pos') ? rgget('pos') : 0;
     $sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
     $sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
     $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
     $is_numeric = $sort_field_meta['type'] == 'number';
     $search_criteria['status'] = $status;
     require_once 'entry_list.php';
     $filter_links = GFEntryList::get_filter_links($form, false);
     foreach ($filter_links as $filter_link) {
         if ($filter == $filter_link['id']) {
             $search_criteria['field_filters'] = $filter_link['field_filters'];
             break;
         }
     }
     $search_field_id = rgget('field_id');
     if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
         $key = $search_field_id;
         $val = rgget('s');
         $strpos_row_key = strpos($search_field_id, '|');
         if ($strpos_row_key !== false) {
             //multi-row likert
             $key_array = explode('|', $search_field_id);
             $key = $key_array[0];
             $val = $key_array[1] . ':' . $val;
         }
         $search_criteria['field_filters'][] = array('key' => $key, 'operator' => rgempty('operator', $_GET) ? 'is' : rgget('operator'), 'value' => $val);
         $type = rgget('type');
         if (empty($type)) {
             if (rgget('field_id') == '0') {
                 $search_criteria['type'] = 'global';
             }
         }
     }
     /**
      * Allow the entry list search criteria to be overridden.
      *
      * @since  1.9.14.30
      *
      * @param array $search_criteria An array containing the search criteria.
      * @param int $form_id The ID of the current form.
      */
     $search_criteria = gf_apply_filters(array('gform_search_criteria_entry_list', $form_id), $search_criteria, $form_id);
     $paging = array('offset' => $position, 'page_size' => 1);
     if (!empty($sort_field)) {
         $sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
     } else {
         $sorting = array();
     }
     $leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, self::$_total_count);
     if (!$lead_id) {
         $lead = !empty($leads) ? $leads[0] : false;
     } else {
         $lead = GFAPI::get_entry($lead_id);
     }
     self::set_current_entry($lead);
     return $lead;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:67,代码来源:entry_detail.php

示例3: update_lead_status

 /**
  * Updates the entry status
  *
  * Called via AJAX
  * Passes data off to either RGFormsModel::update_lead_property or RGFormsModel::delete_lead
  *
  * @access public
  * @static
  * @see RGFormsModel::update_lead_property
  * @see RGFormsModel::delete_lead
  */
 public static function update_lead_status()
 {
     check_ajax_referer('gf_delete_entry');
     $status = rgpost('status');
     $lead_id = rgpost('entry');
     $entry = GFAPI::get_entry($lead_id);
     $form = GFAPI::get_form($entry['form_id']);
     switch ($status) {
         case 'unspam':
             RGFormsModel::update_lead_property($lead_id, 'status', 'active');
             break;
         case 'delete':
             if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
                 RGFormsModel::delete_lead($lead_id);
             }
             break;
         default:
             RGFormsModel::update_lead_property($lead_id, 'status', $status);
             break;
     }
     require_once 'entry_list.php';
     $filter_links = GFEntryList::get_filter_links($form);
     $counts = array();
     foreach ($filter_links as $filter_link) {
         $id = $filter_link['id'] == '' ? 'all' : $filter_link['id'];
         $counts[$id . '_count'] = $filter_link['count'];
     }
     $x = new WP_Ajax_Response();
     $x->add(array('what' => 'gf_entry', 'id' => $lead_id, 'supplemental' => $counts));
     $x->send();
 }
开发者ID:fjbeteiligung,项目名称:development,代码行数:42,代码来源:gravityforms.php

示例4: get_filter_links

 /**
  * Returns the array of filter links.
  *
  * @param bool $include_counts
  *
  * @return array|mixed|void
  */
 public function get_filter_links($include_counts = true)
 {
     $form = $this->get_form();
     return GFEntryList::get_filter_links($form, $include_counts);
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:12,代码来源:entry_list.php


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