PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Your Code/Web App-Code/wp-content/plugins/formidable/classes/views/frm-forms/list.php

https://bitbucket.org/midasinc/your-submission
PHP | 206 lines | 193 code | 13 blank | 0 comment | 30 complexity | 0763ea9beda657264a3349b241be503b MD5 | raw file
  1. <div class="wrap">
  2. <div class="frmicon icon32"><br/></div>
  3. <h2><?php echo ($params['template'])? __('Form Templates', 'formidable') : __('Forms', 'formidable');
  4. if(!$params['template'] and current_user_can('frm_edit_forms')){ ?>
  5. <a href="?page=formidable-new" class="button add-new-h2"><?php _e('Add New', 'formidable'); ?></a>
  6. <?php } ?>
  7. </h2>
  8. <?php require(FRM_VIEWS_PATH.'/shared/errors.php');
  9. if(class_exists('WP_List_Table')){
  10. ?>
  11. <form id="posts-filter" method="get">
  12. <input type="hidden" name="page" value="<?php echo $_GET['page'] ?>" />
  13. <input type="hidden" name="frm_action" value="list" />
  14. <?php $wp_list_table->search_box( __( 'Search', 'formidable' ), 'entry' );
  15. if ($params['template']) require(FRM_VIEWS_PATH .'/frm-forms/default-templates.php');
  16. $wp_list_table->display(); ?>
  17. </form>
  18. <?php }else{
  19. do_action('frm_before_item_nav',$sort_str, $sdir_str, $search_str, false);
  20. if ($params['template']) require(FRM_VIEWS_PATH .'/frm-forms/default-templates.php'); ?>
  21. <form class="form-fields item-list-form" name="item_list_form" id="posts-filter" method="post" >
  22. <input type="hidden" name="frm_action" value="list-form"/>
  23. <input type="hidden" name="template" value="<?php echo esc_attr($params['template']) ?>" />
  24. <?php $footer = false; require(FRM_VIEWS_PATH.'/shared/item-table-nav.php'); ?>
  25. <table class="widefat fixed" cellspacing="0">
  26. <thead>
  27. <tr>
  28. <th class="manage-column check-column" scope="col"> <?php do_action('frm_column_header'); ?> </th>
  29. <?php if ($params['template']){ ?>
  30. <th class="manage-column <?php FrmFormsHelper::get_sortable_classes('name', $sort_str, $sdir_str); ?>" width="">
  31. <a href="?page=formidable-templates&amp;sort=name&amp;sdir=<?php echo (($sort_str == 'name' and $sdir_str == 'desc')?'asc':'desc'); ?>">
  32. <span><?php _e('Name', 'formidable') ?></span>
  33. <span class="sorting-indicator"></span>
  34. </a>
  35. </th>
  36. <th class="manage-column <?php FrmFormsHelper::get_sortable_classes('description', $sort_str, $sdir_str); ?>">
  37. <a href="?page=formidable-templates&amp;sort=description&amp;sdir=<?php echo (($sort_str == 'description' and $sdir_str == 'desc')?'asc':'desc'); ?>">
  38. <span><?php _e('Description', 'formidable') ?></span>
  39. <span class="sorting-indicator"></span>
  40. </a>
  41. </th>
  42. <?php }else{?>
  43. <th class="manage-column <?php FrmFormsHelper::get_sortable_classes('id', $sort_str, $sdir_str); ?>" width="50px">
  44. <a href="?page=formidable&amp;sort=id&amp;sdir=<?php echo (($sort_str == 'id' and $sdir_str == 'desc')?'asc':'desc'); ?>">
  45. <span><?php _e('ID', 'formidable') ?></span>
  46. <span class="sorting-indicator"></span>
  47. </a>
  48. </th>
  49. <th class="manage-column <?php FrmFormsHelper::get_sortable_classes('name', $sort_str, $sdir_str); ?>" width="350px">
  50. <a href="?page=formidable&amp;sort=name&amp;sdir=<?php echo (($sort_str == 'name' and $sdir_str == 'desc')?'asc':'desc'); ?>">
  51. <span><?php _e('Name', 'formidable') ?></span>
  52. <span class="sorting-indicator"></span>
  53. </a>
  54. </th>
  55. <th class="manage-column <?php FrmFormsHelper::get_sortable_classes('description', $sort_str, $sdir_str); ?>">
  56. <a href="?page=formidable&amp;sort=description&amp;sdir=<?php echo (($sort_str == 'description' and $sdir_str == 'desc')?'asc':'desc'); ?>">
  57. <span><?php _e('Description', 'formidable') ?></span>
  58. <span class="sorting-indicator"></span>
  59. </a>
  60. </th>
  61. <th class="manage-column <?php FrmFormsHelper::get_sortable_classes('form_key', $sort_str, $sdir_str); ?>" width="70px">
  62. <a href="?page=formidable&amp;sort=form_key&amp;sdir=<?php echo (($sort_str == 'form_key' and $sdir_str == 'desc')?'asc':'desc'); ?>">
  63. <span><?php _e('Key', 'formidable') ?></span>
  64. <span class="sorting-indicator"></span>
  65. </a>
  66. </th>
  67. <th class="manage-column" width="60px"><?php _e('Entries', 'formidable') ?></th>
  68. <th class="manage-column" width="115px"><?php _e('Direct Link', 'formidable') ?></th>
  69. <th class="manage-column" width="115px"><?php _e('ShortCodes', 'formidable') ?></th>
  70. <?php } ?>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <?php if($record_count <= 0){ ?>
  75. <tr>
  76. <td colspan="<?php echo ($params['template'])? '3':'7'; ?>">
  77. <?php if ($params['template']){ ?>
  78. <?php _e('No Templates Found', 'formidable') ?>.
  79. <br/><br/><?php _e('To add a new template','formidable') ?>:
  80. <ol><li style="list-style:decimal;">Create a <a href="?page=formidable-new">new form</a>.</li>
  81. <li style="list-style:decimal;">After your form is created, go to Formidable -> <a href="?page=formidable">Forms</a>.</li>
  82. <li style="list-style:decimal;">Place your mouse over the name of the form you just created, and click the "Create Template" link.</li>
  83. </ol>
  84. <?php }else{ ?>
  85. <?php _e('No Forms Found', 'formidable') ?>.
  86. <a href="?page=formidable-new"><?php _e('Add New', 'formidable'); ?></a>
  87. <?php } ?>
  88. </td>
  89. </tr>
  90. <?php
  91. }else{
  92. $alternate = '';
  93. foreach($forms as $form){
  94. $alternate = (empty($alternate)) ? ' alternate' : '';
  95. ?>
  96. <tr class="iedit<?php echo $alternate ?>" >
  97. <th class="check-column" scope="row"><?php do_action('frm_first_col', $form->id); ?></th>
  98. <?php if ($params['template']){ ?>
  99. <td class="post-title">
  100. <?php if(current_user_can('frm_edit_forms')){ ?>
  101. <a class="row-title" href="?page=formidable&amp;frm_action=edit&amp;id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))); ?>"><?php echo stripslashes($form->name); ?></a>
  102. <?php }else{
  103. echo stripslashes($form->name);
  104. } ?>
  105. <br/>
  106. <div class="row-actions">
  107. <?php if(current_user_can('frm_edit_forms')){ ?>
  108. <span><a href="?page=formidable&amp;frm_action=duplicate&amp;id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))); ?>"><?php _e('Create Form from Template', 'formidable') ?></a></span>
  109. | <span class="edit"><a href="?page=formidable&amp;frm_action=edit&amp;id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))); ?>"><?php _e('Edit', 'formidable') ?></a></span>
  110. <?php } ?>
  111. <?php do_action('frm_template_action_links', $form); ?>
  112. <?php if(current_user_can('frm_delete_forms')){ ?>
  113. | <span class="trash"><a href="?page=formidable&amp;frm_=destroy&amp;id=<?php echo $form->id; ?>" onclick="return confirm('<?php printf(__('Are you sure you want to delete your %1$s Form?', 'formidable'), strip_tags(stripslashes($form->name))) ?>');" title="<?php _e('Delete', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))); ?>"><?php _e('Delete', 'formidable') ?></a></span>
  114. <?php } ?>
  115. </div>
  116. </td>
  117. <td><?php echo $form->description ?></td>
  118. <?php }else{ ?>
  119. <td><?php echo $form->id ?></td>
  120. <td class="post-title">
  121. <?php if(current_user_can('frm_edit_forms')){ ?>
  122. <a class="row-title" href="?page=formidable&amp;frm_action=edit&amp;id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))); ?>"><?php echo stripslashes($form->name); ?></a>
  123. <?php }else{
  124. echo stripslashes($form->name);
  125. }
  126. ?>
  127. <br/>
  128. <div class="row-actions">
  129. <?php if(current_user_can('frm_edit_forms')){ ?>
  130. <span class="edit"><a href="?page=formidable&amp;frm_action=edit&amp;id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))) ?>"><?php _e('Edit', 'formidable') ?></a></span>
  131. | <span><a href="?page=formidable&amp;frm_action=settings&amp;id=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags(stripslashes($form->name))) ?> <?php _e('Settings', 'formidable') ?>"><?php _e('Settings', 'formidable') ?></a></span>
  132. <?php } ?>
  133. <?php if(current_user_can('frm_view_entries')){ ?>
  134. | <span><a href="?page=formidable-entries&amp;form=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags(stripslashes($form->name))); ?> Entries"><?php _e('Entries', 'formidable') ?></a></span>
  135. | <span><a href="?page=formidable-reports&amp;form=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags(stripslashes($form->name))); ?> Reports"><?php _e('Reports', 'formidable') ?></a></span>
  136. <?php } ?>
  137. <?php if($frmpro_is_installed and current_user_can('frm_create_entries')){ ?>
  138. | <span><a href="?page=formidable-entries&amp;frm_action=new&amp;form=<?php echo $form->id; ?>" title="<?php _e('New', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))) ?> <?php _e('Entry', 'formidable') ?>"><?php _e('New Entry', 'formidable') ?></a></span></br>
  139. <?php } ?>
  140. <?php if(current_user_can('frm_edit_forms') and $frmpro_is_installed){ ?>
  141. <span><a href="?page=formidable&amp;frm_action=duplicate&amp;id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))) ?>"><?php _e('Duplicate', 'formidable') ?></a></span>
  142. | <span><a href="?page=formidable&amp;frm_action=duplicate&amp;id=<?php echo $form->id; ?>&amp;template=1" title="<?php _e('Create', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))) ?> <?php _e('Template', 'formidable') ?>"><?php _e('Create Template', 'formidable') ?></a></span>
  143. | <span><a href="<?php echo FRM_SCRIPT_URL ?>&amp;controller=forms&amp;frm_action=export&amp;id=<?php echo $form->id; ?>" title="<?php _e('Export', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))) ?> <?php _e('Template', 'formidable') ?>"><?php _e('Export as Template', 'formidable') ?></a></span>
  144. <?php
  145. }
  146. if(current_user_can('frm_delete_forms')){ ?>
  147. | <span class="trash"><a href="?page=formidable&amp;frm_action=destroy&amp;id=<?php echo $form->id; ?>" onclick="return confirm('<?php printf(__('Are you sure you want to delete your %1$s Form?', 'formidable'), strip_tags(stripslashes($form->name))) ?>');" title="<?php _e('Delete', 'formidable') ?> <?php echo esc_attr(strip_tags(stripslashes($form->name))) ?>"><?php _e('Delete', 'formidable') ?></a></span>
  148. <?php } ?>
  149. </div>
  150. </td>
  151. <td><?php echo stripslashes($form->description) ?></td>
  152. <td><?php echo $form->form_key ?></td>
  153. <td><?php
  154. $text = $frm_entry->getRecordCount($form->id);
  155. $text = sprintf(_n( '%1$s Entry', '%1$s Entries', $text, 'formidable' ), $text);
  156. echo (current_user_can('frm_view_entries')) ? '<a href="'. esc_url(admin_url('admin.php') .'?page=formidable-entries&form='. $form->id ) .'">'. $text .'</a>' : $text;
  157. unset($text);
  158. ?></td>
  159. <td>
  160. <input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="<?php echo $target_url = FrmFormsHelper::get_direct_link($form->form_key, $form->prli_link_id); ?>" /><br/><a href="<?php echo $target_url; ?>" target="blank"><?php _e('View Form', 'formidable') ?></a>
  161. </td>
  162. <td><input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable id=<?php echo $form->id; ?>]" /><br/>
  163. <input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable key=<?php echo $form->form_key ?>]" />
  164. </td>
  165. <?php } ?>
  166. </tr>
  167. <?php
  168. }
  169. }
  170. ?>
  171. </tbody>
  172. <tfoot>
  173. <tr>
  174. <th class="manage-column check-column" scope="col"> <?php do_action('frm_column_header'); ?> </th>
  175. <?php if ($params['template']){ ?>
  176. <th class="manage-column"><?php _e('Name', 'formidable') ?></th>
  177. <th class="manage-column"><?php _e('Description', 'formidable') ?></th>
  178. <?php }else{ ?>
  179. <th class="manage-column"><?php _e('ID', 'formidable') ?></th>
  180. <th class="manage-column"><?php _e('Name', 'formidable') ?></th>
  181. <th class="manage-column"><?php _e('Description', 'formidable') ?></th>
  182. <th class="manage-column"><?php _e('Key', 'formidable') ?></th>
  183. <th class="manage-column"><?php _e('Entries', 'formidable') ?></th>
  184. <th class="manage-column"><?php _e('Direct Link', 'formidable') ?></th>
  185. <th class="manage-column"><?php _e('ShortCodes', 'formidable') ?></th>
  186. <?php } ?>
  187. </tr>
  188. </tfoot>
  189. </table>
  190. <?php $footer = true; require(FRM_VIEWS_PATH.'/shared/item-table-nav.php'); ?>
  191. </form>
  192. <?php } ?>
  193. </div>