本文整理汇总了PHP中RGFormsModel::get_form_counts方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_form_counts方法的具体用法?PHP RGFormsModel::get_form_counts怎么用?PHP RGFormsModel::get_form_counts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_form_counts方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leads_page
//.........这里部分代码省略.........
$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);
$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);
?>
,
示例2: set_post_content
function set_post_content($entry, $form)
{
//getting post
$post = get_post($entry['post_id']);
$posta = $wp_query->post;
$postid = $post->ID;
//setting grid variables
$petition_form_contain = '"container"';
$petition_form_row = '"row"';
$petition_form_col_1 = '"col-md-1"';
$petition_form_col_4_off_1 = '"col-md-4 col-md-offset-1"';
$petition_form_col_5 = '"col-md-5"';
$petition_form_col_6_off_1 = '"col-md-6 col-md-offset-1"';
//other variables
$petition_form = '"petition-privacy"';
$petition_form_petf = '"petfsize"';
$quoteone = '"';
//setting up the petition form
$formid = 1;
$form_count = RGFormsModel::get_form_counts($formid);
$form_count_disp = $form_count['total'];
$form_id_step = $form_count_disp + 32;
$form_id = 2;
$form = GFAPI::get_form($form_id);
$form_add_new = GFAPI::add_form($form);
$form_id = $form_id_step;
$form = GFAPI::get_form($form_id);
$form['title'] = 'Petition Form ID' . ' ' . $form_id;
$result = GFAPI::update_form($form);
//changing post content
$post->post_content = "<div class={$petition_form_col_4_off_1}>[gravityform id ={$quoteone}{$form_id_step}{$quoteone}]</div><div class={$petition_form_contain}><div class={$petition_form_row}>\r\n<div class={$petition_form_col_6_off_1}><div class={$petition_form_petf}>" . rgar($entry, '4') . "</div></div><div class={$petition_form_col_5}></div></div></div>";
//updating post
wp_update_post($post);
//adding form ID
$post_id = $postid;
$meta_key = 'field_petition_form_id';
$meta_value = $form_id_step;
add_post_meta($post_id, $meta_key, $meta_value);
}
示例3: get_total_entries
public static function get_total_entries($form)
{
$totals = RGFormsModel::get_form_counts($form['id']);
return $totals['total'];
}
示例4: get_post_custom_values
<section class="entry-content">
<?php
//get current max value
$pet_max_val = get_post_custom_values("field_max_petition");
$pet_max_val_new = implode(" ", $pet_max_val);
//get number of signatures
$pet_form_id_val = get_post_custom_values("field_petition_form_id");
$formid = implode(" ", $pet_form_id_val);
$form_count = RGFormsModel::get_form_counts($formid);
$pet_sigs_val = $form_count['total'];
//calculate bar percentage fill
$pet_bar_val = $pet_sigs_val / $pet_max_val_new * 100;
//display progress bar
echo '<div class="container"><div class="row"><div class="col-md-6 col-md-offset-1"><div class="progress"><div class="progress-bar progress-bar-striped" role="progressbar" style="width: ';
echo $pet_bar_val;
echo '%">';
echo $pet_sigs_val;
echo ' supporters </div></div><h5>';
echo $pet_sigs_val;
echo ' supporters have signed. Help us get to ';
echo $pet_max_val_new;
echo '!</h5>';
//update number of sigs
$postid = $post->ID;
$meta_key = 'field_petition_sigs';
update_post_meta($postid, $meta_key, $pet_sigs_val);
?>
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('full', array('class' => 'img-responsive'));
示例5: 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}" : "";
//.........这里部分代码省略.........
示例6: rtlib_importer
//.........这里部分代码省略.........
/*if ($lfield["type"] == 'defined')
continue;*/
$form_fields .= '<option value="' . $lfield['slug'] . '">' . ucfirst($lfield['display_name']) . '</option>';
}
//$form_fields .= '<option value="ticketmeta">Other Field</option>';
$form_fields .= '</select>';
echo balanceTags($form_fields);
?>
</td>
<td></td>
<td class='rtlib-importer-dummy-data'
data-field-name="<?php
echo esc_attr($value);
?>
"><?php
echo esc_html($data[$value]);
?>
</td>
</tr>
<?php
}
?>
</tbody>
<?php
} else {
echo "<div class='error'><p>" . esc_html(__('Please Select File')) . '</p></div>';
return false;
}
} else {
$form_id = intval($_REQUEST['mapSource']);
$post_type = $_REQUEST['mapPostType'];
$form_data = RGFormsModel::get_form_meta($form_id);
$form_count = RGFormsModel::get_form_counts($form_id);
if (!$form_data) {
?>
<div id="map_message" class="error">Invalid Form</div>
<?php
return false;
}
if (!$flag) {
return;
}
$style = '';
if (empty($form_count['total'])) {
$style = 'style="display:none;"';
}
?>
<div id="map_message" class="updated map_message">
<div>Form Selected : <strong><?php
echo esc_html($form_data['title']);
?>
</strong></div>
<div>Total Entries:
<strong><?php
echo esc_html($form_count['total']);
?>
</strong></div>
</div>
<?php
if (empty($form_data['fields'])) {
echo 'Form doesn\'t seem to have any fields!';
die;
}
?>
示例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: poll_total_shortcode
public function poll_total_shortcode($atts, $content = null)
{
extract(shortcode_atts(array('id' => '1'), $atts));
$totals = RGFormsModel::get_form_counts($id);
$total = $totals['total'];
return $total;
}