本文整理汇总了PHP中RGFormsModel::get_grid_columns方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_grid_columns方法的具体用法?PHP RGFormsModel::get_grid_columns怎么用?PHP RGFormsModel::get_grid_columns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_grid_columns方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leads_page
//.........这里部分代码省略.........
}
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);
$display_total = ceil($total_count / $page_size);
$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 . $search_field_id_qs . $search_operator_qs, 'format' => 'paged=%#%', 'prev_text' => esc_html__('«', 'gravityforms'), 'next_text' => esc_html__('»', 'gravityforms'), 'total' => $display_total, 'current' => $page_index + 1, 'show_all' => false));
wp_print_styles(array('thickbox'));
$field_filters = GFCommon::get_field_filter_settings($form);
$init_field_id = empty($search_field_id) ? 0 : $search_field_id;
$init_field_operator = empty($search_operator) ? 'contains' : $search_operator;
$init_filter_vars = array('mode' => 'off', 'filters' => array(array('field' => $init_field_id, 'operator' => $init_field_operator, 'value' => $search)));
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min';
?>
<script type="text/javascript">
var messageTimeout = false,
gformFieldFilters = <?php
echo json_encode($field_filters);
?>
,
gformInitFilter = <?php
echo json_encode($init_filter_vars);
?>
function ChangeColumns(columns) {
jQuery("#action").val("change_columns");
示例2: sort_by_default_field_query
private static function sort_by_default_field_query($form_id, $sort_field, $sort_direction = 'DESC', $search = '', $offset = 0, $page_size = 30, $star = null, $read = null, $is_numeric_sort = false, $start_date = null, $end_date = null, $status = 'active', $payment_status = false)
{
global $wpdb;
if (!is_numeric($form_id) || !is_numeric($offset) || !is_numeric($page_size)) {
return '';
}
$lead_detail_table_name = self::get_lead_details_table_name();
$lead_table_name = self::get_lead_table_name();
$lead_meta_table_name = self::get_lead_meta_table_name();
$where = self::get_leads_where_sql(compact('form_id', 'search', 'status', 'star', 'read', 'start_date', 'end_date', 'payment_status'));
$entry_meta = self::get_entry_meta($form_id);
$entry_meta_sql_join = '';
if (false === empty($entry_meta) && array_key_exists($sort_field, $entry_meta)) {
$entry_meta_sql_join = $wpdb->prepare("INNER JOIN\n\t\t\t\t(\n\t\t\t\tSELECT\n\t\t\t\t\t lead_id, meta_value as {$sort_field}\n\t\t\t\t\t from {$lead_meta_table_name}\n\t\t\t\t\t WHERE meta_key = %s\n\t\t\t\t) lead_meta_data ON lead_meta_data.lead_id = l.id\n\t\t\t\t", $sort_field);
$is_numeric_sort = $entry_meta[$sort_field]['is_numeric'];
}
$grid_columns = RGFormsModel::get_grid_columns($form_id);
if ($sort_field != 'date_created' && false === array_key_exists($sort_field, $grid_columns)) {
$sort_field = 'date_created';
}
$orderby = $is_numeric_sort ? "ORDER BY ({$sort_field}+0) {$sort_direction}" : "ORDER BY {$sort_field} {$sort_direction}";
$sql = "\n SELECT filtered.sort, l.*, d.field_number, d.value\n FROM {$lead_table_name} l\n INNER JOIN {$lead_detail_table_name} d ON d.lead_id = l.id\n INNER JOIN\n (\n SELECT @rownum:=@rownum + 1 as sort, id\n FROM\n (\n SELECT distinct l.id\n FROM {$lead_table_name} l\n INNER JOIN {$lead_detail_table_name} d ON d.lead_id = l.id\n\t\t\t\t\t{$entry_meta_sql_join}\n {$where}\n {$orderby}\n LIMIT {$offset},{$page_size}\n ) page\n ) filtered ON filtered.id = l.id\n ORDER BY filtered.sort";
return $sql;
}
示例3: sort_by_column_query
private static function sort_by_column_query($form_id, $search_criteria, $sorting, $paging)
{
global $wpdb;
$sort_field = isset($sorting["key"]) ? $sorting["key"] : "date_created";
$sort_direction = isset($sorting["direction"]) ? $sorting["direction"] : "DESC";
$is_numeric_sort = isset($sorting["is_numeric"]) ? $sorting["is_numeric"] : false;
$offset = isset($paging["offset"]) ? $paging["offset"] : 0;
$page_size = isset($paging["page_size"]) ? $paging["page_size"] : 20;
if (!is_numeric($form_id) || !is_numeric($offset) || !is_numeric($page_size)) {
return "";
}
$lead_detail_table_name = GFFormsModel::get_lead_details_table_name();
$lead_table_name = GFFormsModel::get_lead_table_name();
$lead_meta_table_name = GFFormsModel::get_lead_meta_table_name();
$entry_meta = GFFormsModel::get_entry_meta($form_id);
$entry_meta_sql_join = "";
if (false === empty($entry_meta) && array_key_exists($sort_field, $entry_meta)) {
$entry_meta_sql_join = $wpdb->prepare("INNER JOIN\n (\n SELECT\n lead_id, meta_value as {$sort_field}\n from {$lead_meta_table_name}\n WHERE meta_key=%s\n ) lead_meta_data ON lead_meta_data.lead_id = l.id\n ", $sort_field);
$is_numeric_sort = $entry_meta[$sort_field]['is_numeric'];
}
$grid_columns = RGFormsModel::get_grid_columns($form_id);
if ($sort_field != "date_created" && false === array_key_exists($sort_field, $grid_columns)) {
$sort_field = "date_created";
}
$orderby = $is_numeric_sort ? "ORDER BY ({$sort_field}+0) {$sort_direction}" : "ORDER BY {$sort_field} {$sort_direction}";
$where_arr = array();
$search_where = self::get_search_where($form_id, $search_criteria);
if (!empty($search_where)) {
$where_arr[] = $search_where;
}
$info_search_where = self::get_info_search_where($search_criteria);
if (!empty($info_search_where)) {
$where_arr[] = $info_search_where;
}
$form_id_where = $form_id > 0 ? $wpdb->prepare("l.form_id=%d", $form_id) : "";
if (!empty($form_id_where)) {
$where_arr[] = $form_id_where;
}
$where = empty($where_arr) ? "" : "WHERE " . join($where_arr, " AND ");
$sql = "\n SELECT filtered.sort, l.*, d.field_number, d.value\n FROM {$lead_table_name} l\n INNER JOIN {$lead_detail_table_name} d ON d.lead_id = l.id\n INNER JOIN\n (\n SELECT @rownum:=@rownum + 1 as sort, id\n FROM\n (\n SELECT distinct l.id\n FROM {$lead_table_name} l\n INNER JOIN {$lead_detail_table_name} d ON d.lead_id = l.id\n {$entry_meta_sql_join}\n\t\t\t\t\t{$where}\n {$orderby}\n LIMIT {$offset},{$page_size}\n ) page\n ) filtered ON filtered.id = l.id\n\n ORDER BY filtered.sort";
return $sql;
}
示例4: sort_by_default_field_query
private static function sort_by_default_field_query($form_id, $sort_field, $sort_direction = 'DESC', $search = '', $offset = 0, $page_size = 30, $star = null, $read = null, $is_numeric_sort = false, $start_date = null, $end_date = null, $status = 'active')
{
global $wpdb;
if (!is_numeric($form_id) || !is_numeric($offset) || !is_numeric($page_size)) {
return "";
}
$lead_detail_table_name = self::get_lead_details_table_name();
$lead_table_name = self::get_lead_table_name();
$lead_meta_table_name = self::get_lead_meta_table_name();
$search_term = "%{$search}%";
$search_filter = empty($search) ? "" : $wpdb->prepare(" AND value LIKE %s", $search_term);
$star_filter = $star !== null && $status == 'active' ? $wpdb->prepare(" AND is_starred=%d AND status='active' ", $star) : "";
$read_filter = $read !== null && $status == 'active' ? $wpdb->prepare(" AND is_read=%d AND status='active' ", $read) : "";
$status_filter = $wpdb->prepare(" AND status=%s ", $status);
$start_date_filter = empty($start_date) ? "" : " AND timestampdiff(SECOND, '{$start_date}', date_created) >=0";
$end_date_filter = empty($end_date) ? "" : " AND timestampdiff(SECOND, '{$end_date}', date_created) <=0";
$entry_meta = self::get_entry_meta($form_id);
$entry_meta_sql_join = "";
if (false === empty($entry_meta) && array_key_exists($sort_field, $entry_meta)) {
$entry_meta_sql_join = $wpdb->prepare("INNER JOIN\n (\n SELECT\n lead_id, meta_value as {$sort_field}\n from {$lead_meta_table_name}\n WHERE meta_key=%s\n ) lead_meta_data ON lead_meta_data.lead_id = l.id\n ", $sort_field);
$is_numeric_sort = $entry_meta[$sort_field]['is_numeric'];
}
$grid_columns = RGFormsModel::get_grid_columns($form_id);
if ($sort_field != "date_created" && false === array_key_exists($sort_field, $grid_columns)) {
$sort_field = "date_created";
}
$orderby = $is_numeric_sort ? "ORDER BY ({$sort_field}+0) {$sort_direction}" : "ORDER BY {$sort_field} {$sort_direction}";
$sql = "\n SELECT filtered.sort, l.*, d.field_number, d.value\n FROM {$lead_table_name} l\n INNER JOIN {$lead_detail_table_name} d ON d.lead_id = l.id\n INNER JOIN\n (\n SELECT @rownum:=@rownum + 1 as sort, id\n FROM\n (\n SELECT distinct l.id\n FROM {$lead_table_name} l\n INNER JOIN {$lead_detail_table_name} d ON d.lead_id = l.id\n {$entry_meta_sql_join}\n\t\t\t\t\tWHERE l.form_id={$form_id}\n {$search_filter}\n {$star_filter}\n {$read_filter}\n {$status_filter}\n {$start_date_filter}\n {$end_date_filter}\n {$orderby}\n LIMIT {$offset},{$page_size}\n ) page\n ) filtered ON filtered.id = l.id\n ORDER BY filtered.sort";
return $sql;
}
示例5: Array
});
var columns = new Array();
function SelectColumns(){
jQuery("#sortable_selected li").each(function(){
columns.push(this.id);
});
self.parent.parent.ChangeColumns(columns);
}
</script>
</head>
<body>
<?php
$columns = RGFormsModel::get_grid_columns($form_id);
$field_ids = array_keys($columns);
$form = RGFormsModel::get_form_meta($form_id);
array_push($form["fields"], array("id" => "id", "label" => __("Entry Id", "gravityforms")));
array_push($form["fields"], array("id" => "date_created", "label" => __("Entry Date", "gravityforms")));
array_push($form["fields"], array("id" => "ip", "label" => __("User IP", "gravityforms")));
array_push($form["fields"], array("id" => "source_url", "label" => __("Source Url", "gravityforms")));
array_push($form["fields"], array("id" => "payment_status", "label" => __("Payment Status", "gravityforms")));
array_push($form["fields"], array("id" => "transaction_id", "label" => __("Transaction Id", "gravityforms")));
array_push($form["fields"], array("id" => "payment_amount", "label" => __("Payment Amount", "gravityforms")));
array_push($form["fields"], array("id" => "payment_date", "label" => __("Payment Date", "gravityforms")));
array_push($form["fields"], array("id" => "created_by", "label" => __("User", "gravityforms")));
?>
<div class="panel-instructions"><?php
_e("Drag & drop to order and select which columns are displayed in the entries table.", "gravityforms");
?>
示例6: 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}" : "";
//.........这里部分代码省略.........
示例7: 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");
switch ($action) {
case "delete":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$lead_id = $_POST["action_argument"];
RGFormsModel::delete_lead($lead_id);
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"];
switch ($bulk_action) {
case "delete":
RGFormsModel::delete_leads($leads);
break;
case "mark_read":
RGFormsModel::update_leads_property($leads, "is_read", 1);
break;
case "mark_unread":
RGFormsModel::update_leads_property($leads, "is_read", 0);
break;
case "add_star":
RGFormsModel::update_leads_property($leads, "is_starred", 1);
break;
case "remove_star":
RGFormsModel::update_leads_property($leads, "is_starred", 0);
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;
}
$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 = is_numeric(RGForms::get("star")) ? intval(RGForms::get("star")) : null;
$read = is_numeric(RGForms::get("read")) ? intval(RGForms::get("read")) : null;
$page_size = 20;
$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";
$leads = RGFormsModel::get_leads($form_id, $sort_field, $sort_direction, $search, $first_item_index, $page_size, $star, $read, $is_numeric);
$lead_count = RGFormsModel::get_lead_count($form_id, $search, $star, $read);
$summary = RGFormsModel::get_form_counts($form_id);
$total_lead_count = $summary["total"];
$unread_count = $summary["unread"];
$starred_count = $summary["starred"];
$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}" : "";
$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, 'format' => 'paged=%#%', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($lead_count / $page_size), 'current' => $page_index + 1, 'show_all' => false));
wp_print_scripts(array("thickbox"));
wp_print_styles(array("thickbox"));
?>
<script src="<?php
echo GFCommon::get_base_url();
?>
/js/jquery.json-1.3.js?ver=<?php
echo GFCommon::$version;
?>
"></script>
<script>
function ChangeColumns(columns){
jQuery("#action").val("change_columns");
jQuery("#grid_columns").val(jQuery.toJSON(columns));
tb_remove();
jQuery("#lead_form")[0].submit();
}
function Search(sort_field_id, sort_direction, form_id, search, star, read){
var search_qs = search == "" ? "" : "&s=" + search;
var star_qs = star == "" ? "" : "&star=" + star;
var read_qs = read == "" ? "" : "&read=" + read;
var location = "?page=gf_entries&view=entries&id=" + form_id + "&sort=" + sort_field_id + "&dir=" + sort_direction + search_qs + star_qs + read_qs;
document.location = location;
}
function ToggleStar(img, lead_id){
var is_starred = img.src.indexOf("star1.png") >=0
if(is_starred)
img.src = img.src.replace("star1.png", "star0.png");
//.........这里部分代码省略.........
示例8: select_columns_page
public static function select_columns_page()
{
$form_id = $_GET["id"];
if (empty($form_id)) {
echo __("Oops! We could not locate your form. Please try again.", "gravityforms");
exit;
}
//reading form metadata
$form = RGFormsModel::get_form_meta($form_id);
?>
<html>
<head>
<?php
wp_print_styles(array("wp-admin", "colors-fresh"));
wp_print_scripts(array("jquery-ui-sortable"));
//adds touchscreen support on mobile devices
if (wp_is_mobile()) {
wp_print_scripts(array("jquery-touch-punch"));
}
?>
<style type="text/css">
body {font-family:"Lucida Grande",Verdana,Arial,sans-serif;}
#sortable_available, #sortable_selected { list-style-type: none; margin: 0; padding: 2px; height:250px; border:1px solid #eaeaea; -moz-border-radius:4px; -webkit-border-radius:4px; -khtml-border-radius:4px; border-radius:4px background-color:#FFF;
overflow: auto; }
#sortable_available li, #sortable_selected li { margin: 0 2px 2px 2px; padding:2px; width: 96%; border:1px solid white; cursor:pointer; font-size: 13px;}
.field_hover { border: 1px dashed #2175A9!important;}
.placeholder{background-color: #FFF0A5; height:20px;}
.gcolumn_wrapper { height:290px; padding: 0 20px; }
.gcolumn_container_left, .gcolumn_container_right {width:46%;}
.gcolumn_container_left {float:left;}
.gcolumn_container_right {float:right;}
.gform_select_column_heading{font-weight:bold; padding-bottom:7px; font-size:13px;}
.column-arrow-mid {float:left; width:45px; height:250px; background-image:url(<?php
echo GFCommon::get_base_url();
?>
/wp-content/themes/localedge/images/arrow-rightleft.jpg); background-repeat:no-repeat; background-position:center center; margin-top:26px;}
.panel-instructions {border-bottom: 1px solid #dfdfdf; color:#555; font-size:11px; padding: 10px 20px; margin-bottom:6px}
div.panel-buttons {margin-top:8px; padding: 0 20px; }
div.panel-buttons {*margin-top:0px} /* ie specific */
</style>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#sortable_available, #sortable_selected").sortable({connectWith: '.sortable_connected', placeholder: 'placeholder'});
jQuery(".sortable_connected li").hover(
function(){
jQuery(this).addClass("field_hover");
},
function(){
jQuery(this).removeClass("field_hover");
}
);
});
var columns = new Array();
function SelectColumns(){
jQuery("#sortable_selected li").each(function(){
columns.push(this.id);
});
self.parent.parent.ChangeColumns(columns);
}
</script>
</head>
<body>
<?php
$columns = RGFormsModel::get_grid_columns($form_id);
$field_ids = array_keys($columns);
$form = RGFormsModel::get_form_meta($form_id);
array_push($form["fields"], array("id" => "id", "label" => __("Entry Id", "gravityforms")));
array_push($form["fields"], array("id" => "date_created", "label" => __("Entry Date", "gravityforms")));
array_push($form["fields"], array("id" => "ip", "label" => __("User IP", "gravityforms")));
array_push($form["fields"], array("id" => "source_url", "label" => __("Source Url", "gravityforms")));
array_push($form["fields"], array("id" => "payment_status", "label" => __("Payment Status", "gravityforms")));
array_push($form["fields"], array("id" => "transaction_id", "label" => __("Transaction Id", "gravityforms")));
array_push($form["fields"], array("id" => "payment_amount", "label" => __("Payment Amount", "gravityforms")));
array_push($form["fields"], array("id" => "payment_date", "label" => __("Payment Date", "gravityforms")));
array_push($form["fields"], array("id" => "created_by", "label" => __("User", "gravityforms")));
$form = self::get_selectable_entry_meta($form);
?>
<div class="panel-instructions"><?php
_e("Drag & drop to order and select which columns are displayed in the entries table.", "gravityforms");
?>
</div>
<div class="gcolumn_wrapper">
<div class="gcolumn_container_left">
<div class="gform_select_column_heading"><?php
_e("Active Columns", "gravityforms");
?>
</div>
<ul id="sortable_selected" class="sortable_connected">
<?php
foreach ($columns as $field_id => $field_info) {
?>
<li id="<?php
echo $field_id;
//.........这里部分代码省略.........
示例9: select_columns_page
//.........这里部分代码省略.........
}
/* ie specific */
</style>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#sortable_available, #sortable_selected").sortable({connectWith: '.sortable_connected', placeholder: 'placeholder'});
jQuery(".sortable_connected li").hover(
function () {
jQuery(this).addClass("field_hover");
},
function () {
jQuery(this).removeClass("field_hover");
}
);
});
var columns = new Array();
function SelectColumns() {
jQuery("#sortable_selected li").each(function () {
columns.push(this.id);
});
self.parent.parent.ChangeColumns(columns);
}
</script>
</head>
<body>
<?php
$columns = RGFormsModel::get_grid_columns($form_id);
$field_ids = array_keys($columns);
$form = RGFormsModel::get_form_meta($form_id);
array_push($form['fields'], array('id' => 'id', 'label' => __('Entry Id', 'gravityforms')));
array_push($form['fields'], array('id' => 'date_created', 'label' => __('Entry Date', 'gravityforms')));
array_push($form['fields'], array('id' => 'ip', 'label' => __('User IP', 'gravityforms')));
array_push($form['fields'], array('id' => 'source_url', 'label' => __('Source Url', 'gravityforms')));
array_push($form['fields'], array('id' => 'payment_status', 'label' => __('Payment Status', 'gravityforms')));
array_push($form['fields'], array('id' => 'transaction_id', 'label' => __('Transaction Id', 'gravityforms')));
array_push($form['fields'], array('id' => 'payment_amount', 'label' => __('Payment Amount', 'gravityforms')));
array_push($form['fields'], array('id' => 'payment_date', 'label' => __('Payment Date', 'gravityforms')));
array_push($form['fields'], array('id' => 'created_by', 'label' => __('User', 'gravityforms')));
$form = self::get_selectable_entry_meta($form);
$form = GFFormsModel::convert_field_objects($form);
?>
<div class="panel-instructions"><?php
esc_html_e('Drag & drop to order and select which columns are displayed in the entries table.', 'gravityforms');
?>
</div>
<div class="gcolumn_wrapper">
<div class="gcolumn_container_left">
<div class="gform_select_column_heading"><?php
esc_html_e('Active Columns', 'gravityforms');
?>
</div>
<ul id="sortable_selected" class="sortable_connected">
<?php
foreach ($columns as $field_id => $field_info) {
?>
<li id="<?php
echo esc_attr($field_id);
?>
"><?php
示例10: get_columns
function get_columns()
{
$args = $this->get_filter_args();
$columns['cb'] = esc_html__('Checkbox', 'gravityflow');
if ($this->id_column) {
$columns['id'] = esc_html__('ID', 'gravityflow');
}
$columns['date_created'] = esc_html__('Date', 'gravityflow');
if (!isset($args['form-id'])) {
$columns['form_id'] = esc_html__('Form', 'gravityflow');
}
if ($this->submitter_column) {
$columns['created_by'] = esc_html__('Submitter', 'gravityflow');
}
if ($this->step_column) {
$columns['workflow_step'] = esc_html__('Step', 'gravityflow');
}
if ($this->status_column) {
$columns['workflow_final_status'] = esc_html__('Status', 'gravityflow');
}
if (!empty($args['form-id']) && !empty($this->field_ids)) {
$form = GFAPI::get_form($args['form-id']);
$grid_columns = RGFormsModel::get_grid_columns($args['form-id'], true);
$field_ids = array_keys($grid_columns);
foreach ($this->field_ids as $field_id) {
$field = GFFormsModel::get_field($form, $field_id);
if (in_array(GFFormsModel::get_input_type($field), array('workflow_user', 'workflow_assignee_select', 'workflow_role'))) {
continue;
}
$field_id = trim($field_id);
if (in_array($field_id, $field_ids)) {
$field_info = $grid_columns[$field_id];
$columns[$field_id] = $field_info['label'];
}
}
}
if ($step_id = $this->get_filter_step_id()) {
unset($columns['workflow_step']);
$step = gravity_flow()->get_step($step_id);
$assignees = $step->get_assignees();
foreach ($assignees as $assignee) {
$meta_key = sprintf('workflow_%s_%s', $assignee->get_type(), $assignee->get_id());
$columns[$meta_key] = $assignee->get_display_name();
}
}
if ($this->last_updated) {
$columns['workflow_timestamp'] = esc_html__('Last Updated', 'gravityflow');
}
return $columns;
}
示例11: make_directory
function make_directory($atts)
{
global $wpdb, $wp_rewrite, $post, $wpdb, $directory_shown, $kws_gf_scripts, $kws_gf_styles;
if (!class_exists('GFEntryDetail')) {
@(require_once GFCommon::get_base_path() . "/entry_detail.php");
}
if (!class_exists('GFCommon')) {
@(require_once WP_PLUGIN_DIR . "/gravityforms/common.php");
}
if (!class_exists('RGFormsModel')) {
@(require_once WP_PLUGIN_DIR . "/gravityforms/forms_model.php");
}
//quit if version of wp is not supported
if (!class_exists('GFCommon') || !GFCommon::ensure_wp_version()) {
return;
}
ob_start();
// Using ob_start() allows us to use echo instead of $output .=
foreach ($atts as $key => $att) {
if (strtolower($att) == 'false') {
$atts[$key] = false;
}
if (strtolower($att) == 'true') {
$atts[$key] = true;
}
}
$atts['approved'] = isset($atts['approved']) ? $atts['approved'] : -1;
if (!empty($atts['lightboxsettings']) && is_string($atts['lightboxsettings'])) {
$atts['lightboxsettings'] = explode(',', $atts['lightboxsettings']);
}
$options = self::directory_defaults($atts);
// Make sure everything is on the same page.
if (is_array($options['lightboxsettings'])) {
foreach ($options['lightboxsettings'] as $key => $value) {
if (is_numeric($key)) {
$options['lightboxsettings']["{$value}"] = $value;
unset($options['lightboxsettings']["{$key}"]);
}
}
}
extract($options);
$form_id = $form;
$form = RGFormsModel::get_form_meta($form_id);
if (empty($form)) {
return;
}
$sort_field = empty($_GET["sort"]) ? $sort : $_GET["sort"];
$sort_direction = empty($_GET["dir"]) ? $dir : $_GET["dir"];
$search_query = !empty($_GET["gf_search"]) ? $_GET["gf_search"] : null;
$start_date = !empty($_GET["start_date"]) ? $_GET["start_date"] : $start_date;
$end_date = !empty($_GET["end_date"]) ? $_GET["end_date"] : $end_date;
$page_index = empty($_GET["page"]) ? $startpage - 1 : intval($_GET["page"]) - 1;
$star = isset($_GET["star"]) && is_numeric($_GET["star"]) ? intval($_GET["star"]) : null;
$read = isset($_GET["read"]) && is_numeric($_GET["read"]) ? intval($_GET["read"]) : null;
$first_item_index = $page_index * $page_size;
$link_params = array();
if (!empty($page_index)) {
$link_params['page'] = $page_index;
}
$formaction = remove_query_arg(array('gf_search', 'sort', 'dir', 'page', 'edit'), add_query_arg($link_params));
$tableclass .= !empty($jstable) ? ' tablesorter' : '';
$title = $form["title"];
$sort_field_meta = RGFormsModel::get_field($form, $sort_field);
$is_numeric = $sort_field_meta["type"] == "number";
$columns = RGFormsModel::get_grid_columns($form_id, true);
$approvedcolumn = false;
if ($approved || !empty($smartapproval) && $approved === -1) {
$approvedcolumn = self::get_approved_column($form);
}
if (!empty($smartapproval) && $approved === -1 && !empty($approvedcolumn)) {
$approved = true;
// If there is an approved column, turn on approval
} else {
$approved = false;
// Otherwise, show entries as normal.
}
$entrylinkcolumns = self::get_entrylink_column($form, $entry);
$adminonlycolumns = self::get_admin_only($form);
//
// Show only a single entry
//
if (!empty($entry) && ($detail = self::process_lead_detail(true, $entryback, $showadminonly, $adminonlycolumns, $approvedcolumn, $options, $entryonly))) {
echo $detail;
if (!empty($entryonly)) {
do_action('kws_gf_after_directory', do_action('kws_gf_after_directory_form_' . $form_id, $form, compact($approved, $sort_field, $sort_direction, $search_query, $first_item_index, $page_size, $star, $read, $is_numeric, $start_date, $end_date)));
$content = ob_get_contents();
// Get the output
ob_end_clean();
// Clear the cache
// If the form is form #2, two filters are applied: `kws_gf_directory_output_2` and `kws_gf_directory_output`
$content = apply_filters('kws_gf_directory_output', apply_filters('kws_gf_directory_output_' . $form_id, self::pseudo_filter($content, $directoryview)));
return $content;
}
}
//
// Or start to generate the directory
//
$leads = GFDirectory::get_leads($form_id, $sort_field, $sort_direction, $search_query, $first_item_index, $page_size, $star, $read, $is_numeric, $start_date, $end_date, 'active', $approvedcolumn, $limituser);
# if(!$showadminonly) {
$columns = self::remove_admin_only($columns, $adminonlycolumns, $approvedcolumn, false, false, $form);
//.........这里部分代码省略.........
示例12: display
public static function display($args)
{
global $current_user;
$filter = apply_filters('gravityflow_inbox_filter', array('form_id' => 0, 'start_date' => '', 'end_date' => ''));
$field_ids = apply_filters('gravityflow_inbox_fields', array());
$defaults = array('display_empty_fields' => true, 'id_column' => true, 'submitter_column' => true, 'step_column' => true, 'check_permissions' => true, 'form_id' => absint(rgar($filter, 'form_id')), 'field_ids' => $field_ids, 'detail_base_url' => admin_url('admin.php?page=gravityflow-inbox&view=entry'), 'last_updated' => false);
$args = array_merge($defaults, $args);
if ($current_user->ID > 0) {
$filter_key = 'user_id_' . $current_user->ID;
} elseif ($token = gravity_flow()->decode_access_token()) {
$filter_key = 'email_' . gravity_flow()->parse_token_assignee($token)->get_id();
}
$entries = array();
$form_id = $args['form_id'];
$total_count = 0;
if (!empty($filter_key)) {
$field_filters[] = array('key' => 'workflow_' . $filter_key, 'value' => 'pending');
$user_roles = gravity_flow()->get_user_roles();
foreach ($user_roles as $user_role) {
$field_filters[] = array('key' => 'workflow_role_' . $user_role, 'value' => 'pending');
}
$field_filters['mode'] = 'any';
$search_criteria['field_filters'] = $field_filters;
$search_criteria['status'] = 'active';
$form_ids = $args['form_id'] ? $args['form_id'] : gravity_flow()->get_workflow_form_ids();
if (!empty($form_ids)) {
$paging = array('page_size' => 150);
$entries = GFAPI::get_entries($form_ids, $search_criteria, null, $paging, $total_count);
}
}
if (sizeof($entries) > 0) {
$id_style = $args['id_column'] ? '' : 'style="display:none;"';
$submitter_style = $args['submitter_column'] ? '' : 'style="display:none;"';
$step_style = $args['step_column'] ? '' : 'style="display:none;"';
?>
<table id="gravityflow-inbox" class="widefat gravityflow-inbox" cellspacing="0" style="border:0px;">
<thead>
<tr>
<th <?php
echo $id_style;
?>
data-label="<?php
esc_html_e('ID', 'gravityflow');
?>
"><?php
esc_html_e('ID', 'gravityflow');
?>
</th>
<?php
if (empty($form_id)) {
?>
<th><?php
esc_html_e('Form', 'gravityflow');
?>
</th>
<?php
}
?>
<th <?php
echo $submitter_style;
?>
><?php
esc_html_e('Submitter', 'gravityflow');
?>
</th>
<th <?php
echo $step_style;
?>
><?php
esc_html_e('Step', 'gravityflow');
?>
</th>
<th><?php
esc_html_e('Submitted', 'gravityflow');
?>
</th>
<?php
if ($args['form_id'] && is_array($args['field_ids'])) {
$columns = RGFormsModel::get_grid_columns($args['form_id'], true);
$field_ids = array_keys($columns);
foreach ($args['field_ids'] as $field_id) {
$field_id = trim($field_id);
if (in_array($field_id, $field_ids)) {
$field_info = $columns[$field_id];
echo '<th>' . esc_html($field_info['label']) . '</th>';
}
}
}
if ($args['last_updated']) {
echo '<th>' . esc_html__('Last Updated', 'gravityflow') . '</th>';
}
?>
</tr>
</thead>
<tbody class="list:user user-list">
<?php
foreach ($entries as $entry) {
$form = GFAPI::get_form($entry['form_id']);
//.........这里部分代码省略.........
示例13: sort_by_default_field_query
private static function sort_by_default_field_query($form_id, $sort_field, $sort_direction='DESC', $search='', $offset=0, $page_size=30, $star=null, $read=null, $is_numeric_sort = false, $start_date=null, $end_date=null, $status='active', $payment_status = false){
global $wpdb;
if(!is_numeric($form_id) || !is_numeric($offset)|| !is_numeric($page_size)){
return "";
}
$lead_detail_table_name = self::get_lead_details_table_name();
$lead_table_name = self::get_lead_table_name();
$lead_meta_table_name = self::get_lead_meta_table_name();
$where = self::get_leads_where_sql(compact('form_id', 'search', 'status', 'star', 'read', 'start_date', 'end_date', 'payment_status'));
$entry_meta = self::get_entry_meta($form_id);
$entry_meta_sql_join = "";
if ( false === empty( $entry_meta ) && array_key_exists( $sort_field, $entry_meta ) ) {
$entry_meta_sql_join = $wpdb->prepare("INNER JOIN
(
SELECT
lead_id, meta_value as $sort_field
from $lead_meta_table_name
WHERE meta_key = '$sort_field'
) lead_meta_data ON lead_meta_data.lead_id = l.id
");
$is_numeric_sort = $entry_meta[$sort_field]['is_numeric'];
}
$grid_columns = RGFormsModel::get_grid_columns($form_id);
if ( $sort_field != "date_created" && false === array_key_exists($sort_field, $grid_columns) )
$sort_field = "date_created";
$orderby = $is_numeric_sort ? "ORDER BY ($sort_field+0) $sort_direction" : "ORDER BY $sort_field $sort_direction";
$sql = "
SELECT filtered.sort, l.*, d.field_number, d.value
FROM $lead_table_name l
INNER JOIN $lead_detail_table_name d ON d.lead_id = l.id
INNER JOIN
(
SELECT @rownum:=@rownum + 1 as sort, id
FROM
(
SELECT distinct l.id
FROM $lead_table_name l
INNER JOIN $lead_detail_table_name d ON d.lead_id = l.id
$entry_meta_sql_join
$where
$orderby
LIMIT $offset,$page_size
) page
) filtered ON filtered.id = l.id
ORDER BY filtered.sort";
return $sql;
}