GravityView  2.10.1
The best, easiest way to display Gravity Forms entries on your website.
class-admin-approve-entries.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-admin-approve-entries.php
4  * @package GravityView
5  * @license GPL2+
6  * @author GravityView <[email protected]>
7  * @link http://gravityview.co
8  * @copyright Copyright 2014, Katz Web Services, Inc.
9  *
10  * @since 1.0.0
11  */
12 
13 
14 
16 
17  // hold notification messages
18  public $bulk_update_message = '';
19 
20  /**
21  * @var array Set the prefixes here instead of spread across the class
22  * @since 1.17
23  */
24  private $bulk_action_prefixes = array(
25  'approve' => 'gvapprove',
26  'disapprove' => 'gvdisapprove',
27  'unapprove' => 'gvunapprove',
28  );
29 
30  function __construct() {
31 
32  $this->add_hooks();
33 
34  }
35 
36  private function add_hooks() {
37  /** Edit Gravity Form page */
38 
39  // Add button to left menu
40  add_filter( 'gform_add_field_buttons', array( $this, 'add_field_buttons' ) );
41  // Set defaults
42  add_action( 'gform_editor_js_set_default_values', array( $this, 'set_defaults' ) );
43 
44  /** gf_entries page - entries table screen */
45 
46  // capture bulk actions
47  add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
48 
49  // add hidden field with approve status
50  add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
51 
52  add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) );
53 
54  // adding styles and scripts
55  add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
56  // bypass Gravity Forms no-conflict mode
57  add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
58  add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
59 
60  add_filter( 'gform_filter_links_entry_list', array( $this, 'filter_links_entry_list' ), 10, 3 );
61  }
62 
63  /**
64  * Add filter links to the Entries page
65  *
66  * Can be disabled by returning false on the `gravityview/approve_entries/show_filter_links_entry_list` filter
67  *
68  * @since 1.17.1
69  *
70  * @param array $filter_links Array of links to include in the subsubsub filter list. Includes `id`, `field_filters`, `count`, and `label` keys
71  * @param array $form GF Form object of current form
72  * @param bool $include_counts Whether to include counts in the output
73  *
74  * @return array Filter links, with GravityView approved/disapproved links added
75  */
76  public function filter_links_entry_list( $filter_links = array(), $form = array(), $include_counts = true ) {
77 
78  /**
79  * @filter `gravityview/approve_entries/show_filter_links_entry_list` Disable filter links
80  * @since 1.17.1
81  * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
82  * @param array $form GF Form object of current form
83  */
84  if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
85  return $filter_links;
86  }
87 
88  $field_filters_approved = array(
89  array(
92  ),
93  );
94 
95  $field_filters_disapproved = array(
96  array(
99  ),
100  );
101 
102  $field_filters_unapproved = array(
103  array(
106  ),
107  );
108 
109  $approved_count = $disapproved_count = $unapproved_count = 0;
110 
111  // Only count if necessary
112  if( $include_counts ) {
113  $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
114  $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
115  $unapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) );
116  }
117 
118  $filter_links[] = array(
119  'id' => 'gv_approved',
120  'field_filters' => $field_filters_approved,
121  'count' => $approved_count,
123  );
124 
125  $filter_links[] = array(
126  'id' => 'gv_disapproved',
127  'field_filters' => $field_filters_disapproved,
128  'count' => $disapproved_count,
130  );
131 
132  $filter_links[] = array(
133  'id' => 'gv_unapproved',
134  'field_filters' => $field_filters_unapproved,
135  'count' => $unapproved_count,
137  );
138 
139  return $filter_links;
140  }
141 
142  /**
143  * Add the GravityView Fields group tooltip
144  *
145  * @param $tooltips
146  *
147  * @return array Tooltips array with GravityView fields tooltip
148  */
149  function tooltips( $tooltips ) {
150 
151  $tooltips['form_gravityview_fields'] = array(
152  'title' => __('GravityView Fields', 'gravityview'),
153  'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
154  );
155 
156  return $tooltips;
157  }
158 
159 
160  /**
161  * Inject new add field buttons in the gravity form editor page
162  *
163  * @param mixed $field_groups
164  * @return array Array of fields
165  */
166  function add_field_buttons( $field_groups ) {
167 
168  $gravityview_fields = array(
169  'name' => 'gravityview_fields',
170  'label' => 'GravityView',
171  'fields' => array(
172  array(
173  'class' => 'button',
174  'value' => __( 'Approve/Reject', 'gravityview' ),
175  'onclick' => "StartAddField('gravityviewapproved_admin');",
176  'data-type' => 'gravityviewapproved_admin',
177  'data-icon' => 'dashicons-yes-alt'
178  ),
179  array(
180  'class' => 'button',
181  'value' => __( 'User Opt-In', 'gravityview' ),
182  'onclick' => "StartAddField('gravityviewapproved');",
183  'data-type' => 'gravityviewapproved',
184  'data-icon' => 'dashicons-media-text',
185  ),
186  )
187  );
188 
189  array_push( $field_groups, $gravityview_fields );
190 
191  return $field_groups;
192  }
193 
194 
195 
196  /**
197  * At edit form page, set the field Approve defaults
198  *
199  * @todo Convert to a partial include file
200  * @return void
201  */
202  function set_defaults() {
203  ?>
204  case 'gravityviewapproved_admin':
205  field.label = "<?php echo esc_js( __( 'Approved? (Admin-only)', 'gravityview' ) ); ?>";
206 
207  field.adminLabel = "<?php echo esc_js( __( 'Approved?', 'gravityview' ) ); ?>";
208  field.adminOnly = true;
209 
210  field.choices = null;
211  field.inputs = null;
212 
213  if( !field.choices ) {
214  field.choices = new Array( new Choice("<?php echo esc_js( GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ) ); ?>") );
215  }
216 
217  field.inputs = new Array();
218  for( var i=1; i<=field.choices.length; i++ ) {
219  field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text));
220  }
221 
222  field.type = 'checkbox';
223  field.gravityview_approved = 1;
224 
225  break;
226  case 'gravityviewapproved':
227  field.label = "<?php echo esc_js( __( 'Show Entry on Website', 'gravityview' ) ); ?>";
228 
229  field.adminLabel = "<?php echo esc_js( __( 'Opt-In', 'gravityview' ) ); ?>";
230  field.adminOnly = false;
231 
232  field.choices = null;
233  field.inputs = null;
234 
235  if( !field.choices ) {
236  field.choices = new Array(
237  new Choice("<?php echo esc_js( __( 'Yes, display my entry on the website', 'gravityview' ) ); ?>")
238  );
239  }
240 
241  field.inputs = new Array();
242  for( var i=1; i<=field.choices.length; i++ ) {
243  field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text));
244  }
245 
246  field.type = 'checkbox';
247  field.gravityview_approved = 1;
248 
249  break;
250  <?php
251  }
252 
253  /**
254  * Get the Bulk Action submitted value if it is a GravityView Approve/Unapprove action
255  *
256  * @since 1.17.1
257  *
258  * @return string|false If the bulk action was GravityView Approve/Unapprove, return the full string (gvapprove-16, gvunapprove-16). Otherwise, return false.
259  */
260  private function get_gv_bulk_action() {
261 
262  $gv_bulk_action = false;
263 
264  if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
265  $bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' );
266  } else {
267  // GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
268  $bulk_action = \GV\Utils::_POST( 'bulk_action' ) ? \GV\Utils::_POST( 'bulk_action' ) : \GV\Utils::_POST( 'bulk_action2' );
269  }
270 
271  // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
272  if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
273  $gv_bulk_action = $bulk_action;
274  }
275 
276  return $gv_bulk_action;
277  }
278 
279  /**
280  * Capture bulk actions - gf_entries table
281  *
282  * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
283  * @return void|boolean
284  */
285  public function process_bulk_action() {
286 
287  if ( ! is_admin() || ! class_exists( 'GFForms' ) || empty( $_POST ) ) {
288  return false;
289  }
290 
291  // The action is formatted like: gvapprove-16 or gvunapprove-16, where the first word is the name of the action and the second is the ID of the form.
292  $bulk_action = $this->get_gv_bulk_action();
293 
294  // gforms_entry_list is the nonce that confirms we're on the right page
295  // gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
296  if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) {
297 
298  check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
299 
300  /**
301  * The extra '-' is to make sure that there are at *least* two items in array.
302  * @see https://github.com/katzwebservices/GravityView/issues/370
303  */
304  $bulk_action .= '-';
305 
306  list( $approved_status, $form_id ) = explode( '-', $bulk_action );
307 
308  if ( empty( $form_id ) ) {
309  gravityview()->log->error( 'Form ID is empty from parsing bulk action.', array( 'data' => $bulk_action ) );
310  return false;
311  }
312 
313  // All entries are set to be updated, not just the visible ones
314  if ( ! empty( $_POST['all_entries'] ) ) {
315 
316  // Convert the current entry search into GF-formatted search criteria
317  $search = array(
318  'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
319  'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
320  'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
321  );
322 
323  $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
324 
325  // Get all the entry IDs for the form
326  $entries = gravityview_get_entry_ids( $form_id, $search_criteria );
327 
328  } else {
329 
330  // Changed from 'lead' to 'entry' in 2.0
331  $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
332 
333  }
334 
335  if ( empty( $entries ) ) {
336  gravityview()->log->error( 'Entries are empty' );
337  return false;
338  }
339 
340  $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
341 
342  switch ( $approved_status ) {
343  case $this->bulk_action_prefixes['approve']:
345  $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
346  break;
347  case $this->bulk_action_prefixes['unapprove']:
349  $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
350  break;
351  case $this->bulk_action_prefixes['disapprove']:
353  $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
354  break;
355  }
356  }
357  }
358 
359 
360  /**
361  * update_approved function.
362  *
363  * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
364  * @see GravityView_Entry_Approval::update_approved
365  *
366  * @param int $entry_id (default: 0)
367  * @param int $approved (default: 0)
368  * @param int $form_id (default: 0)
369  * @param int $approvedcolumn (default: 0)
370  *
371  * @return boolean True: It worked; False: it failed
372  */
373  public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
374  return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
375  }
376 
377  /**
378  * Calculate the approve field.input id
379  *
380  * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
381  * @see GravityView_Entry_Approval::get_approved_column
382  *
383  * @param mixed $form GF Form or Form ID
384  * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
385  */
386  static public function get_approved_column( $form ) {
387  return GravityView_Entry_Approval::get_approved_column( $form );
388  }
389 
390  /**
391  * Add a hidden input that is used in the Javascript to show approved/disapproved entries checkbox
392  *
393  * See the /assets/js/admin-entries-list.js setInitialApprovedEntries method
394  *
395  * @param $form_id
396  * @param $field_id
397  * @param $value
398  * @param $entry
399  * @param $query_string
400  *
401  * @return void
402  */
403  static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
404 
405  if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
406  return;
407  }
408 
409  if( empty( $entry['id'] ) ) {
410  return;
411  }
412 
413  $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
414 
415  if( $status_value ) {
416  echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
417  }
418  }
419 
420  /**
421  * Get the form ID of the form currently being displayed
422  *
423  * @since 1.17.1
424  *
425  * @return int ID of the current form being displayed. `0` is returned if no forms are found.
426  */
427  private function get_form_id() {
428 
429  $form_id = GFForms::get('id');
430 
431  // If there are no forms identified, use the first form. That's how GF does it.
432  if( empty( $form_id ) && class_exists('RGFormsModel') ) {
433  $form_id = $this->get_first_form_id();
434  }
435 
436  return absint( $form_id );
437  }
438 
439  /**
440  * Get the first form ID from Gravity Forms, sorted in the same order as in the All Forms page
441  *
442  * @see GFEntryList::all_entries_page() This method is based on the form-selecting code here
443  *
444  * @since 1.17.2
445  *
446  * @return int ID of the first form, sorted by title. `0` if no forms were found.
447  */
448  private function get_first_form_id() {
449 
450  $forms = RGFormsModel::get_forms( null, 'title' );
451 
452  if( ! isset( $forms[0] ) ) {
453  gravityview()->log->error( 'No forms were found' );
454  return 0;
455  }
456 
457  $first_form = $forms[0];
458 
459  $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
460 
461  return intval( $form_id );
462  }
463 
464 
465  function add_scripts_and_styles( $hook ) {
466 
467  if( ! class_exists( 'GFForms' ) ) {
468  gravityview()->log->error( 'GFForms does not exist.' );
469  return;
470  }
471 
472  // enqueue styles & scripts gf_entries
473  // But only if we're on the main Entries page, not on reports pages
474  if( GFForms::get_page() !== 'entry_list' ) {
475  return;
476  }
477 
478  $form_id = $this->get_form_id();
479 
480  // Things are broken; no forms were found
481  if( empty( $form_id ) ) {
482  return;
483  }
484 
485  wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
486 
487  $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
488 
489  wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
490 
491  wp_enqueue_script( 'gravityview_entries_list-popper', plugins_url( 'assets/lib/tippy/popper.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
492  wp_enqueue_script( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
493  wp_enqueue_style( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
494 
495  wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
496  'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
497  'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
498  'form_id' => $form_id,
499  'show_column' => (int)$this->show_approve_entry_column( $form_id ),
500  'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
501  'status_approved' => GravityView_Entry_Approval_Status::APPROVED,
502  'status_disapproved' => GravityView_Entry_Approval_Status::DISAPPROVED,
503  'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
504  'bulk_actions' => $this->get_bulk_actions( $form_id ),
505  'bulk_message' => $this->bulk_update_message,
506  'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
507  'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
508  'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
509  'column_title' => __( 'Show entry in directory view?', 'gravityview'),
510  'column_link' => esc_url( $this->get_sort_link() ),
511  'status_popover_template' => GravityView_Entry_Approval::get_popover_template(),
512  'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(),
513  ) );
514 
515  }
516 
517  /**
518  * Generate a link to sort by approval status
519  *
520  * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
521  * numeric, but it does group the approved entries together.
522  *
523  * @since 2.0.14 Remove need for approval field for sorting by approval status
524  *
525  * @param int $form_id [NO LONGER USED]
526  *
527  * @return string Sorting link
528  */
529  private function get_sort_link( $form_id = 0 ) {
530 
531  $args = array(
532  'orderby' => 'is_approved',
533  'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc',
534  );
535 
536  return add_query_arg( $args );
537  }
538 
539  /**
540  * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group
541  *
542  * @since 1.16.3
543  *
544  * @param int $form_id ID of the form currently being displayed
545  *
546  * @return array Array of actions to be added to the GravityView option group
547  */
548  private function get_bulk_actions( $form_id ) {
549 
550  $bulk_actions = array(
551  'GravityView' => array(
552  array(
553  'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
554  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
555  ),
556  array(
557  'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
558  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
559  ),
560  array(
561  'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
562  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
563  ),
564  ),
565  );
566 
567  /**
568  * @filter `gravityview/approve_entries/bulk_actions` Modify the GravityView "Bulk action" dropdown list. Return an empty array to hide.
569  * @see https://gist.github.com/zackkatz/82785402c996b51b4dc9 for an example of how to use this filter
570  * @since 1.16.3
571  * @param array $bulk_actions Associative array of actions to be added to "Bulk action" dropdown inside GravityView `<optgroup>`. Parent array key is the `<optgroup>` label, then each child array must have `label` (displayed text) and `value` (input value) keys
572  * @param int $form_id ID of the form currently being displayed
573  */
574  $bulk_actions = apply_filters( 'gravityview/approve_entries/bulk_actions', $bulk_actions, $form_id );
575 
576  // Sanitize the values, just to be sure.
577  foreach ( $bulk_actions as $key => $group ) {
578 
579  if( empty( $group ) ) {
580  continue;
581  }
582 
583  foreach ( $group as $i => $action ) {
584  $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
585  $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
586  }
587  }
588 
589  return $bulk_actions;
590  }
591 
592  /**
593  * Should the Approve/Reject Entry column be shown in the GF Entries page?
594  *
595  * @since 1.7.2
596  *
597  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
598  *
599  * @return bool True: Show column; False: hide column
600  */
601  private function show_approve_entry_column( $form_id ) {
602 
603  $show_approve_column = GVCommon::has_cap( 'gravityview_moderate_entries' );
604 
605  /**
606  * @filter `gravityview/approve_entries/hide-if-no-connections` Return true to hide reject/approve if there are no connected Views
607  * @since 1.7.2
608  * @param boolean $hide_if_no_connections
609  */
610  $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
611 
612  if( $hide_if_no_connections ) {
613 
614  $connected_views = gravityview_get_connected_views( $form_id );
615 
616  if( empty( $connected_views ) ) {
617  $show_approve_column = false;
618  }
619  }
620 
621  /**
622  * @filter `gravityview/approve_entries/show-column` Override whether the column is shown
623  * @param boolean $show_approve_column Whether the column will be shown
624  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
625  */
626  $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
627 
628  return $show_approve_column;
629  }
630 
631  function register_gform_noconflict_script( $scripts ) {
632  $scripts[] = 'gravityview_gf_entries_scripts';
633  $scripts[] = 'gravityview_entries_list-popper';
634  $scripts[] = 'gravityview_entries_list-tippy';
635  return $scripts;
636  }
637 
638  function register_gform_noconflict_style( $styles ) {
639  $styles[] = 'gravityview_entries_list';
640  $styles[] = 'gravityview_entries_list-tippy';
641  return $styles;
642  }
643 
644 }
645 
add_field_buttons( $field_groups)
Inject new add field buttons in the gravity form editor page.
get_first_form_id()
Get the first form ID from Gravity Forms, sorted in the same order as in the All Forms page...
static update_approved( $entry_id=0, $approved=0, $form_id=0, $approvedcolumn=0)
update_approved function.
$forms
Definition: data-source.php:19
process_bulk_action()
Capture bulk actions - gf_entries table.
static get_popover_placement()
Where should the popover be placed?
$entries
static get_approved_column( $form)
Calculate the approve field.input id.
static update_bulk( $entries=array(), $approved=0, $form_id=0)
Process a bulk of entries to update the approve field/property.
gravityview()
Definition: _stubs.php:26
get( $key, $default=null)
Retrieve a setting.
if(gravityview() ->plugin->is_GF_25()) $form
static get_title_attr( $value_or_key)
Get the label for a specific approval value.
static get_search_criteria( $args, $form_id)
Parse search criteria for a entries search.
get_bulk_actions( $form_id)
Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" op...
filter_links_entry_list( $filter_links=array(), $form=array(), $include_counts=true)
Add filter links to the Entries page.
get_sort_link( $form_id=0)
Generate a link to sort by approval status.
const APPROVED
gravityview_get_connected_views( $form_id, $args=array())
Get the views for a particular form.
static update_approved( $entry_id=0, $approved=2, $form_id=0, $approvedcolumn=0)
update_approved function.
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
Definition: gravityview.php:31
$field_id
Definition: time.php:17
static get_entry_status( $entry, $value_or_label='label')
Get the approval status for an entry.
const DISAPPROVED
tooltips( $tooltips)
Add the GravityView Fields group tooltip.
static get_string( $value_or_key, $string_key='')
Get the label for a specific approval value.
get_form_id()
Get the form ID of the form currently being displayed.
if(empty( $created_by)) $form_id
const UNAPPROVED
static add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string)
Add a hidden input that is used in the Javascript to show approved/disapproved entries checkbox...
get_gv_bulk_action()
Get the Bulk Action submitted value if it is a GravityView Approve/Unapprove action.
gravityview_get_entry_ids( $form_id, $search_criteria=array())
Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method.
static get_popover_template()
Get HTML template for a popover used to display approval statuses.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
$entry
Definition: notes.php:27
set_defaults()
At edit form page, set the field Approve defaults.
show_approve_entry_column( $form_id)
Should the Approve/Reject Entry column be shown in the GF Entries page?
const meta_key
static _POST( $name, $default=null)
Grab a value from the _POST superglobal or default.
static get_label( $value_or_key)
Get the label for a specific approval value.
new GravityView_Admin_ApproveEntries