#,
Ranq_Forms_Post_Type::POST_TYPE, 'post_status' => array( 'publish', 'draft' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC', 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, ) ); if ( ! $form_id && $forms ) { $form_id = (int) $forms[0]->ID; } // The entry count per form. The same figure serves the picker, the empty screen // and the pointer to a form that already has entries, so it is counted once, in // one query for all the forms rather than one query per form. $counts = Ranq_Forms_Entries::counts_by_form(); $total = isset( $counts[ $form_id ] ) ? $counts[ $form_id ] : 0; $entries = $form_id ? Ranq_Forms_Entries::get_for_form( $form_id, self::PER_PAGE, ( $paged - 1 ) * self::PER_PAGE ) : array(); $fields = array(); // Only fields that really take input are shown. A heading, a divider and a // page break have no value, so they have nothing to show either. if ( $form_id ) { foreach ( Ranq_Forms_Fields::get_form_fields( $form_id ) as $one ) { $object = isset( $one['type'] ) ? Ranq_Forms_Fields::get( $one['type'] ) : null; if ( $object instanceof Ranq_Forms_Field && $object->is_input() ) { $fields[] = $one; } } } $open = null; $index = 0; foreach ( $entries as $i => $one ) { if ( $open_id && (int) $one['id'] === $open_id ) { $open = $one; $index = (int) $i; break; } } if ( ! $open && $entries ) { $open = $entries[0]; } // A form that already has entries, so the empty screen has something to offer. $other = 0; $other_n = 0; // Only a form that still exists is offered. The counts come from the entries // table, which keeps the entries of a form that has since been deleted. foreach ( $forms as $one ) { $id = (int) $one->ID; $n = isset( $counts[ $id ] ) ? (int) $counts[ $id ] : 0; if ( $id !== (int) $form_id && $n > $other_n ) { $other = $id; $other_n = $n; } } $base = admin_url( 'admin.php?page=' . Ranq_Forms_Admin::PAGE_ENTRIES . '&form_id=' . (int) $form_id ); $table = Ranq_Forms_Install::entries_table(); $code = '[2ranq_form id="' . (int) $form_id . '"]'; $notify = (string) get_option( 'ranq_forms_notify_email', get_option( 'admin_email' ) ); $name = $form_id ? get_the_title( $form_id ) : ''; $day = ''; ?>