ninja_forms_tab_form_list

The Ninja Forms ninja forms tab form list function.

Description

ninja_forms_tab_form_list(); 

Usage

  1. if ( !function_exists( 'ninja_forms_tab_form_list' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/pages/ninja-forms/tabs/form-list/form-list.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_tab_form_list(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/admin/pages/ninja-forms/tabs/form-list/form-list.php  
  1. function ninja_forms_tab_form_list() { 
  2.  
  3.  
  4. $all_forms = apply_filters( 'ninja_forms_form_list_forms', Ninja_Forms()->forms()->get_all() ); 
  5.  
  6. $form_count = count($all_forms); 
  7.  
  8. if( isset( $_REQUEST['limit'] ) ) { 
  9. $saved_limit = absint( $_REQUEST['limit'] ); 
  10. $limit = absint( $_REQUEST['limit'] ); 
  11. }else{ 
  12. $saved_limit = 20; 
  13. $limit = 20; 
  14.  
  15. if( $form_count < $limit ) { 
  16. $limit = $form_count; 
  17.  
  18. if( isset( $_REQUEST['paged']) AND !empty( $_REQUEST['paged'] ) ) { 
  19. $current_page = absint( $_REQUEST['paged'] ); 
  20. }else{ 
  21. $current_page = 1; 
  22.  
  23. if( $form_count > $limit ) { 
  24. $page_count = ceil( $form_count / $limit ); 
  25. }else{ 
  26. $page_count = 1; 
  27.  
  28. if( $current_page > 1 ) { 
  29. $start = ( ( $current_page - 1 ) * $limit ); 
  30. if( $form_count < $limit ) { 
  31. $end = $form_count; 
  32. }else{ 
  33. $end = $current_page * $limit; 
  34. // $end = $end - 1; 
  35.  
  36. if( $end > $form_count ) { 
  37. $end = $form_count; 
  38. }else{ 
  39. $start = 0; 
  40. $end = $limit; 
  41.  
  42. ?> 
  43.  
  44. <ul class="subsubsub"> 
  45. <li class="all"><a href="" class="current"><?php _e( 'All', 'ninja-forms' ); ?> <span class="count">(<?php echo $form_count;?>)</span></a> 
  46. </ul> 
  47. <div id="" class="tablenav top"> 
  48. <div class="alignleft actions"> 
  49. <select id="" class="" name="bulk_action"> 
  50. <option value=""><?php _e( 'Bulk Actions', 'ninja-forms' );?></option> 
  51. <option value="delete"><?php _e( 'Delete', 'ninja-forms' );?></option> 
  52. </select> 
  53. <input type="submit" name="submit" value="<?php _e( 'Apply', 'ninja-forms' ); ?>" class="button-secondary"> 
  54. </div> 
  55. <div class="alignleft actions"> 
  56. <select id="" name="limit"> 
  57. <option value="20" <?php selected($saved_limit, 20);?>>20</option> 
  58. <option value="50" <?php selected($saved_limit, 50);?>>50</option> 
  59. <option value="100" <?php selected($saved_limit, 100);?>>100</option> 
  60. </select> 
  61. <?php _e( 'Forms Per Page', 'ninja-forms' ); ?> 
  62. <input type="submit" name="submit" value="<?php _e( 'Go', 'ninja-forms' ); ?>" class="button-secondary"> 
  63. </div> 
  64. <div id="" class="alignright navtable-pages"> 
  65. <?php 
  66. if($form_count != 0 AND $current_page <= $page_count) { 
  67. ?> 
  68. <span class="displaying-num"><?php if($start == 0) { echo 1; }else{ echo $start; }?> - <?php echo $end;?> <?php _e( 'of', 'ninja-forms' ); ?> <?php echo $form_count;?> <?php if($form_count == 1) { _e( 'Form', 'ninja-forms' ); }else{ _e( 'Forms', 'ninja-forms' ); }?></span> 
  69. <?php 
  70. if($page_count > 1) { 
  71.  
  72. $first_page = esc_url( remove_query_arg( 'paged' ) ); 
  73. $last_page = esc_url( add_query_arg( array( 'paged' => $page_count ) ) ); 
  74.  
  75. if($current_page > 1) { 
  76. $prev_page = $current_page - 1; 
  77. $prev_page = esc_url( add_query_arg( array('paged' => $prev_page ) ) ); 
  78. }else{ 
  79. $prev_page = $first_page; 
  80. if($current_page != $page_count) { 
  81. $next_page = $current_page + 1; 
  82. $next_page = esc_url( add_query_arg( array('paged' => $next_page ) ) ); 
  83. }else{ 
  84. $next_page = $last_page; 
  85.  
  86. ?> 
  87. <span class="pagination-links"> 
  88. <a class="first-page disabled" title="<?php _e( 'Go to the first page', 'ninja-forms' ); ?>" href="<?php echo $first_page;?>"></a> 
  89. <a class="prev-page disabled" title="<?php _e( 'Go to the previous page', 'ninja-forms' ); ?>" href="<?php echo $prev_page;?>">*</a> 
  90. <span class="paging-input"><input class="current-page" title="<?php _e( 'Current page', 'ninja-forms' ); ?>" type="text" name="paged" value="<?php echo $current_page;?>" size="2"> <?php _e( 'of', 'ninja-forms' ); ?> <span class="total-pages"><?php echo $page_count;?></span></span> 
  91. <a class="next-page" title="<?php _e( 'Go to the next page', 'ninja-forms' ); ?>" href="<?php echo $next_page;?>">*</a> 
  92. <a class="last-page" title="<?php _e( 'Go to the last page', 'ninja-forms' ); ?>" href="<?php echo $last_page;?>"></a> 
  93. </span> 
  94. <?php 
  95. ?> 
  96. </div> 
  97. </div> 
  98. <table class="wp-list-table widefat fixed posts"> 
  99. <thead> 
  100. <tr> 
  101. <th class="check-column"><input type="checkbox" id="" class="ninja-forms-select-all" title="ninja-forms-bulk-action"></th> 
  102. <th><?php _e( 'Form Title', 'ninja-forms' );?></th> 
  103. <th><?php _e( 'Shortcode', 'ninja-forms' );?></th> 
  104. <th><?php _e( 'Template Function', 'ninja-forms' );?></th> 
  105. <th><?php _e( 'Date Updated', 'ninja-forms' );?></th> 
  106. </tr> 
  107. </thead> 
  108. <tbody> 
  109. <?php 
  110. if(is_array($all_forms) AND !empty($all_forms) AND $current_page <= $page_count) { 
  111. for ($i = $start; $i < $end; $i++) { 
  112. $form_id = $all_forms[$i]; 
  113. $data = Ninja_Forms()->form( $form_id )->get_all_settings(); 
  114. $date_updated = $data['date_updated']; 
  115. $date_updated = strtotime( $date_updated ); 
  116. $date_updated = date_i18n( 'F d, Y', $date_updated ); 
  117. $link = esc_url( remove_query_arg( array( 'paged' ) ) ); 
  118. $edit_link = esc_url( add_query_arg( array( 'tab' => 'builder', 'form_id' => $form_id ), $link ) ); 
  119. $subs_link = admin_url( 'edit.php?post_status=all&post_type=nf_sub&action=-1&m=0&form_id=' . $form_id . '&paged=1&mode=list&=-1' ); 
  120. $duplicate_link = esc_url( add_query_arg( array( 'duplicate_form' => 1, 'form_id' => $form_id ), $link ) ); 
  121. $shortcode = apply_filters ( "ninja_forms_form_list_shortcode", "[ninja_forms id=" . $form_id . "]", $form_id ); 
  122. $template_function = apply_filters ( "ninja_forms_form_list_template_function", "<pre>if( function_exists( 'ninja_forms_display_form' ) ) { ninja_forms_display_form( " . "$form_id" . " ); }</pre>", $form_id ); 
  123. ?> 
  124. <tr id="ninja_forms_form_<?php echo $form_id;?>_tr"> 
  125. <th scope="row" class="check-column"> 
  126. <input type="checkbox" id="" name="form_ids[]" value="<?php echo $form_id;?>" class="ninja-forms-bulk-action"> 
  127. </th> 
  128. <td class="post-title page-title column-title"> 
  129. <strong> 
  130. <a href="<?php echo $edit_link;?>"><?php echo stripslashes( $data['form_title'] );?></a> 
  131. </strong> 
  132. <div class="row-actions"> 
  133. <span class="edit"><a href="<?php echo $edit_link;?>"><?php _e( 'Edit', 'ninja-forms' ); ?></a> | </span> 
  134. <span class="trash"><a class="ninja-forms-delete-form" title="<?php _e( 'Delete this form', 'ninja-forms' ); ?>" href="#" id="ninja_forms_delete_form_<?php echo $form_id;?>"><?php _e( 'Delete', 'ninja-forms' ); ?></a> | </span> 
  135. <span class="duplicate"><a href="<?php echo $duplicate_link;?>" title="<?php _e( 'Duplicate Form', 'ninja-forms' ); ?>"><?php _e( 'Duplicate', 'ninja-forms' ); ?></a> | </span> 
  136. <span class="bleep"><?php echo ninja_forms_preview_link( $form_id ); ?> | </span> 
  137. <span class="subs"><a href="<?php echo $subs_link;?>" class="" title="<?php _e( 'View Submissions', 'ninja-forms' ); ?>"><?php _e( 'View Submissions', 'ninja-forms' ); ?></a></span> 
  138. </div> 
  139. </td> 
  140. <td> 
  141. <?php echo $shortcode; ?> 
  142. </td> 
  143. <td> 
  144. <?php echo $template_function; ?> 
  145. </td> 
  146. <td> 
  147. <?php echo $date_updated;?> 
  148. </td> 
  149. </tr> 
  150.  
  151. <?php 
  152. }else{ 
  153.  
  154.  
  155. } //End $all_forms if statement 
  156. ?> 
  157. </tbody> 
  158. <tfoot> 
  159. <tr> 
  160. <th class="check-column"><input type="checkbox" id="" class="ninja-forms-select-all" title="ninja-forms-bulk-action"></th> 
  161. <th><?php _e( 'Form Title', 'ninja-forms' );?></th> 
  162. <th><?php _e( 'Shortcode', 'ninja-forms' );?></th> 
  163. <th><?php _e( 'Template Function', 'ninja-forms' );?></th> 
  164. <th><?php _e( 'Date Updated', 'ninja-forms' );?></th> 
  165. </tr> 
  166. </tfoot> 
  167. </table> 
  168. <?php