本文整理汇总了PHP中RGFormsModel::get_leads方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_leads方法的具体用法?PHP RGFormsModel::get_leads怎么用?PHP RGFormsModel::get_leads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_leads方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_bloginfo
<?php
// Get Time from Timesheets
// Return more than 30 entries (the default)
$the_form = 4;
$all_entries = RGFormsModel::get_leads($the_form, 0, 'ASC', '', 0, 999, NULL, NULL, FALSE, NULL, NULL, 'active', FALSE);
?>
<div class="medium caps">
<a href="<?php
echo get_bloginfo('wpurl') . '/?gf_pdf=1&fid=' . $_GET['fid'] . '&lid=' . $_GET['lid'] . '&template=sg360.php';
?>
" target="_blank">
<span class="purple"><?php
echo $lead[27];
?>
: <?php
echo $lead[37];
?>
</span>
</a>
</div>
<div class="left half">
<span class="medium">Task:
<span class="red">
<?php
$f_id = 1;
// Form ID
$f_ld = $_GET['task'];
示例2: rtlib_importer
//.........这里部分代码省略.........
value="<?php
echo esc_attr($_REQUEST['type']);
?>
"/>
<input type="hidden" name="mapEntryCount" id="mapEntryCount"
value="<?php
echo esc_attr($form_count['total']);
?>
"/>
<table class="wp-list-table widefat fixed posts rt-importer" >
<thead>
<tr>
<th scope="row"><?php
_e('Form field name');
?>
</th>
<th scope="row"><?php
_e('Mapped with entity');
?>
</th>
<th scope="row"><?php
_e('Default value (optional)');
?>
</th>
<th scope="row"><a href="#dummyDataPrev"> << </a><?php
_e('Sample');
?>
<a
href="#dummyDataNext"> >> </a></th>
</tr>
</thead>
<tbody style=" ">
<?php
$formdummydata = RGFormsModel::get_leads($form_id, 0, 'ASC', '', 0, 1);
foreach ($form_data['fields'] as &$field) {
?>
<tr data-field-name="<?php
echo esc_attr($field['label']);
?>
">
<td><?php
echo esc_html(ucfirst($field['label']));
?>
<input type="hidden" value="<?php
echo esc_attr(ucfirst($field['type']));
?>
"/>
</td>
<td>
<?php
$form_fields = '<select name="field-' . $field['id'] . '" id="field-' . $field['id'] . '" class="map_form_fields map_form_fixed_fields">';
$form_fields .= '<option value="">Choose a field or Skip it</option>';
foreach ($this->field_array[$post_type] as $key => $lfield) {
/*if (isset($lfield["type"]) && $lfield["type"]== 'defined')
continue;*/
$form_fields .= '<option value="' . esc_attr($lfield['slug']) . '">' . esc_html(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($field['id']);
示例3: start_export
public static function start_export($form)
{
$form_id = $form["id"];
$fields = $_POST["export_field"];
$start_date = $_POST["export_date_start"];
$end_date = $_POST["export_date_end"];
//adding default fields
array_push($form["fields"], array("id" => "created_by", "label" => __("Created By (User Id)", "gravityforms")));
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" => "source_url", "label" => __("Source Url", "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" => "payment_status", "label" => __("Payment Status", "gravityforms")));
array_push($form["fields"], array("id" => "post_id", "label" => __("Post Id", "gravityforms")));
array_push($form["fields"], array("id" => "user_agent", "label" => __("User Agent", "gravityforms")));
array_push($form["fields"], array("id" => "ip", "label" => __("User IP", "gravityforms")));
$entry_count = RGFormsModel::get_lead_count($form_id, "", null, null, $start_date, $end_date);
$page_size = 200;
$offset = 0;
//Adding BOM marker for UTF-8
$lines = chr(239) . chr(187) . chr(191);
// set the separater
$separator = apply_filters('gform_export_separator_' . $form_id, apply_filters('gform_export_separator', ',', $form_id), $form_id);
$field_rows = self::get_field_row_count($form, $fields, $entry_count);
//writing header
foreach ($fields as $field_id) {
$field = RGFormsModel::get_field($form, $field_id);
$value = str_replace('"', '""', GFCommon::get_label($field, $field_id));
$subrow_count = isset($field_rows[$field_id]) ? intval($field_rows[$field_id]) : 0;
if ($subrow_count == 0) {
$lines .= '"' . $value . '"' . $separator;
} else {
for ($i = 1; $i <= $subrow_count; $i++) {
$lines .= '"' . $value . " " . $i . '"' . $separator;
}
}
}
$lines = substr($lines, 0, strlen($lines) - 1) . "\n";
//paging through results for memory issues
while ($entry_count > 0) {
$leads = RGFormsModel::get_leads($form_id, "date_created", "DESC", "", $offset, $page_size, null, null, false, $start_date, $end_date);
foreach ($leads as $lead) {
foreach ($fields as $field_id) {
switch ($field_id) {
case "date_created":
$lead_gmt_time = mysql2date("G", $lead["date_created"]);
$lead_local_time = GFCommon::get_local_timestamp($lead_gmt_time);
$value = date_i18n("Y-m-d H:i:s", $lead_local_time);
break;
default:
$long_text = "";
if (strlen($lead[$field_id]) >= GFORMS_MAX_FIELD_LENGTH - 10) {
$long_text = RGFormsModel::get_field_value_long($lead, $field_id, $form);
}
$value = !empty($long_text) ? $long_text : $lead[$field_id];
break;
}
if (isset($field_rows[$field_id])) {
$list = empty($value) ? array() : unserialize($value);
foreach ($list as $row) {
$row_values = array_values($row);
$row_str = implode("|", $row_values);
$lines .= '"' . str_replace('"', '""', $row_str) . '"' . $separator;
}
//filling missing subrow columns (if any)
$missing_count = intval($field_rows[$field_id]) - count($list);
for ($i = 0; $i < $missing_count; $i++) {
$lines .= '""' . $separator;
}
} else {
$value = maybe_unserialize($value);
if (is_array($value)) {
$value = implode("|", $value);
}
$lines .= '"' . str_replace('"', '""', $value) . '"' . $separator;
}
}
$lines = substr($lines, 0, strlen($lines) - 1);
$lines .= "\n";
}
$offset += $page_size;
$entry_count -= $page_size;
if (!seems_utf8($lines)) {
$lines = utf8_encode($lines);
}
echo $lines;
$lines = "";
}
}
示例4: array
// i need to do some counting here, or rather at the end;
// if the number of steps = 0, output a message
// and unhide the section and increment use_this_section_id
$number_of_steps_selected = 0;
// build the div with the goal title
$goal_text_div = '<div class="report-top">';
$goal_text_div .= '<h4 class="plan-goal-top">Goal ' . ($goal_index + 1) . ': ' . $my_selected_goal_names[$goal_index] . '</h4>';
$goal_text_div .= '</div>';
// echo out the javascript needed to fill the 'section' div, and show the page
echo '<script>fillDiv(' . $use_this_section_id . ',\'' . $goal_text_div . '\');</script>';
// define steps arrays
$policy_step_names = array();
$practice_step_names = array();
$communication_step_names = array();
// find BUILDER leads for current user
$builder_leads = RGFormsModel::get_leads($selected_ap_builder_form_id);
// get the form meta for the GOALS AND PLANNING form from ID
$builder_form_meta = RGFormsModel::get_form_meta($selected_ap_builder_form_id);
// loop BUILDER results and return the 1st lead that matches on user-login
$my_builder_lead = null;
$user_field_id = get_field_id_by_label('user-login', $builder_form_meta);
foreach ($builder_leads as $builder_lead) {
if ($builder_lead[$user_field_id] == $user_login) {
$my_builder_lead = $builder_lead;
break;
}
}
// loop all fields
$am_i_first = true;
$last_step_in_goal = '';
if (is_array($builder_form_meta["fields"])) {
示例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");
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");
//.........这里部分代码省略.........
示例6: lead_detail_page
public static function lead_detail_page()
{
global $wpdb;
global $current_user;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$form = RGFormsModel::get_form_meta($_GET["id"]);
$form = apply_filters("gform_admin_pre_render_" . $form["id"], apply_filters("gform_admin_pre_render", $form));
$lead_id = rgget('lid');
$filter = rgget("filter");
$status = in_array($filter, array("trash", "spam")) ? $filter : "active";
$search = rgget("s");
$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";
$star = $filter == "star" ? 1 : null;
$read = $filter == "unread" ? 0 : null;
// added status as an optional parameter to get_lead_count because the counts are inaccurate without using the status
$lead_count = RGFormsModel::get_lead_count($form['id'], $search, $star, $read, null, null, $status);
$prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
$next_pos = !rgblank($position) && $position < $lead_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 == $lead_count) {
$next_pos = false;
}
}
// get the lead
$leads = RGFormsModel::get_leads($form['id'], $sort_field, $sort_direction, $search, $position, 1, $star, $read, $is_numeric, null, null, $status);
if (!$lead_id) {
$lead = !empty($leads) ? $leads[0] : false;
} else {
$lead = RGFormsModel::get_lead($lead_id);
}
if (!$lead) {
_e("Oops! We couldn't find your lead. 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');
RGFormsModel::save_lead($form, $lead);
do_action("gform_after_update_entry", $form, $lead["id"]);
do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]);
$lead = RGFormsModel::get_lead($lead["id"]);
$lead = GFFormsModel::set_entry_meta($lead, $form);
break;
case "add_note":
check_admin_referer('gforms_update_note', 'gforms_update_note');
$user_data = get_userdata($current_user->ID);
RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"]));
//emailing notes if configured
if (rgpost("gentry_email_notes_to")) {
$email_to = $_POST["gentry_email_notes_to"];
$email_from = $current_user->user_email;
$email_subject = stripslashes($_POST["gentry_email_subject"]);
$headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
$result = wp_mail($email_to, $email_subject, stripslashes($_POST["new_note"]), $headers);
}
break;
case "add_quick_note":
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
$user_data = get_userdata($current_user->ID);
RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["quick_note"]));
break;
case "bulk":
check_admin_referer('gforms_update_note', 'gforms_update_note');
if ($_POST["bulk_action"] == "delete") {
RGFormsModel::delete_notes($_POST["note"]);
}
break;
case "trash":
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
RGFormsModel::update_lead_property($lead["id"], "status", "trash");
$lead = RGFormsModel::get_lead($lead["id"]);
break;
case "restore":
case "unspam":
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
RGFormsModel::update_lead_property($lead["id"], "status", "active");
$lead = RGFormsModel::get_lead($lead["id"]);
break;
case "spam":
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
RGFormsModel::update_lead_property($lead["id"], "status", "spam");
$lead = RGFormsModel::get_lead($lead["id"]);
break;
case "delete":
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
RGFormsModel::delete_lead($lead["id"]);
?>
<script type="text/javascript">
document.location.href='<?php
echo "admin.php?page=gf_entries&view=entries&id=" . absint($form["id"]);
//.........这里部分代码省略.........
示例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");
$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}" : "";
//.........这里部分代码省略.........
示例8: get_bloginfo
// wordpress urls
$template_url = get_bloginfo('template_url');
$site_url = get_site_url();
// user info
$user_login = $current_user->user_login;
// find prev/next page in menu
$pagelist = get_pages('sort_column=menu_order&sort_order=asc');
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$prevID = $pages[$current - 1];
$nextID = $pages[$current + 1];
// find all PRACTICE leads
$practice_leads = RGFormsModel::get_leads(4);
// practice form_id=4
// gather the first 5 (or fewer) leads for this user
$my_practice_leads = array();
$has_practice_lead = false;
$total_practice_leads = 0;
$i = 0;
foreach ($practice_leads as $practice_lead) {
if ($practice_lead['29'] == $user_login) {
array_push($my_practice_leads, $practice_lead);
$has_practice_lead = true;
$total_practice_leads++;
if (++$i == 4) {
break;
}
}
示例9: deleteAllMyEntries
function deleteAllMyEntries()
{
// get current user info
global $current_user;
get_currentuserinfo();
$user_id = $current_user->ID;
// initialize
$result = "";
$my_lead_ids = array();
$successes = 0;
$failures = 0;
$failure_msg = "";
// find entries for this user in all forms that we want to wipe out
$form_ids = array(1, 4, 7, 8, 10, 16, 18, 19, 20, 21, 22, 49);
foreach ($form_ids as $form_id) {
// reset running count of number of entries found
$number_of_entries_f[$form_id] = 0;
// get all leads for that form id
$leads = RGFormsModel::get_leads($form_id);
// get form meta and then user-login field id for each form
$form_meta = RGFormsModel::get_form_meta($form_id);
$form_title = $form_meta["title"];
// get leads that match on user-login
foreach ($leads as $lead) {
if ($lead['created_by'] == $user_id) {
array_push($my_lead_ids, $lead['id']);
$number_of_entries_f[$form_id]++;
}
}
$result .= $form_title . ": " . $number_of_entries_f[$form_id] . "<br/>";
}
// delete the entries
foreach ($my_lead_ids as $lead_id) {
$del_result = GFAPI::delete_entry($lead_id);
//echo "dr: ".$del_result;
if ($del_result == true) {
$successes++;
} else {
$failures++;
$failure_msg .= "<br>" . $del_result;
}
}
$final_result = "<br><br><b>Reset of all forms is complete.</b><br/><br/>Details - Attempted to delete the following number of entries:<br/>" . $result;
$final_result .= "<br/>Successes: " . $successes . "<br/>Failures: " . $failures . "<br>" . $failure_msg;
return $final_result;
}
示例10: gpoll_get_data
public function gpoll_get_data($form_id, $gpoll_data = array())
{
$time_start = microtime(true);
$max_execution_time = 20;
//seconds
$form_meta = RGFormsModel::get_form_meta($form_id);
$form_meta = apply_filters("gform_polls_form_pre_results_{$form_id}", apply_filters("gform_polls_form_pre_results", $form_meta));
$totals = RGFormsModel::get_form_counts($form_id);
$total = $totals["total"];
$sort_field_number = 0;
$sort_direction = 'DESC';
$search = '';
$offset = 0;
$page_size = 200;
$star = null;
$read = null;
$is_numeric_sort = false;
$start_date = null;
$end_date = null;
$status = 'active';
$field_counter = 0;
if (empty($gpoll_data)) {
//first build list of fields to count and later count the entries
//it's split up this way to avoid a timeout on large resultsets
foreach ($form_meta["fields"] as $field) {
$fieldid = $field["id"];
if ($field["type"] !== "poll") {
continue;
}
$gpoll_field_data = array("field_label" => $field["label"], "field_id" => $fieldid, "type" => $field["type"], "inputType" => $field["inputType"]);
$gpoll_data["fields"][$field_counter] = $gpoll_field_data;
$gpoll_input_data = array();
//for checkboxes
if ($field["inputType"] == "checkbox") {
$input_counter = 0;
foreach ($field["inputs"] as $input) {
$inputid = str_replace(".", "_", $input["id"]);
$gpoll_input_data = array("input_id" => "#choice_{$inputid}", "label" => $input["label"]);
$gpoll_data["fields"][$field_counter]["inputs"][$input_counter] = $gpoll_input_data;
$input_counter += 1;
}
} else {
//for radio & dropdowns
$choice_counter = 0;
if (isset($field["enableOtherChoice"]) && $field["enableOtherChoice"] === true) {
$choice_index = count($field["choices"]);
$field["choices"][$choice_index]["text"] = __("Other", "gravityformspolls");
}
foreach ($field["choices"] as $choice) {
$gpoll_input_data = array("input_id" => "#choice_{$fieldid}_{$choice_counter}", "label" => $choice["text"]);
$gpoll_data["fields"][$field_counter]["inputs"][$choice_counter] = $gpoll_input_data;
$choice_counter += 1;
}
}
$field_counter += 1;
$i = $offset;
}
} else {
$i = $gpoll_data["offset"];
unset($gpoll_data["offset"]);
}
$precision = apply_filters("gform_polls_percentage_precision", 0, $form_id);
//get leads in groups of $page_size to avoid timeouts
while ($i <= $total) {
$field_counter = 0;
$get_leads_time_start = microtime(true);
$entries = RGFormsModel::get_leads($form_id, $sort_field_number, $sort_direction, $search, $i, $page_size, null, null, false, null, null);
$get_leads_time_end = microtime(true);
$get_leads_time = $get_leads_time_end - $get_leads_time_start;
//loop through each field currently on the form and count the entries for each choice
foreach ($form_meta["fields"] as $field) {
$fieldid = $field["id"];
if ($field["type"] !== "poll") {
continue;
}
if (isset($gpoll_data["fields"][$field_counter]["total_entries"])) {
$field_total_entries = $gpoll_data["fields"][$field_counter]["total_entries"];
} else {
$field_total_entries = 0;
}
foreach ($entries as $entry) {
$entry_value = RGFormsModel::get_lead_field_value($entry, $field);
if (false === empty($entry_value)) {
$field_total_entries++;
}
}
$gpoll_data["fields"][$field_counter]["total_entries"] = $field_total_entries;
$gpoll_input_data = array();
// checkboxes store entries differently to radio & dropdowns
if ($field["inputType"] == "checkbox") {
//for checkboxes
// loop through all the choices and count the entries for each choice
$input_counter = 0;
foreach ($field["inputs"] as $input) {
// running total of entries for each set of entries
if (isset($gpoll_data["fields"][$field_counter]["inputs"][$input_counter]["total_entries"])) {
$total_entries = $gpoll_data["fields"][$field_counter]["inputs"][$input_counter]["total_entries"];
} else {
$total_entries = 0;
}
//.........这里部分代码省略.........
示例11: get_header
/*
Template Name: Tool Page
*/
?>
<?php
// get the wp header
get_header();
// get all of the Advanced Custom Fields for this page
$fields = get_fields();
// get current user
$user_login = $current_user->user_login;
// find BACKGROUND info for current user
$my_background_lead = null;
$background_leads = RGFormsModel::get_leads(6);
// form_id=6
// loop results and return the first ONE for this user
foreach ($background_leads as $background_lead) {
if ($background_lead['9'] == $user_login) {
$my_background_lead = $background_lead;
break;
}
}
// find prev/next page in menu
$pagelist = get_pages('sort_column=menu_order&sort_order=asc');
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
示例12: get_bloginfo
echo "<h4>" . $fields['subtitle'] . "</h4>";
}
?>
<?php
// image tags
$template_url = get_bloginfo('template_url');
$greencheck_url = $template_url . "/images/icon-green-check.png";
$orangemark_url = $template_url . "/images/icon-orange-ex-point.png";
$redex_url = $template_url . "/images/icon-red-ex.png";
//user info
$user_login = $current_user->user_login;
// find leads for current user
//function get_leads($form_id, $sort_field_number=0, $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')
$leads = RGFormsModel::get_leads(1, 0, 'DESC', $user_login);
//<?php if ($entry_count > 0) { code hidden here... };
?>
<div class="results-table">
<!-- only write out the results table if results were found -->
<?php
if ($results_found == 'false') {
echo "<div class='no-results'><p><b>No results were found for your IP</b> (" . $ip . ")</p>";
echo "<p> </p>";
echo "<p>You must first complete the interview questions. </p>";
echo "<p>Use the link to the left to start the interview, and make sure to click submit when you are done.</p></div>";
} else {
?>
示例13:
// get the form meta for the GOALS AND PLANNING form
$form = RGFormsModel::get_form_meta(7);
// get the field with the checkboxed goals
$field = RGFormsModel::get_field($form, 2);
// get the labels for each option in that field
$label_s1 = $field["choices"][0]["text"];
$label_s2 = $field["choices"][1]["text"];
$label_s3 = $field["choices"][2]["text"];
$label_s4 = $field["choices"][3]["text"];
$label_s5 = $field["choices"][4]["text"];
$label_s6 = $field["choices"][5]["text"];
$label_s7 = $field["choices"][6]["text"];
$label_s8 = $field["choices"][7]["text"];
$label_s9 = $field["choices"][8]["text"];
// find GOALS leads for current user
$goal_leads = RGFormsModel::get_leads(7);
// form_id=7
// loop GOALS results and return the 1st lead that matches on user-login
$my_goal_lead = null;
$has_goal_lead = false;
foreach ($goal_leads as $goal_lead) {
if ($goal_lead['4'] == $user_login) {
$my_goal_lead = $goal_lead;
$has_goal_lead = true;
break;
}
}
// find which goals were checked/selected in this lead
$buttons_div = "<div class='goal-buttons-div'>";
if ($my_goal_lead['2.1']) {
$buttons_div = $buttons_div . "<p><a href='" . $site_url . "/tools/action-plan-builder/mod-pa/' class='btn btn-block'>" . $label_s1 . "</a></p>";
示例14: get_btc_participants
function get_btc_participants($form_id, $event_id)
{
// cache participants per form
$cacher = new Cacher();
$registrants = $cacher->get_cache('gravity_forms_' . $form_id);
if ($registrants == false) {
$registrants = RGFormsModel::get_leads($form_id, '2', 'ASC', '', 0, 500000);
$cacher->set_cache($registrants, 'gravity_forms_' . $form_id);
}
$racers = array();
foreach ($registrants as $racer) {
if ($racer[EVENT_FIELD_ID] == $event_id) {
$racers[$racer["id"]] = $racer['92'];
}
}
return $racers;
}
示例15: foreach
// find GOAL leads for current user
$my_goal_lead = null;
$goal_leads = RGFormsModel::get_leads(7);
// loop GOALS results and return the 1st lead that matches on user-login
foreach ($goal_leads as $goal_lead) {
if ($goal_lead['4'] == $user_login) {
$my_goal_lead = $goal_lead;
break;
}
}
// find only if current user has any BUILDER leads
$has_builder_lead = false;
$builder_form_ids = array(8, 10, 16, 17, 18, 19, 20, 21, 22);
foreach ($builder_form_ids as $form_id) {
// get all leads for that form id
$builder_leads = RGFormsModel::get_leads($form_id);
// get form meta for that form id, to use for matching on user-login
$builder_form_meta = RGFormsModel::get_form_meta($form_id);
// get leads that match on user-login
$user_field_id = get_field_id_by_label('user-login', $builder_form_meta);
foreach ($builder_leads as $builder_lead) {
if ($builder_lead[$user_field_id] == $user_login) {
$has_builder_lead = true;
break;
}
}
}
// if user has builder leads, then they will have an ACTION PLAN
$has_action_plan = $has_builder_lead;
// ROWS //////////////////////////////////////////////////////
// BACKGROUND row