Plugin Directory

source: contact-form-entries/trunk/templates/leads-table.php

Last change on this file was 3046066, checked in by CRMPerks, 14 months ago

releasing 1.3.4

File size: 9.2 KB
Line 
1<?php
2  if ( ! defined( 'ABSPATH' ) ) {
3     exit;
4 } 
5if(!empty($search)){
6 ?>
7<p class="vx_table_actions">
8<input type="search" placeholder="<?php _e('Search', 'contact-form-entries'); ?>"  data-column="all" class="vx_search">
9<?php
10if(!empty($export)){ ?><a class="vx_export_btn" href="?vx_crm_form_action=download_csv&vx_crm_key=<?php echo esc_html($export) ?>"><?php _e('Download CSV', 'contact-form-entries'); ?></a> <?php } ?>
11 </p>
12<?php
13} 
14$upload=vxcf_form::get_upload_dir();
15   $thumb_fields=array();   
16     if(!empty($atts['thumb-cols'])){
17     $thumb_fields=array_map('trim',array_map('strtolower',explode(',',$atts['thumb-cols']))); 
18     } 
19  $thumb_width='70';  if(!empty($atts['thumb-width'])){ $thumb_width=$atts['thumb-width']; } 
20?>
21 <table <?php echo $class.' '.$css ?> cellspacing="0" <?php echo wp_kses_post($table_id) ?>>
22  <thead>
23  <tr>
24  <?php
25      if(!empty($atts['number-col'])){
26  ?>
27<th <?php if(!empty($atts['number-col-width'])){ echo 'style="width:'.esc_html($atts['number-col-width']).' "'; } ?>><?php _e('#','contact-form-entries'); ?></th>
28<?php
29      }
30$total_cols=2;
31  foreach($fields as $field){ 
32$total_cols++;
33?>
34  <th><?php echo esc_html($field['label']) ?></th>
35<?php
36  }
37?>
38
39  </tr>
40  </thead>
41 
42  <tfoot>
43  <tr>
44  <?php
45      if(!empty($atts['number-col'])){
46  ?>
47<th <?php if(!empty($atts['number-col-width'])){ echo 'style="width:'.esc_html($atts['number-col-width']).' "'; } ?>><?php _e('#','contact-form-entries'); ?></th>
48<?php
49      }
50  foreach($fields as $field){ 
51?>
52  <th><?php echo esc_html($field['label']) ?></th>
53<?php
54  }
55?>
56
57  </tr>
58 
59  </tfoot>
60  <tbody>
61  <?php
62  if(is_array($leads) && !empty($leads)){
63  $sno=0;
64      foreach($leads as $lead){
65  $sno++;
66  ?>
67  <tr>
68  <?php
69      if(!empty($atts['number-col'])){
70  ?>
71  <td><?php echo esc_html($sno) ?></td>
72    <?php
73      }
74foreach($fields as $field){
75$field_name=$field['name'].'_field'; 
76if($field['name'] == 'time'){
77  $field['name']='created'; 
78}
79if(isset($field['label'] ) && in_array( strtolower($field['label']),$thumb_fields)){
80$field['type']='thumb';         
81}
82$field_label='';
83if(isset($lead['detail'][$field_name])){
84 $field_label=maybe_unserialize($lead['detail'][$field_name]);   
85
86 }
87if($field['name'] == 'created' && !empty($lead['created'])){
88   $field_label=strtotime($lead['created']); //+$offset
89$field_label= date('M-d-Y H:i:s',$field_label);   
90}
91if(isset($field['type']) && in_array($field['type'],array('file','thumb')) && !empty($field_label) && self::$is_pr){ 
92    if(!is_array($field_label)){
93        $field_label=array($field_label);
94    }
95 $file_urls=array();   
96foreach($field_label as $file_url){
97    $file_arr=explode('/',$file_url);
98$file_name=$file_arr[count($file_arr)-1];
99
100    if(filter_var($file_url,FILTER_VALIDATE_URL) === false){ 
101  $field_label=$upload['url'].$file_url;     
102    } 
103   // echo $field_label;
104 if($field['type'] == 'thumb'){   
105$file_urls[]='<div class="vxcf_front_thumb" style="max-width:'.esc_attr($thumb_width).'px "> <img src="'.$field_label.'"></div>';   
106 }else{ 
107$file_urls[]='<a href="'.esc_url($field_label).'" target="_blank" class="vxcf_front_file_url">'.esc_attr($file_name)."</a>";     
108} }
109$field_label=implode("<br/>",$file_urls);
110}
111if(is_array($field_label)){
112  $field_label=implode(', ',$field_label); 
113}
114?>
115<td><?php echo wp_kses_post($field_label); ?></td>
116  <?php
117  }
118  ?>
119
120  </tr>
121  <?php
122  }
123  }
124  else { 
125  ?>
126  <tr>
127    <td colspan="<?php echo esc_html($total_cols) ?>">
128        <?php _e("No Record(s) Found", 'contact-form-entries'); ?>
129    </td>
130  </tr>
131  <?php
132  }
133  ?>
134  </tbody>
135  </table>
136  <?php
137   if(!empty($atts['sortable'])){
138       if(!empty($atts['pager']) && $page_size<count($leads)){
139  ?>
140 <div class="vx_pager">
141  <form>
142    <img src="<?php echo esc_url($base_url) ?>images/first.png" class="vx_first"/>
143    <img src="<?php echo esc_url($base_url) ?>images/prev.png" class="vx_prev"/>
144    <span class="vx_pagedisplay"></span> <!-- this can be any element, including an input -->
145    <img src="<?php echo esc_url($base_url) ?>images/next.png" class="vx_next"/>
146    <img src="<?php echo esc_url($base_url) ?>images/last.png" class="vx_last"/>
147    <?php
148        $rows=count($leads)/$page_size;
149        $pages_count=floor($rows);
150        if($pages_count>0){
151            ?>
152    <select class="vx_pagesize">
153    <?php
154        for($i=1; $i<$pages_count; $i++ ){
155    $op=$page_size*$i;
156            ?>
157      <option value="<?php echo esc_html($op) ?>"><?php echo esc_html($op) ?></option>
158<?php
159        }
160?>
161      <option value="all"><?php _e('All Rows', 'contact-form-entries'); ?></option>
162    </select>
163    <?php
164        }
165    ?>
166  </form>
167</div>
168<?php
169       }
170       
171       ?>
172    <script>
173    jQuery(function($){
174        $pager = $('.vx_pager');
175        $table=$('.vx_entries_table');
176
177        $table.tablesorter({
178       
179          //  theme : 'blue',
180   <?php
181   if(!empty($search)){
182   ?> 
183       widgets        : ['filter'],     
184    widgetOptions : {
185       filter_external : '.vx_search',
186      filter_columnFilters: false,
187      filter_searchDelay : 100,
188      filter_hideEmpty : true,
189    },
190    <?php } ?>
191       usNumberFormat : false,
192            sortReset      : true,
193            sortRestart    : true
194        });
195       
196   /// $.tablesorter.filter.bindSearch( $table, $('#vx_search') );   
197       <?php
198   if(!empty($atts['pager'])){
199  ?>   
200        $table.tablesorterPager({
201      // target the pager markup - see the HTML block below
202      container: $pager,
203      size: <?php echo (int)esc_html($page_size) ?>,
204         // css class names of pager arrows
205    cssNext: '.vx_next', // next page arrow
206    cssPrev: '.vx_prev', // previous page arrow
207    cssFirst: '.vx_first', // go to first page arrow
208    cssLast: '.vx_last', // go to last page arrow
209 //   cssGoto: '.gotoPage', // select dropdown to allow choosing a page
210
211    cssPageDisplay: '.vx_pagedisplay', // location of where the "output" is displayed
212    cssPageSize: '.vx_pagesize', // page size selector - select dropdown that sets the "size" option
213      output: 'showing: {startRow} to {endRow} ({filteredRows})'
214    });
215    <?php
216   }
217    ?>
218
219    //////
220    });
221    </script>
222<?php
223        }
224     ?> 
225  <style type="text/css">
226  .vxcf_front_thumb img{
227      width:100%;
228      display: block;
229  }
230  .vx_export_btn{
231      float: right;
232  }
233/* pager wrapper, div */
234.vx_pager {
235  padding: 5px;
236}
237.vx_entries_table{
238    display: block;
239    overflow: auto;
240}
241/* pager navigation arrows */
242.vx_pager img {
243  vertical-align: middle;
244  margin-right: 2px;
245  cursor: pointer;
246  width: 32px;
247  height: 32px;
248  display: inline-block;
249  border-width: 0;
250  padding: 0;
251}
252.vx_pager img.disabled {opacity: .5; cursor: default;}
253.vx_paging_icon{
254    font-size: 26px;
255    vertical-align: middle;
256    margin: 0 4px 0 2px;
257    cursor: pointer;
258}
259.vx_paging_icon.disabled{color: #ccc; cursor: default;}
260
261/* pager output text */
262.vx_pager .pagedisplay {
263  padding: 0 5px 0 5px;
264  width: 50px;
265  text-align: center;
266}
267
268/* pager element reset (needed for bootstrap) */
269.vx_pager select {
270  margin: 0;
271  padding: 0;
272}
273.tablesorter .filtered {
274  display: none;
275}
276.tablesorter-default .header,
277.tablesorter-default .tablesorter-header {
278    background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==);
279    background-position: center right;
280    background-repeat: no-repeat;
281    cursor: pointer;
282    white-space: normal;
283}
284.tablesorter-default thead .headerSortUp,
285.tablesorter-default thead .tablesorter-headerSortUp,
286.tablesorter-default thead .tablesorter-headerAsc {
287    background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7);
288    border-bottom: #000 2px solid;
289}
290.tablesorter-default thead .headerSortDown,
291.tablesorter-default thead .tablesorter-headerSortDown,
292.tablesorter-default thead .tablesorter-headerDesc {
293    background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
294    border-bottom: #000 2px solid;
295}
296/* tfoot */
297.tablesorter-default tfoot .tablesorter-headerSortUp,
298.tablesorter-default tfoot .tablesorter-headerSortDown,
299.tablesorter-default tfoot .tablesorter-headerAsc,
300.tablesorter-default tfoot .tablesorter-headerDesc {
301    border-top: #000 2px solid;
302}
303/* table processing indicator */
304.tablesorter-default .tablesorter-processing {
305    background-position: center center !important;
306    background-repeat: no-repeat !important;
307    /* background-image: url(images/loading.gif) !important; */
308    background-image: url('data:image/gif;base64,R0lGODlhFAAUAKEAAO7u7lpaWgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgACACwAAAAAFAAUAAACQZRvoIDtu1wLQUAlqKTVxqwhXIiBnDg6Y4eyx4lKW5XK7wrLeK3vbq8J2W4T4e1nMhpWrZCTt3xKZ8kgsggdJmUFACH5BAEKAAIALAcAAAALAAcAAAIUVB6ii7jajgCAuUmtovxtXnmdUAAAIfkEAQoAAgAsDQACAAcACwAAAhRUIpmHy/3gUVQAQO9NetuugCFWAAAh+QQBCgACACwNAAcABwALAAACE5QVcZjKbVo6ck2AF95m5/6BSwEAIfkEAQoAAgAsBwANAAsABwAAAhOUH3kr6QaAcSrGWe1VQl+mMUIBACH5BAEKAAIALAIADQALAAcAAAIUlICmh7ncTAgqijkruDiv7n2YUAAAIfkEAQoAAgAsAAAHAAcACwAAAhQUIGmHyedehIoqFXLKfPOAaZdWAAAh+QQFCgACACwAAAIABwALAAACFJQFcJiXb15zLYRl7cla8OtlGGgUADs=') !important;
309}
310
311/* optional disabled input styling */
312.tablesorter-default .tablesorter-filter-row .disabled {
313    opacity: 0.5;
314    filter: alpha(opacity=50);
315    cursor: not-allowed;
316}
317
318
319</style>
320
321
322
323
324
Note: See TracBrowser for help on using the repository browser.