', ''); ?>
id; self::leads_page($id); } } 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"); $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"]; $leads = $_POST["lead"]; $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; } $filter = rgget("filter"); 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"]; $search = RGForms::get("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; $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; $form = RGFormsModel::get_form_meta($form_id); $sort_field_meta = RGFormsModel::get_field($form, $sort_field); $is_numeric = $sort_field_meta["type"] == "number"; $status = in_array($filter, array("trash", "spam")) ? $filter : "active"; $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); $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" : ""; $filter_qs = "&filter=" . $filter; // determine which counter to use for paging and set total count switch ($filter) { case "trash" : $display_total = ceil($trash_count / $page_size); $total_lead_count = $trash_count; break; case "spam" : $display_total = ceil($spam_count / $page_size); $total_lead_count = $spam_count; break; case "star" : $display_total = ceil($starred_count / $page_size); $total_lead_count = $starred_count; break; case "unread" : $display_total = ceil($unread_count / $page_size); $total_lead_count = $unread_count; break; default : $display_total = ceil($active_lead_count / $page_size); $total_lead_count = $active_lead_count; break; } $page_links = paginate_links( array( 'base' => admin_url("admin.php") . "?page=gf_entries&view=entries&id=$form_id&%_%" . $search_qs . $sort_qs . $dir_qs. $star_qs . $read_qs . $filter_qs, 'format' => 'paged=%#%', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $display_total, 'current' => $page_index + 1, 'show_all' => false )); wp_print_scripts(array("thickbox")); wp_print_styles(array("thickbox")); ?>

:

'; echo apply_filters("gform_entry_apply_button", $apply_button); if(in_array($filter, array("trash", "spam"))){ $message = $filter == "trash" ? __("WARNING! This operation cannot be undone. Empty trash? \'Ok\' to empty trash. \'Cancel\' to abort.") : __("WARNING! This operation cannot be undone. Permanently delete all spam? \'Ok\' to delete. \'Cancel\' to abort."); $button_label = $filter == "trash" ? __("Empty Trash", "gravityforms") : __("Delete All Spam", "gravityforms"); ?>
$field_info){ $dir = $field_id == 0 ? "DESC" : "ASC"; //default every field so ascending sorting except date_created (id=0) if($field_id == $sort_field) //reverting direction if clicking on the currently sorted field $dir = $sort_direction == "ASC" ? "DESC" : "ASC"; ?> $field_info){ $dir = $field_id == 0 ? "DESC" : "ASC"; //default every field so ascending sorting except date_created (id=0) if($field_id == $sort_field) //reverting direction if clicking on the currently sorted field $dir = $sort_direction == "ASC" ? "DESC" : "ASC"; ?> 0){ $field_ids = array_keys($columns); foreach($leads as $position => $lead){ $position = ($page_size * $page_index) + $position; ?> " class='author-self status-inherit ' valign="top"> "; } else{ $field = RGFormsModel::get_field($form, $field_id); if(rgar($field, "enableChoiceValue") || rgar($field, "enablePrice")){ foreach($field["choices"] as $choice){ if($choice["value"] == $lead[$field_id]){ $value = ""; break; } else if($field["enablePrice"]){ $ary = explode("|", $lead[$field_id]); $val = count($ary) > 0 ? $ary[0] : ""; $price = count($ary) > 1 ? $ary[1] : ""; if($val == $choice["value"]){ $value = ""; break; } } } } } } } } break; case "post_image" : list($url, $title, $caption, $description) = rgexplode("|:|", $value, 4); if(!empty($url)){ //displaying thumbnail (if file is an image) or an icon based on the extension $thumb = self::get_icon_url($url); $value = ""; } break; case "fileupload" : $file_path = $value; if(!empty($file_path)){ //displaying thumbnail (if file is an image) or an icon based on the extension $thumb = self::get_icon_url($file_path); $file_path = esc_attr($file_path); $value = ""; } break; case "source_url" : $value = ".../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . ""; break; case "textarea" : case "post_content" : case "post_excerpt" : $value = esc_html($value); break; case "date_created" : case "payment_date" : $value = GFCommon::format_date($value, false); break; case "date" : $field = RGFormsModel::get_field($form, $field_id); $value = GFCommon::date_display($value, $field["dateFormat"]); break; case "radio" : case "select" : $field = RGFormsModel::get_field($form, $field_id); $value = GFCommon::selection_display($value, $field, $lead["currency"]); break; case "number" : $field = RGFormsModel::get_field($form, $field_id); $value = GFCommon::format_number($value, rgar($field, "numberFormat")); break; case "total" : case "payment_amount" : $value = GFCommon::to_money($value, $lead["currency"]); break; case "created_by" : if(!empty($value)){ $userdata = get_userdata($value); $value = $userdata->user_login; } break; case "multiselect": // add space after comma-delimited values $value = implode(', ', explode(',', $value)); break; default: $value = esc_html($value); } $value = apply_filters("gform_entries_field_value", $value, $form_id, $field_id, $lead); /* ^ maybe move to function */ $query_string = "gf_entries&view=entry&id={$form_id}&lid={$lead["id"]}{$search_qs}{$sort_qs}{$dir_qs}{$filter_qs}&paged=" . ($page_index + 1); if($is_first_column){ ?>
  " href="/?gf_page=select_columns&id=&TB_iframe=true&height=365&width=600" class="thickbox entries_edit_icon">
 
" /> " src="/images/star.png" onclick="ToggleStar(this, );" /> &paged=&pos=">    
'; echo apply_filters("gform_entry_apply_button", $apply_button); ?>
'; $range_max = ''; if (($first_item_index + $page_size) > $total_lead_count) { $range_max .= $total_lead_count; } else { $range_max .= ($first_item_index + $page_size); } $range_max .= ""; $range_min = '' . ($first_item_index + 1) . ""; $paging_total = '' . $total_lead_count . ""; $paging_html .= sprintf(__("Displaying %s - %s of %s", "gravityforms"), $range_min, $range_max , $paging_total); $paging_html .= "" .$page_links . ""; } else { $paging_html = ""; } return $paging_html; } } ?>