Plugin Directory

source: nex-forms-express-wp-form-builder/tags/8.5.7/includes/classes/class.dashboard.php

Last change on this file was 3029297, checked in by webaways, 15 months ago

adding 8.5.7

File size: 216.8 KB
Line 
1<?php
2if ( ! defined( 'ABSPATH' ) ) exit;
3
4
5function NEXForms_entries_page(){
6        global $wpdb;
7        $theme = wp_get_theme();
8        $output = '';
9       
10        $nf_function = new NEXForms_functions();
11       
12        $database_actions = new NEXForms_Database_Actions();
13       
14        $dashboard = new NEXForms_dashboard();
15        $dashboard->dashboard_checkout();
16       
17       
18       
19        $count_entries = $wpdb->get_results('SELECT nex_forms_Id, COUNT(nex_forms_Id) as counted FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE trashed IS NULL GROUP BY nex_forms_Id;');
20                        foreach($count_entries as $entry)
21                                {
22                                $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms', array('entry_count'=>$entry->counted), array('Id' => $entry->nex_forms_Id) );
23                                }
24       
25       
26       
27        $entries = new NEXForms_dashboard();
28        //$entries->action = 'print_entries';
29       
30       
31       
32       
33       
34        $entries->table = 'wap_nex_forms_entries';
35        $entries->table_resize = true;
36        $entries->table_header = '<span class="fas fa-filter"></span>&nbsp;&nbsp;Filters:';
37        $entries->extra_buttons = array(
38                                                                'unread'                =>array('class'=>'filter_unread filter_button',                 'id'=>'filter_unread',          'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-eye-slash"></span> '.__('&nbsp;Unread','nex-forms').''),
39                                                                'starred'               =>array('class'=>'filter_starred filter_button',                'id'=>'filter_starred',         'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-star"></span> '.__('&nbsp;Starred','nex-forms').''),
40                                                                'attachments'   =>array('class'=>'filter_attachments filter_button',    'id'=>'filter_attachments', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-paperclip"></span> '.__('&nbsp;Attachment','nex-forms').'')
41                                                                //'read'                        =>array('class'=>'filter_read filter_button',                   'id'=>'filter_read',            'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-eye"></span> '.__('&nbsp;Read','nex-forms').''),
42                                                                );
43        $entries->table_header_icon = 'assignment';
44        $entries->additional_params = array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
45        $entries->table_headings = array(
46        'Id',
47        array('icon'=>'fas fa-star', 'user_func'=>'NEXForms_starred','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom starred','sort_by'=>'starred'),
48        array('icon'=>'fas fa-paperclip', 'user_func'=>'NEXForms_get_attachment','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_files', 'set_class'=>'custom read', 'sort_by'=>'attachments'),
49        array('icon'=>'fas fa-glasses', 'user_func'=>'NEXForms_entry_status','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom read','sort_by'=>'viewed'),
50        //'title',
51        array('heading'=> __('Form','nex-forms'), 'user_func'=>'NEXForms_get_title3','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms','sort_by'=>'nex_forms_Id'),
52        'page',
53        array('heading'=>__('Submitted','nex-forms'), 'user_func'=>'NEXForms_time_elapsed_string','user_func_args_1'=>'date_time', 'user_func_args_2'=>'wap_nex_forms', 'sort_by'=>'date_time'),
54        'date_time',
55        );
56        $entries->show_headings=true;
57        $entries->search_params = array('Id','form_data');
58        $entries->color_adapt = true;
59        $entries->checkout = $dashboard->checkout;
60        $entries->record_limit = 100;
61        $entries->show_delete  = false;
62       
63       
64       
65       
66        /*$file_uploads = new NEXForms_dashboard();
67        $file_uploads->table = 'wap_nex_forms_files';
68        $file_uploads->table_header = 'Form Entries';
69        $file_uploads->table_header_icon = 'insert_drive_file';
70        $file_uploads->table_headings = array('entry_Id', array('heading'=>__('Form','nex-forms'), 'user_func'=>'NEXForms_get_title','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'), 'name','type','size','url');
71        $file_uploads->show_headings=true;
72        $file_uploads->extra_classes = 'file_manager';
73        $file_uploads->search_params = array('entry_Id','name','type');
74        //$file_uploads->build_table_dropdown = 'form_id';
75        $file_uploads->checkout = $dashboard->checkout;
76        $file_uploads->show_delete  = true;*/
77       
78       
79       
80        $output .= $dashboard->dashboard_menu('Form Entries');
81        if(!$dashboard->checkout)
82                        {
83                                 $output .= '<div id="dashboard_panel" class="dashboard_panel">';
84                                        $output .= '<div class="row row_zero_margin ">';
85                                               
86                                                $output .= '<div class="col-sm-5">';
87                                                        $output .= $dashboard->license_setup();
88                                                $output .= '</div>';
89                                        $output .= '</div>';
90                                $output .= '</div>';
91                        $output .= '</div>';
92                       
93                        echo $output;
94                        return;
95                        }
96       
97        $output .= '<div class="admin_url" style="display:none;">'.admin_url().'</div>';
98       
99        $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' );
100        $output .= '<div id="_wpnonce" style="display:none;">'.$nonce_url.'</div>';
101               
102       
103        $output .= '<div class="nf_context_menu nf_context_menu_2 aa_menu aa_bg_main">
104                               
105                                <ul class="aa_menu">
106                                        <li class="cm-action-item mark-read" data-action="mark-read"><a href="#" class="cm-item-text"><span class="fas fa-eye"></span>Mark as read</span><span class="kbsc"></span></a></li>
107                                        <li class="cm-action-item mark-unread" data-action="mark-unread"><a href="#" class="cm-item-text"><span class="fas fa-eye-slash"></span>Mark as unread</span><span class="kbsc"></span></a></li>
108                                        <li class="sec_divider"></li>
109                                        <li class="cm-action-item" data-action="add-star"><a href="#" class="cm-item-text"><span class="fas fa-star"></span> Add Star</span><span class="kbsc"></span></a></li>
110                                        <li class="cm-action-item" data-action="remove-star"><a href="#" class="cm-item-text"><span class="far fa-star"></span> remove Star</span><span class="kbsc"></span></a></li>
111                                        <!--<li class="sec_divider"></li>
112                                        <li class="cm-action-item" data-action="move-to-archive"><a href="#" class="cm-item-text"><span class="fas fa-archive"></span> Move to archive</span><span class="kbsc"></span></a></li>-->
113                                        <li class="sec_divider restore_record" tyle="display:none;"></li>
114                                        <li class="cm-action-item restore_record" data-action="restore" style="display:none;"><a href="#" class="cm-item-text"><span class="fas fa-trash-restore"></span> Restore</span><span class="kbsc"></span></a></li>
115                                        <li class="sec_divider"></li>
116                                        <li class="cm-action-item" data-action="delete"><a href="#" class="cm-item-text"><span class="fas fa-trash"></span> Delete</span><span class="kbsc">Delete</span></a></li>
117                                <ul>
118                        </div>';
119       
120        $output .= '<div id="nex_forms_entries" class="nex_forms_entries">';
121               
122                $output .= '<div class="entries_wrapper">';
123                       
124                        $output .= '<div class="left-col aa_bg_main">';
125                                       
126                                $output .= $dashboard->entries_menu();
127                               
128                        $output .= '</div>';
129                       
130                        $output .= '<div class="right-col">';
131                                $output .= '<div class="right-col-top">';
132                                        $output .= $entries->print_record_table();
133                                       
134                                       
135                                       
136                                $output .= '</div>';
137                                $output .= '<div class="right-mid">';
138                                       
139                                       
140                                       
141                                        $output .= '<div class="entry_tools aa_bg_main">';
142                                               
143                                                $output .= '<button type="submit" class="save_form_entry save_button button button-primary" style="display:none;">'.__('Save','nex-forms').'</button>';
144                                                $output .= '<button class="cancel_save_form_entry save_button button button-primary" style="display:none;"><i class="fa fa-close"></i></button>';
145                                               
146                                               
147                                                $output .= '<div class="entry_views">';
148                                               
149                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch  view_form_data active" data-action="view-data" disabled="disabled"><span class="fas fa-database"></span> '.__('Entry Data','nex-forms').'</button>';
150                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-admin-email" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>';
151                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-user-email" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>';
152                                                $output .= '</div>';
153                                       
154                                                $output .= '<div class="entry_actions">';       
155                                                        $output .= '<button class="print_to_pdf aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'</button>';
156                                                        //$output .= '<button class="button no_batch do_action" data-action="print-form-entry" disabled="disabled"><span class="fas fa-print"></span> '.__('Print','nex-forms').'</button>';
157                                                        $output .= '<button id="" class="edit_form_entry aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-pen-square"></span> '.__('Edit','nex-forms').'</button>';
158                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action" data-action="delete" disabled="disabled"><span class="fas fa-trash"></span> '.__('Delete','nex-forms').'</button>';
159                                                $output .= '</div>';
160                                               
161                                        $output .= '</div>';
162                                       
163                                $output .= '</div>';
164                                $output .= '<div class="right-bottom">';
165                                        $output .= $entries->print_form_entry();
166                                $output .= '</div>';
167                               
168                        $output .= '</div>';
169                       
170                $output .= '</div>';
171               
172       
173                //
174               
175               
176                //
177        $output .= '</div>';
178       
179        echo $output;
180       
181        $dashboard->remove_unwanted_styles();
182}
183
184function NEXForms_stats_page(){
185        global $wpdb;
186        $theme = wp_get_theme();
187        $nf_function = new NEXForms_functions();
188        $dashboard = new NEXForms_dashboard();
189        $dashboard->dashboard_checkout();
190        $dashboard->color_adapt = true;
191       
192       
193        $output = '';
194       
195        $output .= $dashboard->dashboard_menu('Form Analytics');
196        if(!$dashboard->checkout)
197                        {
198                                 $output .= '<div id="dashboard_panel" class="dashboard_panel">';
199                                        $output .= '<div class="row row_zero_margin ">';
200                                               
201                                                $output .= '<div class="col-sm-5">';
202                                                        $output .= $dashboard->license_setup();
203                                                $output .= '</div>';
204                                        $output .= '</div>';
205                                $output .= '</div>';
206                        $output .= '</div>';
207                       
208                        echo $output;
209                        return;
210                        }
211       
212       
213        $output .= '<div id="nex_forms_entries" class="nex_forms_entries submission_reporting">';
214               
215                $output .= '<div class="entries_wrapper">';
216                       
217                        $output .= '<div class="left-col aa_bg_main">';
218                                       
219                                $output .= $dashboard->analytics_menu();
220                               
221                        $output .= '</div>';
222                       
223                        $output .= '<div class="right-col">';
224                               
225         
226                        $output .= '<div class="hidden">';
227                          $output .= '<div id="siteurl">'.get_option('siteurl').'</div>';
228                          $output .= '<div id="nf_dashboard_load">0</div>';
229                          $output .= '<div id="plugins_url">'.plugins_url('/',__FILE__).'</div>';
230                          $output .= '<div id="load_entry">'.$dashboard->checkout.'</div>';
231                        $output .= '</div>';
232       
233                               
234                                         
235                                          $output .= '<div class="form_analytics_panel">';
236                                         
237                                                  $output .= '<div class="row row_zero_margin ">';
238                                                 
239                                                               
240                                                                $output .= '<div  class="col-sm-9">';
241                                                                        $output .= $dashboard->form_analytics();
242                                                                $output .= '</div>';
243                                                               
244                                                               
245                                                  $output .= '</div>';
246                                                 
247                                                 
248                                                 
249                                          $output .= '</div>';
250                 
251                  $output .= '</div>';
252                       
253         $output .= '</div>'; //nex_forms_admin_page_wrapper
254       
255        echo $output;
256       
257       
258}
259
260function NEXForms_reporting_page(){
261        global $wpdb;
262        $theme = wp_get_theme();
263
264        $nf_function = new NEXForms_functions();
265        $dashboard = new NEXForms_dashboard();
266        $dashboard->dashboard_checkout();
267
268       
269        $output = '';
270       
271       
272       
273        $output .= $dashboard->dashboard_menu('Submission Reporting');
274        if(!$dashboard->checkout)
275                        {
276                                 $output .= '<div id="dashboard_panel" class="dashboard_panel">';
277                                        $output .= '<div class="row row_zero_margin ">';
278                                               
279                                                $output .= '<div class="col-sm-5">';
280                                                        $output .= $dashboard->license_setup();
281                                                $output .= '</div>';
282                                        $output .= '</div>';
283                                $output .= '</div>';
284                        $output .= '</div>';
285                       
286                        echo $output;
287                        return;
288                        }
289       
290       
291         $output .= '<div id="nex_forms_entries" class="nex_forms_entries submission_reporting">';
292               
293                $output .= '<div class="entries_wrapper">';
294                       
295                        $output .= '<div class="left-col aa_bg_main">';
296                                       
297                                $output .= $dashboard->reporting_menu();
298                               
299                        $output .= '</div>';
300                       
301                        $output .= '<div class="right-col">';
302                               
303         
304                        $output .= '<div class="hidden">';
305                          $output .= '<div id="siteurl">'.get_option('siteurl').'</div>';
306                          $output .= '<div id="nf_dashboard_load">0</div>';
307                          $output .= '<div id="plugins_url">'.plugins_url('/',__FILE__).'</div>';
308                          $output .= '<div id="load_entry">'.$dashboard->checkout.'</div>';
309                        $output .= '</div>';
310                                       
311                  //DASHBOARD
312                                  $output .= '<div id="" class="reporting_panel">';
313                         
314                                                $output .= '<div id="submission_reports" class="" >';
315                                                        $output .= '<div class="row row_zero_margin report_table_selection">';
316                                                               
317                                                                $output .= '<div class="col-xs-12 zero_padding">';
318                                                                        $output .= '<div class="row row_zero_margin report_table_container">';
319                                                                                $output .= '<div class="col-sm-12 zero_padding ">';
320                                                                                        $output .= '<div class="right-col">';
321                                                                                               
322                                                                                                $output .= '<div class="right-col-top faded">
323                                                                                                                                <div class="right-col-inner aa_bg_tri">
324                                                                                                                                  <div class="reporting_controls">
325                                                                                                                                        <div class="col-sm-3 field_selection_col ">
326                                                                                                                                          <select name="showhide_fields[]" multiple="multiple" class="aa_multi_select field_selection_multi_select">
327                                                                                                                                                <option disabled="disabled">Show Fields</option>
328                                                                                                                                          </select>
329                                                                                                                                        </div>
330                                                                                                                                       
331                                                                                                                                </div>
332                                                                                                                          </div>
333                                                                                                                          <div class="right-bottom">
334                                                                                                                                <div class="dashboard-box database_table wap_nex_forms_temp_report wap_nex_forms_entries" data-table="wap_nex_forms_temp_report">
335                                                                                                                                  <div class="dashboard-box-header aa_bg_main">
336                                                                                                                                        <div class="table_title font_color_1 ">Report</div>
337                                                                                                                                       
338                                                                                                                                          </div>
339                                                                                                                                  <div class="dashboard-box-content zero_padding">
340                                                                                                                                        <div class="no_records"><span class="fa fa-ban"></span> <span class="result_text">No results found</span></div>
341                                                                                                                                       
342                                                                                                                                  </div>
343                                                                                                                                 
344                                                                                                                                </div>
345                                                                                                                          </div>';
346                                                                                                       
347                                                                                               
348                                                                                                $output .= '</div>';                                   
349                                                                                       
350                                                                                        $output .= '</div>';
351                                                                                $output .= '</div>';
352                                                                        $output .= '</div>';
353                                                                $output .= '</div>';
354                                                        $output .= '</div>';
355                                                  $output .= '</div>';
356                                        $output .= '</div>';
357                                $output .= '</div>';
358               
359                 $output .= '</div>';
360                        $output .= '</div>';
361                $output .= '</div>';
362       
363        echo $output;
364       
365        $dashboard->remove_unwanted_styles();
366}
367
368function NEXForms_attachments_page(){
369        global $wpdb;
370        $theme = wp_get_theme();
371        $output = '';
372       
373        $nf_function = new NEXForms_functions();
374       
375        $database_actions = new NEXForms_Database_Actions();
376       
377        $dashboard = new NEXForms_dashboard();
378        $dashboard->dashboard_checkout();
379       
380        /*$entries = new NEXForms_dashboard();
381        //$entries->action = 'print_entries';
382        $entries->table = 'wap_nex_forms_entries';
383        $entries->table_resize = true;
384        $entries->table_header = '<span class="fas fa-filter"></span>&nbsp;&nbsp;Filters:';
385        $entries->extra_buttons = array(
386                                                                'unread'                =>array('class'=>'filter_unread filter_button',                 'id'=>'filter_unread',          'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-eye-slash"></span> '.__('&nbsp;Unread','nex-forms').''),
387                                                                'starred'               =>array('class'=>'filter_starred filter_button',                'id'=>'filter_starred',         'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-star"></span> '.__('&nbsp;Starred','nex-forms').''),
388                                                                'attachments'   =>array('class'=>'filter_attachments filter_button',    'id'=>'filter_attachments', 'type'=>'button','link'=>'', 'rank'=>'2', 'icon'=>'<span class="fas fa-paperclip"></span> '.__('&nbsp;Attachment','nex-forms').'')
389                                                                //'read'                        =>array('class'=>'filter_read filter_button',                   'id'=>'filter_read',            'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-eye"></span> '.__('&nbsp;Read','nex-forms').''),
390                                                                );
391        $entries->table_header_icon = 'assignment';
392        $entries->additional_params = array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
393        $entries->table_headings = array(
394        'Id',
395        array('icon'=>'fas fa-star', 'user_func'=>'NEXForms_starred','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom starred','sort_by'=>'starred'),
396        array('icon'=>'fas fa-paperclip', 'user_func'=>'NEXForms_get_attachment','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_files', 'set_class'=>'custom read', 'sort_by'=>'attachments'),
397        array('icon'=>'fas fa-glasses', 'user_func'=>'NEXForms_entry_status','user_func_args_1'=>'Id', 'user_func_args_2'=>'wap_nex_forms_entries', 'set_class'=>'custom read','sort_by'=>'viewed'),
398        //'title',
399        array('heading'=> __('Form','nex-forms'), 'user_func'=>'NEXForms_get_title3','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'),//'sort_by'=>'nex_forms_Id'
400        'page',
401        array('heading'=>__('Submitted','nex-forms'), 'user_func'=>'NEXForms_time_elapsed_string','user_func_args_1'=>'date_time', 'user_func_args_2'=>'wap_nex_forms', 'sort_by'=>'date_time'),
402        'date_time',
403        );
404        $entries->show_headings=true;
405        $entries->search_params = array('form_data');
406        $entries->color_adapt = true;
407        $entries->checkout = $dashboard->checkout;
408        $entries->record_limit = 100;
409        $entries->show_delete  = false;*/
410       
411       
412       
413       
414        $file_uploads = new NEXForms_dashboard();
415        $file_uploads->table = 'wap_nex_forms_files';
416        $file_uploads->table_header = '';
417        $file_uploads->table_header_icon = 'insert_drive_file';
418        $file_uploads->table_headings = array('Id','entry_Id', array('heading'=>__('Form','nex-forms'), 'user_func'=>'NEXForms_get_title','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'), 'name','type','size','url', array('heading'=>__('','nex-forms'), 'user_func'=>'NEXForms_download_file','user_func_args_1'=>'url','user_func_args_2'=>'wap_nex_forms_files','set_class'=>'read download'));
419        $file_uploads->show_headings=true;
420        $file_uploads->table_resize = true;
421        $file_uploads->extra_classes = ' wap_nex_forms_entries file_manager';
422        $file_uploads->search_params = array('Id','entry_Id','name','type');
423        $file_uploads->color_adapt = true;
424        //$file_uploads->build_table_dropdown = 'form_id';
425        $file_uploads->record_limit = 50;
426        $file_uploads->checkout = $dashboard->checkout;
427        $file_uploads->show_delete  = true;
428       
429       
430       
431        $output .= $dashboard->dashboard_menu('File Uploads');
432        if(!$dashboard->checkout)
433                        {
434                                 $output .= '<div id="dashboard_panel" class="dashboard_panel">';
435                                        $output .= '<div class="row row_zero_margin ">';
436                                               
437                                                $output .= '<div class="col-sm-5">';
438                                                        $output .= $dashboard->license_setup();
439                                                $output .= '</div>';
440                                        $output .= '</div>';
441                                $output .= '</div>';
442                        $output .= '</div>';
443                       
444                        echo $output;
445                        return;
446                        }
447       
448        $output .= '<div class="admin_url" style="display:none;">'.admin_url().'</div>';
449        $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' );
450        $output .= '<div id="_wpnonce" style="display:none;">'.$nonce_url.'</div>';
451       
452        $output .= '<div class="nf_context_menu nf_context_menu_2 aa_menu aa_bg_main">
453                               
454                                <ul class="aa_menu">
455                                        <li class="cm-action-item mark-read" data-action="mark-read"><a href="#" class="cm-item-text"><span class="fas fa-eye"></span>Mark as read</span><span class="kbsc"></span></a></li>
456                                        <li class="cm-action-item mark-unread" data-action="mark-unread"><a href="#" class="cm-item-text"><span class="fas fa-eye-slash"></span>Mark as unread</span><span class="kbsc"></span></a></li>
457                                        <li class="sec_divider"></li>
458                                        <li class="cm-action-item" data-action="add-star"><a href="#" class="cm-item-text"><span class="fas fa-star"></span> Add Star</span><span class="kbsc"></span></a></li>
459                                        <li class="cm-action-item" data-action="remove-star"><a href="#" class="cm-item-text"><span class="far fa-star"></span> remove Star</span><span class="kbsc"></span></a></li>
460                                        <!--<li class="sec_divider"></li>
461                                        <li class="cm-action-item" data-action="move-to-archive"><a href="#" class="cm-item-text"><span class="fas fa-archive"></span> Move to archive</span><span class="kbsc"></span></a></li>-->
462                                        <li class="sec_divider restore_record" tyle="display:none;"></li>
463                                        <li class="cm-action-item restore_record" data-action="restore" style="display:none;"><a href="#" class="cm-item-text"><span class="fas fa-trash-restore"></span> Restore</span><span class="kbsc"></span></a></li>
464                                        <li class="sec_divider"></li>
465                                        <li class="cm-action-item" data-action="delete"><a href="#" class="cm-item-text"><span class="fas fa-trash"></span> Delete</span><span class="kbsc">Delete</span></a></li>
466                                <ul>
467                        </div>';
468       
469        $output .= '<div id="nex_forms_entries" class="nex_forms_entries file_uploads">';
470               
471                $output .= '<div class="entries_wrapper">';
472                       
473                        $output .= '<div class="left-col aa_bg_main">';
474                                       
475                                $output .= $dashboard->uploads_menu();
476                               
477                        $output .= '</div>';
478                       
479                        $output .= '<div class="right-col">';
480                                $output .= '<div class="right-col-top">';
481                                        $output .= $file_uploads->print_record_table();
482                                       
483                                       
484                                       
485                                $output .= '</div>';
486                                /*$output .= '<div class="right-mid">';
487                                       
488                                       
489                                       
490                                        $output .= '<div class="entry_tools aa_bg_main">';
491                                               
492                                                $output .= '<button type="submit" class="save_form_entry save_button button button-primary" style="display:none;">'.__('Save','nex-forms').'</button>';
493                                                $output .= '<button class="cancel_save_form_entry save_button button button-primary" style="display:none;"><i class="fa fa-close"></i></button>';
494                                               
495                                               
496                                                $output .= '<div class="entry_views">';
497                                               
498                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch  view_form_data active" data-action="view-data" disabled="disabled"><span class="fas fa-database"></span> '.__('Entry Data','nex-forms').'</button>';
499                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-admin-email" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>';
500                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-user-email" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>';
501                                                $output .= '</div>';
502                                       
503                                                $output .= '<div class="entry_actions">';       
504                                                        $output .= '<button class="print_to_pdf aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'</button>';
505                                                        //$output .= '<button class="button no_batch do_action" data-action="print-form-entry" disabled="disabled"><span class="fas fa-print"></span> '.__('Print','nex-forms').'</button>';
506                                                        $output .= '<button id="" class="edit_form_entry aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-pen-square"></span> '.__('Edit','nex-forms').'</button>';
507                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action" data-action="delete" disabled="disabled"><span class="fas fa-trash"></span> '.__('Delete','nex-forms').'</button>';
508                                                $output .= '</div>';
509                                               
510                                        $output .= '</div>';
511                                       
512                                $output .= '</div>';
513                                $output .= '<div class="right-bottom">';
514                                        $output .= $file_uploads->print_form_entry();
515                                $output .= '</div>';
516                                */
517                        $output .= '</div>';
518                       
519                $output .= '</div>';
520               
521       
522                //
523               
524               
525                //
526        $output .= '</div>';
527       
528        echo $output;
529       
530        $dashboard->remove_unwanted_styles();
531}
532
533function NEXForms_global_setup_page(){
534        global $wpdb;
535        $theme = wp_get_theme();
536        $output = '';
537       
538        $nf_function = new NEXForms_functions();
539        $dashboard = new NEXForms_dashboard();
540        $dashboard->dashboard_checkout();
541       
542        $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' );
543        $output .= '<div id="_wpnonce" style="display:none;">'.$nonce_url.'</div>';
544       
545        $output .= '<div class="nex_forms_admin_page_wrapper">';
546
547        $output .= $dashboard->dashboard_menu('Settings');
548                 
549                  $output .= '<div id="dashboard_panel" class="dashboard_panel global_settings_page">';
550                 
551                          $output .= '<div class="row row_zero_margin ">';
552                               
553                                //EMAIL SETUP
554                                $output .= '<div class="col-sm-4">';
555                                        $output .= $dashboard->license_setup($dashboard->checkout, $dashboard->client_info);
556                                        $output .= $dashboard->email_setup();
557                                $output .= '</div>';
558                               
559                                //WP ADMIN OPTIONS
560                                $output .= '<div class="col-sm-4">';
561                                        $output .= $dashboard->preferences();
562                                        $output .= $dashboard->wp_admin_options();
563                                $output .= '</div>';
564                               
565                                //PREFERENCES
566                                $output .= '<div class="col-sm-4">';
567                                        $output .= $dashboard->email_subscriptions_setup();
568                                        $output .= $dashboard->troubleshooting_options();
569                                $output .= '</div>';
570                               
571                        $output .= '</div>';
572                         
573                  $output .= '</div>';
574                       
575         $output .= '</div>'; //nex_forms_admin_page_wrapper
576 
577         echo $output;
578         $dashboard->remove_unwanted_styles();
579       
580         if(!get_option('7103891'))
581                {
582                $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0);
583                $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params));                   
584               
585                echo $response['body'];
586                if(!get_option('7103891'))
587                        update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y"))));
588                }
589       
590       
591}
592
593function NEXForms_add_ons_page(){
594        global $wpdb;
595        $theme = wp_get_theme();
596        $output = '';
597       
598        $nf_function = new NEXForms_functions();
599        $dashboard = new NEXForms_dashboard();
600        $dashboard->dashboard_checkout();
601       
602       
603       
604       
605       
606        $get_info = $dashboard->client_info;
607                               
608                                $get_license = $dashboard->license_info;
609                               
610                                $set_year       =       2021; //substr($get_info['date_puchased'],0,4);
611                                $set_month      =       8; //substr($get_info['date_puchased'],5,2);
612                                $set_day        =       20; //substr($get_info['date_puchased'],8,2);
613                               
614                                $set_support_year       =       substr($get_license['supported_until'],0,4);
615                                $set_support_month      =       substr($get_license['supported_until'],5,2);
616                                $set_support_day        =       substr($get_license['supported_until'],8,2);
617                               
618                                $get_support_date = $get_info['expiration_date'];
619                               
620                                $date1 = $set_support_year.'-'.$set_support_month.'-'.$set_support_day;
621                                $date2 = date('yy-m-d');
622                               
623                                $diff = strtotime($date1) - strtotime($date2);
624                               
625                                $years = floor($diff / (365*60*60*24));
626                                $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
627                                $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
628
629                                if($set_year==2020 || $set_year==2021 || $set_year==2022)
630                                        {
631                                        $download=true;         
632                                        }
633                               
634                                       
635                                       
636                                if($download && $diff>0)
637                                        $output .= '<div class="set_free_add_ons hidden">true</div>';
638                                else
639                                        {
640                                        //if(!get_option('nf_activated'))
641                                        //      $output .= '<div class="row"><div class="col-sm-12"><div class="alert alert-info"><h3>SALE NOW ON!</h3>We are celebrating 12 000+ Sales! <a href="http://codecanyon.net/item/nexforms-the-ultimate-wordpress-form-builder/7103891?license=regular&open_purchase_for_item_id=7103891&purchasable=source&ref=Basix">Buy NEX-forms today</a> and all these add-ons worth $210 absolutely FREE!.</div></div></div>';
642                                        }//
643               
644               
645                $output .= '<div class="nex_forms_admin_page_wrapper">';
646
647        $output .= $dashboard->dashboard_menu('Add-ons');
648                 
649                  $output .= '<div id="dashboard_panel" class="dashboard_panel global_settings_page">'; 
650                               
651                                //FORM THEMES
652                                $output .= '<div class="col-sm-3">';
653                                        $output .= '<div class="add_on_item">'; 
654                                                $output .= '<div class="add_on_cover">';
655                                                        $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/form-themes/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-form-themes.png',  dirname(dirname(__FILE__))).'"></a>'; 
656                                                $output .= '</div>';
657                                                $output .= '<div class="add_on_desciprtion">'; 
658                                                        $output .= '<h3>Form Themes/Color Schemes</h3>';
659                                                        $output .= 'Instantly fit your form design to your site\'s look and feel. Switch forms to Bootstrap, Material Design, Neumorphism, JQuery UI or Classic Themes. Includes 44 Preset Color Schemes.';
660                                                $output .= '</div>';
661                                                $output .= '<div class="add_on_check">';       
662                                                       
663                                                        if(function_exists('nf_not_found_notice_ft'))
664                                                                {
665                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
666                                                                }
667                                                        else
668                                                                {
669                                                                $output .= '<a href="https://codecanyon.net/item/form-themes-for-nexforms/10037800?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>'; 
670                                                                }
671                                                       
672                                                $output .= '</div>';
673                                        $output .= '</div>';           
674                                $output .= '</div>';
675                               
676                                //PAYPAL PRO
677                                $output .= '<div class="col-sm-3">';
678                                        $output .= '<div class="add_on_item">'; 
679                                                $output .= '<div class="add_on_cover">';
680                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/paypal-pro/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-paypal-pro.png',  dirname(dirname(__FILE__))).'"></a>'; 
681                                                $output .= '</div>';
682                                                $output .= '<div class="add_on_desciprtion">'; 
683                                                        $output .= '<h3>PayPal Pro</h3>';
684                                                       
685                                                        $output .= 'Enable online payments through PayPal. Incudes Itemized PayPal checkout and email sending options based on payment status.<br />&nbsp;';
686                                                $output .= '</div>';
687                                                $output .= '<div class="add_on_check">';       
688                                                       
689                                                        if(function_exists('nf_get_paypal_payment'))
690                                                                {
691                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
692                                                                }
693                                                        else
694                                                                {
695                                                                $output .= '<a href="https://codecanyon.net/item/paypal-pro-for-nexforms/22449576?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';   
696                                                                }
697                                                       
698                                                $output .= '</div>';
699                                        $output .= '</div>';           
700                                $output .= '</div>';
701                               
702                                //PDF CREATOR
703                                $output .= '<div class="col-sm-3">';
704                                        $output .= '<div class="add_on_item">'; 
705                                                $output .= '<div class="add_on_cover">';
706                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/pdf-creator/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-pdf-creator.png',  dirname(dirname(__FILE__))).'"></a>';       
707                                                $output .= '</div>';
708                                                $output .= '<div class="add_on_desciprtion">'; 
709                                                        $output .= '<h3>PDF Creator</h3>';
710                                                        $output .= 'Enables custom PDF creation from submmited form data. Also include options for these PDF\'s to be attached to admin and user emails.<br />&nbsp;';
711                                                $output .= '</div>';
712                                                $output .= '<div class="add_on_check">';       
713                                                       
714                                                        if(function_exists('nf_not_found_notice_pdf'))
715                                                                {
716                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
717                                                                }
718                                                        else
719                                                                {
720                                                                $output .= '<a href="https://codecanyon.net/item/pdf-creator-for-nexforms/11220942?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>'; 
721                                                                }
722                                                       
723                                                $output .= '</div>';
724                                        $output .= '</div>';           
725                                $output .= '</div>';
726                                //SUPER SELECT
727                                $output .= '<div class="col-sm-3">';
728                                        $output .= '<div class="add_on_item">'; 
729                                                $output .= '<div class="add_on_cover">';
730                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/super-select-form-field/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-super-select.png', dirname(dirname(__FILE__))).'"></a>';   
731                                                $output .= '</div>';
732                                                $output .= '<div class="add_on_desciprtion">'; 
733                                                        $output .= '<h3>Super Selection Form Field</h3>';
734                                                        $output .= 'Use 1500+ Icons to create your own custom Radio Buttons, Checkboxes, Dropdown selects and Spinner selects. Abolutely Full Cutomisation...use any on/off colors and any on/off icons for each option.';
735                                                $output .= '</div>';
736                                                $output .= '<div class="add_on_check">';       
737                                                       
738                                                        if(function_exists('nf_not_found_notice_ss'))
739                                                                {
740                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
741                                                                }
742                                                        else
743                                                                {
744                                                                $output .= '<a  href="https://codecanyon.net/item/super-selection-form-field-for-nexforms/23748570?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>'; 
745                                                                }
746                                                       
747                                                $output .= '</div>';
748                                        $output .= '</div>';           
749                                $output .= '</div>';
750                                //STRIPE
751                                /*$output .= '<div class="col-sm-3">';
752                                        $output .= '<div class="add_on_item">';
753                                                $output .= '<div class="add_on_cover">';
754                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/stripe/" target="_blank"><img src="https://basixonline.net/add-ons/covers/nex-forms-add-on-stripe.png"></a>';       
755                                                $output .= '</div>';
756                                                $output .= '<div class="add_on_desciprtion">'; 
757                                                        $output .= '<h3>Stripe</h3>';
758                                                        $output .= 'Enable online payments through Stripe<br /><br /><br />&nbsp;';
759                                                $output .= '</div>';
760                                                $output .= '<div class="add_on_check">';       
761                                                       
762                                                        if(function_exists('nf_not_found_notice_stripe'))
763                                                                {
764                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
765                                                                }
766                                                        else
767                                                                {
768                                                                $output .= '<a href="https://codecanyon.net/user/basix/portfolio?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';   
769                                                                }
770                                                       
771                                                $output .= '</div>';
772                                        $output .= '</div>';           
773                                $output .= '</div>';*/
774                               
775                               
776                               
777                               
778                               
779                               
780                               
781                               
782                                //MAILCHIMP
783                                $output .= '<div class="col-sm-3">';
784                                        $output .= '<div class="add_on_item">'; 
785                                                $output .= '<div class="add_on_cover">';
786                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/mailchimp/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-mailchimp.png',  dirname(dirname(__FILE__))).'"></a>';   
787                                                $output .= '</div>';
788                                                $output .= '<div class="add_on_desciprtion">'; 
789                                                        $output .= '<h3>MailChimp</h3>';
790                                                        $output .= 'Automatically update your MailChimp lists with new subscribers from NEX-Forms. <br />&nbsp;';
791                                                $output .= '</div>';
792                                                $output .= '<div class="add_on_check">';       
793                                                       
794                                                        if(function_exists('nexforms_mc_test_api'))
795                                                                {
796                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
797                                                                }
798                                                        else
799                                                                {
800                                                                $output .= '<a href="https://codecanyon.net/item/mailchimp-for-nexforms/18030221?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';   
801                                                                }
802                                                       
803                                                $output .= '</div>';
804                                        $output .= '</div>';           
805                                $output .= '</div>';
806                               
807                               
808                                //MAILSTER
809                                $output .= '<div class="col-sm-3">';
810                                        $output .= '<div class="add_on_item">'; 
811                                                $output .= '<div class="add_on_cover">';
812                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/mailchimp/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-mailster.png',  dirname(dirname(__FILE__))).'"></a>';     
813                                                $output .= '</div>';
814                                                $output .= '<div class="add_on_desciprtion">'; 
815                                                        $output .= '<h3>Mailster</h3>';
816                                                        $output .= 'Automatically update your Mailster lists with new subscribers from NEX-Forms. <br />&nbsp;';
817                                                $output .= '</div>';
818                                                $output .= '<div class="add_on_check">';       
819                                                       
820                                                        if(function_exists('nexforms_ms_test_api'))
821                                                                {
822                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
823                                                                }
824                                                        else
825                                                                {
826                                                                $output .= '<a href="https://codecanyon.net/item/mailster-for-nexforms/27019198?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';     
827                                                                }
828                                                       
829                                                $output .= '</div>';
830                                        $output .= '</div>';           
831                                $output .= '</div>';
832                               
833                                //MAILPOET
834                                $output .= '<div class="col-sm-3">';
835                                        $output .= '<div class="add_on_item">'; 
836                                                $output .= '<div class="add_on_cover">';
837                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/mailchimp/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-mailpoet.png',  dirname(dirname(__FILE__))).'"></a>';     
838                                                $output .= '</div>';
839                                                $output .= '<div class="add_on_desciprtion">'; 
840                                                        $output .= '<h3>MailPoet</h3>';
841                                                        $output .= 'Automatically update your MailPoet lists with new subscribers from NEX-Forms. <br />&nbsp;';
842                                                $output .= '</div>';
843                                                $output .= '<div class="add_on_check">';       
844                                                       
845                                                        if(function_exists('nexforms_mp_test_api'))
846                                                                {
847                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
848                                                                }
849                                                        else
850                                                                {
851                                                                $output .= '<a href="https://codecanyon.net/item/mailpoet-for-nexforms/26950120?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';     
852                                                                }
853                                                       
854                                                $output .= '</div>';
855                                        $output .= '</div>';           
856                                $output .= '</div>';
857                               
858                               
859                               
860                                //GETRESPONSE
861                                $output .= '<div class="col-sm-3">';
862                                        $output .= '<div class="add_on_item">'; 
863                                                $output .= '<div class="add_on_cover">';
864                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/getresponse/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-getresponse.png',  dirname(dirname(__FILE__))).'"></a>';       
865                                                $output .= '</div>';
866                                                $output .= '<div class="add_on_desciprtion">'; 
867                                                        $output .= '<h3>GetRepsonse</h3>';
868                                                        $output .= 'Automatically update your GetResponse lists with new subscribers from NEX-Forms. <br />&nbsp;';
869                                                $output .= '</div>';
870                                                $output .= '<div class="add_on_check">';       
871                                                       
872                                                        if(function_exists('nexforms_gr_test_api'))
873                                                                {
874                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
875                                                                }
876                                                        else
877                                                                {
878                                                                $output .= '<a href="https://codecanyon.net/item/getresponse-for-nexforms/18462247?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>'; 
879                                                                }
880                                                       
881                                                $output .= '</div>';
882                                        $output .= '</div>';           
883                                $output .= '</div>';
884                               
885                               
886                               
887                                //DIGITAL SIGNATURES
888                                $output .= '<div class="col-sm-3">';
889                                        $output .= '<div class="add_on_item">'; 
890                                                $output .= '<div class="add_on_cover">';
891                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/digital-signatures/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-digital-signatures.png',  dirname(dirname(__FILE__))).'"></a>'; 
892                                                $output .= '</div>';
893                                                $output .= '<div class="add_on_desciprtion">'; 
894                                                        $output .= '<h3>Digital Signatures</h3>';
895                                                        $output .= 'Allows you to add digital signature fields to your forms. Use these signatures in email and PDF\'s.<br />&nbsp;';
896                                                $output .= '</div>';
897                                                $output .= '<div class="add_on_check">';       
898                                                       
899                                                        if(function_exists('nf_not_found_notice_ds'))
900                                                                {
901                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
902                                                                }
903                                                        else
904                                                                {
905                                                                $output .= '<a href="https://codecanyon.net/item/digital-signatures-for-nexforms/17044658?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';   
906                                                                }
907                                                       
908                                                $output .= '</div>';
909                                        $output .= '</div>';           
910                                $output .= '</div>';
911                               
912                                //FORM TO POST
913                                $output .= '<div class="col-sm-3">';
914                                        $output .= '<div class="add_on_item">'; 
915                                                $output .= '<div class="add_on_cover">';
916                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/form-to-post-or-page/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-form-to-post-or-page.png',  dirname(dirname(__FILE__))).'"></a>';     
917                                                $output .= '</div>';
918                                                $output .= '<div class="add_on_desciprtion">'; 
919                                                        $output .= '<h3>Form to POST / PAGE</h3>';
920                                                        $output .= 'Automatically create posts or pages from NEX-Forms form submissions. Includes setting featured image and the use of data tags to populate Page/Post content.';
921                                                $output .= '</div>';
922                                                $output .= '<div class="add_on_check">';       
923                                                       
924                                                        if(function_exists('nexforms_ftp_setup'))
925                                                                {
926                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
927                                                                }
928                                                        else
929                                                                {
930                                                                $output .= '<a href="https://codecanyon.net/item/form-to-postpage-for-nexforms/19538774?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';     
931                                                                }
932                                                       
933                                                $output .= '</div>';
934                                        $output .= '</div>';           
935                                $output .= '</div>';
936                               
937                               
938                               
939                               
940                               
941                               
942                               
943                               
944                                //CONDITIONAL CONTENT BLOCKS
945                                $output .= '<div class="col-sm-3">';
946                                        $output .= '<div class="add_on_item">'; 
947                                                $output .= '<div class="add_on_cover">';
948                                                        $output .= '<a  href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/conditional-content-blocks/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-conditional-content-blocks.png',  dirname(dirname(__FILE__))).'"></a>'; 
949                                                $output .= '</div>';
950                                                $output .= '<div class="add_on_desciprtion">'; 
951                                                        $output .= '<h3>Conditional Content Blocks</h3>';
952                                                        $output .= 'Create dynamic content in emails and PDF\'s from submitted data. Meaning you can hide/show specific content in the emails or PDF\'s based on a users input or selection.';
953                                                $output .= '</div>';
954                                                $output .= '<div class="add_on_check">';       
955                                                       
956                                                        if(function_exists('nf_not_found_notice_ccb'))
957                                                                {
958                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
959                                                                }
960                                                        else
961                                                                {
962                                                                $output .= '<a href="https://codecanyon.net/item/conditional-content-blocks-for-nexforms/22096224?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>';   
963                                                                }
964                                                       
965                                                $output .= '</div>';
966                                        $output .= '</div>';           
967                                $output .= '</div>';
968                               
969                               
970                                //SHORTCODE PROCESSOR
971                                $output .= '<div class="col-sm-3">';
972                                        $output .= '<div class="add_on_item">'; 
973                                                $output .= '<div class="add_on_cover">';
974                                                        $output .= '<a href="http://basixonline.net/nex-forms-wordpress-form-builder-demo/add-ons/shortcode-processor/" target="_blank"><img src="'.plugins_url('/admin/images/add-ons/covers/nex-forms-add-on-shortcode-processor.png',  dirname(dirname(__FILE__))).'"></a>'; 
975                                                $output .= '</div>';
976                                                $output .= '<div class="add_on_desciprtion">'; 
977                                                        $output .= '<h3>Shorcode Processor</h3>';
978                                                        $output .= 'Run your own custom shorcode or 3rd party plugin/theme shorcode anywhere in your forms.<br /><br />&nbsp;';
979                                                $output .= '</div>';
980                                                $output .= '<div class="add_on_check">';       
981                                                       
982                                                        if(function_exists('nf_not_found_notice_sp'))
983                                                                {
984                                                                $output .= '<div class="installed"><span class="fa fa-check"></span> Installed</div>';         
985                                                                }
986                                                        else
987                                                                {
988                                                                $output .= '<a href="https://codecanyon.net/item/shortcode-processor-for-nexforms/22556756?ref=Basix" class="buy_add_on btn btn-lime" target="_blank">Get Add-on</a>'; 
989                                                                }
990                                                       
991                                                $output .= '</div>';
992                                        $output .= '</div>';           
993                                $output .= '</div>';
994                               
995                               
996                               
997                        $output .= '</div>';
998                 $output .= '</div>';
999       
1000         echo $output;
1001         $dashboard->remove_unwanted_styles();
1002       
1003}
1004
1005function NEXForms_dashboard(){
1006       
1007        global $wpdb;
1008        $theme = wp_get_theme();
1009        $output = '';
1010       
1011        $nf_function = new NEXForms_functions();
1012       
1013       
1014        $count_entries = $wpdb->get_results('SELECT nex_forms_Id, COUNT(nex_forms_Id) as counted FROM `'.$wpdb->prefix.'wap_nex_forms_entries` WHERE trashed IS NULL GROUP BY nex_forms_Id;');
1015                        foreach($count_entries as $entry)
1016                                {
1017                                $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms', array('entry_count'=>$entry->counted), array('Id' => $entry->nex_forms_Id) );
1018                                }
1019       
1020       
1021        $dashboard = new NEXForms_dashboard();
1022        $dashboard->dashboard_checkout();
1023        $dashboard->color_adapt = true;
1024       
1025        //MY FORMS
1026        $saved_forms = new NEXForms_dashboard();
1027        $saved_forms->table = 'wap_nex_forms';
1028        $saved_forms->table_header = 'My Forms';
1029        $saved_forms->table_header_icon = 'insert_drive_file';
1030        $saved_forms->table_headings = array('Id', array('heading'=>__('title','nex-forms'), 'user_func'=>'link_form_title_2', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id','sort_by'=>'title'),  array('heading'=>__('Total Entries','nex-forms'), 'user_func'=>'get_total_entries_3', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id','user_func_args_2'=>'entry_count', 'sort_by'=>'entry_count'),array('heading'=>'', 'user_func'=>'link_form_title', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'),array('heading'=>'', 'user_func'=>'duplicate_record', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'),array('heading'=>'', 'user_func'=>'print_export_form_link', 'user_func_class'=>'NEXForms_dashboard','user_func_args_1'=>'Id'));
1031        $saved_forms->show_headings=true;
1032        $saved_forms->extra_classes = 'my-forms chart-selection';
1033        $saved_forms->additional_params = array(array('column'=>'is_template','operator'=>'=','value'=>0),array('column'=>'is_form','operator'=>'=','value'=>1));
1034        $saved_forms->search_params = array('Id','title');
1035        $saved_forms->checkout = $dashboard->checkout;
1036        $saved_forms->extra_buttons = array('new_form'=>array('class'=>'create_new_form', 'id'=>isset($_POST['form_Id']) ? sanitize_text_field($_POST['form_Id']) : '', 'type'=>'button','link'=>'', 'icon'=>'<span class="fas fa-file-medical"></span> '.__('&nbsp;&nbsp;Add a New Form','nex-forms').''));
1037        $saved_forms->color_adapt = true;
1038        $saved_forms->show_delete = true;
1039       
1040        //LATEST ENTRIES
1041        $latest_entries = new NEXForms_dashboard();
1042        $latest_entries->table = 'wap_nex_forms_entries';
1043        $latest_entries->table_header = 'Last 10 Form Submissions';
1044        $latest_entries->sortable_columns = false;
1045        $latest_entries->table_header_icon = 'assignment';
1046        $latest_entries->table_headings = array(array('heading'=> __('Form','nex-forms'), 'user_func'=>'NEXForms_get_title','user_func_args_1'=>'nex_forms_Id','user_func_args_2'=>'wap_nex_forms'),'page',array('heading'=>__('Submitted','nex-forms'), 'user_func'=>'NEXForms_time_elapsed_string','user_func_args_1'=>'date_time', 'user_func_args_2'=>'wap_nex_forms'),array('heading'=>__('Data Summary','nex-forms'), 'user_func'=>'NEXForms_get_entry_data_preview','user_func_args_1'=>'Id'));
1047        $latest_entries->show_headings=true;
1048        $latest_entries->search_params = array('Id','form_data');
1049        $latest_entries->checkout = $dashboard->checkout;
1050        $latest_entries->show_delete = true;
1051        $latest_entries->show_paging = false;
1052        $latest_entries->show_search = false;
1053        $latest_entries->color_adapt = true;
1054       
1055        $latest_entries->show_more_link = array('link'=> get_admin_url().'admin.php?page=nex-forms-page-submissions','text'=>'Show all form entries');
1056       
1057       
1058        $output .= '<div class="nex_forms_admin_page_wrapper">';
1059
1060        $output .= $dashboard->dashboard_menu('Dashboard');
1061       
1062       
1063        if(!get_option('7103891'))
1064                {
1065                $api_params = array( 'nexforms-installation-2' => 1, 'source' => 'wordpress.org', 'email_address' => get_option('admin_email'), 'for_site' => get_option('siteurl'), 'get_option'=>(is_array(get_option('7103891'))) ? 1 : 0);
1066                $response = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'=> 30,'sslverify' => false,'body'=> $api_params));                   
1067               
1068                echo $response['body'];
1069                if(!get_option('7103891'))
1070                        update_option( '7103891' , array( $response['body'],mktime(0,0,0,date("m"),date("d")+30,date("Y"))));
1071                }
1072        update_option('nf_activated',$dashboard->checkout);
1073       
1074       
1075                 
1076                 if(!$dashboard->checkout)
1077                        {
1078                                 $output .= '<div id="dashboard_panel" class="dashboard_panel">';
1079                                        $output .= '<div class="row row_zero_margin ">';
1080                                               
1081                                                $output .= '<div class="col-sm-5">';
1082                                                        $output .= $dashboard->license_setup();
1083                                                $output .= '</div>';
1084                                                $output .= '<div class="col-sm-7">';
1085                                                        $output .= $saved_forms->print_record_table();
1086                                                $output .= '</div>';
1087                                        $output .= '</div>';
1088                                $output .= '</div>';
1089                        $output .= '</div>';
1090                       
1091                        echo $output;
1092                        return;
1093                        }
1094                 $nonce_url = wp_create_nonce( 'nf_admin_dashboard_actions' );
1095                 $output .= '<div id="_wpnonce" style="display:none;">'.$nonce_url.'</div>';
1096                 
1097                  $output .= '<div id="dashboard_panel" class="dashboard_panel">';
1098                 
1099                          $output .= '<div class="row row_zero_margin ">';
1100                         
1101                                        $output .= '<div class="col-sm-7">';
1102                                                $output .= $saved_forms->print_record_table();
1103                                        $output .= '</div>';
1104                                       
1105                                        $output .= '<div  class="col-sm-5">';
1106                                                $output .= $dashboard->form_analytics($print_chart='summary');
1107                                        $output .= '</div>';
1108                                       
1109                          $output .= '</div>';
1110                         
1111                          $output .= '<div class="row row_zero_margin ">';
1112                                        $output .= '<div class="col-sm-12">';
1113                                                $output .= $latest_entries->print_record_table();
1114                                        $output .= '</div>';
1115                                       
1116                                        //$output .= '<div  class="col-sm-6">';
1117                                        //      $output .= $latest_entries->print_form_entry();
1118                                        //$output .= '</div>';
1119                          $output .= '</div>';
1120                         
1121                  $output .= '</div>';
1122                       
1123         $output .= '</div>'; //nex_forms_admin_page_wrapper
1124 
1125         echo $output;
1126         $dashboard->remove_unwanted_styles();
1127         
1128}
1129
1130
1131
1132
1133if(!class_exists('NEXForms_dashboard'))
1134        {
1135        class NEXForms_dashboard{
1136                public 
1137                $table = 'wap_nex_forms',
1138                $table_header = '',
1139                $extra_classes = '',
1140                $table_header_icon = '',
1141                $additional_params = array(),
1142                $show_search = true,
1143                $search_params = array(),
1144                $build_table_dropdown = false,
1145                $table_headings = array(),
1146                $field_selection = array(),
1147                $extra_buttons = array(),
1148                $show_headings = true,
1149                $show_delete = true,
1150                $show_paging = true,
1151                $table_resize =false,
1152                $checkout = false,
1153                $client_info = 'no info',
1154                $is_report=false,
1155                $action_button,
1156                $color_adapt=false,
1157                $record_limit=10,
1158                $sortable_columns = true,
1159                $action='',
1160                $show_more_link = '';
1161               
1162                public function __construct($table='', $table_header='', $extra_classes='', $table_header_icon='',$additional_params='', $search_params='', $table_headings='', $show_headings='', $field_selection ='', $extra_buttons ='', $checkout=false, $sortable_columns = true, $show_search=true, $show_paging=true, $show_delete=false, $is_report=false, $color_adapt=false, $table_resize=false , $record_limit=10, $action=''){
1163                       
1164                        global $wpdb; 
1165               
1166                       
1167                       
1168                        add_action('wp_ajax_get_table_records', array($this,'get_table_records'));
1169                        add_action('wp_ajax_do_form_entry_save', array($this,'do_form_entry_save'));
1170                        add_action('wp_ajax_submission_report', array($this,'submission_report'));
1171                        add_action('wp_ajax_nf_print_chart', array($this,'print_chart'));
1172                       
1173                        add_action('wp_ajax_nf_delete_form_entry', array($this,'delete_form_entry'));
1174                       
1175                        add_action('wp_ajax_nf_entries_restore', array($this,'restore_records'));
1176                       
1177                        add_action('wp_ajax_nf_entries_set_starred', array($this,'set_starred'));
1178                        add_action('wp_ajax_nf_entries_set_read', array($this,'set_read'));
1179                       
1180                        add_action('wp_ajax_nf_reset_forms_menu', array($this,'entries_menu'));
1181                       
1182                       
1183                        add_action('wp_ajax_nf_print_to_pdf', array($this,'print_to_pdf'));
1184                        add_action('wp_ajax_nf_delete_pdf', array($this,'delete_pdf'));
1185                        //add_action('wp_ajax_nopriv_nf_print_to_pdf', array($this,'print_to_pdf'));
1186                       
1187                        add_action('wp_ajax_nf_print_report_to_pdf', array($this,'print_report_to_pdf'));
1188                        //add_action('wp_ajax_nopriv_nf_print_report_to_pdf', array($this,'print_report_to_pdf'));
1189                       
1190                        $this->table                            = $table;
1191                        $this->table_resize             = $table_resize;
1192                        $this->table_header             = $table_header;
1193                        $this->table_header_icon        = $table_header_icon;
1194                        $this->additional_params        = $additional_params;
1195                        $this->search_params            = $search_params;
1196                        $this->field_selection          = $field_selection;
1197                        $this->table_headings           = $table_headings;
1198                        $this->show_headings            = $show_headings;
1199                        $this->show_delete                      = $show_delete;
1200                        $this->show_paging                      = $show_paging;
1201                        $this->extra_buttons            = $extra_buttons;
1202                        $this->extra_classes            = $extra_classes;
1203                        $this->is_report                        = $is_report;
1204                        $this->color_adapt                      = $color_adapt;
1205                        $this->record_limit                     = $record_limit;
1206                        $this->action                           = $action;
1207                        $this->sortable_columns         = $sortable_columns;
1208                        }
1209                public function entries_menu(){
1210                       
1211                        global $wpdb;
1212                        $output = '';   
1213                       
1214                        $nf_function = new NEXForms_functions();
1215       
1216                        $database_actions = new NEXForms_Database_Actions();
1217                       
1218                        $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC');
1219                       
1220
1221                        $total_all = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')));
1222                       
1223                        $additional_params = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
1224                        $total_unread = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params);
1225                               
1226                        $output .= '<ul class="forms_menu aa_menu">';
1227                               
1228                               
1229                               
1230                                $output .= '<li class="form_item top_item dropable all_entries" data-form-id="0" data-folder="all_entries">';   
1231                                        $output .= '<a class="form_item all_entries main_item active" ><span class="menu_icon far fa-envelope"></span><span class="form_title">'.__('Inbox','nex-forms').'</span><span class="form_entry_total"><span class="menu_badge">'.$total_all.'</span><span class="form_entry_unread">'.(($total_unread<=0) ? '' : '&nbsp;('.$total_unread.')' ).'</span></span></a>';
1232                                               
1233                                        //$output .= '<ul class="forms_menu aa_menu aa_bg_tri">';
1234                                $output .= '</li>';     
1235                                foreach($forms as $form)
1236                                        {
1237                                        $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id);   
1238                                       
1239                                        $additional_params_form = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
1240                                        $total_unread_form = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params_form,$form->Id);
1241                                       
1242                                        if($total_entries>0)   
1243                                                $output .= '<li class="form_item   sub_form_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'" data-folder="form_entries_'.$form->Id.'"><a class="form_item form_entries_'.$form->Id.'"><span class="form_title">'.$nf_function->view_excerpt2($form->title,20).'</span><span class="form_entry_total"><span class="menu_badge">'.$total_entries.'</span> <span class="form_entry_unread">'.(($total_unread_form>0) ? '&nbsp;('.$total_unread_form.')' : '' ).'</span></span></a></li>'; 
1244                                        }
1245                                       
1246                                        //$output .= '</ul>';   
1247                               
1248                               
1249                                /*$output .= '<li class="form_item top_item dropable entry_attachment" data-folder="entry_attachment">';       
1250                                        $output .= '<a class="form_item entry_attachment main_item" ><span class="menu_icon fas fa-paperclip"></span><span class="form_title">'.__('Attachments','nex-forms').'</span></a>';
1251                                $output .= '</li>';
1252                               
1253                                $output .= '<li class="form_item top_item dropable starred_entries" data-folder="starred_entries">';   
1254                                        $output .= '<a class="form_item starred_entries main_item" ><span class="menu_icon fas fa-star"></span><span class="form_title">'.__('Starred','nex-forms').'</span></a>';
1255                                $output .= '</li>';*/
1256                               
1257                                $output .= '<li class="form_item top_item dropable paypal_entries" data-folder="payment_entries">';     
1258                                        $output .= '<a class="form_item payment_entries main_item" ><span class="menu_icon fab fa-paypal"></span><span class="form_title">'.__('PayPal Payments','nex-forms').'</span></a>';
1259                                $output .= '</li>';     
1260                                        //$output .= '<ul class="forms_menu aa_menu ">';
1261                                               
1262                                                $output .= '<li class="form_item sub_form_item  dropable paypal_entries_paid" data-folder="payment_entries_paid">';     
1263                                                        $output .= '<a class="form_item form_item_sec payment_entries_paid" ><span class="menu_icon fas fa-check"></span><span class="form_title">'.__('Paid','nex-forms').'</span></a>';
1264                                                $output .= '</li>';
1265                                               
1266                                                $output .= '<li class="form_item sub_form_item  dropable paypal_entries_unpaid" data-folder="payment_entries_unpaid">'; 
1267                                                        $output .= '<a class="form_item form_item_sec payment_entries_unpaid" ><span class="menu_icon fas fa-times"></span><span class="form_title">'.__('Unpaid','nex-forms').'</span></a>';
1268                                                $output .= '</li>';
1269                                               
1270                                                $output .= '<li class="form_item sub_form_item  dropable paypal_entries_pending" data-folder="payment_entries_pending">';       
1271                                                        $output .= '<a class="form_item form_item_sec payment_entries_pending" ><span class="menu_icon fas fa-sync-alt"></span><span class="form_title">'.__('Pending','nex-forms').'</span></a>';
1272                                                $output .= '</li>';
1273                                               
1274                                        //$output .= '</ul>';
1275                               
1276                               
1277                                /*$output .= '<li class="form_item dropable archived_entries">';       
1278                                        $output .= '<a class="form_item archived_entries main_item"><span class="menu_icon fas fa-archive"></span><span class="form_title">'.__('Archived','nex-forms').'</span></a>';
1279                                $output .= '</li>';*/
1280                               
1281                                $output .= '<li class="form_item top_item dropable trashed_entries" data-form-id="0" data-folder="trashed_entries">';   
1282                                        $output .= '<a class="form_item trashed_entries main_item"><span class="menu_icon fas fa-trash"></span><span class="form_title">'.__('Trash','nex-forms').'</span></a>';
1283                                $output .= '</li>';
1284                               
1285                                       
1286                        $output .= '</ul>';
1287                       
1288                       
1289                        $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : '';
1290
1291                        if($do_ajax)
1292                                {
1293                                NEXForms_clean_echo($output);
1294                                wp_die();
1295                                }
1296                        else
1297                                return $output;
1298                               
1299                }
1300               
1301               
1302                public function uploads_menu(){
1303                       
1304                        global $wpdb;
1305                        $output = '';   
1306                       
1307                        $nf_function = new NEXForms_functions();
1308       
1309                        $database_actions = new NEXForms_Database_Actions();
1310                       
1311                        $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC');
1312                       
1313
1314                        $total_all = $database_actions->get_total_records('wap_nex_forms_files',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')));
1315                       
1316                       
1317                        $output .= '<ul class="forms_menu aa_menu">';
1318                               
1319                               
1320                               
1321                                $output .= '<li class="form_item top_item dropable all_entries" data-form-id="0" data-folder="all_entries">';   
1322                                        $output .= '<a class="form_item all_entries main_item active" ><span class="menu_icon fas fa-file-upload"></span><span class="form_title">'.__('All Files','nex-forms').'</span><span class="form_entry_total"><span class="menu_badge">'.$total_all.'</span><span class="form_entry_unread">'.((isset($total_unread) && $total_unread<=0) ? '' : '&nbsp;('.((isset($total_unread)) ? $total_unread : '').')' ).'</span></span></a>';
1323                                               
1324                                        //$output .= '<ul class="forms_menu aa_menu aa_bg_tri">';
1325                                $output .= '</li>';     
1326                                foreach($forms as $form)
1327                                        {
1328                                        $total_entries = $database_actions->get_total_records('wap_nex_forms_files',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id);     
1329                                       
1330                                       
1331                                        if($total_entries>0)   
1332                                                $output .= '<li class="form_item   sub_form_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'" data-folder="form_entries_'.$form->Id.'"><a class="form_item form_entries_'.$form->Id.'"><span class="form_title">'.$nf_function->view_excerpt2($form->title,20).'</span><span class="form_entry_total"><span class="menu_badge">'.$total_entries.'</span></span></a></li>';       
1333                                        }
1334                                       
1335                               
1336                               
1337                               
1338                               
1339                                       
1340                        $output .= '</ul>';
1341                        $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : '';
1342
1343                        if($do_ajax)
1344                                {
1345                                NEXForms_clean_echo($output);
1346                                wp_die();
1347                                }
1348                        else
1349                                return $output;
1350                               
1351                }
1352               
1353               
1354                public function reporting_menu(){
1355                       
1356                        global $wpdb;
1357                        $output = '';   
1358                       
1359                        $nf_function = new NEXForms_functions();
1360       
1361                        $database_actions = new NEXForms_Database_Actions();
1362                       
1363                        $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC');
1364                       
1365
1366                        $total_all = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')));
1367                       
1368                        $additional_params = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
1369                        $total_unread = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params);
1370                       
1371                        $output .= '<div class="menu_head aa_bg_sec font_color_1">Select form to create report</div>';
1372                        $output .= '<ul class="forms_menu aa_menu">';
1373                               
1374                               
1375                               
1376                               
1377                                       
1378                               
1379                                foreach($forms as $form)
1380                                        {
1381                                        $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id);   
1382                                       
1383                                        $additional_params_form = '';//array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
1384                                        $total_unread_form = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params_form,$form->Id);
1385                                       
1386                                        if($total_entries>0)   
1387                                                $output .= '<li class="reporting_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'"><a class="form_item"><span class="form_title">'.$nf_function->view_excerpt2($form->title,20).'</span><span class="form_entry_total"><span class="menu_badge">'.(($total_unread_form>0) ? ''.$total_unread_form.'' : '' ).'</span></span></a></li>';   
1388                                        }
1389                               
1390                               
1391                                       
1392                        $output .= '</ul>';
1393                        $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : '';
1394
1395                        if($do_ajax)
1396                                {
1397                                NEXForms_clean_echo($output);
1398                                wp_die();
1399                                }
1400                        else
1401                                return $output;
1402                               
1403                }
1404               
1405               
1406               
1407                public function analytics_menu(){
1408                       
1409                        global $wpdb;
1410                        $output = '';   
1411                       
1412                        $nf_function = new NEXForms_functions();
1413       
1414                        $database_actions = new NEXForms_Database_Actions();
1415                       
1416                        $forms = $wpdb->get_results('SELECT Id, title FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_form=1 ORDER BY Id DESC');
1417                       
1418
1419                        $total_all = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')));
1420                       
1421                        $additional_params = array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
1422                        $total_unread = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params);
1423                       
1424                        //$output .= '<div class="menu_head aa_bg_sec font_color_1">Select form to create report</div>';
1425                        $output .= '<ul class="forms_menu aa_menu">';
1426                               
1427                               
1428                               
1429                                $output .= '<li class="analytics_item form_id_0" data-form-id="0"><a class="form_item active"><span class="form_title">All Forms</span></a></li>';     
1430                                       
1431                               
1432                                foreach($forms as $form)
1433                                        {
1434                                        $total_entries = $database_actions->get_total_records('wap_nex_forms_entries',array(array('column'=>'trashed','operator'=>'IS','value'=>'NULL')),$form->Id);   
1435                                       
1436                                        $additional_params_form = '';//array(array('column'=>'viewed','operator'=>'IS','value'=>'NULL'), array('column'=>'trashed','operator'=>'IS','value'=>'NULL'));
1437                                        $total_unread_form = $database_actions->get_total_records('wap_nex_forms_entries',$additional_params_form,$form->Id);
1438                                       
1439                                        //if($total_entries>0) 
1440                                                $output .= '<li class="analytics_item form_id_'.$form->Id.'" data-form-id="'.$form->Id.'"><a class="form_item"><span class="form_title">'.$nf_function->view_excerpt2($form->title,30).'</span></a></li>';      //<span class="form_entry_total"><span class="menu_badge">'.(($total_unread_form>0) ? ''.$total_unread_form.'' : '0' ).'</span></span>
1441                                        }
1442                               
1443                               
1444                                       
1445                        $output .= '</ul>';
1446                        $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : '';
1447
1448                        if($do_ajax)
1449                                {
1450                                NEXForms_clean_echo($output);
1451                                wp_die();
1452                                }
1453                        else
1454                                return $output;
1455                               
1456                }
1457               
1458                public function delete_form_entry(){
1459                       
1460                        if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'nf_admin_dashboard_actions' ) ) {
1461                                wp_die();
1462                        }
1463                        if(!current_user_can( NF_USER_LEVEL )) 
1464                                wp_die();
1465                               
1466                        global $wpdb;
1467
1468                        $db_table = sanitize_title($_POST['table']);
1469                       
1470                        if(!strstr($db_table, 'nex_forms'))
1471                                wp_die();
1472                       
1473                       
1474                        if($_POST['delete_action']=='trash')
1475                                {               
1476                                foreach($_POST['selection'] as $key=>$val)
1477                                        {
1478                                        $update = $wpdb->update ( $wpdb->prefix . filter_var($db_table,FILTER_SANITIZE_STRING), array('trashed'=>'1'), array(   'Id' => filter_var($val,FILTER_SANITIZE_NUMBER_INT)) ); 
1479                                        }
1480                                }
1481                        else
1482                                {
1483                                foreach($_POST['selection'] as $key=>$val)
1484                                        {
1485                                        $delete = $wpdb->delete($wpdb->prefix. filter_var($db_table,FILTER_SANITIZE_STRING),array('Id'=>filter_var($val,FILTER_SANITIZE_NUMBER_INT)));
1486                                        }
1487                                }
1488                       
1489                        die();
1490                }       
1491               
1492               
1493                public function restore_records(){
1494                       
1495                        if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'nf_admin_dashboard_actions' ) ) {
1496                                wp_die();
1497                        }
1498                        if(!current_user_can( NF_USER_LEVEL )) 
1499                                wp_die();
1500                       
1501                        global  $wpdb;
1502                                foreach($_POST['selection'] as $key=>$val)
1503                                        {
1504                                        $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('trashed'=>NULL), array(       'Id' => filter_var($val,FILTER_SANITIZE_NUMBER_INT)) );
1505                                        echo $update;
1506                                        }
1507
1508                        wp_die();       
1509                }
1510               
1511               
1512                public function set_starred(){
1513                       
1514                        if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'nf_admin_dashboard_actions' ) ) {
1515                                wp_die();
1516                        }
1517                        if(!current_user_can( NF_USER_LEVEL )) 
1518                                wp_die();
1519                       
1520                        global  $wpdb;
1521                       
1522                        $set_starred = ($_POST['starred']=='1' || $_POST['starred']==1) ? 0 : 1;
1523                        if($_POST['record_id'])
1524                                {
1525                                $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('starred'=>$set_starred), array(       'Id' => filter_var($_POST['record_id'],FILTER_SANITIZE_NUMBER_INT)) );
1526                                }
1527                        else
1528                                {
1529                                foreach($_POST['selection'] as $key=>$val)
1530                                        {
1531                                        $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('starred'=>$set_starred), array(       'Id' => filter_var($val,FILTER_SANITIZE_NUMBER_INT)) );
1532                                        }
1533                                }
1534                       
1535                       
1536                        wp_die();       
1537                }
1538               
1539                public function set_read(){
1540                       
1541                        if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'nf_admin_dashboard_actions' ) ) {
1542                                wp_die();
1543                        }
1544                        if(!current_user_can( NF_USER_LEVEL )) 
1545                                wp_die();
1546                       
1547                        global  $wpdb;
1548                       
1549                        $set_read = ($_POST['read']!='1') ? NULL : 'viewed';
1550                       
1551                        foreach($_POST['selection'] as $key=>$val)
1552                                {
1553                                $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries', array('viewed'=>$set_read), array(   'Id' => $val) );
1554                                }
1555                        wp_die();       
1556                }
1557               
1558                public function dashboard_checkout()
1559                        {
1560                        $db_action = new NEXForms_Database_Actions();
1561                        $this->checkout = $db_action->checkout();
1562                        $this->client_info      = $db_action->client_info;
1563                        $this->license_info     = $db_action->license_info;     
1564                       
1565                        }
1566                public function remove_unwanted_styles(){
1567                       
1568                        $dashboard = new NEXForms_dashboard();
1569                        $dashboard->dashboard_checkout();
1570                       
1571                        global $wp_styles;
1572                        $include_style_array = array('colors','common','wp-codemirror', 'wp-theme-plugin-editor','forms','admin-menu','dashboard','list-tables','bootstrap-timepicker','jqui-timepicker','bootstrap-material-datetimepicker','nf-nouislider','nf-jquery-ui','nf-md-checkbox-radio','edit','revisions','media','themes','about','nav-menus','widgets','site-icon','l10n','wp-admin','login','install','wp-color-picker','customize-controls','customize-widgets','customize-nav-menus','press-this','ie','buttons','dashicons','open-sans','admin-bar','wp-auth-check','editor-buttons','media-views','wp-pointer','customize-preview','wp-embed-template-ie','imgareaselect','wp-jquery-ui-dialog','mediaelement','wp-mediaelement','thickbox','deprecated-media','farbtastic','jcrop','colors-fresh','nex-forms-jQuery-UI','nex-forms-font-awesome','nex-forms-bootstrap','nex-forms-fields','nex-forms-ui','nex-forms-admin-style','nex-forms-animate','nex-forms-admin-overrides','nex-forms-admin-bootstrap.colorpickersliders','nex-forms-public-admin','nex-forms-editor','nex-forms-custom-admin','nex-forms-jq-ui','nf-styles-chosen','nf-admin-color-adapt', 'nex-forms-jq-ui','nf-styles-font-menu', 'nex-forms-bootstrap-tour.min','nf-color-adapt-fresh','nf-color-adapt-light','nf-color-adapt-blue','nf-color-adapt-coffee','nf-color-adapt-ectoplasm','nf-color-adapt-midnight','nf-color-adapt-ocean','nf-color-adapt-sunrise', 'nf-color-adapt-default','nex_forms-materialize.min','nex_forms-bootstrap.min','nex_forms-dashboard','nex_forms-font-awesome-5','nex_forms-font-awesome-4-shims','nex_forms-material-icons','ion.rangeSlider','ion.rangeSlider.skinFlat','nex_forms-builder','google-roboto');
1573               
1574                        echo '<div class="unwanted_css_array" style="display:none;">';
1575                        foreach($wp_styles->registered as $wp_style=>$array)
1576                                {
1577                                if(!in_array($array->handle,$include_style_array) && !strstr($array->handle,'nex-forms'))
1578                                        {
1579                                        echo '<div class="unwanted_css">'.$array->handle.'-css</div>';
1580                                        }
1581                                }       
1582                        echo '</div>';
1583                       
1584                       
1585                               
1586                }
1587                public function dashboard_menu($page_title){
1588                               
1589                                $item = get_option('7103891');
1590                               
1591                                $output = '';
1592                                $config = new NEXForms5_Config();
1593                                $nf_function = new NEXForms_Functions();       
1594                       
1595                                $output .= $nf_function->new_form_setup($this->checkout);
1596                               
1597                           
1598                                $theme = wp_get_theme();
1599                               
1600                                $set_folder = isset($_REQUEST['folder']) ? sanitize_text_field($_REQUEST['folder']) : 0;
1601                                $entry_id = isset($_REQUEST['entry_id']) ? sanitize_text_field($_REQUEST['entry_id']) : 0;
1602                               
1603                                $output .= '<div class="set_entry_id" style="display:none;">'.$entry_id.'</div>';
1604                                $output .= '<div class="set_folder" style="display:none;">'.$set_folder.'</div>';
1605                               
1606                                $output .= '<div class="hidden">';
1607                                  $output .= '<div id="siteurl">'.get_option('siteurl').'</div>';
1608                                  $output .= '<div id="nf_dashboard_load">0</div>';
1609                                  $output .= '<div id="plugins_url">'.plugins_url('/',__FILE__).'</div>';
1610                                  $output .= '<div id="load_entry">'.$this->checkout.'</div>';
1611                                  $output .= '<div id="current_form_id">0</div>';
1612                                  $output .= '<div id="currently_viewing" style="display:none;">'.(($this->checkout) ? 'dashboard' : 'backend').'</div>';
1613                                $output .= '</div>';
1614                               
1615                                $output .= '<nav class="start-page aa_bg_main">';
1616                                        $output .= '<div class="nav-container prime-menu">';
1617                                               
1618                                                $output .= '<div class="inner">';
1619                                                        $output .= '<ul class="navigation aa_menu">';
1620                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" class="logo"> NEX-Forms </a>';//
1621                                                                $output .= '</li>';     
1622                                                         $output .= '</ul>';   
1623                                                        $output .= '<ul class="navigation aa_menu db_tabs_nf">';
1624                                                                //$output .= '<li class=" menu-item-has-children"><a href="" class="logo create_new_form_home"></a>';//
1625                                                                        /*$output .= '<ul class="aa_menu_2">';
1626                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'active' : '').' submissions_tab"><span class="fas fa-home"></span> '.__('Dashboard','nex-forms').'</a></li>';
1627                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'active' : '').' submissions_tab"><span class="fas fa-envelope"></span> '.__('Form Entries','nex-forms').'</a></li>';
1628                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-reporting" class="'.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'active' : '').' submissions_tab"><span class="fas fa-scroll"></span> '.__('Reporting','nex-forms').'</a></li>';
1629                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'active' : '').' submissions_tab"><span class="fas fa-chart-line"></span> '.__('Analytics','nex-forms').'</a></li>';
1630                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-file-uploads" class="'.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'active' : '').' submissions_tab"><span class="fas fa-file-upload"></span> '.__('File Uploads','nex-forms').'</a></li>';
1631                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" class="'.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'active' : '').' submissions_tab"><span class="fas fa-cog"></span> '.__('Settings','nex-forms').'</a></li>';
1632                                                                                $output .= '<li class=""><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons" class="'.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'active' : '').' submissions_tab"><span class="fas fa-plug"></span> '.__('Add-ons','nex-forms').'</a></li>';
1633                                                                        $output .= '</ul>';*/
1634                                                                $output .= '</li>';
1635                                                                       
1636                                                                                $output .= '<li class="db_tab '.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-dashboard" data-title="'.__('Dashboard','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').' submissions_tab"><span class="fas fa-home"></span> <span class="menu-text">'.__('Dashboard','nex-forms').'</span></a></li>';
1637                                                                               
1638                                                                                //$output .= '<li class="db_tab menu-item-has-children"><a class="create_new_form_home" data-title="'.__('Create a NEW Form','nex-forms').'" data-toggle="tooltip_bs" data-placement="bottom"><span class="fas fa-file-medical"></span></a></li>';
1639                                                           
1640                                                                               
1641                                                                                $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions"  data-placement="bottom" data-title="'.__('Form Entries').'" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-envelope"></span> <span class="menu-text">'.__('Form Entries','nex-forms').'</span></a></li>';
1642                                                                                $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-reporting"  data-placement="bottom" data-title="'.__('Reporting','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-scroll"></span> <span class="menu-text">'.__('Reporting','nex-forms').'</span></a></li>';
1643                                                                                $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics"  data-placement="bottom" data-title="'.__('Analytics','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-chart-line"></span> <span class="menu-text">'.__('Analytics','nex-forms').'</span></a></li>';
1644                                                                                $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-file-uploads"  data-placement="bottom" data-title="'.__('File Uploads','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-file-uploads') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-file-upload"></span> <span class="menu-text">'.__('File Uploads','nex-forms').'</span></a></li>';
1645                                                                                $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings"  data-placement="bottom" data-title="'.__('Global Settings','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-cog"></span> <span class="menu-text">'.__('Settings','nex-forms').'</span></a></li>';
1646                                                                                $output .= '<li class="db_tab menu-item-has-children '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons"  data-placement="bottom" data-title="'.__('Add-ons','nex-forms').'" class="'.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').' submissions_tab"><span class="top-icon fas fa-plug"></span> <span class="menu-text">'.__('Add-ons','nex-forms').'</span></a></li>';
1647                                                               
1648                                                               
1649                                                          $output .= ($theme->Name=='NEX-Forms Demo' || !$this->checkout) ? '<a href="https://1.envato.market/zQ6de" target="_blank" class="btn waves-effect waves-light upgrade_pro">BUY NEX-FORMS</a>' : '';
1650                                                           $output .= '</ul>';
1651                                                           //$output .= '<div class="page-title aa_font_color_default">'.$page_title.'</div>';
1652                                                       
1653                                                       
1654                                                        $output .= '<div class="nf_version font_color_1"><span class="">Version '.$config->plugin_version.'</span></div>';
1655                                                           
1656                                                $output .= '</div>';
1657                                        $output .= '</div>';
1658                                $output .= '</nav>';
1659                       
1660                        return $output;
1661                }
1662               
1663                public function dashboard_header(){
1664                                $item = get_option('7103891');
1665                               
1666                                $output = '';
1667                                $config = new NEXForms5_Config();
1668                                $nf_function = new NEXForms_Functions();
1669                                //$builder = new NEXForms_Builder7();
1670                                       
1671                                $output .= $nf_function->new_form_setup($this->checkout);
1672                               
1673                           
1674                                $theme = wp_get_theme();
1675                                $output .= '<div id="demo_site" style="display:none;">'.(($theme->Name=='NEX-Forms Demo') ? 'yes' : 'no').'</div>';
1676                                $output .= '<div id="currently_viewing" style="display:none;">'.(($this->checkout) ? 'dashboard' : 'backend').'</div>';
1677                               
1678                                $output .= '<div class="row row_zero_margin">';
1679                                       
1680                                        $output .= '
1681                                                <div class="col-sm-12">
1682                                                  <nav class="nav-extended dashboard_nav aa_bg_main prime-menu main_nav">
1683                                                       
1684                                                        <div class="nav-content aa_bg_main">
1685                                                         
1686                                                          <ul class="tabs_nf  aa_bg_main aa_menu">
1687                                                               
1688                                                                 <li class="tab logo"><img src="'. plugins_url( '/admin/css/'.NF_PATH.'images/logo.png',dirname(dirname(__FILE__))).'" alt=""><span class="version_number">v '.$config->plugin_version.'</li>
1689                                                               
1690                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-dashboard') ? 'current' : '').'"><a class="'.(($_REQUEST['page']=='nex-forms-dashboard') ? 'active' : '').' forms_tab" href="'.get_admin_url().'admin.php?page=nex-forms-dashboard"><span class="top-icon fa fas fa-home"></span><span class="menu-text">'.__('Dashboard','nex-forms').'</span></a></li>
1691                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions" class="'.(($_REQUEST['page']=='nex-forms-page-submissions') ? 'active' : '').' submissions_tab"><span class="top-icon fa fas fa-envelope"></span><span class="menu-text">'.__('Submissions','nex-forms').'</span></a></li>
1692                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" class="'.(($_REQUEST['page']=='nex-forms-page-analytics') ? 'active' : '').' submissions_tab"><span class="top-icon fa fas fa-chart-line"></span><span class="menu-text">'.__('Analytics','nex-forms').'</span></a></li>';
1693                                                                if(function_exists('run_nf_adv_paypal') && $theme->Name!='NEX-Forms Demo')
1694                                                                        $output .= '<li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-payments') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-payments" class="payment_tab '.(($_REQUEST['page']=='nex-forms-page-payments') ? 'active' : '').'"><span class="top-icon fa fas fa-funnel-dollar"></span><span class="menu-text">'.__('Payments','nex-forms').'</span></a></li>';
1695
1696                                                               
1697                                                               
1698                                                                $output .= '
1699                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-reporting" class="reporting_tab '.(($_REQUEST['page']=='nex-forms-page-reporting') ? 'active' : '').'"><span class="top-icon fa fas fa-scroll"></span><span class="menu-text">'.__('Reporting','nex-forms').'</span></a></li>
1700                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-attachments') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-attachments" class="file_uploads_tab '.(($_REQUEST['page']=='nex-forms-page-attachments') ? 'active' : '').'"><span class="top-icon fa fas fa-paperclip"></span><span class="menu-text">'.__('File Uploads','nex-forms').'</span></a></li>
1701                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-global-settings" class="global_settings_tab '.(($_REQUEST['page']=='nex-forms-page-global-settings') ? 'active' : '').'"><span class="top-icon fa fas fa-cog"></span><span class="menu-text">'.__('Global Settings','nex-forms').'</span></a></li>
1702                                                                <li class="tab has_icon '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'current' : '').'"><a href="'.get_admin_url().'admin.php?page=nex-forms-page-add-ons" class="add_ons_tab '.(($_REQUEST['page']=='nex-forms-page-add-ons') ? 'active' : '').'"><span class="top-icon fa fas fa-puzzle-piece"></span><span class="menu-text">'.__('ADD-ONS','nex-forms').'</span></a></li>
1703                                                                <li class="tab has_icon"><a href="http://basixonline.net/nex-forms-docs/" target="_blank"><span class="top-icon fa fas fa-file-export"></span><span class="menu-text">'.__('DOCS','nex-forms').'</span></a></li>
1704                                                                '.(($theme->Name=='NEX-Forms Demo' || !$this->checkout) ? '<a href="http://codecanyon.net/item/nexforms-the-ultimate-wordpress-form-builder/7103891?license=regular&open_purchase_for_item_id=7103891&purchasable=source&ref=Basix" target="_blank" class="btn waves-effect waves-light upgrade_pro">BUY NEX-FORMS</a>' : '' ).'
1705                                                          </ul>
1706                                                        </div>
1707                                                  </nav>
1708                                                </div>';
1709                               
1710                                $output .= '</div>';
1711                               
1712                                return $output;
1713                }       
1714               
1715                public function form_analytics($print_chart=''){
1716                       
1717                        global $wpdb;
1718                       
1719                        $output = '';
1720                       
1721                        $output .= '<div class="dashboard-box form_analytics '.(($print_chart=='summary') ? 'summary_stats' : '' ).'">';
1722                       
1723                       
1724                                $output .= '<div class="dashboard-box-header '.(($this->color_adapt) ? 'aa_bg_main': '' ).'">';
1725                                        if(($print_chart=='summary'))
1726                                                $output .= '<div class="table_title '.(($this->color_adapt) ? 'font_color_1': '' ).'">'.__('Form Entry Analytics for the last 7 Days','nex-forms').'</div>';
1727                                       
1728                                        if($print_chart!='summary')
1729                                                {
1730                                        $output .= '<div class="controls">';
1731                                                /*$output .= '<div class="col-xs-3">';
1732                                                        $output .= '<select class="form_control aa_bg_main_input" name="stats_per_form">';
1733                                                                $output .= '<option value="0" selected>'.__('All Forms','nex-forms').'</option>';
1734                                                                $get_forms = 'SELECT * FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_template<>1 AND is_form<>"preview" AND is_form<>"draft" ORDER BY Id DESC';
1735                                                               
1736                                                                $forms = $wpdb->get_results($get_forms);
1737                                                                foreach($forms as $form)
1738                                                                        $output .= '<option value="'.$form->Id.'">'.str_replace('\\','',$form->title).'</option>';
1739                                                        $output .= '</select>';
1740                                                       
1741                                                $output .= '</div>';*/
1742                                               
1743                                                $output .= '<div class="col-xs-2">';
1744                                                        $output .= '<select class="form_control aa_bg_main_input" name="stats_per_year">';
1745                                                                $current_year = (int)date('Y');
1746                                                                $output .= '<option value="'.$current_year.'" selected>'.$current_year.'</option>';
1747                                                                for($i=($current_year-1);$i>=($current_year-20);$i--)
1748                                                                        {
1749                                                                        if($i>=2015)
1750                                                                                $output .= '<option value="'.$i.'">'.$i.'</option>';
1751                                                                        }
1752                                                        $output .= '</select>';
1753                                                $output .= '</div>';
1754                                               
1755                                                $output .= '<div class="col-xs-2">';
1756                                                        $output .= '<select class="form_control aa_bg_main_input" name="stats_per_month">';
1757                                                        $month_array = array('01'=>'January','02'=>'February','03'=>'March','04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August','09'=>'September','10'=>'October','11'=>'November','12'=>'December');
1758                                                                //$output .= '<option value="0">'.__('Month','nex-forms').'</option>';
1759                                                                $current_month = (int)date('m');
1760                                                                foreach($month_array as $key=>$val)
1761                                                                        {
1762                                                                        $output .= '<option value="'.$key.'" '.(($key==$current_month) ? 'selected' : '' ).'>'.$val.'</option>';
1763                                                                       
1764                                                                        }
1765                                                        $output .= '</select>';
1766                                                $output .= '</div>';
1767                                               
1768                                                        //$output .= '<button class="btn waves-effect waves-light switch_chart" data-chart-type="global"><i class="fa fa-globe"></i></button>';
1769                                                        $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="radar"><i class="fa fa-spider"></i></button>';
1770                                                        $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="polarArea"><i class="fa fa-bullseye"></i></button>';
1771                                                        $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="doughnut"><i class="fa fa-pie-chart"></i></button>';
1772                                                        $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart" data-chart-type="bar"><i class="fa fa-bar-chart"></i></button>';
1773                                                        $output .= '<button class="btn aa_bg_sec_btn nf_button switch_chart active" data-chart-type="line"><i class="fa fa-line-chart"></i></button>';
1774                                               
1775                                               
1776                                        $output .= '</div>';
1777                                }
1778                                $output .= '</div>';
1779                               
1780                               
1781                               
1782                               
1783                                       
1784                               
1785                                $output .= '<div  class="dashboard-box-content">';
1786                               
1787                               
1788                                       
1789                                        $output .= '<div class="chart-container"><div class="data_set">'.$this->print_chart($this->checkout, $print_chart).'</div>
1790                                       
1791                                        <canvas id="chart_canvas" height="196px" ></canvas>
1792                                        </div>';
1793                                       
1794                                       
1795                                       
1796                                       
1797                                       
1798                                        $output .= '</div>';
1799                                       
1800                                        if($print_chart=='summary')
1801                                                {
1802                                                $output .='<div class="chart_legend">';
1803                                                        $output .= '<a href="'.get_admin_url().'admin.php?page=nex-forms-page-analytics" class="more_button">MORE INSIGHTS <span class="fa fa-chevron-right"></span></a>';
1804                                                $output .= '</div>';
1805                                                }
1806                                $output .= '</div>';
1807                       
1808                        return $output;
1809                }       
1810               
1811                public function print_chart($args='', $chart_view=''){
1812                        if(!current_user_can( NF_USER_LEVEL )) 
1813                                wp_die();
1814                        global $wpdb;
1815                        $current_year = (int)date('Y');
1816       
1817                                        $year_selected = isset($_REQUEST['year_selected']) ? sanitize_text_field($_REQUEST['year_selected']) : (int)date('Y');
1818                                        $month_selected =  isset($_REQUEST['month_selected']) ? sanitize_text_field($_REQUEST['month_selected']) : (int)date('m');
1819                                        $month_array = array('1'=>__('January','nex-forms'),'2'=>__('February','nex-forms'),'3'=>__('March','nex-forms'),'4'=>__('April','nex-forms'),'5'=>__('May','nex-forms'),'6'=>__('June','nex-forms'),'7'=>__('July','nex-forms'),'8'=>__('August','nex-forms'),'9'=>__('September','nex-forms'),'10'=>__('October','nex-forms'),'11'=>__('November','nex-forms'),'12'=>__('December','nex-forms'));
1820                                       
1821                                       
1822                                        $today = (int)date('j');
1823                                       
1824                                        $days_back = 1;
1825                                        if($chart_view=='summary')
1826                                                $days_back = ($today-7);
1827                                       
1828                                       
1829                                        if($year_selected)
1830                                                $current_year = $year_selected;
1831                                       
1832                                        $database_actions = new NEXForms_Database_Actions();
1833                                        $nf7_functions = new NEXForms_Functions();
1834                                       
1835                                        if($args)
1836                                                $checkin = $args;
1837                                        else
1838                                                $checkin = $database_actions->checkout();
1839                                       
1840                                        $form_id = isset($_REQUEST['form_id']) ? sanitize_title($_REQUEST['form_id']) : '';
1841                                       
1842                                       
1843                                        $where_str = 'Id <> 0';
1844                                               
1845                                        if($form_id)
1846                                                $where_str .= ' AND nex_forms_Id = '.$form_id.' ';
1847                                       
1848                                        if($chart_view=='summary')
1849                                                $where_str .= ' AND date_time >= DATE(NOW()) - INTERVAL 7 DAY';
1850                                        else
1851                                                $where_str .= ' AND Year(date_time)=Year("'.$current_year.'-'.$month_selected.'-01") AND Month(date_time)= Month("'.$current_year.'-'.$month_selected.'-01") ';
1852                                                               
1853                                       
1854                                        $get_entries = $wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE '.$where_str,'');
1855                                        $form_entries = $wpdb->get_results($get_entries);
1856                                       
1857                                        $get_views = $wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_views WHERE '.$where_str,'');
1858                                        $form_views = $wpdb->get_results($get_views);
1859                                       
1860                                        $get_interactions = $wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_stats_interactions WHERE '.$where_str,'');
1861                                        $form_interactions = $wpdb->get_results($get_interactions);
1862                                       
1863                                       
1864                                               
1865                                        $submit_array                           = array();
1866                                        $view_array                             = array();
1867                                        $interaction_array                      = array();
1868                                        $submit_array_pm                        = array();
1869                                        $view_array_pm                          = array();
1870                                        $interaction_array_pm           = array();
1871                                        $country_array                          = array(
1872                                                                                                        'AF' => __('Afghanistan','nex-forms'),
1873                                                                                                        'AX' => __('Aland Islands','nex-forms'),
1874                                                                                                        'AL' => __('Albania','nex-forms'),
1875                                                                                                        'DZ' => __('Algeria','nex-forms'),
1876                                                                                                        'AS' => __('American Samoa','nex-forms'),
1877                                                                                                        'AD' => __('Andorra','nex-forms'),
1878                                                                                                        'AO' => __('Angola','nex-forms'),
1879                                                                                                        'AI' => __('Anguilla','nex-forms'),
1880                                                                                                        'AQ' => __('Antarctica','nex-forms'),
1881                                                                                                        'AG' => __('Antigua and Barbuda','nex-forms'),
1882                                                                                                        'AR' => __('Argentina','nex-forms'),
1883                                                                                                        'AM' => __('Armenia','nex-forms'),
1884                                                                                                        'AW' => __('Aruba','nex-forms'),
1885                                                                                                        'AU' => __('Australia','nex-forms'),
1886                                                                                                        'AT' => __('Austria','nex-forms'),
1887                                                                                                        'AZ' => __('Azerbaijan','nex-forms'),
1888                                                                                                        'BS' => __('Bahamas the','nex-forms'),
1889                                                                                                        'BH' => __('Bahrain','nex-forms'),
1890                                                                                                        'BD' => __('Bangladesh','nex-forms'),
1891                                                                                                        'BB' => __('Barbados','nex-forms'),
1892                                                                                                        'BY' => __('Belarus','nex-forms'),
1893                                                                                                        'BE' => __('Belgium','nex-forms'),
1894                                                                                                        'BZ' => __('Belize','nex-forms'),
1895                                                                                                        'BJ' => __('Benin','nex-forms'),
1896                                                                                                        'BM' => __('Bermuda','nex-forms'),
1897                                                                                                        'BT' => __('Bhutan','nex-forms'),
1898                                                                                                        'BO' => __('Bolivia','nex-forms'),
1899                                                                                                        'BA' => __('Bosnia and Herzegovina','nex-forms'),
1900                                                                                                        'BW' => __('Botswana','nex-forms'),
1901                                                                                                        'BV' => __('Bouvet Island (Bouvetoya)','nex-forms'),
1902                                                                                                        'BR' => __('Brazil','nex-forms'),
1903                                                                                                        'IO' => __('British Indian Ocean Territory (Chagos Archipelago)','nex-forms'),
1904                                                                                                        'VG' => __('British Virgin Islands','nex-forms'),
1905                                                                                                        'BN' => __('Brunei Darussalam','nex-forms'),
1906                                                                                                        'BG' => __('Bulgaria','nex-forms'),
1907                                                                                                        'BF' => __('Burkina Faso','nex-forms'),
1908                                                                                                        'BI' => __('Burundi','nex-forms'),
1909                                                                                                        'KH' => __('Cambodia','nex-forms'),
1910                                                                                                        'CM' => __('Cameroon','nex-forms'),
1911                                                                                                        'CA' => __('Canada','nex-forms'),
1912                                                                                                        'CV' => __('Cape Verde','nex-forms'),
1913                                                                                                        'KY' => __('Cayman Islands','nex-forms'),
1914                                                                                                        'CF' => __('Central African Republic','nex-forms'),
1915                                                                                                        'TD' => __('Chad','nex-forms'),
1916                                                                                                        'CL' => __('Chile','nex-forms'),
1917                                                                                                        'CN' => __('China','nex-forms'),
1918                                                                                                        'CX' => __('Christmas Island','nex-forms'),
1919                                                                                                        'CC' => __('Cocos (Keeling) Islands','nex-forms'),
1920                                                                                                        'CO' => __('Colombia','nex-forms'),
1921                                                                                                        'KM' => __('Comoros the','nex-forms'),
1922                                                                                                        'CD' => __('Congo - Kinshasa','nex-forms'),
1923                                                                                                        'CG' => __('Congo - Brazzaville','nex-forms'),
1924                                                                                                        'CK' => __('Cook Islands','nex-forms'),
1925                                                                                                        'CR' => __('Costa Rica','nex-forms'),
1926                                                                                                        'CI' => __('CI','nex-forms'),
1927                                                                                                        'HR' => __('Croatia','nex-forms'),
1928                                                                                                        'CU' => __('Cuba','nex-forms'),
1929                                                                                                        'CY' => __('Cyprus','nex-forms'),
1930                                                                                                        'CZ' => __('Czech Republic','nex-forms'),
1931                                                                                                        'DK' => __('Denmark','nex-forms'),
1932                                                                                                        'DJ' => __('Djibouti','nex-forms'),
1933                                                                                                        'DM' => __('Dominica','nex-forms'),
1934                                                                                                        'DO' => __('Dominican Republic','nex-forms'),
1935                                                                                                        'EC' => __('Ecuador','nex-forms'),
1936                                                                                                        'EG' => __('Egypt','nex-forms'),
1937                                                                                                        'SV' => __('El Salvador','nex-forms'),
1938                                                                                                        'GQ' => __('Equatorial Guinea','nex-forms'),
1939                                                                                                        'ER' => __('Eritrea','nex-forms'),
1940                                                                                                        'EE' => __('Estonia','nex-forms'),
1941                                                                                                        'ET' => __('Ethiopia','nex-forms'),
1942                                                                                                        'FO' => __('Faroe Islands','nex-forms'),
1943                                                                                                        'FK' => __('Falkland Islands (Malvinas)','nex-forms'),
1944                                                                                                        'FJ' => __('Fiji the Fiji Islands','nex-forms'),
1945                                                                                                        'FI' => __('Finland','nex-forms'),
1946                                                                                                        'FR' => __('France','nex-forms'),
1947                                                                                                        'GF' => __('French Guiana','nex-forms'),
1948                                                                                                        'PF' => __('French Polynesia','nex-forms'),
1949                                                                                                        'TF' => __('French Southern Territories','nex-forms'),
1950                                                                                                        'GA' => __('Gabon','nex-forms'),
1951                                                                                                        'GM' => __('Gambia the','nex-forms'),
1952                                                                                                        'GE' => __('Georgia','nex-forms'),
1953                                                                                                        'DE' => __('Germany','nex-forms'),
1954                                                                                                        'GH' => __('Ghana','nex-forms'),
1955                                                                                                        'GI' => __('Gibraltar','nex-forms'),
1956                                                                                                        'GR' => __('Greece','nex-forms'),
1957                                                                                                        'GL' => __('Greenland','nex-forms'),
1958                                                                                                        'GD' => __('Grenada','nex-forms'),
1959                                                                                                        'GP' => __('Guadeloupe','nex-forms'),
1960                                                                                                        'GU' => __('Guam','nex-forms'),
1961                                                                                                        'GT' => __('Guatemala','nex-forms'),
1962                                                                                                        'GG' => __('Guernsey','nex-forms'),
1963                                                                                                        'GN' => __('Guinea','nex-forms'),
1964                                                                                                        'GW' => __('Guinea-Bissau','nex-forms'),
1965                                                                                                        'GY' => __('Guyana','nex-forms'),
1966                                                                                                        'HT' => __('Haiti','nex-forms'),
1967                                                                                                        'HM' => __('Heard Island and McDonald Islands','nex-forms'),
1968                                                                                                        'VA' => __('Holy See (Vatican City State)','nex-forms'),
1969                                                                                                        'HN' => __('Honduras','nex-forms'),
1970                                                                                                        'HK' => __('Hong Kong','nex-forms'),
1971                                                                                                        'HU' => __('Hungary','nex-forms'),
1972                                                                                                        'IS' => __('Iceland','nex-forms'),
1973                                                                                                        'IN' => __('India','nex-forms'),
1974                                                                                                        'ID' => __('Indonesia','nex-forms'),
1975                                                                                                        'IR' => __('Iran','nex-forms'),
1976                                                                                                        'IQ' => __('Iraq','nex-forms'),
1977                                                                                                        'IE' => __('Ireland','nex-forms'),
1978                                                                                                        'IM' => __('Isle of Man','nex-forms'),
1979                                                                                                        'IL' => __('Israel','nex-forms'),
1980                                                                                                        'IT' => __('Italy','nex-forms'),
1981                                                                                                        'JM' => __('Jamaica','nex-forms'),
1982                                                                                                        'JP' => __('Japan','nex-forms'),
1983                                                                                                        'JE' => __('Jersey','nex-forms'),
1984                                                                                                        'JO' => __('Jordan','nex-forms'),
1985                                                                                                        'KZ' => __('Kazakhstan','nex-forms'),
1986                                                                                                        'KE' => __('Kenya','nex-forms'),
1987                                                                                                        'KI' => __('Kiribati','nex-forms'),
1988                                                                                                        'KP' => __('North Korea','nex-forms'),
1989                                                                                                        'KR' => __('South Korea','nex-forms'),
1990                                                                                                        'KW' => __('Kuwait','nex-forms'),
1991                                                                                                        'KG' => __('Kyrgyzstan','nex-forms'),
1992                                                                                                        'LA' => __('Lao','nex-forms'),
1993                                                                                                        'LV' => __('Latvia','nex-forms'),
1994                                                                                                        'LB' => __('Lebanon','nex-forms'),
1995                                                                                                        'LS' => __('Lesotho','nex-forms'),
1996                                                                                                        'LR' => __('Liberia','nex-forms'),
1997                                                                                                        'LY' => __('Libya','nex-forms'),
1998                                                                                                        'LI' => __('Liechtenstein','nex-forms'),
1999                                                                                                        'LT' => __('Lithuania','nex-forms'),
2000                                                                                                        'LU' => __('Luxembourg','nex-forms'),
2001                                                                                                        'MO' => __('Macao','nex-forms'),
2002                                                                                                        'MK' => __('Macedonia','nex-forms'),
2003                                                                                                        'MG' => __('Madagascar','nex-forms'),
2004                                                                                                        'MW' => __('Malawi','nex-forms'),
2005                                                                                                        'MY' => __('Malaysia','nex-forms'),
2006                                                                                                        'MV' => __('Maldives','nex-forms'),
2007                                                                                                        'ML' => __('Mali','nex-forms'),
2008                                                                                                        'MT' => __('Malta','nex-forms'),
2009                                                                                                        'MH' => __('Marshall Islands','nex-forms'),
2010                                                                                                        'MQ' => __('Martinique','nex-forms'),
2011                                                                                                        'MR' => __('Mauritania','nex-forms'),
2012                                                                                                        'MU' => __('Mauritius','nex-forms'),
2013                                                                                                        'YT' => __('Mayotte','nex-forms'),
2014                                                                                                        'MX' => __('Mexico','nex-forms'),
2015                                                                                                        'FM' => __('Micronesia','nex-forms'),
2016                                                                                                        'MD' => __('Moldova','nex-forms'),
2017                                                                                                        'MC' => __('Monaco','nex-forms'),
2018                                                                                                        'MN' => __('Mongolia','nex-forms'),
2019                                                                                                        'ME' => __('Montenegro','nex-forms'),
2020                                                                                                        'MS' => __('Montserrat','nex-forms'),
2021                                                                                                        'MA' => __('Morocco','nex-forms'),
2022                                                                                                        'MZ' => __('Mozambique','nex-forms'),
2023                                                                                                        'MM' => __('Myanmar','nex-forms'),
2024                                                                                                        'NA' => __('Namibia','nex-forms'),
2025                                                                                                        'NR' => __('Nauru','nex-forms'),
2026                                                                                                        'NP' => __('Nepal','nex-forms'),
2027                                                                                                        'AN' => __('Netherlands Antilles','nex-forms'),
2028                                                                                                        'NL' => __('Netherlands','nex-forms'),
2029                                                                                                        'NC' => __('New Caledonia','nex-forms'),
2030                                                                                                        'NZ' => __('New Zealand','nex-forms'),
2031                                                                                                        'NI' => __('Nicaragua','nex-forms'),
2032                                                                                                        'NE' => __('Niger','nex-forms'),
2033                                                                                                        'NG' => __('Nigeria','nex-forms'),
2034                                                                                                        'NU' => __('Niue','nex-forms'),
2035                                                                                                        'NF' => __('Norfolk Island','nex-forms'),
2036                                                                                                        'MP' => __('Northern Mariana Islands','nex-forms'),
2037                                                                                                        'NO' => __('Norway','nex-forms'),
2038                                                                                                        'OM' => __('Oman','nex-forms'),
2039                                                                                                        'PK' => __('Pakistan','nex-forms'),
2040                                                                                                        'PW' => __('Palau','nex-forms'),
2041                                                                                                        'PS' => __('Palestinian Territory','nex-forms'),
2042                                                                                                        'PA' => __('Panama','nex-forms'),
2043                                                                                                        'PG' => __('Papua New Guinea','nex-forms'),
2044                                                                                                        'PY' => __('Paraguay','nex-forms'),
2045                                                                                                        'PE' => __('Peru','nex-forms'),
2046                                                                                                        'PH' => __('Philippines','nex-forms'),
2047                                                                                                        'PN' => __('Pitcairn Islands','nex-forms'),
2048                                                                                                        'PL' => __('Poland','nex-forms'),
2049                                                                                                        'PT' => __('Portugal','nex-forms'),
2050                                                                                                        'PR' => __('Puerto Rico','nex-forms'),
2051                                                                                                        'QA' => __('Qatar','nex-forms'),
2052
2053
2054                                                                                                        'RE' => __('Reunion','nex-forms'),
2055                                                                                                        'RO' => __('Romania','nex-forms'),
2056                                                                                                        'RU' => __('Russia','nex-forms'),
2057                                                                                                        'RW' => __('Rwanda','nex-forms'),
2058                                                                                                        'BL' => __('Saint Barthelemy','nex-forms'),
2059                                                                                                        'SH' => __('Saint Helena','nex-forms'),
2060                                                                                                        'KN' => __('Saint Kitts and Nevis','nex-forms'),
2061                                                                                                        'LC' => __('Saint Lucia','nex-forms'),
2062                                                                                                        'MF' => __('Saint Martin','nex-forms'),
2063                                                                                                        'PM' => __('Saint Pierre and Miquelon','nex-forms'),
2064                                                                                                        'VC' => __('Saint Vincent and the Grenadines','nex-forms'),
2065                                                                                                        'WS' => __('Samoa','nex-forms'),
2066                                                                                                        'SM' => __('San Marino','nex-forms'),
2067                                                                                                        'ST' => __('Sao Tome and Principe','nex-forms'),
2068                                                                                                        'SA' => __('Saudi Arabia','nex-forms'),
2069                                                                                                        'SN' => __('Senegal','nex-forms'),
2070                                                                                                        'RS' => __('Serbia','nex-forms'),
2071                                                                                                        'SC' => __('Seychelles','nex-forms'),
2072                                                                                                        'SL' => __('Sierra Leone','nex-forms'),
2073                                                                                                        'SG' => __('Singapore','nex-forms'),
2074                                                                                                        'SS' => __('SS','nex-forms'),
2075                                                                                                        'SK' => __('Slovakia (Slovak Republic)','nex-forms'),
2076                                                                                                        'SI' => __('Slovenia','nex-forms'),
2077                                                                                                        'SB' => __('Solomon Islands','nex-forms'),
2078                                                                                                        'SO' => __('Somalia, Somali Republic','nex-forms'),
2079                                                                                                        'ZA' => __('South Africa','nex-forms'),
2080                                                                                                        'GS' => __('South Georgia and the South Sandwich Islands','nex-forms'),
2081                                                                                                        'ES' => __('Spain','nex-forms'),
2082                                                                                                        'LK' => __('Sri Lanka','nex-forms'),
2083                                                                                                        'SD' => __('Sudan','nex-forms'),
2084                                                                                                        'SR' => __('Suriname','nex-forms'),
2085                                                                                                        'SJ' => __('SJ','nex-forms'),
2086                                                                                                        'SZ' => __('Swaziland','nex-forms'),
2087                                                                                                        'SE' => __('Sweden','nex-forms'),
2088                                                                                                        'CH' => __('Switzerland, Swiss Confederation','nex-forms'),
2089                                                                                                        'SY' => __('Syrian Arab Republic','nex-forms'),
2090                                                                                                        'TW' => __('Taiwan','nex-forms'),
2091                                                                                                        'TJ' => __('Tajikistan','nex-forms'),
2092                                                                                                        'TZ' => __('Tanzania','nex-forms'),
2093                                                                                                        'TH' => __('Thailand','nex-forms'),
2094                                                                                                        'TL' => __('Timor-Leste','nex-forms'),
2095                                                                                                        'TG' => __('Togo','nex-forms'),
2096                                                                                                        'TK' => __('Tokelau','nex-forms'),
2097                                                                                                        'TO' => __('Tonga','nex-forms'),
2098                                                                                                        'TT' => __('Trinidad and Tobago','nex-forms'),
2099                                                                                                        'TN' => __('Tunisia','nex-forms'),
2100                                                                                                        'TR' => __('Turkey','nex-forms'),
2101                                                                                                        'TM' => __('Turkmenistan','nex-forms'),
2102                                                                                                        'TC' => __('Turks and Caicos Islands','nex-forms'),
2103                                                                                                        'TV' => __('Tuvalu','nex-forms'),
2104                                                                                                        'UG' => __('Uganda','nex-forms'),
2105                                                                                                        'UA' => __('Ukraine','nex-forms'),
2106                                                                                                        'AE' => __('United Arab Emirates','nex-forms'),
2107                                                                                                        'GB' => __('United Kingdom','nex-forms'),
2108                                                                                                        'US' => __('United States','nex-forms'),
2109                                                                                                        'UM' => __('United States Minor Outlying Islands','nex-forms'),
2110                                                                                                        'VI' => __('United States Virgin Islands','nex-forms'),
2111                                                                                                        'UY' => __('Uruguay','nex-forms'),
2112                                                                                                        'UZ' => __('Uzbekistan','nex-forms'),
2113                                                                                                        'VU' => __('Vanuatu','nex-forms'),
2114                                                                                                        'VE' => __('Venezuela','nex-forms'),
2115                                                                                                        'VN' => __('Vietnam','nex-forms'),
2116                                                                                                        'WF' => __('Wallis and Futuna','nex-forms'),
2117                                                                                                        'EH' => __('Western Sahara','nex-forms'),
2118                                                                                                        'YE' => __('Yemen','nex-forms'),
2119                                                                                                        'ZM' => __('Zambia','nex-forms'),
2120                                                                                                        'ZW' => __('Zimbabwe','nex-forms')
2121                                                                                                );
2122                                        $total_form_entries             = 0;
2123                                        $total_form_views                       = 0;
2124                                        $total_form_interactions        = 0;
2125                                        $set_form_views                         = 0;
2126                                        $set_form_interactions          = 0;
2127                                        $set_form_entries                       = 0;
2128                                       
2129                                        $days_in_month = '';
2130                                        if($month_selected && $month_selected!='0')
2131                                                {
2132                                                if(function_exists('cal_days_in_month')){
2133                                                        $days_in_month = cal_days_in_month(CAL_GREGORIAN, (int)$month_selected, $current_year);
2134                                                        }
2135                                                else
2136                                                        $days_in_month = 31;
2137                                                }
2138                                        if($chart_view=='summary')
2139                                                $days_in_month = $today;
2140                                        for($m=1;$m<=12;$m++)
2141                                                {
2142                                                $submit_array[$m]               = 0;
2143                                                $view_array[$m]                 = 0;
2144                                                $interaction_array[$m]  = 0;
2145                                                }
2146                                        for($d=1;$d<=$days_in_month;$d++)
2147                                                {
2148                                                $submit_array_pm[$d]            = 0;
2149                                                $view_array_pm[$d]                      = 0;
2150                                                $interaction_array_pm[$d]       = 0;
2151                                                }
2152                                       
2153                                        $array_countries = array();
2154                                        foreach($country_array as $key=>$val)
2155                                                $array_countries[$key] = 0;
2156                                               
2157                                        foreach($form_entries as $form_entry)
2158                                                {
2159                                               
2160                                                $year = substr($form_entry->date_time,0,4);
2161                                                $month = (int)substr($form_entry->date_time,5,2);
2162                                                $day = (int)substr($form_entry->date_time,8,2);
2163                                               
2164                                                if($current_year==$year)
2165                                                        {
2166                                                        if($month_selected && $month_selected!='0')
2167                                                                {
2168                                                                if($month==$month_selected)
2169                                                                        {
2170                                                                       
2171                                                                        $total_form_entries++;
2172                                                                       
2173                                                                        if($form_entry->country!='')
2174                                                                                $array_countries[$form_entry->country]++;
2175                                                                               
2176                                                                       
2177                                                                       
2178                                                                        for($d=1;$d<=$days_in_month;$d++)
2179                                                                                {
2180                                                                                if($day==$d)
2181                                                                                        {
2182                                                                                        $submit_array_pm[$d]++;
2183                                                                                        }
2184                                                                                }       
2185                                                                        }
2186                                                                }
2187                                                        else
2188                                                                {       
2189                                                                for($m=1;$m<=12;$m++)
2190                                                                        {
2191                                                                        if($month==$m)
2192                                                                                {
2193                                                                                $submit_array[$m]++;   
2194                                                                                $total_form_entries++;
2195                                                                                if($form_entry->country!='')
2196                                                                                        $array_countries[$form_entry->country]++;
2197                                                                                       
2198                                                                               
2199                                                                                }
2200                                                                        }
2201                                                                }
2202                                                        }
2203                                                }       
2204                                        foreach($form_views as $view)
2205                                                {
2206                                                $date = date('Y-m-d h:i:s',$view->time_viewed);
2207                                                $year = substr($date,0,4);
2208                                                $month = (int)substr($date,5,2);
2209                                                $day = (int)substr($date,8,2);
2210                                               
2211                                                if($current_year==$year)
2212                                                        {
2213                                                        if($month_selected && $month_selected!='0')
2214                                                                {
2215                                                                if($month==$month_selected)
2216                                                                        {
2217                                                                        $total_form_views++;
2218                                                                        for($dv=1;$dv<=$days_in_month;$dv++)
2219                                                                                {
2220                                                                                if($day==$dv)
2221                                                                                        $view_array_pm[$dv]++;         
2222                                                                                }       
2223                                                                        }
2224                                                                }
2225                                                        else
2226                                                                {       
2227                                                                for($mv=1;$mv<=12;$mv++)
2228                                                                        {
2229                                                                        if($month==$mv)
2230                                                                                {
2231                                                                                $view_array[$mv]++;     
2232                                                                                $total_form_views++;
2233                                                                                }
2234                                                                        }
2235                                                                }       
2236                                                        }
2237                                                }
2238                                       
2239                                        foreach($form_interactions as $interaction)
2240                                                {
2241                                               
2242                                                $date = date('Y-m-d h:i:s',$interaction->time_interacted);
2243                                                $year = substr($date,0,4);
2244                                                $month = (int)substr($date,5,2);
2245                                                $day = (int)substr($date,8,2);
2246                                               
2247                                                if($current_year==$year)
2248                                                        {
2249                                                        if($month_selected && $month_selected!='0')
2250                                                                {
2251                                                                if($month==$month_selected)
2252                                                                        {
2253                                                                        $total_form_interactions++;
2254                                                                        for($dv=1;$dv<=$days_in_month;$dv++)
2255                                                                                {
2256                                                                                if($day==$dv)
2257                                                                                        $interaction_array_pm[$dv]++;           
2258                                                                                }       
2259                                                                        }
2260                                                                }
2261                                                        else
2262                                                                {       
2263                                                                for($mv=1;$mv<=12;$mv++)
2264                                                                        {
2265                                                                        if($month==$mv)
2266                                                                                {
2267                                                                                $interaction_array[$mv]++;     
2268                                                                                $total_form_interactions++;
2269                                                                                }
2270                                                                        }
2271                                                                }       
2272                                                        }
2273                                                }
2274                                        $output = '';
2275                                       
2276                                        if(!$checkin)
2277                                                {
2278                                                for($m=1;$m<=12;$m++)
2279                                                        {
2280                                                        $submit_array[$m] = 0;
2281                                                        $interaction_array[$m] = 0;
2282                                                        $view_array[$m] = 0;
2283                                                        }
2284                                               
2285                                                for($dv=1;$dv<=$days_in_month;$dv++)
2286                                                        {
2287                                                        $submit_array_pm[$dv] = 0;
2288                                                        $interaction_array_pm[$dv] = 0;
2289                                                        $view_array_pm[$dv] = 0;       
2290                                                        }
2291                                                }
2292                                       
2293                                       
2294                                       
2295                                        $output.= '<div class="row stats aa_bg_sec">';
2296                                                if(!$checkin)
2297                                                        {
2298                                                        $total_form_views=0;
2299                                                        //$output.= '<div class="alert alert-danger" style="width:95%"><strong>'.__('Plugin NOT Registered!</strong> The below <strong>data is randomized</strong>! To view actual data go to Global Settings above and register the plugin.','nex-forms').'</div>';   
2300                                                        }
2301                                                       
2302                                                       
2303                                                        $output.= '<div class="col-xs-3" ><span class="big_txt">'.(($checkin) ? $total_form_views : $set_form_views).'</span> <label style="cursor:default;color:#60a1e1;">'.__('Views','nex-forms').'</label> </div>';
2304                                                        $output.= '<div class="col-xs-3" ><span class="big_txt">'.(($checkin) ? $total_form_interactions : $set_form_interactions).'</span> <label style="cursor:default;color:#8BC34A;">'.__('Interactions','nex-forms').'</label> </div>';
2305                                                        $output.= '<div class="col-xs-3" ><span class="big_txt">'.(($checkin) ? $total_form_entries : $set_form_entries).'</span> <label style="cursor:default;color:#F57C00;">'.__('Submissions','nex-forms').'</label> </div>';
2306                                                       
2307                                                        if($total_form_entries==0 || $total_form_views==0)
2308                                                                $output.= '<div class="col-xs-3" ><span class="big_txt">0%</span> <label style="cursor:default;">Conversion</label> </div>';
2309                                                        else
2310                                                                $output.= '<div class="col-xs-3" ><span class="big_txt">'.round((($total_form_entries/$total_form_views)*100),2).'%</span> <label>Conversion</label> </div>';
2311                                                               
2312                                                               
2313                                                               
2314                                                        $output.= '</div>';
2315                                                       
2316                                                        $get_countries = $nf7_functions->code_to_country('',1);
2317                                                        $opacity = 0.1;
2318                                                        $chart_type = isset($_REQUEST['chart_type']) ? sanitize_text_field($_REQUEST['chart_type']) : '';
2319                                                        if($chart_type=='global')
2320                                                                {
2321                                                                       
2322                                                                $output .= '<script type="text/javascript">
2323                                                                                          google.charts.load(\'current\', {\'packages\':[\'geochart\']});
2324                                                                                          google.charts.setOnLoadCallback(drawRegionsMap);
2325                                                                               
2326                                                                                          function drawRegionsMap() {
2327                                                                               
2328                                                                                                var data = google.visualization.arrayToDataTable([
2329                                                                                                  [\'Country\', \'Submissions\'],
2330                                                                                                 
2331                                                                                                  ';
2332                                                                                                  if($checkin)
2333                                                                                                        {
2334                                                                                                        foreach($array_countries as $key=>$value)
2335                                                                                                                {
2336                                                                                                                if(is_int($value))
2337                                                                                                                        $output .=        '[\''.$nf7_functions->code_to_country($key).'\', '.$value.'],';
2338                                                                                                               
2339                                                                                                                }
2340                                                                                                        }
2341                                                                                                else
2342                                                                                                        {
2343                                                                                                        foreach($get_countries as $key=>$val)
2344                                                                                                                $output .=        '["'.str_replace('"','',$val).'", '.rand(0,150).'],'; 
2345                                                                                                        }
2346                                                                                                  $output .= '
2347                                                                                                ]);
2348                                                                               
2349                                                                                                var options = {};
2350                                                                               
2351                                                                                                var gchart = new google.visualization.GeoChart(document.getElementById(\'regions_div\'));
2352                                                                               
2353                                                                                                gchart.draw(data, options);
2354                                                                                          }
2355                                                                                        </script>';
2356                                                                        $output .= '<div id="regions_div" style="width: 900px; height: 500px;"></div>';
2357                                                                }
2358                                                        if($chart_type=='bar')
2359                                                                $opacity = 0.2;
2360                                                       
2361                                                        if($chart_type=='doughnut' || $chart_type=='polarArea')
2362                                                                {
2363                                                                $opacity = 0.3;
2364                                                                $output .= '<script>
2365                                                                        randomScalingFactor = function(){ return Math.round(Math.random()*100)};
2366                                                                       
2367                                                                        var lineChartData = {
2368                                                                                        labels: [
2369                                                                                                "'.__('Views','nex-forms').'",
2370                                                                                                "'.__('Interactions','nex-forms').'",
2371                                                                                                "'.__('Submissions','nex-forms').'"
2372                                                                                        ],
2373                                                                        datasets: [
2374                                                                                {
2375                                                                                        data: ['.(($checkin) ? $total_form_views : $set_form_views).', '.(($checkin) ? $total_form_interactions : $set_form_interactions).', '.(($checkin) ? $total_form_entries : $set_form_entries).'],
2376                                                                                        backgroundColor: [
2377                                                                                                "'.NEXForms5_hex2RGB('#1976D2',true,',',$opacity).'",
2378                                                                                                "'.NEXForms5_hex2RGB('#8BC34A',true,',',$opacity).'",
2379                                                                                                "'.NEXForms5_hex2RGB('#F57C00',true,',',$opacity).'"
2380                                                                                        ],
2381                                                                                        hoverBackgroundColor: [
2382                                                                                                "#1976D2",
2383                                                                                                "#8BC34A",
2384                                                                                                "#F57C00"
2385                                                                                        ],
2386                                                                                        borderColor : [
2387                                                                                                "#fff",
2388                                                                                                "#fff",
2389                                                                                                "#fff"
2390                                                                                        ],
2391                                                                                       
2392                                                                                }]
2393                                                                        }
2394                                                                </script>';
2395                                                                }
2396                                                        else
2397                                                                {
2398                                                                $echo ='';
2399                                                                if($month_selected && $month_selected!='0')
2400                                                                                        {
2401                                                                                        for($d=0;$d<=$days_in_month;$d++)
2402                                                                                                {
2403                                                                                                $echo .= '"'.$d.'"';
2404                                                                                                if($d<$days_in_month)
2405                                                                                                        $echo  .= ',';
2406                                                                                                }
2407                                                                                        }
2408                                                                                else
2409                                                                                        {
2410                                                                                        foreach($month_array as $month)
2411                                                                                                {
2412                                                                                                $echo  .= '"'.$month.'"';
2413                                                                                                if($stop_count<12)
2414                                                                                                        $echo  .= ',';
2415                                                                                                $stop_count++;         
2416                                                                                                }
2417                                                                                        }       
2418                                                                                       
2419                                                                $output.= '<script>
2420                                                                        randomScalingFactor = function(){ return Math.round(Math.random()*100)};
2421                                                                        lineChartData = {
2422                                                                                labels : [';
2423                                                                                $stop_count = 1;
2424                                                                                if($month_selected && $month_selected!='0')
2425                                                                                        {
2426                                                                                        for($d=$days_back;$d<=$days_in_month;$d++)
2427                                                                                                {
2428                                                                                                $output.= '"'.$d.'"';
2429                                                                                                if($d<$days_in_month)
2430                                                                                                        $output.= ',';
2431                                                                                                }
2432                                                                                        }
2433                                                                                else
2434                                                                                        {
2435                                                                                        foreach($month_array as $month)
2436                                                                                                {
2437                                                                                                $output.= '"'.$month.'"';
2438                                                                                                if($stop_count<12)
2439                                                                                                        $output.= ',';
2440                                                                                                $stop_count++;         
2441                                                                                                }
2442                                                                                        }
2443                                                                                $output.= '],
2444                                                                                datasets : [
2445                                                                                        {
2446                                                                                                label: "'.__('Form Views','nex-forms').'",
2447                                                                                                backgroundColor : "'.NEXForms5_hex2RGB('#1976d2',true,',',$opacity).'",
2448                                                                                                borderColor : "#1976d2",
2449                                                                                                borderWidth : 1,
2450                                                                                                pointBackgroundColor : "#1976d2",
2451                                                                                                pointHoverBorderWidth : 5,
2452                                                                                                fill:true,
2453                                                                                                data : [
2454                                                                                                ';
2455                                                                                                if($month_selected && $month_selected!='0')
2456                                                                                                        {
2457                                                                                                        $counter2 = 1;
2458                                                                                                        foreach($view_array_pm as $views)
2459                                                                                                                {
2460                                                                                                                if($counter2>=$days_back)
2461                                                                                                                        {       
2462                                                                                                                        $output.= $views;
2463                                                                                                                        if($counter2<$days_in_month)
2464                                                                                                                                $output.= ',';
2465                                                                                                                        }
2466                                                                                                                        $counter2++;           
2467                                                                                                                }
2468                                                                                                        }
2469                                                                                                else
2470                                                                                                        {
2471                                                                                                        $counter2 = 1;
2472                                                                                                        foreach($view_array as $views)
2473                                                                                                                {
2474                                                                                                                $output.= $views;
2475                                                                                                                if($counter2<12)
2476                                                                                                                        $output.= ',';
2477                                                                                                                $counter2++;                           
2478                                                                                                                }
2479                                                                                                        }
2480                                                                                        $output.= '
2481                                                                                                        ]
2482                                                                                        },
2483                                                                                       
2484                                                                                        {
2485                                                                                                label: "'.__('Form Interactions','nex-forms').'",
2486                                                                                                backgroundColor : "'.NEXForms5_hex2RGB('#8BC34A',true,',',$opacity).'",
2487                                                                                                borderColor : "#8BC34A",
2488                                                                                                borderWidth : 1,
2489                                                                                                pointBackgroundColor : "#8BC34A",
2490                                                                                                pointHoverBorderWidth : 5,
2491                                                                                                fill:true,
2492                                                                                                data : [
2493                                                                                                ';
2494                                                                                                if($month_selected && $month_selected!='0')
2495                                                                                                        {
2496                                                                                                        $counter3 = 1;
2497                                                                                                        foreach($interaction_array_pm as $interaction)
2498                                                                                                                {
2499                                                                                                                if($counter3>=$days_back)
2500                                                                                                                        {
2501                                                                                                                        $output.= $interaction;
2502                                                                                                                        if($counter3<$days_in_month)
2503                                                                                                                                $output.= ',';
2504                                                                                                                        }
2505                                                                                                                        $counter3++;   
2506                                                                                                                       
2507                                                                                                                }
2508                                                                                                        }
2509                                                                                                else
2510                                                                                                        {
2511                                                                                                        $counter3 = 1;
2512                                                                                                        foreach($interaction_array as $interaction)
2513                                                                                                                {
2514                                                                                                                $output.= $interaction;
2515                                                                                                                if($counter3<12)
2516                                                                                                                        $output.= ',';
2517                                                                                                                $counter3++;                           
2518                                                                                                                }
2519                                                                                                        }
2520                                                                                        $output.= '
2521                                                                                                        ]
2522                                                                                        },
2523                                                                                        {
2524                                                                                                label: "'.__('Form Entries','nex-forms').'",
2525                                                                                                backgroundColor : "'.NEXForms5_hex2RGB('#F57C00',true,',',$opacity).'",
2526                                                                                                borderColor : "#F57C00",
2527                                                                                                borderWidth : 1,
2528                                                                                                pointBackgroundColor : "#F57C00",
2529                                                                                                pointHoverBorderWidth : 5,
2530                                                                                                fill:true,
2531                                                                                                data : [
2532                                                                                                ';
2533                                                                                                if($month_selected && $month_selected!='0')
2534                                                                                                        {
2535                                                                                                        $counter = 1;
2536                                                                                                        foreach($submit_array_pm as $submissions)
2537                                                                                                                {
2538                                                                                                                if($counter>=$days_back)
2539                                                                                                                        {
2540                                                                                                                        $output.= $submissions;
2541                                                                                                                        if($counter<$days_in_month)
2542                                                                                                                                $output.= ',';
2543                                                                                                                        }
2544                                                                                                                        $counter++;             
2545                                                                                                                       
2546                                                                                                                }
2547                                                                                                        }
2548                                                                                                else
2549                                                                                                        {
2550                                                                                                        $counter = 1;
2551                                                                                                        foreach($submit_array as $submissions)
2552                                                                                                                {
2553                                                                                                                $output.= $submissions;
2554                                                                                                                if($counter<12)
2555                                                                                                                        $output.= ',';
2556                                                                                                                $counter++;             
2557                                                                                                                }
2558                                                                                                        }
2559                                                                                        $output.= '
2560                                                                                                        ]
2561                                                                                        }
2562                                                                                ]
2563                                                                        }
2564                                                                  </script>
2565                                                                  ';
2566                                                                }
2567                                                $ajax = isset($_REQUEST['ajax']) ? sanitize_text_field($_REQUEST['ajax']) : '';
2568                                                if($ajax)
2569                                                        {
2570                                                        echo $output;
2571                                                        die();
2572                                                        }
2573                                                else
2574                                                        return $output;
2575                }
2576               
2577               
2578                public function print_record_table(){
2579                       
2580                        global $wpdb;
2581                       
2582                        $functions = new NEXForms_functions();
2583                        $database_actions = new NEXForms_Database_Actions();
2584                       
2585                        $output = '';
2586                       
2587                        $show_delete = (isset($_POST['show_delete'])) ? sanitize_text_field($_POST['show_delete']) : $this->show_delete;
2588                       
2589                        $output .= '<div class="dashboard-box database_table '.$this->table.' '.$this->extra_classes.'" data-table="'.$this->table.'">';
2590                                $output .= '<div class="dashboard-box-header '.(($this->color_adapt) ? 'aa_bg_main': '' ).'">';
2591                                        $output .= '<div class="table_title '.(($this->color_adapt) ? 'font_color_1': '' ).' ">';
2592                                       
2593                                        $output .= $this->table_header;
2594                                       
2595                                        //if($this->action_button)
2596                                        //      $output .= '<a class="btn-floating btn-large waves-effect waves-light blue"><i class="material-icons">'.$this->action_button.'</i></a>';
2597                                        //else
2598                                        //      $output .= '<i class="material-icons header-icon">'.$this->table_header_icon.'</i><span class="header_text '.(($this->action_button) ? 'has_action_button' : '' ).'">'.$this->table_header.'</span>';
2599                                        //<span class="header_text '.(($this->action_button) ? 'has_action_button' : '' ).'">'.$this->table_header.'</span>
2600                                        $output .= '</div>';
2601                                        if($this->show_search)
2602                                                {
2603                                                $output .= '  <div class="search_box">
2604                                                        <div class="input-field">
2605                                                        <input id="search" type="text" class="search_box aa_bg_main_input material-d" value="" placeholder="'.__('Search...','nex-forms').'" name="table_search_term">
2606                                                        <i class="fa fa-search do_search font_color_1"></i>
2607                                                        <i class="fa fa-close do_search font_color_1"></i>
2608                                                   </div>
2609                                                   </div>
2610                                                ';
2611                                                }
2612                                        if(is_array($this->extra_buttons))
2613                                                {
2614                                                $output .= '<div class="dashboard-box-header-buttons">';
2615                                                foreach($this->extra_buttons as $button)
2616                                                        {
2617                                                        $adapt_color = 'aa_bg_main_btn';
2618                                                       
2619                                                        $button_rank = isset($button['rank']) ? $button['rank'] : '';
2620                                                       
2621                                                        $button_rank=='2';
2622                                                                $adapt_color = 'aa_bg_sec_btn';
2623                                                               
2624                                                        if($button['type']=='link')
2625                                                                $output .= '<a href="'.$button['link'].'" class="'.$button['class'].' nf_button '.$adapt_color.'" id="'.$button['id'].'">'.$button['icon'].'</a>';
2626                                                        else
2627                                                                $output .= '<a href="#" class="'.$adapt_color.' '.$button['class'].' nf_button" id="'.$button['id'].'">'.$button['icon'].'</a>';
2628                                                        }
2629                                                $output .= '</div>';
2630                                                }
2631                                       
2632                                if($this->build_table_dropdown)
2633                                        {
2634                                        $output .= '<select class="form-control table_dropdown" name="'.$this->build_table_dropdown.'">';
2635                                                $output .= '<option value="0" selected>'.__('--- Select Form ---','nex-forms').'</option>';
2636                                                $get_forms = 'SELECT * FROM '.$wpdb->prefix.'wap_nex_forms WHERE is_template<>1 AND is_form<>"preview" AND is_form<>"draft" ORDER BY Id DESC';
2637                                                $forms = $wpdb->get_results($get_forms);
2638                                                foreach($forms as $form)
2639                                                        $output .= '<option value="'.$form->Id.'">'.$database_actions->get_total_records($this->table,'',$form->Id).' - '.$form->title.'</option>';
2640                                        $output .= '</select>';
2641                                        }
2642                                $output .= '</div>';
2643                                $output .= '<div  class="dashboard-box-content zero_padding">';
2644                               
2645                                        $output .= '<table class="'.(($this->table_resize) ? 'fixed_headers' : '').'">'; //highlight
2646                                        if($this->show_headings)
2647                                                {
2648                                                $output .= '<thead>';
2649                                                        $output .= '<tr>';
2650                                                        $output .= '<th class="batch-actions">
2651                                                        <input id="rs-check-all" name="check-all" value="check-all" type="checkbox">
2652                                                        </th>';
2653                                                        foreach($this->table_headings as $key=>$val)
2654                                                                {
2655                                                                if(is_array($val))
2656                                                                        {
2657                                                                        if(array_key_exists('heading',$val))
2658                                                                                $output .= '<th class="db-table-head '.((isset($val['set_class'])) ? $val['set_class'] : '').' '.$functions->format_name($val['heading']).' '.((isset($val['sort_by']) && $this->sortable_columns) ? 'sortable' : '' ).'" '.((isset($val['sort_by'])) ? 'data-sort-by="'.$val['sort_by'].'"' : '' ).'>'.$functions->unformat_records_name($val['heading']).'</th>';
2659                                                                        if(array_key_exists('icon',$val))
2660                                                                                $output .= '<th class="db-table-head '.((isset($val['set_class'])) ? $val['set_class'] : '').' '.((isset($val['sort_by']) && $this->sortable_columns) ? 'sortable' : '' ).'" '.(($val['sort_by']) ? 'data-sort-by="'.((isset($val['sort_by'])) ? $val['sort_by'] : '').'"' : '' ).'><span class="'.$val['icon'].'"></span></th>';
2661                                                                        }
2662                                                                else
2663                                                                        $output .= '<th class="db-table-head  '.(($this->sortable_columns) ? 'sortable' : '' ).' '.$functions->format_name($val).'" data-sort-by="'.$functions->format_name($val).'">'.$functions->unformat_records_name($val).'</th>';
2664                                                                }
2665                                                        if($show_delete)
2666                                                                $output .= '<th class="db-table-head  delete"></th>';   
2667                                                        $output .= '</tr>';
2668                                                   
2669                                                               
2670                                                $output .= '</thead>';
2671                                                }
2672                                                //$output .= $functions->print_preloader('big','blue',false,'database-table-loader');
2673                                                $output .= '<tbody class="'.(($this->checkout) ? 'saved_records_container' : 'saved_records_contianer').'">'.$this->get_table_records($this->additional_params, $this->search_params, $this->table_headings, $this->is_report ).'</tbody>';
2674
2675                                        $output .= '</table>';
2676                                $output .= '</div>';
2677                                $output .= '<div class="paging_wrapper">';
2678                               
2679                       
2680                               
2681                                        $output .='<input type="hidden" value="0" name="current_page" />';
2682                                       
2683                                        $output .="<input type='hidden' value='".json_encode($this->additional_params,JSON_UNESCAPED_UNICODE)."' name='additional_params' />";
2684                                        $output .="<input type='hidden' value='".json_encode($this->field_selection,JSON_UNESCAPED_UNICODE)."'  name='field_selection' />";
2685                                        $output .="<input type='hidden' value='".json_encode($this->search_params,JSON_UNESCAPED_UNICODE)."'     name='search_params' />";
2686                                        $output .="<input type='hidden' value='".json_encode($this->table_headings,JSON_UNESCAPED_UNICODE)."'    name='header_params' />";
2687                                        $output .="<input type='hidden' value='' name='sort_by' />";
2688                                        $output .="<input type='hidden' value='DESC' name='sort_by_direction' />";
2689                                        $output .="<input type='hidden' value='".$this->is_report."'            name='is_report' />";
2690                                        $output .="<input type='hidden' value='".$this->table."'                name='database_table' />";
2691                                        $output .="<input type='hidden' value='".$this->record_limit."'     name='record_limit' />";
2692                                        $output .="<input type='hidden' value='".$this->show_delete."'     name='show_delete' />";
2693                                        $output .="<input type='hidden' value='".$this->action."'     name='do_action' />";
2694                                       
2695                                       
2696                                        $total_record = $database_actions->get_total_records($this->table,$this->additional_params,'', $this->search_params,'');
2697                                       
2698                                                $output .= '<div class="paging">';
2699                                               
2700                                                if($this->show_paging)
2701                                                        {
2702                                                        $output .= '
2703                                                        <span class="displaying-num"><span class="entry-count">'.$total_record.'</span> '.__('items ','nex-forms').'</span>
2704                                                        <span class="pagination-links">
2705                                                               
2706                                                                <span class="paging-input">Page <span class="current-page">1</span> '.__('of','nex-forms').' <span class="total-pages">'.(($total_record>$this->record_limit) ? round(($total_record/$this->record_limit)+1,0) : '1').'</span><span class="records_per_page">
2707                                                                <select name="set_record_per_page">
2708                                                                <option value="10" '.(($this->record_limit==10) ? 'selected="selected"' : '').'>10</option>
2709                                                                <option value="20" '.(($this->record_limit==20) ? 'selected="selected"' : '').'>20</option>
2710                                                                <option value="50" '.(($this->record_limit==50) ? 'selected="selected"' : '').'>50</option>
2711                                                                <option value="100" '.(($this->record_limit==100) ? 'selected="selected"' : '').'>100</option>
2712                                                                <option value="150" '.(($this->record_limit==150) ? 'selected="selected"' : '').'>150</option>
2713                                                                <option value="300" '.(($this->record_limit==300) ? 'selected="selected"' : '').'>300</option>
2714                                                                <option value="500" '.(($this->record_limit==500) ? 'selected="selected"' : '').'>500</option>
2715                                                                <option value="1000" '.(($this->record_limit==1000) ? 'selected="selected"' : '').'>1000</option>
2716                                                                </select> '.__('records p/page','nex-forms').'</span>
2717                                                       
2718                                                                <a title="'.__('Go to the first page','nex-forms').'"class="first-page iz-first-page btn waves-effect waves-light"><span class="fa fa-angle-double-left"></span></a>
2719                                                                <a title="'.__('Go to the next page','nex-forms').'" class="iz-prev-page btn waves-effect waves-light prev-page"><span class="fa fa-angle-left"></span></a>
2720                                                               
2721                                                                <a title="'.__('Go to the next page','nex-forms').'" class="iz-next-page btn waves-effect waves-light next-page"><span class="fa fa-angle-right"></span></a>
2722                                                                <a title="'.__('Go to the last page','nex-forms').'" class="iz-last-page btn waves-effect waves-light last-page"><span class="fa fa-angle-double-right"></span></a>
2723                                                        </span>
2724                                                       
2725                                                        ';     
2726                                                        }       
2727                                                if($this->show_more_link){
2728                                                        $output .= '<a href="'.$this->show_more_link['link'].'" class="show_more_button">'.$this->show_more_link['text'].' <span class="fa fa-chevron-right"></span></a>';
2729                                                }
2730                                                $output .= '</div>';
2731                                               
2732                                $output .= '</div>';
2733                               
2734                        $output .= '</div>';
2735                       
2736                        return $output;
2737                }       
2738                public function get_table_records($additional_params=array(), $search_params=array(), $header_params=array(), $is_report=false){
2739                        if(!current_user_can( NF_USER_LEVEL )) 
2740                                wp_die();
2741                        global $wpdb;
2742                       
2743                       
2744                        $output = '';
2745                        $page_num = isset($_POST['page']) ? sanitize_text_field($_POST['page']) : 0;
2746                        $page_num = filter_var($page_num ,FILTER_SANITIZE_NUMBER_INT);
2747                       
2748                        $page_num = isset($_POST['page']) ? sanitize_text_field($_POST['page']) : 0;
2749                        $page_num = filter_var($page_num ,FILTER_SANITIZE_NUMBER_INT);
2750                        $search_term = isset($_POST['search_term']) ? sanitize_text_field($_POST['search_term']) : '';
2751                        $limit = 10;                   
2752                       
2753                        $nf_functions = new NEXForms_Functions();
2754                        $database_actions = new NEXForms_Database_Actions();
2755                       
2756                        $header_params = (isset($_POST['header_params'])) ? sanitize_text_field($_POST['header_params']) : '';
2757                        $additional_params = (isset($_POST['additional_params'])) ?  sanitize_text_field($_POST['additional_params']) : '';
2758                        $field_selection = (isset($_POST['field_selection'])) ?  sanitize_text_field($_POST['field_selection']) : '';
2759                        $search_params = (isset($_POST['search_params'])) ?  sanitize_text_field($_POST['search_params']) : '';
2760                       
2761                        $do_action = (isset($_POST['do_action'])) ? sanitize_text_field($_POST['do_action']) : $this->action;
2762                       
2763                        $sort_by_table = '';
2764                       
2765                        if($do_action=='print_entries')
2766                                {
2767                                if($_POST['sort_by']=='title')
2768                                        $sort_by_table = $wpdb->prefix.'wap_nex_forms.';
2769                                else
2770                                        $sort_by_table = $wpdb->prefix.'wap_nex_forms_entries.';
2771                                }
2772                       
2773                        $sort_by = (isset($_POST['sort_by']) && $_POST['sort_by']!='') ? sanitize_text_field($_POST['sort_by']) : 'Id';
2774                       
2775                       
2776                        $sort_by = $sort_by_table.$sort_by;
2777                       
2778                        $sort_by_direction =(isset($_POST['sort_by_direction']) && $_POST['sort_by_direction']!='') ? sanitize_text_field($_POST['sort_by_direction']) : 'DESC';
2779                       
2780                        $record_limit = (isset($_POST['record_limit'])) ? sanitize_text_field($_POST['record_limit']) : $this->record_limit;
2781       
2782                       
2783                        if($header_params)
2784                                {
2785                                $set_header_params = isset($header_params) ? $header_params : '';
2786                                if(!is_array($set_header_params))
2787                                        $header_params = json_decode(str_replace('\\','',$set_header_params),true);
2788                                else
2789                                        $header_params = $set_header_params;
2790                                }
2791                        else
2792                                $header_params = $this->table_headings;
2793                               
2794                        if($additional_params)
2795                                {
2796                                $set_params = isset($additional_params) ? $additional_params : '';
2797                                if(!is_array($set_params))
2798                                        $additional_params = json_decode(str_replace('\\','',$set_params),true);
2799                                else
2800                                        $additional_params = $set_params;
2801                                }
2802                        else
2803                                $additional_params = $this->additional_params;
2804                               
2805                        if($field_selection)
2806                                {
2807                                $set_field_selection = isset($field_selection) ? $field_selection : '';
2808                                if(!is_array($set_field_selection))
2809                                        $field_selection = json_decode(str_replace('\\','',$set_field_selection),true);
2810                                else
2811                                        $field_selection = $set_field_selection;
2812                                }
2813                        else
2814                                $field_selection = $this->field_selection;     
2815                       
2816                        if($search_params)
2817                                {
2818                                $set_search_params = isset($search_params) ? $search_params : '';
2819                                if(!is_array($set_search_params))
2820                                        $search_params = json_decode(str_replace('\\','',$set_search_params),true);
2821                                else
2822                                        $search_params = $set_search_params;
2823                                }
2824                        else
2825                                $search_params = $this->search_params;
2826                       
2827                        if(isset($_POST['table']))
2828                                $table = sanitize_title($_POST['table']);
2829                        else
2830                                $table = $this->table;
2831                               
2832                        $where_str = '';
2833                       
2834                        $show_hide_field = (isset($_POST['showhide_fields'])) ? sanitize_text_field($_POST['showhide_fields']) : '';
2835                       
2836                        $show_cols = filter_var($show_hide_field ,FILTER_SANITIZE_STRING);
2837                       
2838                        if(is_array($additional_params))
2839                                {
2840                                foreach($additional_params as $clause)
2841                                        {
2842                                        $like = '';
2843                                        if($clause['operator'] == 'LIKE' || $clause['operator'] == 'NOT LIKE')
2844                                                $like = '%';
2845                                        if($clause['value']=='NULL')
2846                                                $where_str .= ' AND `'.$clause['column'].'` '.(($clause['operator']!='') ? $clause['operator'] : '=').'  '.$like.$clause['value'].$like.'';
2847                                        else
2848                                                $where_str .= ' AND `'.$clause['column'].'` '.(($clause['operator']!='') ? $clause['operator'] : '=').'  "'.$like.$clause['value'].$like.'"';
2849                                       
2850                                        }
2851                                }
2852                       
2853                        $select_fields = '*';
2854                        if(is_array($field_selection))
2855                                {
2856                                $j=1;
2857                                $select_fields = '';
2858                                foreach($field_selection as $field_select)
2859                                        {
2860                                       
2861                                        if($j<count($field_selection))
2862                                                 $select_fields .= '`'.$field_select.'`,';
2863                                        else
2864                                                $select_fields .= '`'.$field_select.'`';
2865                                        $j++;
2866                                        }
2867                                }
2868                        else
2869                                {
2870                                $select_fields = '*';   
2871                                }
2872                       
2873                        $count_search_params = 0;
2874                       
2875                        if(is_array($search_params))
2876                                $count_search_params = count($search_params);
2877                               
2878                        if(is_array($search_params) && $search_term)
2879                                {
2880                                if($count_search_params>1)
2881                                        {
2882                                        $where_str .= ' AND (';
2883                                        $loop_count = 1;
2884                                        foreach($search_params as $column)
2885                                                {
2886                                                if($loop_count==1)
2887                                                        $where_str .= '`'.$column.'` LIKE "%'.$search_term.'%" ';
2888                                                else
2889                                                        $where_str .= ' OR `'.$column.'` LIKE "%'.$search_term.'%" ';
2890                                                       
2891                                                $loop_count++;
2892                                                }
2893                                        $where_str .= ') ';
2894                                        }
2895                                else
2896                                        {
2897                                        foreach($search_params as $column)
2898                                                {
2899                                                $where_str .= ' AND `'.$column.'` LIKE "%'.$search_term.'%" ';
2900                                                }
2901                                        }
2902                                }
2903                       
2904                        $entry_report_id = (isset($_POST['entry_report_id'])) ? sanitize_title($_POST['entry_report_id']) : '';
2905                        $form_id = (isset($_POST['form_id'])) ? sanitize_title($_POST['form_id']) : '';
2906                        $post_table = (isset($_POST['table'])) ? sanitize_title($_POST['table']) : '';
2907                       
2908                        $is_report = (isset($_POST['is_report'])) ? sanitize_text_field($_POST['is_report']) : $this->is_report;
2909                       
2910                        if($entry_report_id)
2911                                {
2912                                $where_str .= ' AND nex_forms_Id = '.filter_var($entry_report_id ,FILTER_SANITIZE_NUMBER_INT);
2913                                $nex_forms_id = filter_var($entry_report_id ,FILTER_SANITIZE_NUMBER_INT);
2914                                }
2915                        if($form_id)
2916                                {
2917                                $where_str .= ' AND nex_forms_Id = '.filter_var($form_id ,FILTER_SANITIZE_NUMBER_INT);
2918                                $nex_forms_id = filter_var($form_id ,FILTER_SANITIZE_NUMBER_INT);
2919                                }
2920                       
2921                        if($post_table)
2922                                $output = '<div class="total_table_records hidden">'.$database_actions->get_total_records($table,$additional_params,$nex_forms_id, $search_params,$search_term).'</div>';
2923               
2924                       
2925                        if($do_action=='print_entries')
2926                                $get_records = 'SELECT '.$select_fields.', title FROM '.$wpdb->prefix.$table.', '.$wpdb->prefix.'wap_nex_forms  WHERE '.$wpdb->prefix.$table.'.Id<>"" AND '.$wpdb->prefix.'wap_nex_forms.Id = '.$wpdb->prefix.$table.'.nex_forms_Id '.$where_str.' ORDER BY '.$sort_by.' '.$sort_by_direction.' LIMIT '.($page_num*$record_limit).','.$record_limit;
2927                        else
2928                                $get_records = 'SELECT '.$select_fields.' FROM '.$wpdb->prefix.$table.'  WHERE Id<>"" '.$where_str.' ORDER BY '.$sort_by.' '.$sort_by_direction.' LIMIT '.($page_num*$record_limit).','.$record_limit;
2929                       
2930                        //echo $get_records;
2931                        $records = $wpdb->get_results($get_records);
2932                       
2933                        $get_temp_table_details = get_option('tmp_csv_export');
2934                        update_option('tmp_csv_export',array('query'=>$get_records,'cols'=>$field_selection,'form_Id'=>$get_temp_table_details['form_Id']));
2935                       
2936                        $img_ext_array = array('jpg','jpeg','png','tiff','gif','psd');
2937                        $file_ext_array = array('doc','docx','mpg','mpeg','mp3','mp4','odt','odp','ods','pdf','ppt','pptx','txt','xls','xlsx');
2938                                foreach($records as $record)
2939                                        {
2940                                        //echo '<pre>';
2941                                        //print_r($record);
2942                                        //echo '</pre>';
2943                                        $record_val = '';
2944                                        $output .= '<tr class="form_record" id="'.$record->Id.'">';
2945                                                $output .= '<td class="batch-actions"><input id="rs-check-all-'.$record->Id.'" name="record[]" value="'.$record->Id.'" type="checkbox"></td>';
2946                                        if($is_report)
2947                                                {
2948                                                foreach($record as $record_head=>$record_val)
2949                                                        {
2950                                                        if($record_head!='Id')
2951                                                                {
2952                                                               
2953                                                                //$field_value = $data->field_value;
2954                                                                $set_val = '';
2955                                                                if(strstr($record_val,'||'))
2956                                                                        {
2957                                                                       
2958                                                                        $get_val = explode('||',$record_val);
2959                                                                       
2960                                                                        foreach($get_val as $setkey=>$setval)
2961                                                                                {
2962                                                                                $set_val .= ''.trim($setval).',';       
2963                                                                                }
2964                                                                       
2965                                                                        $record_val = $set_val;
2966                                                                       
2967                                                                        }
2968                                                               
2969                                                               
2970                                                                if($nf_functions->isJson($record_val) && !is_numeric($record_val))
2971                                                                                {
2972                                                                                $output .= '<td class="'.$val.'" style="overflow-x:auto;overflow-y:auto;">';
2973                                                                                $json = json_decode($record_val,1);
2974                                                                               
2975                                                                                $output .= '<table width="100%" class="highlight" cellpadding="3" cellspacing="0" style="border-bottom:1px solid #ddd; border-left:1px solid #ddd; border-top:1px solid #ddd;">';
2976                                                                                $i = 1;
2977                                                                                foreach($json as $value)
2978                                                                                        {
2979                                                                                        if(is_array($value) || is_object($value))
2980                                                                                                {
2981                                                                                                       
2982                                                                                                        if($i==1)
2983                                                                                                                {
2984                                                                                                                $output .= '<tr>';
2985                                                                                                                foreach($value as $innerkey=>$innervalue)
2986                                                                                                                        {
2987                                                                                                                        if(!strstr($innerkey,'real_val__'))     
2988                                                                                                                                $output .= '<td style="border-bottom:1px solid #ddd;border-right:1px solid #ddd;"><strong>'.$nf_functions->unformat_records_name($innerkey).'</strong></td>';
2989                                                                                                                        }
2990                                                                                                                $output .= '</tr>';
2991                                                                                                                }
2992                                                                                                       
2993                                                                                                        $output .= '<tr>';
2994                                                                                                        foreach($value as $innerkey=>$innervalue)
2995                                                                                                                {
2996                                                                                                                if(array_key_exists('real_val__'.$innerkey.'',$val))
2997                                                                                                                                {
2998                                                                                                                                $realval = 'real_val__'.$innerkey;
2999                                                                                                                                $innervalue = $val->$realval;   
3000                                                                                                                               
3001                                                                                                                                }
3002                                                                                                                if(!strstr($innerkey,'real_val__'))
3003                                                                                                                        {
3004                                                                                                                       
3005                                                                                                                        if(in_array($nf_functions->get_ext($innervalue),$img_ext_array))
3006                                                                                                                                $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;"><img class="materialboxed" src="'.rtrim($innervalue,', ').'" width="80px" /></td>';
3007                                                                                                                        else
3008                                                                                                                                $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;">'.rtrim($innervalue,', ').'</td>';
3009                                                                                                                       
3010                                                                                                                        }
3011                                                                                                                }
3012                                                                                                               
3013                                                                                                        $output .= '</tr>';
3014                                                                                                       
3015                                                                                                }
3016                                                                                        else
3017                                                                                                $output .= ''.rtrim(esc_html(strip_tags($value)),', ').'';
3018                                                                                       
3019                                                                                        $i++;
3020                                                                                        }
3021                                                                               
3022                                                                                $output .= '</table>';
3023                                                                                $output .= '</td>';
3024                                                                                }
3025                                                                        else if(strstr($record_val,',') && !strstr($record_val,'data:image'))
3026                                                                                {
3027                                                                                $is_array = explode(',',$record_val);
3028                                                                                $output .= '<td class="image_td '.$val.'">';
3029                                                                                foreach($is_array as $item)
3030                                                                                        {
3031                                                                                        if(in_array($nf_functions->get_ext($item),$img_ext_array))
3032                                                                                                $output .= '<img class="materialboxed"  width="40px" src="'.$item.'">';
3033                                                                                        else if(in_array($nf_functions->get_ext($item),$file_ext_array))
3034                                                                                                $output .= '<a class="btn file_upload_link" href="'.$item.'" target="_blank"><i class="fa fa-file"></i> '.$nf_functions->get_ext($item).'</a>';
3035                                                                                        else
3036                                                                                                $output .= $item;
3037                                                                                        }
3038                                                                                $output .= '</td>';
3039                                                                                }
3040                                                                        else if(strstr($record_val,'data:image'))
3041                                                                                $output .= '<td class="'.$val.'"><img  width="100px" src="'.$record_val.'" /></td>';
3042                                                                        else if(in_array($nf_functions->get_ext($record_val),$img_ext_array) && $val!='name')
3043                                                                                $output .= '<td class="'.$val.'"><img class="materialboxed"  width="65px" src="'.esc_html(strip_tags($record_val)).'"></td>';
3044                                                                        else{
3045                                                                               
3046                                                               
3047                                                                                $output .= '<td class="report_row '.$record_val.'">'.$nf_functions->view_excerpt(esc_html(strip_tags($record_val)),30).'</td>';
3048                                                                        }
3049                                                               
3050                                                               
3051                                                                }
3052                                                        }
3053                                                }
3054                                        else
3055                                                {
3056                                                foreach($header_params as $key=>$val)
3057                                                        {
3058                                                               
3059                                                       
3060                                                               
3061                                                        if(is_array($val))
3062                                                                {
3063                                                                $func_args_1 = (isset($val['user_func_args_1'])) ? $val['user_func_args_1'] : '';
3064                                                                $func_args_2 = (isset($val['user_func_args_2'])) ? $val['user_func_args_2'] : '';
3065                                                                $func_args_3 = (isset($val['user_func_args_3'])) ? $val['user_func_args_3'] : '';
3066                                                                $func_args_4 = (isset($val['user_func_args_4'])) ? $val['user_func_args_4'] : '';
3067                                                                $func_args_5 = (isset($val['user_func_args_5'])) ? $val['user_func_args_5'] : '';
3068                                                                $func_args_6 = (isset($val['user_func_args_6'])) ? $val['user_func_args_6'] : '';
3069                                                               
3070                                                               
3071                                                                if(isset($val['user_func_class']))
3072                                                                        $output .= '<td class="'.$nf_functions->format_name($val['heading']).' '.((isset($val['set_class'])) ? $val['set_class'] : '').'">'.call_user_func(array($val['user_func_class'],$val['user_func']), array($record->$func_args_1, $func_args_2)).'</td>';
3073                                                                else
3074                                                                        $output .= '<td class=" '.((isset($val['set_class'])) ? $val['set_class'] : '').'">'.call_user_func($val['user_func'], array($record->$func_args_1, $func_args_2)).'</td>';
3075                                                                }
3076                                                        else
3077                                                                {
3078                                                                if($val)
3079                                                                        {
3080                                                       
3081                                                                        if($nf_functions->isJson($record_val) && !is_numeric($record_val))
3082                                                                                {
3083                                                                                $output .= '<td class="'.$val.'" style="overflow-x:auto;overflow-y:auto;">';
3084                                                                                $json = json_decode($record->$val,1);
3085                                                                               
3086                                                                                $output .= '<table width="100%" class="highlight" cellpadding="3" cellspacing="0" style="border-bottom:1px solid #ddd; border-left:1px solid #ddd; border-top:1px solid #ddd;">';
3087                                                                                $i = 1;
3088                                                                                foreach($json as $value)
3089                                                                                        {
3090                                                                                        if(is_array($value) || is_object($value))
3091                                                                                                {
3092                                                                                                       
3093                                                                                                        if($i==1)
3094                                                                                                                {
3095                                                                                                                $output .= '<tr>';
3096                                                                                                                foreach($value as $innerkey=>$innervalue)
3097                                                                                                                        {
3098                                                                                                                        if(!strstr($innerkey,'real_val__'))     
3099                                                                                                                                $output .= '<td style="border-bottom:1px solid #ddd;border-right:1px solid #ddd;"><strong>'.$nf_functions->unformat_records_name($innerkey).'</strong></td>';
3100                                                                                                                        }
3101                                                                                                                $output .= '</tr>';
3102                                                                                                                }
3103                                                                                                       
3104                                                                                                        $output .= '<tr>';
3105                                                                                                        foreach($value as $innerkey=>$innervalue)
3106                                                                                                                {
3107                                                                                                                if(array_key_exists('real_val__'.$innerkey.'',$val))
3108                                                                                                                                {
3109                                                                                                                                $realval = 'real_val__'.$innerkey;
3110                                                                                                                                $innervalue = $val->$realval;   
3111                                                                                                                               
3112                                                                                                                                }
3113                                                                                                                if(!strstr($innerkey,'real_val__'))
3114                                                                                                                        {
3115                                                                                                                       
3116                                                                                                                        if(in_array($nf_functions->get_ext($innervalue),$img_ext_array))
3117                                                                                                                                $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;"><img class="materialboxed" src="'.rtrim($innervalue,', ').'" width="80px" /></td>';
3118                                                                                                                        else
3119                                                                                                                                $output .= '<td style="border-right:1px solid #ddd;border-bottom:1px solid #eee;">'.rtrim($innervalue,', ').'</td>';
3120                                                                                                                       
3121                                                                                                                        }
3122                                                                                                                }
3123                                                                                                               
3124                                                                                                        $output .= '</tr>';
3125                                                                                                       
3126                                                                                                        //foreach($value as $innerkey => $innervalue)
3127                                                                                                                //{
3128                                                                                                                //$output .= '<strong>'.$nf_functions->unformat_records_name($innerkey).'</strong>: '.$innervalue.' | ';       
3129                                                                                                                //}
3130                                                                                                        //$output .= '<br />'; 
3131                                                                                                }
3132                                                                                        else
3133                                                                                                $output .= ''.rtrim(esc_html(strip_tags($value)),', ').'';
3134                                                                                       
3135                                                                                        $i++;
3136                                                                                        }
3137                                                                               
3138                                                                                $output .= '</table>';
3139                                                                                $output .= '</td>';
3140                                                                                }
3141                                                                        else if(strstr($record->$val,',') && !strstr($record->$val,'data:image'))
3142                                                                                {
3143                                                                                $is_array = explode(',',$record->$val);
3144                                                                                $output .= '<td class="image_td '.$val.'">';
3145                                                                                foreach($is_array as $item)
3146                                                                                        {
3147                                                                                        if(in_array($nf_functions->get_ext($item),$img_ext_array))
3148                                                                                                $output .= '<img class="materialboxed"  width="65px" src="'.$item.'">';
3149                                                                                        else if(in_array($nf_functions->get_ext($item),$file_ext_array))
3150                                                                                                $output .= '<a class="btn file_upload_link" href="'.$item.'" target="_blank"><i class="fa fa-file"></i> '.$nf_functions->get_ext($item).'</a>';
3151                                                                                        else
3152                                                                                                $output .= $item;
3153                                                                                        }
3154                                                                                $output .= '</td>';
3155                                                                                }
3156                                                                        else if(strstr($record->$val,'data:image'))
3157                                                                                $output .= '<td class="'.$val.'"><img  width="100px" src="'.$record->$val.'" /></td>';
3158                                                                        else if(in_array($nf_functions->get_ext($record->$val),$img_ext_array) && $val!='name')
3159                                                                                $output .= '<td class="'.$val.'"><img class="materialboxed"  width="65px" src="'.esc_html(strip_tags($record->$val)).'"></td>';
3160                                                                        else{
3161                                                                               
3162                                                               
3163                                                                                $output .= '<td class="'.$val.'">'.$nf_functions->view_excerpt(esc_html(strip_tags($record->$val)),30).'</td>';
3164                                                                        }
3165                                                                        }
3166                                                                else
3167                                                                        $output .= '<td>&nbsp;</td>';
3168                                                                }
3169                                                        }
3170                                               
3171                                                //$theme = wp_get_theme();
3172                                                ///if($theme->Name=='NEX-Forms Demo' && $record->Id<22)
3173                                                //      $output .= '<td class="td_right"></td>';
3174                                                //else
3175                                                }
3176                                               
3177                                                $show_delete = (isset($_POST['show_delete'])) ? sanitize_text_field($_POST['show_delete']) : $this->show_delete;
3178                                               
3179                                                if($show_delete)
3180                                                        $output .= '<td class="td_right col_delete"><a class="delete"><i id="'.$record->Id.'" data-table="'.$table.'"  data-placement="bottom" class="delete-record fas fa-trash" data-title="'.__('Delete','nex-forms').'" data-toggle="tooltip_bs" title="'.__('Delete Record','nex-forms').'"></i></a></td>';
3181                                        $output .= '</tr>';
3182                                        }
3183                       
3184                        if(!$records)
3185                                {
3186                                $output .= '<div class="no_records"><span class="fa fa-ban"></span> <span class="result_text">'.__('No results found'.(($search_term) ? ' containing '.$search_term.'': '').'','nex-forms').'</span></div>';
3187                                       
3188                                }
3189                               
3190                        $do_ajax = (isset($_POST['do_ajax'])) ? sanitize_text_field($_POST['do_ajax']) : '';
3191
3192                        if($do_ajax)
3193                                {
3194                                NEXForms_clean_echo($output);
3195                                wp_die();
3196                                }
3197                        else
3198                                return $output;
3199                               
3200                               
3201                }
3202                public function get_total_entries($form_Id){
3203                        global  $wpdb;
3204                       
3205                        if(is_array($form_Id))
3206                                $set_form_id = $form_Id[0];
3207                        $total_entries = $wpdb->get_var('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id='.$set_form_id);
3208                        return $total_entries;
3209                }
3210               
3211                public function get_total_entries_2($form_Id){
3212                        global  $wpdb;
3213                       
3214                        if(is_array($form_Id))
3215                                $set_form_id = $form_Id[0];
3216                        $total_entries = $wpdb->get_var('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id='.$set_form_id);
3217                        return ($total_entries>0) ? '<a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions&folder='.$set_form_id.'"><span class="total_entries_display menu_badge">'.$total_entries.'</span></a>' : '<span class="total_entries_display">'.$total_entries.'</span>';
3218                }
3219               
3220               
3221                public function get_total_entries_3($id){
3222                        global  $wpdb;
3223                       
3224                        if(is_array($id))
3225                                $id = $id[0];
3226                        $set_count = $wpdb->get_var('SELECT count(*) FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id='.$id);
3227                        return ($set_count>0) ? '<a href="'.get_admin_url().'admin.php?page=nex-forms-page-submissions&folder='.$id.'" ><span data-title="View Form Entries" data-toggle="tooltip_bs" data-placement="bottom" class="total_entries_display menu_badge">'.$set_count.'</span></a>' : '<span class="total_entries_display">'.$set_count.'</span>';
3228                }
3229               
3230                public function duplicate_record($form_Id){
3231                        global  $wpdb;
3232                       
3233                        if(is_array($form_Id))
3234                                $set_form_id = $form_Id[0];
3235                               
3236                        return '<a id="'.$set_form_id.'" class="duplicate_record" title="'.__('Duplicate Form','nex-forms').'" ><i class="fa fa-files-o" data-title="'.__('Duplicate Form','nex-forms').'" data-toggle="tooltip_bs" data-placement="bottom"></i></a>';
3237                }
3238               
3239                public function link_form_title($form_Id){
3240                        global  $wpdb;
3241                       
3242                        if(is_array($form_Id))
3243                                $set_form_id = $form_Id[0];
3244                        $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id);
3245                       
3246                        $title= wp_unslash($title);
3247                        $title= str_replace('\"','',$title);
3248                        $title= str_replace('/','',$title);
3249                        $title = sanitize_text_field( $title );
3250                       
3251                       
3252                        return '<a href="'.get_admin_url().'admin.php?page=nex-forms-builder&open_form='.$set_form_id.'"  class="edit_record" title="'.__('Edit Form','nex-forms').'"><i class="fa fa-edit" data-title="'.__('Edit Form','nex-forms').'" data-toggle="tooltip_bs" data-placement="bottom"></i></a>';
3253                }
3254               
3255                public function link_form_title_2($form_Id){
3256                        global  $wpdb;
3257                       
3258                        if(is_array($form_Id))
3259                                $set_form_id = $form_Id[0];
3260                        $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id);
3261
3262                        $title= wp_unslash($title);
3263                        $title= str_replace('\"','',$title);
3264                        $title= str_replace('"','',$title);
3265                        $title= str_replace("\'",'',$title);
3266                        $title= str_replace("'",'',$title);
3267                        $title= str_replace('/','',$title);
3268                        $title = sanitize_text_field( $title );
3269                       
3270                        return '<a href="'.get_admin_url().'admin.php?page=nex-forms-builder&open_form='.$set_form_id.'" class="form_title"   title="'.__('Edit - '.$title,'nex-forms').'" data-title="'.__('Edit Form','nex-forms').'" data-toggle="tooltip_bs" data-placement="bottom">'.$title.'</a>';
3271                }
3272               
3273                public function print_export_form_link($form_Id){
3274                        global  $wpdb;
3275                       
3276                        if(is_array($form_Id))
3277                                $set_form_id = $form_Id[0];
3278                        $title = $wpdb->get_var('SELECT title FROM '.$wpdb->prefix.'wap_nex_forms WHERE Id='.$set_form_id);
3279                       
3280                        $title= wp_unslash($title);
3281                        $title= str_replace('\"','',$title);
3282                        $title= str_replace('/','',$title);
3283                        $title = sanitize_text_field( $title );
3284                       
3285                        return '<a href="'.get_option('siteurl').'/wp-admin/admin.php?page=nex-forms-dashboard&nex_forms_Id='.$set_form_id.'&export_form=true"    class="export_form" title="'.__('Export Form','nex-forms').'"><i class="fa fa-cloud-download" data-title="'.__('Export Form','nex-forms').'" data-toggle="tooltip_bs" data-placement="bottom"></i></a>';
3286                }
3287               
3288               
3289               
3290                public function print_form_entry(){
3291                       
3292                        global $wpdb;
3293                        $output = '';
3294                        $output .= '<form id="form_save_form_entry" class="form_save_form_entry" name="save_form_entry" action="'.admin_url('admin-ajax.php').'" method="post" enctype="multipart/form-data">';
3295                        $output .= '<div class="dashboard-box form_entry_view">';
3296                               
3297                                //<span class="header_text">'.__('Form Entry Data','nex-forms').'</span>
3298                                /*$output .= '<div class="dashboard-box-header '.(($this->color_adapt) ? 'aa_bg_main' : '' ).'">';
3299                                        $output .= '<div class="table_title"><i class="material-icons header-icon">assignment_turned_in</i> </div>';
3300                                       
3301                                       
3302                                        $output .= '<a  class="cancel_save_form_entry save_button btn waves-effect waves-light" style="display:none;"><i class="fa fa-close"></i></a>';
3303                                        $output .= '<button type="submit" class="save_form_entry save_button btn waves-effect waves-light" style="display:none;">'.__('Save','nex-forms').'</button>';
3304                                       
3305                                        $output .= '<a class="btn waves-effect waves-light print_to_pdf" disabled="disabled">'.__('PDF','nex-forms').'</a>';
3306                                        $output .= '<a class="btn waves-effect waves-light print_form_entry" disabled="disabled">'.__('Print','nex-forms').'</a>';
3307                                        $output .= '<a id="" class="btn waves-effect waves-light edit_form_entry" disabled="disabled">'.__('Edit','nex-forms').'</a>';
3308                                $output .= '</div>';*/
3309                                $output .= '<div  class="dashboard-box-content form_entry_data">';
3310                               
3311                                $output .= '<table class="highlight" id="form_entry_table"></table>';//<thead><tr><th>'.__('Field Name','nex-forms').'</th><th>'.__('Field Value','nex-forms').'</th></tr></thead>
3312                               
3313                                $output .= '</div>';
3314                                       
3315                        $output .= '</div>';
3316                        $output .= '</form>';
3317                       
3318                        $output .= '<div class="form_entry_admin_email_view email_preview" style="display:none;">';
3319                        $output .= '<iframe class="admin_email_view" src=""></iframe>';
3320                        $output .= '</div>';
3321                       
3322                        $output .= '<div class="form_entry_user_email_view email_preview" style="display:none;">';
3323                        $output .= '<iframe class="user_email_view" src=""></iframe>';
3324                        $output .= '</div>';
3325                       
3326                       
3327                        return $output;
3328                }
3329               
3330        public function do_form_entry_save(){
3331               
3332                if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'nf_admin_do_form_entry_save' ) ) {
3333                                wp_die();
3334                        }
3335               
3336                if(!current_user_can( NF_USER_LEVEL )) 
3337                                wp_die();
3338                global $wpdb;
3339               
3340                $edit_id = sanitize_text_field($_POST['form_entry_id']);
3341               
3342                unset($_POST['_wpnonce']);
3343                unset($_POST['action']);
3344                unset($_POST['submit']);
3345                unset($_POST['form_entry_id']);
3346               
3347                foreach($_POST as $key=>$val)
3348                        {
3349                        $data_array[] = array('field_name'=>$key,'field_value'=>filter_var(sanitize_text_field($val),FILTER_SANITIZE_STRING));
3350                        }
3351                //print_r($data_array);
3352                $update = $wpdb->update ( $wpdb->prefix . 'wap_nex_forms_entries',array(
3353                                'form_data'=>json_encode($data_array)
3354                ), array(       'Id' => filter_var($edit_id,FILTER_SANITIZE_NUMBER_INT)) );
3355               
3356                echo $edit_id;
3357               
3358                die();
3359                }
3360               
3361               
3362               
3363        public function submission_report(){
3364                        if(!current_user_can( NF_USER_LEVEL )) 
3365                                wp_die();
3366                        global $wpdb;
3367                       
3368                        $set_additional_params = array();
3369                        $nf_functions = new NEXForms_Functions();
3370                       
3371                        if($_POST['field_selection'])
3372                                        {
3373                                        $field_selection = isset($_POST['field_selection']) ? $_POST['field_selection'] : '';
3374                                        }
3375                               
3376                       
3377                        $get_records = $wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'wap_nex_forms_entries WHERE nex_forms_Id=%d', filter_var(sanitize_text_field($_POST['form_Id']),FILTER_SANITIZE_NUMBER_INT));
3378                        $records = $wpdb->get_results($get_records);
3379                       
3380                       
3381                        $get_temp_table_details = get_option('tmp_csv_export');
3382                        update_option('tmp_csv_export',array('query'=>$get_temp_table_details['query'],'cols'=>$get_temp_table_details['cols'],'form_Id'=>sanitize_text_field($_POST['form_Id'])));
3383                       
3384                        foreach($records as $data)
3385                                {
3386                                $form_values = json_decode($data->form_data);
3387                               
3388                                $header_array['entry_Id'] = $data->Id;
3389                               
3390                                $header_array['date_time'] = $data->date_time;
3391                               
3392                                foreach($form_values as $field)
3393                                        {
3394                                        if(is_array($field_selection))
3395                                                {
3396                                                if(in_array($field->field_name,$field_selection))
3397                                                        {
3398                                                        $header_array_filters[$field->field_name] = $nf_functions->unformat_records_name($field->field_name);
3399                                                        }
3400                                                }
3401                                        else
3402                                                {
3403                                                $header_array_filters[$field->field_name] = $nf_functions->unformat_records_name($field->field_name);
3404                                                }
3405                                        $header_array[$field->field_name] = $nf_functions->unformat_records_name($field->field_name);
3406                                        }
3407                                };
3408                        if($wpdb->get_var("show tables like '".$wpdb->prefix."wap_nex_forms_temp_report'") == $wpdb->prefix.'wap_nex_forms_temp_report')
3409                                {
3410                                $drop_table = 'DROP TABLE '.$wpdb->prefix.'wap_nex_forms_temp_report';
3411                                $wpdb->query($drop_table);
3412                                }
3413                        $nf_functions = new NEXForms_Functions();
3414                       
3415                        $header_array2 = array_unique($header_array);
3416                        $col_array_unique = array();
3417                        foreach($header_array2 as $key => $val){
3418                                if($key)
3419                                        $col_array_unique[$nf_functions->format_column_name($key)] = $nf_functions->format_column_name($key);
3420                        }
3421                       
3422                       
3423                        $sql .= 'CREATE TABLE `'.$wpdb->prefix.'wap_nex_forms_temp_report` ('; 
3424                                       
3425                                        $sql .= '`Id` BIGINT(255) unsigned NOT NULL AUTO_INCREMENT,';
3426                               
3427                                        foreach($col_array_unique as $key => $val){
3428                                               
3429                                                $col_name = $nf_functions->format_column_name($key);
3430                                               
3431                                                if($col_name!='')
3432                                                        {
3433                                                        if($col_name=='entry_id')
3434                                                                $sql .= '`'.$col_name.'` BIGINT(255),';
3435                                                        else
3436                                                                $sql .= '`'.$col_name.'` longtext,';
3437                                                        }
3438                                        }
3439                                $sql .= 'PRIMARY KEY (`Id`)
3440                                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4';
3441                               
3442                                $wpdb->query($sql);
3443                               
3444                          $table_fields         = $wpdb->get_results('SHOW FIELDS FROM '.$wpdb->prefix.'wap_nex_forms_temp_report');
3445                       
3446                          foreach($records as $data)
3447                                        {
3448                                        $form_fields = json_decode($data->form_data);
3449
3450                                        $column_array = array();
3451                                       
3452                                        $column_array['entry_Id'] = $data->Id;
3453                                       
3454                                        $column_array['date_time'] = $data->date_time;
3455                                       
3456                                        foreach($table_fields as $table_field)
3457                                                {
3458                                                foreach($form_fields as $form_field)
3459                                                        {
3460                                                        $form_field_name = $nf_functions->format_column_name($form_field->field_name);
3461                                                        $table_field_col = $nf_functions->format_column_name($table_field->Field);
3462                                                       
3463                                                        if(is_array($form_field->field_value) || is_object($form_field->field_value))
3464                                                                $form_field->field_value = json_encode($form_field->field_value);
3465                                                       
3466                                                        if($form_field_name==$table_field_col)
3467                                                                {
3468                                                                $column_array[$table_field_col] = $form_field->field_value;
3469                                                                }
3470                                                        }
3471                                                }
3472                                        $insert = $wpdb->insert ( $wpdb->prefix . 'wap_nex_forms_temp_report' , $column_array );
3473                                        $insert_id = $wpdb->insert_id;
3474                                        }
3475                          foreach($col_array_unique as $key=>$val)
3476                                {
3477                                if(is_array($field_selection))
3478                                        {
3479                                        if(in_array($key,$field_selection))
3480                                                {
3481                                                $set_headers[$key]      = $key;
3482                                                $set_search[$key]       = $key;
3483                                                }
3484                                        }
3485                                else
3486                                        {
3487                                        $set_headers[$key]      = $key;
3488                                        $set_search[$key]       = $key;
3489                                        }
3490                                }
3491                       
3492                          $database = new NEXForms_Database_Actions();
3493
3494                          $report = new NEXForms_dashboard();
3495                          $report->table = 'wap_nex_forms_temp_report';
3496                          $report->extra_classes = 'wap_nex_forms_entries'; 
3497                          $report->table_header = 'Report';
3498                          $report->table_resize = true;
3499                          $report->table_header_icon = 'view_list';
3500                          $report->action_button = 'add';
3501                          $report->table_headings = $set_headers;
3502                          $report->show_headings=true;
3503                          $report->search_params = $set_search;
3504                          $report->extra_buttons = array( 'Export'=>array('class'=>'export-csv', 'type'=>'link','link'=>admin_url().'admin.php?page=nex-forms-dashboard&amp;export_csv=true', 'icon'=>'<span class="fa fa-file-excel"></span> '.__('Export to Excel(CSV)','nex-forms').''), 'PDF'=>array('class'=>'print_report_to_pdf', 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'')); //'Report'=>array('class'=>'run_query', 'id'=>$_POST['form_Id'], 'type'=>'button','link'=>'', 'icon'=>'<span class="fa fa-filter"></span> '.__('Build Report','nex-forms').''),
3505                          $report->checkout = $database->checkout();
3506                          $report->is_report = true;
3507                          $report->show_delete = false;
3508                          $report->color_adapt = true;
3509                          $report->record_limit = 100;
3510                         
3511                          if($_POST['field_selection'])
3512                                 $report->field_selection = $_POST['field_selection'];
3513                          $report->additional_params = $_POST['additional_params'];
3514                         $output .= '<div class="right-col-top">'; 
3515                         
3516                                $output .= '<div class="right-col-inner aa_bg_tri">'; 
3517                         
3518                                       
3519                                //$output .= $report->print_form_entry();
3520                               
3521                               
3522                               
3523                                $output .= '<div class="reporting_controls">';
3524                               
3525                                $show_cols = $_POST['showhide_fields'];
3526                               
3527                                $output .= '<div class="col-sm-3 field_selection_col ">';
3528                                $output .= '<select name="showhide_fields[]" multiple="multiple" class="aa_multi_select field_selection_multi_select">
3529                                                        <option disabled="disabled">'.__('Show Fields','nex-forms').'</option>
3530                                ';
3531                                $show_cols = explode(',',$show_cols);
3532                                $i = 0;
3533                                 
3534                                if($_POST['field_selection'])
3535                                        {
3536                                        $field_selection = isset($_POST['field_selection']) ? $_POST['field_selection'] : '';
3537                                        }
3538                                //else
3539                                        //$field_selection = $this->field_selection;
3540                                 
3541                                 foreach($col_array_unique as $key=>$val)
3542                                        {
3543                                        if(is_array($field_selection))
3544                                                {
3545                                                $output .= '<option value="'.$key.'" '.((in_array($key,$field_selection)) ? 'selected="selected"' : '').'>
3546                                                                '. $nf_functions->unformat_records_name($val,30).'</option>';
3547                                                }
3548                                        else
3549                                                {
3550                                                $output .= '<option value="'.$key.'"  selected="selected">
3551                                                                '.$nf_functions->unformat_records_name($val,30).'</option>';   
3552                                                }
3553                                        $i++;
3554                                        }
3555                                        $output .= '</select></div>';
3556                                 $output .= '<div class="col-sm-1 add_clause">';
3557                                                $output .= '<a class="nf_button aa_bg_main_btn add_new_where_clause2"><i class="fa fa-filter"></i> Add filter </a>';
3558                                               
3559                                               
3560                                                $output .= '<a class="nf_button aa_bg_main_btn run_query_2 run_query" id="'.sanitize_text_field($_POST['form_Id']).'"><i class="fa fa-file-import"></i> Run Query </a>';
3561                                                       
3562                                         $output .= '</div>';
3563                               
3564                                $output .= '<div class="clause_container zero_padding">';
3565                               
3566                                foreach($_POST['additional_params'] as $key=>$val)
3567                                        {
3568                                               
3569                                        $output .= '<div class="new_clause">';
3570                                        $output .= '<div class="col-xs-4 zero_padding">';
3571                                                $output .= '<select class="post_ajax_select aa_bg_main_input form_control" name="column">
3572                                                                          <option value="">'.__('--- Select field ---','nex-forms').'</option>';
3573                                                                                foreach($header_array_filters as $key2=>$val2)
3574                                                                                        $output .= ' <option value="'.$key2.'" '.(($val['column']==$key2) ? 'selected="selected"' : '').'>'.$val2.'</option>';
3575                                                $output .= '</select>'; 
3576                                         $output .= '</div>';
3577                                         
3578                                         $output .= '<div class="col-xs-3">';
3579                                                $output .= '
3580                                                                        <select class="post_ajax_select aa_bg_main_input form_control" name="operator">
3581                                                                          <option value="="             '.(($val['operator']=='=')                      ? 'selected="selected"' : '').'>'.__('Equal to','nex-forms').'</option>
3582                                                                          <option value="<>"            '.(($val['operator']=='<>')             ? 'selected="selected"' : '').'>'.__('Not equal','nex-forms').'</option>
3583                                                                          <option value=">"             '.(($val['operator']=='>')                      ? 'selected="selected"' : '').'>'.__('Greater than','nex-forms').'</option>
3584                                                                          <option value="<"             '.(($val['operator']=='<')                      ? 'selected="selected"' : '').'>'.__('Less than','nex-forms').'</option>
3585                                                                          <option value="LIKE"          '.(($val['operator']=='LIKE')           ? 'selected="selected"' : '').'>'.__('Contains','nex-forms').'</option>
3586                                                                          <option value="NOT LIKE"      '.(($val['operator']=='NOT LIKE')       ? 'selected="selected"' : '').'>'.__('Does not contain','nex-forms').'</option>
3587                                                                          ';
3588                                                $output .= '</select>'; 
3589                                        $output .= '</div>';
3590                                       
3591                                        $output .= '<div class="col-xs-4 zero_padding">';
3592                                                $output .= '<input name="column_value" class="form-control aa_bg_main_input" placeholder="'.__('Value','nex-forms').'" value="'.$val['value'].'">';     
3593                                         $output .= '</div>';
3594                                         
3595                                         $output .= '<div class="col-xs-1 zero_padding">';
3596                                                $output .= '<a class="btn remove_where_clause">X</a>'; 
3597                                         $output .= '</div>';
3598                                $output .= '</div>';
3599                                               
3600                                        $set_additional_params[$val['column']] = $val['value'];
3601                                        }
3602                               
3603                                $output .= '</div>';
3604                               
3605                                $output .= '<div class="clause_replicator hidden">';
3606                                        $output .= '<div class="col col-xs-4 zero_padding">';
3607                                                $output .= '
3608                                                                        <select class="post_ajax_select form_control aa_bg_main_input" name="column">
3609                                                                          <option value="" selected="selected">'.__('--- Select field ---','nex-forms').'</option>';
3610                                                                                foreach($header_array_filters as $key=>$val)
3611                                                                                        $output .= ' <option value="'.$key.'">'.$val.'</option>';
3612                                                $output .= '</select>'; 
3613                                         $output .= '</div>';
3614                                         
3615                                         $output .= '<div class="col col-xs-3">';
3616                                                $output .= '
3617                                                                        <select class="post_ajax_select form_control aa_bg_main_input" name="operator">
3618                                                                          <option value="=">'.__('Equal to','nex-forms').'</option>
3619                                                                          <option value="<>">'.__('Not equal','nex-forms').'</option>
3620                                                                          <option value=">">'.__('Greater than','nex-forms').'</option>
3621                                                                          <option value="<">'.__('Less than','nex-forms').'</option>
3622                                                                          <option value="LIKE">'.__('Contains','nex-forms').'</option>
3623                                                                          <option value="NOT LIKE">'.__('Does not contain','nex-forms').'</option>
3624                                                                          ';
3625                                                $output .= '</select>'; 
3626                                        $output .= '</div>';
3627                                       
3628                                        $output .= '<div class="col col-xs-4 zero_padding">';
3629                                                $output .= '<input name="column_value" class="form-control aa_bg_main_input" placeholder="'.__('Value','nex-forms').'">';       
3630                                         $output .= '</div>';
3631                                         
3632                                         $output .= '<div class="col col-xs-1 zero_padding">';
3633                                                $output .= '<a class="btn remove_where_clause">X</a>'; 
3634                                         $output .= '</div>';
3635                                $output .= '</div>';
3636                               
3637                                $output .= '</div>';
3638                                //$output .= '<a class="btn run_query hidden" id="'.$_POST['form_Id'].'"><span class="fa fa-filter"></span> '.__('Run Report','nex-forms').'</a>';
3639                               
3640                                 
3641                                $output .= '</div>';
3642                                       
3643                                $output .= '</div>';
3644                        $output .= '</div>';
3645                        /*$output .= '<div class="right-mid">';
3646                                       
3647                                       
3648                                       
3649                                        $output .= '<div class="entry_tools aa_bg_main">';
3650                                               
3651                                                $output .= '<button type="submit" class="save_form_entry save_button button button-primary" style="display:none;">'.__('Save','nex-forms').'</button>';
3652                                                $output .= '<button class="cancel_save_form_entry save_button button button-primary" style="display:none;"><i class="fa fa-close"></i></button>';
3653                                               
3654                                               
3655                                                $output .= '<div class="entry_views">';
3656                                               
3657                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch  view_form_data active" data-action="view-data" disabled="disabled"><span class="fas fa-database"></span> '.__('Entry Data','nex-forms').'</button>';
3658                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-admin-email" disabled="disabled"><span class="fas fa-envelope"></span> '.__('View Admin Email','nex-forms').'</button>';
3659                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action no_batch" data-action="view-user-email" disabled="disabled"><span class="far fa-envelope"></span> '.__('View User Email','nex-forms').'</button>';
3660                                                $output .= '</div>';
3661                                       
3662                                                $output .= '<div class="entry_actions">';       
3663                                                        $output .= '<button class="print_to_pdf aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-file-pdf"></span> '.__('Export to PDF','nex-forms').'</button>';
3664                                                        //$output .= '<button class="button no_batch do_action" data-action="print-form-entry" disabled="disabled"><span class="fas fa-print"></span> '.__('Print','nex-forms').'</button>';
3665                                                        $output .= '<button id="" class="edit_form_entry aa_bg_main_btn no_batch nf_button" disabled="disabled"><span class="fas fa-pen-square"></span> '.__('Edit','nex-forms').'</button>';
3666                                                        $output .= '<button class="nf_button aa_bg_main_btn do_action" data-action="delete" disabled="disabled"><span class="fas fa-trash"></span> '.__('Delete','nex-forms').'</button>';
3667                                                $output .= '</div>';
3668                                               
3669                                        $output .= '</div>';
3670                                       
3671                                $output .= '</div>';*/
3672                       
3673                        $output .= '<div class="right-bottom">';
3674                        $output .= $report->print_record_table();
3675                                       
3676                                $output .= '</div>';
3677                        echo $output;
3678                        die();
3679                }
3680               
3681        public function print_to_pdf()
3682                {
3683                //if(!current_user_can( NF_USER_LEVEL ))       
3684                //              wp_die();
3685                if (function_exists('NEXForms_export_to_PDF'))
3686                        {
3687                        echo NEXForms_export_to_PDF(sanitize_text_field($_POST['form_entry_Id']), true, true);
3688                        }
3689                else
3690                        {
3691                        echo 'not installed';
3692                        die(); 
3693                        }
3694                }
3695       
3696        public function delete_pdf()
3697                {
3698               
3699                if ( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'nf_admin_dashboard_actions' ) ) {
3700                                wp_die();
3701                        }
3702                       
3703                if(!current_user_can( NF_USER_LEVEL )) 
3704                                wp_die();
3705               
3706                $upload_path = wp_upload_dir();
3707                $set_uploads_dir = $upload_path['path'];
3708               
3709                unlink($upload_path['baseurl'].$upload_path['subdir'].'/form_entry.pdf');
3710                unlink($set_uploads_dir.'/form_entry.pdf');
3711               
3712                unlink($upload_path['baseurl'].$upload_path['subdir'].'/submission_report.pdf');
3713                unlink($set_uploads_dir.'/submission_report.pdf');
3714               
3715                die(); 
3716                       
3717                }
3718       
3719       
3720        public function print_report_to_pdf()
3721                {
3722                if(!current_user_can( NF_USER_LEVEL )) 
3723                                wp_die();
3724                if (function_exists('NEXForms_report_to_PDF'))
3725                        {
3726                        echo NEXForms_report_to_PDF();
3727                        }
3728                else
3729                        {
3730                        echo 'not installed';
3731                        die(); 
3732                        }
3733                }
3734       
3735       
3736        public function email_setup(){
3737                $email_config = get_option('nex-forms-email-config');
3738                $output = '';   
3739                $theme = wp_get_theme();
3740                $output .= '<div class="dashboard-box global_settings">';
3741                        $output .= '<div class="dashboard-box-header aa_bg_main">';
3742                                $output .= '<div class="table_title"><i class="material-icons header-icon">drafts</i><span class="header_text ">'.__('Email Config','nex-forms').'</span></div>';
3743                        $output .= '</div>';
3744                       
3745                        $output .= '<div  class="dashboard-box-content">';
3746                                $output .= '<form name="email_config" id="email_config" action="'.admin_url('admin-ajax.php').'" method="post">         
3747                                                       
3748                                                               
3749                                                                        <div class="row">
3750                                                                                <div class="col-sm-4">'.__('Email Format','nex-forms').'</div>
3751                                                                                <div class="col-sm-8">
3752                                                                                        <input type="radio" '.(($email_config['email_content']=='html' || !$email_config['email_content']) ?    'checked="checked"' : '').' name="email_content" value="html"   id="html" class="with-gap"><label for="html">HTML</label>
3753                                                                                        <input type="radio" '.(($email_config['email_content']=='pt') ?         'checked="checked"' : '').' name="email_content" value="pt"     id="pt" class="with-gap"><label for="pt">Plain Text</label>
3754                                                                                </div>
3755                                                                        </div>
3756                                                                       
3757                                                                        <div class="row">
3758                                                                                <div class="col-sm-4">'.__('Mailing Method','nex-forms').'</div>
3759                                                                                <div class="col-sm-8">
3760                                                                                        <input type="radio" '.((!$email_config['email_method'] || $email_config['email_method']=='php_mailer') ?        'checked="checked"' : '').' name="email_method" value="php_mailer"      id="php_mailer" class="with-gap"><label for="php_mailer">PHP Mailer</label><br />
3761                                                                                        <input type="radio" '.(($email_config['email_method']=='wp_mailer' || $email_config['email_method']=='api') ?   'checked="checked"' : '').' name="email_method" value="wp_mailer"       id="wp_mailer"  class="with-gap"><label for="wp_mailer">WP Mail</label><br />
3762                                                                                        <input type="radio" '.(($email_config['email_method']=='php') ?                 'checked="checked"' : '').' name="email_method" value="php"             id="php"                class="with-gap"><label for="php">Normal PHP</label><br />
3763                                                                                        <input type="radio" '.(($email_config['email_method']=='smtp') ?                'checked="checked"' : '').' name="email_method" value="smtp"            id="smtp"               class="with-gap"><label for="smtp">SMTP</label><br />
3764                                                                                       
3765                                                                                </div>
3766                                                                        </div>
3767                                                                       
3768                                                                        <div class="smtp_settings" '.(($email_config['email_method']!='smtp') ?                 'style="display:none;"' : '').'>
3769                                                                                <h5>'.__('SMTP Setup','nex-forms').'</h5>
3770                                                                                <div class="row">
3771                                                                                        <div class="col-sm-4">'.__('Host','nex-forms').'</div>
3772                                                                                        <div class="col-sm-8">
3773                                                                                                <input class="form-control" type="text" name="smtp_host" placeholder="'.__('eg: mail.gmail.com','nex-forms').'" value="'.$email_config['smtp_host'].'">
3774                                                                                        </div>
3775                                                                                </div>
3776                                                                               
3777                                                                                <div class="row">
3778                                                                                        <div class="col-sm-4">'.__('Port','nex-forms').'</div>
3779                                                                                        <div class="col-sm-8">
3780                                                                                                <input class="form-control" type="text" name="mail_port" placeholder="'.__('likely to be 25, 465 or 587','nex-forms').'" value="'.$email_config['mail_port'].'">
3781                                                                                        </div>
3782                                                                                </div>
3783                                                                               
3784                                                                                <div class="row">
3785                                                                                        <div class="col-sm-4">'.__('Security','nex-forms').'</div>
3786                                                                                        <div class="col-sm-8">
3787                                                                                                <input type="radio" '.(($email_config['email_smtp_secure']=='0' || !$email_config['email_smtp_secure']) ?       'checked="checked"' : '').' name="email_smtp_secure" value="0" id="none" class="with-gap"><label for="none">'.__('None','nex-forms').'</label>
3788                                                                                                <input type="radio" '.(($email_config['email_smtp_secure']=='ssl') ?    'checked="checked"' : '').'  name="email_smtp_secure" value="ssl" id="ssl" class="with-gap"><label for="ssl">SSL</label>
3789                                                                                                <input type="radio" '.(($email_config['email_smtp_secure']=='tls') ?    'checked="checked"' : '').'  name="email_smtp_secure" value="tls" id="tls" class="with-gap"><label for="tls">TLS</label>
3790                                                                                        </div>
3791                                                                                </div>
3792                                                                               
3793                                                                                <div class="row">
3794                                                                                        <div class="col-sm-4">'.__('Authentication','nex-forms').'</div>
3795                                                                                        <div class="col-sm-8">
3796                                                                                                <input type="radio" '.(($email_config['smtp_auth']=='1') ?      'checked="checked"' : '').'  name="smtp_auth" value="1"                 id="auth_yes"           class="with-gap"><label for="auth_yes">Use Authentication</label>
3797                                                                                                <input type="radio" '.(($email_config['smtp_auth']=='0') ?      'checked="checked"' : '').'  name="smtp_auth" value="0"                 id="auth_no"            class="with-gap"><label for="auth_no">No Authentication</label>
3798                                                                                        </div>
3799                                                                                </div>
3800                                                                               
3801                                                                        </div>
3802                                                                       
3803                                                                        <div class="smtp_auth_settings" '.(($email_config['email_method']!='smtp' || $email_config['smtp_auth']!='1') ?                 'style="display:none;"' : '').'>
3804                                                                                <h5>'.__('SMTP Authentication','nex-forms').'</h5>
3805                                                                                <div class="row">
3806                                                                                        <div class="col-sm-4">'.__('Username','nex-forms').'</div>
3807                                                                                        <div class="col-sm-8">
3808                                                                                                <input class="form-control" type="text" name="set_smtp_user" value="'.$email_config['set_smtp_user'].'">
3809                                                                                        </div>
3810                                                                                </div>
3811                                                                                <div class="row">
3812                                                                                        <div class="col-sm-4">'.__('Password','nex-forms').'</div>
3813                                                                                        <div class="col-sm-8">
3814                                                                                                <input class="form-control" type="password" name="set_smtp_pass" value="'.$email_config['set_smtp_pass'].'">
3815                                                                                        </div>
3816                                                                                </div>
3817                                                                        </div>
3818                                                                       
3819                                                                       
3820                                                                                <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save Email Setup','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
3821                                                                                <div style="clear:both;"></div>
3822                                                                       
3823                                                                       
3824                                                                               
3825                                                               
3826                                        </form></div>';
3827                       
3828                $output .= '<div class="dashboard-box-footer">
3829                                                                                        <input type="text" class="form-control" name="test_email_address" value="" placeholder="'.__('Enter Email Address','nex-forms').'">
3830                                                                               
3831                                                                                        <div class="btn blue waves-effect waves-light send_test_email full_width">'.__('Send Test Email','nex-forms').'</div>
3832                                                                                        <div style="clear:both"></div>
3833                                                                                </div></div>';
3834                return $output;
3835        }
3836       
3837       
3838        public function email_subscriptions_setup(){
3839               
3840                $output = '';
3841                        $output .= '<div class="dashboard-box global_settings ">';
3842                                                        $output .= '<div class="dashboard-box-header aa_bg_main">';
3843                                                                $output .= '<div class="table_title"><i class="material-icons header-icon contact_mail">contact_mail</i><span class="header_text ">'.__('Email Subscriptions Setup','nex-forms').'</span></div>';
3844                                                                $output .= '
3845                                                                <nav class="nav-extended dashboard_nav dashboard-box-nav">
3846                                                                        <div class="nav-content aa_bg_sec">
3847                                                                          <ul class="tabs_nf tabs_nf-transparent sec-menu aa_menu">
3848                                                                                <li class="tab"><a class="active" href="#mail_chimp">'.__('MailChimp','nex-forms').'</a></li>
3849                                                                                <li class="tab"><a href="#get_response">'.__('GetResponse','nex-forms').'</a></li>
3850                                                                          </ul>
3851                                                                        </div>
3852                                                                 </nav>';
3853                                                        $output .= '</div>';
3854                                                       
3855                                                        $output .= '<div  class="dashboard-box-content">';
3856                                                                $output .= '<div id="mail_chimp">';
3857                                                                        $output .= $this->print_mailchimp_setup();
3858                                                                $output .= '</div>';
3859                                                               
3860                                                                $output .= '<div id="get_response" style="display:none;">';
3861                                                                        $output .= $this->print_getresponse_setup();
3862                                                                $output .= '</div>';
3863                                                               
3864                                                        $output .= '</div>';
3865                                                $output .= '</div>';
3866                return $output;
3867        }
3868       
3869        public function print_mailchimp_setup(){
3870               
3871                $output = '';   
3872                $theme = wp_get_theme();
3873                $output .= '
3874                                <form name="mail_chimp_setup" id="mail_chimp_setup" action="'.admin_url('admin-ajax.php').'" method="post">
3875                                        <div class="row">
3876                                                <div class="col-sm-4">'.__('Mailchimp API key','nex-forms').'</div>
3877                                                <div class="col-sm-8">
3878                                                        <input class="form-control" type="text" name="mc_api" value="'.(($theme->Name=='NEX-Forms Demo') ? '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;' : get_option('nex_forms_mailchimp_api_key')).'" id="mc_api" placeholder="Enter your Mailchimp API key">
3879                                                </div>
3880                                        </div>
3881                                        <div class="alert alert-info">
3882                                                '.__('<strong>How to get your Mailchimp API key:</strong>
3883                                                <ol>
3884                                                        <li>Login to your Mailchimp account: <a href="http://mailchimp.com/" target="_blank">mailchimp.com</a></li>
3885                                                        <li>Click on your profile picture (top right of the screen)</li>
3886                                                        <li>From the dropdown Click on Account</li>
3887                                                        <li>Click on Extras->API Keys</li>
3888                                                        <li>Copy your API key, or create a new one</li>
3889                                                        <li>Paste your API key in the above field.</li>
3890                                                        <li>Save</li>
3891                                                </ol>','nex-forms').'
3892                                        </div>
3893                                       
3894                                       
3895                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save MailChimp API','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
3896                                        <div style="clear:both"></div>
3897                                </form>
3898                                        ';
3899               
3900               
3901                return $output;
3902        }
3903       
3904        public function print_getresponse_setup(){
3905               
3906                $output = '';   
3907                $theme = wp_get_theme();
3908                $output .= '
3909                                <form name="get_response_setup" id="get_response_setup" action="'.admin_url('admin-ajax.php').'" method="post">
3910                                        <div class="row">
3911                                                <div class="col-sm-4">'.__('GetResponse API key','nex-forms').'</div>
3912                                                <div class="col-sm-8">
3913                                                        <input class="form-control" type="text" name="gr_api" value="'.(($theme->Name=='NEX-Forms Demo') ? '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;' : get_option('nex_forms_get_response_api_key')).'" id="gr_api" placeholder="Enter your GetResponse API key">
3914                                                </div>
3915                                        </div>
3916                                        <div class="alert alert-info">
3917                                                '.__('<strong>How to get your GetReponse API key:</strong>
3918                                                <ol>
3919                                                        <li>Login to your GetResponse account: <a href="https://app.getresponse.com/" target="_blank">GetResponse</a></li>
3920                                                        <li>Hover over your profile picture (top right of the screen)</li>
3921                                                        <li>From the dropdown Click on Integrations</li>
3922                                                        <li>Click on API &amp; OAuth</li>
3923                                                        <li>Copy your API key, or create a new one</li>
3924                                                        <li>Paste your API key in the above field.</li>
3925                                                        <li>Save</li>
3926                                                </ol>','nex-forms').'
3927                                        </div>
3928                                       
3929                                       
3930                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save GetResponse API','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
3931                                        <div style="clear:both"></div>
3932                                </form>
3933                                        ';
3934               
3935                return $output;
3936        }
3937       
3938       
3939       
3940        public function wp_admin_options(){
3941                $other_config = get_option('nex-forms-other-config');
3942               
3943               
3944                $user_config = get_user_option('nex-forms-user-config',get_current_user_id());
3945               
3946                $theme = wp_get_theme();
3947                $output = '';   
3948                $output .= '<div class="dashboard-box global_settings">';
3949                        $output .= '<div class="dashboard-box-header aa_bg_main">';
3950                                $output .= '<div class="table_title"><i class="material-icons header-icon">accessibility</i><span class="header_text ">'.__('WP Admin Accessibility Options','nex-forms').'</span></div>';
3951                        $output .= '</div>';
3952                       
3953                        $output .= '<div  class="dashboard-box-content">';
3954                        if($theme->Name!='NEX-Forms Demo')
3955                                $output .= '<form name="other_config" id="other_config" action="'.admin_url('admin-ajax.php').'" method="post">';
3956                                                       
3957                                                               
3958                                $output .= '    <div class="row">
3959                                                                        <div class="col-sm-6">'.__('NEX-Forms User Level','nex-forms').'</div>
3960                                                                        <div class="col-sm-6">
3961                                                                               
3962                                                                                <select name="set-wp-user-level" id="set-wp-user-level" class="material_select_1 form-control" style="display:block !important;">
3963                                                                                        <option '.(($other_config['set-wp-user-level']=='subscriber') ?         'selected="selected"' : '').'  value="subscriber">'.__('Subscriber','nex-forms').'</option>
3964                                                                                        <option '.(($other_config['set-wp-user-level']=='contributor') ?        'selected="selected"' : '').' value="contributor">'.__('Contributor','nex-forms').'</option>
3965                                                                                        <option '.(($other_config['set-wp-user-level']=='author') ?     'selected="selected"' : '').' value="author">'.__('Author','nex-forms').'</option>
3966                                                                                        <option '.(($other_config['set-wp-user-level']=='editor') ?     'selected="selected"' : '').' value="editor">'.__('Editor','nex-forms').'</option>
3967                                                                                        <option '.(($other_config['set-wp-user-level']=='administrator' || !$other_config['set-wp-user-level']) ?       'selected="selected"' : '').' value="administrator">'.__('Administrator','nex-forms').'</option>                       
3968                                                                                </select>
3969                                                                               
3970                                                                        </div>
3971                                                                </div>
3972                                                                       
3973                                                                <div class="row">
3974                                                                        <div class="col-sm-6">'.__('Admin Color Scheme','nex-forms').'</div>
3975                                                                        <div class="col-sm-6">
3976                                                                               
3977                                                                               
3978                                                                                <input type="radio" class="with-gap" name="enable-color-adapt" id="enable-color-adapt-light" value="2" '.(($user_config['enable-color-adapt']=='2' ) ?  'checked="checked"' : '').'>
3979                                                                                <label for="enable-color-adapt-light">'.__('NEX-Forms Light','nex-forms').'</label><br />
3980                                                                               
3981                                                                               
3982                                                                                <input type="radio" class="with-gap" name="enable-color-adapt" id="enable-color-adapt-dark" value="3" '.(($user_config['enable-color-adapt']=='3' ) ? 'checked="checked"' : '').'>
3983                                                                                <label for="enable-color-adapt-dark">'.__('NEX-Forms Dark','nex-forms').'</label><br />
3984                                                                               
3985                                                                                <input type="radio" class="with-gap" name="enable-color-adapt" id="enable-color-adapt-wp-admin" value="1" '.(($user_config['enable-color-adapt']=='1' || !$user_config['enable-color-adapt']) ? 'checked="checked"' : '').'>
3986                                                                                <label for="enable-color-adapt-wp-admin">'.__('WP Admin Color Scheme Adapt','nex-forms').'</label>
3987                                                                               
3988                                                                       
3989                                                                       
3990                                                                        </div>
3991                                                                </div>
3992                                                               
3993                                                               
3994                                                               
3995                                                                <div class="row">
3996                                                                        <div class="col-sm-6">'.__('Enable NEX-Forms TinyMCE Button','nex-forms').'</div>
3997                                                                        <div class="col-sm-6">
3998                                                                               
3999                                                                               
4000                                                                               
4001                                                                               
4002                                                                                <input type="radio" class="with-gap" name="enable-tinymce" id="enable-tinymce01" value="1" '.(($other_config['enable-tinymce']=='1' || !$other_config['enable-tinymce']) ?      'checked="checked"' : '').'>
4003                                                                                <label for="enable-tinymce01">'.__('Yes','nex-forms').'</label>
4004                                                                               
4005                                                                               
4006                                                                                <input type="radio" class="with-gap" name="enable-tinymce" id="enable-tinymce02" value="0" '.(($other_config['enable-tinymce']=='0' ) ? 'checked="checked"' : '').'>
4007                                                                                <label for="enable-tinymce02">'.__('No','nex-forms').'</label>
4008                                                                               
4009                                                                               
4010                                                                               
4011                                                                               
4012                                                                               
4013                                                                               
4014                                                                               
4015                                                                        </div>
4016                                                                </div>
4017                                                               
4018                                                                <div class="row">
4019                                                                        <div class="col-sm-6">'.__('Enable NEX-Forms Widget','nex-forms').'</div>
4020                                                                        <div class="col-sm-6">
4021                                                                               
4022                                                                               
4023                                                                               
4024                                                                                <input type="radio" class="with-gap" name="enable-widget" id="enable-widget01" value="1" '.(($other_config['enable-widget']=='1' || !$other_config['enable-widget']) ?  'checked="checked"' : '').'>
4025                                                                                <label for="enable-widget01">'.__('Yes','nex-forms').'</label>
4026                                                                               
4027                                                                               
4028                                                                                <input type="radio" class="with-gap" name="enable-widget" id="enable-widget02" value="0" '.(($other_config['enable-widget']=='0' ) ? 'checked="checked"' : '').'>
4029                                                                                <label for="enable-widget02">'.__('No','nex-forms').'</label>
4030                                                                               
4031                                                                               
4032                                                                               
4033                                                                               
4034                                                                               
4035                                                                               
4036                                                                        </div>
4037                                                                </div>
4038                                               
4039                                               
4040                                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save WP Admin Options','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4041                                                        <div style="clear:both;"></div>';
4042                                               
4043                                                                       
4044                                                                               
4045                                        if($theme->Name!='NEX-Forms Demo')                     
4046                                                $output .= '</form>';
4047                                       
4048                                        $output .= '</div>';
4049                                       
4050                        $output .= '</div>';
4051                return $output;
4052        }
4053       
4054       
4055       
4056        public function troubleshooting_options(){
4057               
4058                $output = '';   
4059                        $output .= '<div class="dashboard-box global_settings ">';
4060                                                        $output .= '<div class="dashboard-box-header aa_bg_main">';
4061                                                                $output .= '<div class="table_title"><i class="material-icons header-icon contact_mail">report_problem</i><span class="header_text ">'.__('Troubleshooting Options','nex-forms').'</span></div>';
4062                                                                $output .= '
4063                                                                <nav class="nav-extended dashboard_nav dashboard-box-nav">
4064                                                                        <div class="nav-content aa_bg_sec">
4065                                                                          <ul class="tabs_nf tabs_nf-transparent sec-menu aa_menu">
4066                                                                                <li class="tab"><a class="active" href="#js_inc">'.__('Javascript Includes','nex-forms').'</a></li>
4067                                                                                <li class="tab"><a href="#css_inc">'.__('Stylesheet Includes','nex-forms').'</a></li>
4068                                                                          </ul>
4069                                                                        </div>
4070                                                                 </nav>';
4071                                                        $output .= '</div>';
4072                                                       
4073                                                        $output .= '<div  class="dashboard-box-content">';
4074                                                                $output .= '<div id="js_inc" >';
4075                                                                        $output .= $this->print_js_inc();
4076                                                                $output .= '</div>';
4077                                                               
4078                                                                $output .= '<div id="css_inc" style="display:none;">';
4079                                                                        $output .= $this->print_css_inc();
4080                                                                $output .= '</div>';
4081                                                               
4082                                                        $output .= '</div>';
4083                                                $output .= '</div>';
4084                return $output;
4085        }
4086       
4087        public function print_js_inc(){
4088                $script_config = get_option('nex-forms-script-config');
4089                $theme = wp_get_theme();
4090                $output = '';
4091                $output .= '
4092                                <form name="script_config" id="script_config" action="'.admin_url('admin-ajax.php').'" method="post">
4093                                       
4094                                       
4095                                        <div class="alert alert-info">'.__('Please leave these includes if you are not a developer with the proper know-how!','nex-forms').'</div>
4096                                       
4097                                        <div class="row">
4098                                                                                        <div class="col-sm-4">'.__('WP Core javascript','nex-forms').'</div>
4099                                                                                        <div class="col-sm-8">
4100                                                                                                <input type="checkbox" '.(($script_config['inc-jquery']=='1') ?         'checked="checked"' : '').' name="inc-jquery" value="1"         id="inc-jquery" ><label for="inc-jquery">jQuery </label><br />
4101                                                                                                <input type="checkbox" '.(($script_config['inc-jquery-ui-core']=='1') ?         'checked="checked"' : '').' name="inc-jquery-ui-core" value="1"         id="inc-jquery-ui-core" ><label for="inc-jquery-ui-core">jQuery UI Core</label><br />
4102                                                                                                <input type="checkbox" '.(($script_config['inc-jquery-ui-autocomplete']=='1') ?         'checked="checked"' : '').' name="inc-jquery-ui-autocomplete" value="1"         id="inc-jquery-ui-autocomplete" ><label for="inc-jquery-ui-autocomplete">jQuery UI Autocomplete</label><br />
4103                                                                                                <input type="checkbox" '.(($script_config['inc-jquery-ui-slider']=='1') ?       'checked="checked"' : '').' name="inc-jquery-ui-slider" value="1"       id="inc-jquery-ui-slider"       ><label for="inc-jquery-ui-slider">jQuery UI Slider</label><br />
4104                                                                                                <input type="checkbox" '.(($script_config['inc-jquery-form']=='1') ?    'checked="checked"' : '').' name="inc-jquery-form" value="1"    id="inc-jquery-form"    ><label for="inc-jquery-form">jQuery Form</label><br />
4105                                                                                        </div>
4106                                                                                        </div>
4107                                                                                       
4108                                                                                        <div class="row">
4109                                                                                                <div class="col-sm-4">'.__('Extras','nex-forms').'</div>
4110                                                                                                <div class="col-sm-8">
4111                                                                                                        <!--<input type="checkbox" '.(($script_config['inc-datetime']=='1') ?   'checked="checked"' : '').' name="inc-datetime" value="1"       id="inc-datetime"       ><label for="inc-datetime">Datepicker </label><br />
4112                                                                                                        <input type="checkbox" '.(($script_config['inc-moment']=='1') ?         'checked="checked"' : '').' name="inc-moment" value="1"         id="inc-moment" ><label for="inc-moment">Moment </label><br />
4113                                                                                                        <input type="checkbox" '.(($script_config['inc-locals']=='1') ?         'checked="checked"' : '').' name="inc-locals" value="1"         id="inc-locals" ><label for="inc-locals">Locals </label><br />
4114                                                                                                       
4115                                                                                                        <input type="checkbox" checked="checked" disabled="disabled" name="inc-math" value="1"  id="inc-math"   ><label for="inc-math">Math </label><br />
4116                                                                                                        <input type="checkbox" '.(($script_config['inc-colorpick']=='1') ?      'checked="checked"' : '').' name="inc-colorpick" value="1"      id="inc-colorpick"      ><label for="inc-colorpick">Colorpicker Field </label><br />-->
4117                                                                                                        <input type="checkbox" '.(($script_config['inc-wow']=='1') ?    'checked="checked"' : '').' name="inc-wow" value="1"    id="inc-wow"    ><label for="inc-wow">Animations </label><br />
4118                                                                                                        <!--<input type="checkbox" '.(($script_config['inc-raty']=='1') ?       'checked="checked"' : '').' name="inc-raty" value="1"   id="inc-raty"   ><label for="inc-raty">Raty Form </label><br />
4119                                                                                                        <input type="checkbox" '.(($script_config['inc-sig']=='1') ?    'checked="checked"' : '').' name="inc-sig" value="1"    id="inc-sig"    ><label for="inc-sig">Digital Signature </label><br />-->
4120                                                                                               
4121                                                                                                </div>
4122                                                                                        </div>
4123                                                                                       
4124                                                                                        <div class="row">
4125                                                                                                <div class="col-sm-4">'.__('Plugin Dependent Javascript','nex-forms').'</div>
4126                                                                                                <div class="col-sm-8">
4127                                                                                                        <input type="checkbox" '.(($script_config['inc-bootstrap']=='1') ?      'checked="checked"' : '').' name="inc-bootstrap" value="1"      id="inc-bootstrap"      ><label for="inc-bootstrap">Bootstrap </label><br />
4128                                                                                                        <input type="checkbox" '.(($script_config['inc-onload']=='1') ?         'checked="checked"' : '').' name="inc-onload" value="1"         id="inc-onload" ><label for="inc-onload">Onload Functions </label><br />
4129                                                                                                </div>
4130                                                                                        </div>
4131                                                                                       
4132                                                                                       
4133                                                                                        <!--<div class="row">
4134                                                                                                <div class="col-sm-4">'.__('Print Scripts','nex-forms').'</div>
4135                                                                                                <div class="col-sm-8">
4136                                                                                                        <input type="checkbox" '.(($script_config['enable-print-scripts']=='' || $script_config['enable-print-scripts']=='1') ?         'checked="checked"' : '').'  name="enable-print-scripts" value="1"              id="enable-print-scripts"><label  for="enable-print-scripts"><strong> Use wp_print_scripts()</strong> </label>
4137                                                                                                </div>
4138                                                                                        </div>-->
4139                                       
4140                                       
4141                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save JS Inclusions','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4142                                        <div style="clear:both"></div>
4143                                </form>
4144                                        ';
4145               
4146                return $output;
4147        }
4148       
4149        public function print_css_inc(){
4150                $styles_config = get_option('nex-forms-style-config');
4151                $output = '';
4152                $theme = wp_get_theme();
4153                $output .= '
4154                                <form name="style_config" id="style_config" action="'.admin_url('admin-ajax.php').'" method="post">
4155                                       
4156                                        <div class="alert alert-info">'.__('Please leave these includes if you are not a developer who knows what you are doing!','nex-forms').'</div>
4157                                       
4158                                        <div class="row">
4159                                                <div class="col-sm-4">'.__('WP Core stylesheets','nex-forms').'</div>
4160                                                <div class="col-sm-8">
4161                                                        <input type="checkbox" '.(($styles_config['incstyle-jquery']=='1') ?    'checked="checked"' : '').' name="incstyle-jquery" value="1"    id="incstyle-jquery"    > <label for="incstyle-jquery-ui">jQuery UI</label>     
4162                                                </div>
4163                                        </div>
4164                                       
4165                                        <div class="row">
4166                                                <div class="col-sm-4">'.__('Other stylesheets','nex-forms').'</div>
4167                                                <div class="col-sm-8">
4168                                                        <input type="checkbox" '.(($styles_config['incstyle-bootstrap']=='1' || !array_key_exists('incstyle-bootstrap',$styles_config)) ?       'checked="checked"' : '').' name="incstyle-bootstrap" value="1"         id="incstyle-bootstrap" ><label for="incstyle-bootstrap">Bootstrap</label><br />
4169                                                        <input type="checkbox" '.(($styles_config['incstyle-font-awesome']=='1' || !array_key_exists('incstyle-font-awesome',$styles_config)) ?         'checked="checked"' : '').' name="incstyle-font-awesome" value="1"      id="incstyle-font-awesome"      ><label for="incstyle-font-awesome">Font Awesome</label><br />
4170                                                        <input type="checkbox" '.(($styles_config['incstyle-font-awesome-v4-shims']=='1' || !array_key_exists('incstyle-font-awesome-v4-shims',$styles_config)) ?       'checked="checked"' : '').' name="incstyle-font-awesome-v4-shims" value="1"     id="incstyle-font-awesome-v4-shims"     ><label for="incstyle-font-awesome-v4-shims">Font Awesome v4 Shims</label><br />
4171                                                        <input type="checkbox" '.(($styles_config['incstyle-animations']=='1' || !array_key_exists('incstyle-animations',$styles_config)) ?     'checked="checked"' : '').' name="incstyle-animations" value="1"        id="incstyle-animations"        ><label for="incstyle-animations">Animations</label><br />
4172                                                       
4173                                                        <input type="checkbox" '.(($styles_config['incstyle-custom']=='1') ?    'checked="checked"' : '').' name="incstyle-custom" value="1"    id="incstyle-custom"    ><label for="incstyle-custom">Custom NEX-Forms CSS</label>
4174                                                </div>
4175                                        </div>
4176                                       
4177                                        <!--<div class="row">
4178                                                <div class="col-sm-4">'.__('Print Styles','nex-forms').'</div>
4179                                                <div class="col-sm-8">
4180                                                        <input type="checkbox" '.(($styles_config['enable-print-styles']=='' || $styles_config['enable-print-styles']=='1') ?   'checked="checked"' : '').'  name="enable-print-styles" value="1"               id="enable-print-styles"                ><label  for="enable-print-styles"><strong> Use wp_print_styles()</strong></label>
4181                                                </div>
4182                                        </div>-->
4183                                       
4184                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save CSS Inclusions','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4185                                        <div style="clear:both"></div>
4186                                </form>
4187                                        ';
4188               
4189                return $output;
4190        }
4191       
4192
4193        public function license_setup($args='', $client_info=''){
4194               
4195               
4196               
4197                if(!$args)
4198                        {
4199                        $api_params2 = array( 'check_key' => 1,'ins_data'=>get_option('7103891'));
4200                        $response2 = wp_remote_post( 'https://basixonline.net/activate-license-new-api-v3', array('timeout'   => 30,'sslverify' => false,'body'  => $api_params2) );
4201                        if(is_array($response2->errors))
4202                                {
4203                                foreach($response2->errors as $error_type => $error)
4204                                        {
4205                                        echo '<br /><br /><div class="alert alert-danger"><strong>WP ERROR: </strong>'.strtoupper($error_type).' - '.$error[0].'<br />NEX-Forms can not verify your license as a result of this error. Please as your Hosting Provider to resolve this error. <a href="https://www.google.com/search?q='.$error[0].'" target="_blank">Here are some helpfull articles for your Host</a> </div><br /><br />&nbsp;';
4206                                        }       
4207                                }
4208                        $checked = false;
4209                        }
4210                else
4211                        $checked = $args;
4212               
4213                $output = '';
4214                $output .= '<div class="dashboard-box global_settings">';
4215                        $output .= '<div class="dashboard-box-header aa_bg_main">';
4216                                $output .= '<div class="table_title"><i class="material-icons header-icon">verified_user</i>'.__('NEX-Forms Registration Info','nex-forms').'</div>';
4217                                $output .= '<p class="box-info"><strong>Status:</strong> '.(($checked=='true') ? '<span class="label label-success">'.__('Registered','nex-forms').'</span>' : '<span class="label label-danger">'.__('Not Registered','nex-forms').'</span>').'</p>';
4218                        $output .= '</div>';
4219                       
4220                        $output .= '<div  class="dashboard-box-content activation_box">';
4221                       
4222                        if($checked=='true')
4223                                {       
4224                                $theme = wp_get_theme();
4225                                if($theme->Name=='NEX-Forms Demo')
4226                                        {
4227                                        $output .= '<div class="row">';
4228                                                $output .= '<div class="col-sm-5">';
4229                                                        $output .= '<strong>'.__('Purchase Code','nex-forms').'</strong>';
4230                                                $output .= '</div>';
4231                                                $output .= '<div class="col-sm-7">';
4232                                                        $output .= '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;';
4233                                                        $output .= '</div>';
4234                                        $output .= '</div>';
4235                                        $output .= '<div class="row">';
4236                                                $output .= '<div class="col-sm-5">';
4237                                                        $output .= '<strong>'.__('Envato Username','nex-forms').'</strong>';
4238                                                $output .= '</div>';
4239                                                $output .= '<div class="col-sm-7">';
4240                                                        $output .= 'Basix';
4241                                                $output .= '</div>';
4242                                        $output .= '</div>';
4243                                        $output .= '<div class="row">';
4244                                                $output .= '<div class="col-sm-5">';
4245                                                        $output .= '<strong>'.__('License Type','nex-forms').'</strong>';
4246                                                $output .= '</div>';
4247                                                $output .= '<div class="col-sm-7">';
4248                                                        $output .= 'Regular';
4249                                                $output .= '</div>';
4250                                        $output .= '</div>';
4251                                        $output .= '<div class="row">';
4252                                                $output .= '<div class="col-sm-5">';
4253                                                        $output .= '<strong>'.__('Activated on','nex-forms').'</strong>';
4254                                                $output .= '</div>';
4255                                                $output .= '<div class="col-sm-7">';
4256                                                        $output .= 'Demo Site';
4257                                                $output .= '</div>';
4258                                        $output .= '</div>';
4259                                       
4260                                        $output .= '<div class="row">';
4261                                                $output .= '<div class="col-sm-12">';
4262                                                        $output .= '
4263                                                        '.__('<div class="alert alert-info">Unregistering a Puchase Code will free up the above code to be re-used on another domain. <strong>NOTE:</strong> This will make the current active site\'s registration inactive!</div>
4264                                                        <button class="btn blue waves-effect waves-light" disabled="disabled">Unregister Puchase Code</button>','nex-forms').'';
4265                                                $output .= '</div>';
4266                                        $output .= '</div>';
4267                                        }
4268                                else
4269                                        {
4270                                        $output .= '<div class="row">';
4271                                                $output .= '<div class="col-sm-5">';
4272                                                        $output .= '<strong>'.__('Purchase Code','nex-forms').'</strong>';
4273                                                $output .= '</div>';
4274                                                $output .= '<div class="col-sm-7">';
4275                                                        if($client_info['purchase_code'])
4276                                                                $output .= $client_info['purchase_code'];
4277                                                        else
4278                                                                $output .= __('<strong>License not activated for this domain. Please refresh this page and enter your purchase code when prompted.</strong>','nex-forms');
4279                                                $output .= '</div>';
4280                                        $output .= '</div>';
4281                                        $output .= '<div class="row">';
4282                                                $output .= '<div class="col-sm-5">';
4283                                                        $output .= '<strong>'.__('Envato Username','nex-forms').'</strong>';
4284                                                $output .= '</div>';
4285                                                $output .= '<div class="col-sm-7">';
4286                                                        $output .= $client_info['envato_user_name'];
4287                                                $output .= '</div>';
4288                                        $output .= '</div>';
4289                                        $output .= '<div class="row">';
4290                                                $output .= '<div class="col-sm-5">';
4291                                                        $output .= '<strong>'.__('License Type','nex-forms').'</strong>';
4292                                                $output .= '</div>';
4293                                                $output .= '<div class="col-sm-7">';
4294                                                        $output .= $client_info['license_type'];
4295                                                $output .= '</div>';
4296                                        $output .= '</div>';
4297                                        $output .= '<div class="row">';
4298                                                $output .= '<div class="col-sm-5">';
4299                                                        $output .= '<strong>'.__('Activated on','nex-forms').'</strong>';
4300                                                $output .= '</div>';
4301                                                $output .= '<div class="col-sm-7">';
4302                                                        $output .= $client_info['for_site'];
4303                                                $output .= '</div>';
4304                                        $output .= '</div>';
4305                                       
4306                                        $output .= '<div class="row">';
4307                                                $output .= '<div class="col-sm-12">';
4308                                                        $output .= __('
4309                                                        <div class="alert alert-info">Unregistering a Puchase Code will free up the above code to be re-used on another domain. <strong>NOTE:</strong> This will make the current active site\'s registration inactive!</div>
4310                                                        <button class="btn blue waves-effect waves-light deactivate_license">Unregister Puchase Code</button>','nex-forms');
4311                                                $output .= '</div>';
4312                                        $output .= '</div>';
4313                                        }
4314                                }
4315                        else
4316                                {
4317                                $output .= __('
4318                                                                <div class="alert alert-info">NEX-Forms is not registered and as such some key features will be disabled. To <a href="http://codecanyon.net/item/nexforms-the-ultimate-wordpress-form-builder/7103891?license=regular&open_purchase_for_item_id=7103891&purchasable=source&ref=Basix" target="_blank">activate these features</a> you will need to <a href="http://codecanyon.net/item/nexforms-the-ultimate-wordpress-form-builder/7103891?license=regular&open_purchase_for_item_id=7103891&purchasable=source&ref=Basix" target="_blank"><strong>upgrade to the pro-version</strong></a></div>
4319                               
4320                                                          <input name="purchase_code" id="purchase_code" placeholder="Enter Item Purchase Code" class="form-control" type="text">
4321                                                          <br />
4322                                                          <div class="show_code_response">
4323                                                          <div class="alert alert-success">After your <a href="http://codecanyon.net/item/nexforms-the-ultimate-wordpress-form-builder/7103891?license=regular&open_purchase_for_item_id=7103891&purchasable=source&ref=Basix" target="_blank">purchase</a> you can find your purchase code from <a href="http://codecanyon.net/downloads" target="_blank"><strong>http://codecanyon.net/downloads</strong></a>. Click on Download next to NEX-Forms and then click on "License certificate &amp; purchase code" and copy that code into the above text field and hit Register.</div>
4324                                                          </div>
4325                                                   
4326                                                <button class="btn blue waves-effect waves-light deactivate_license hidden">Unregister Puchase Code</button>
4327                                                 <button class="btn blue waves-effect waves-light verify_purchase_code " type="button">Register</button>
4328                                                <div style="clear:both"></div>
4329                                                ','nex-forms');
4330                                }
4331                $output .= '</div>';   
4332        $output .= '</div>';   
4333                       
4334                return $output;
4335        }
4336       
4337        public function preferences(){
4338               
4339                $output = '';   
4340                $output .= '<div class="dashboard-box global_settings field_preferences">';
4341                                                        $output .= '<div class="dashboard-box-header aa_bg_main">';
4342                                                                $output .= '<div class="table_title"><i class="material-icons header-icon">favorite</i><span class="header_text ">'.__('Overall Preferences / Default presets','nex-forms').'</span></div>';
4343                                                                $output .= '
4344                                                                <nav class="nav-extended dashboard_nav dashboard-box-nav aa_bg_sec">
4345                                                                        <div class="nav-content aa_bg_sec">
4346                                                                          <ul class="tabs_nf tabs_nf-transparent sec-menu aa_menu">
4347                                                                          <li class="tab"><a class="active" href="#email_pref">'.__('Email Presets','nex-forms').'</a></li>
4348                                                                                <li class="tab field_prefs"><a  href="#field_pref">'.__('Field Presets','nex-forms').'</a></li>
4349                                                                                <li class="tab"><a href="#validation_pref">'.__('Validation Preset Massages','nex-forms').'</a></li>
4350                                                                               
4351                                                                                <li class="tab"><a href="#other_pref">'.__('Other','nex-forms').'</a></li>
4352                                                                          </ul>
4353                                                                        </div>
4354                                                                 </nav>';
4355                                                        $output .= '</div>';
4356                                                       
4357                                                        $output .= '<div  class="dashboard-box-content">';
4358                                                                //FIELD PREFERENCES
4359                                                               
4360                                                                $output .= '<div id="email_pref" >';
4361                                                                        $output .= $this->print_email_pref();
4362                                                                $output .= '</div>';
4363                                                               
4364                                                                $output .= '<div id="field_pref" style="display:none;">';
4365                                                                        $output .= $this->print_field_pref();
4366                                                                $output .= '</div>';
4367                                                               
4368                                                                $output .= '<div id="validation_pref" style="display:none;" >';
4369                                                                        $output .= $this->print_validation_pref();
4370                                                                $output .= '</div>';
4371                                                               
4372                                                               
4373                                                               
4374                                                                $output .= '<div id="other_pref" style="display:none;">';
4375                                                                        $output .= $this->print_other_pref();
4376                                                                $output .= '</div>';
4377                                                               
4378                                                        $output .= '</div>';
4379                                        $output .= '</div>';
4380                return $output;
4381                }
4382               
4383                public function print_field_pref(){
4384                        $preferences = get_option('nex-forms-preferences');
4385                        $theme = wp_get_theme();
4386                        $output = '';
4387                        $output .= '
4388                               
4389                                <form name="field-pref" id="field-pref" action="'.admin_url('admin-ajax.php').'" method="post">
4390                               
4391                                <br /><div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div>
4392                               
4393                                        <h5>Field Labels</h5>
4394                                                <div class="row">
4395                                                        <div class="col-sm-4">'.__('Label Position','nex-forms').'</div>
4396                                                        <div class="col-sm-8">
4397                                                               
4398                                                                <input type="radio" class="with-gap" name="pref_label_align" '.((!$preferences['field_preferences']['pref_label_align'] || $preferences['field_preferences']['pref_label_align']=='top') ? 'checked="checked"' : '').' id="pref_label_align_top" value="top">
4399                                                                <label for="pref_label_align_top">'.__('Top','nex-forms').'</label>
4400                                                               
4401                                                                <input type="radio" class="with-gap" name="pref_label_align" id="pref_label_align_left" value="left" '.(($preferences['field_preferences']['pref_label_align']=='left') ? 'checked="checked"' : '').'>
4402                                                                <label for="pref_label_align_left">'.__('Left','nex-forms').'</label>
4403                                                               
4404                                                                <input type="radio" class="with-gap" name="pref_label_align" id="pref_label_align_right" value="right" '.(($preferences['field_preferences']['pref_label_align']=='right') ? 'checked="checked"' : '').'>
4405                                                                <label for="pref_label_align_right">'.__('Right','nex-forms').'</label>
4406                                                               
4407                                                                <input type="radio" class="with-gap" name="pref_label_align" id="pref_label_align_hidden" value="hidden" '.(($preferences['field_preferences']['pref_label_align']=='hidden') ? 'checked="checked"' : '').'>
4408                                                                <label for="pref_label_align_hidden">'.__('Hidden','nex-forms').'</label>
4409                                                        </div>
4410                                                </div>
4411                                               
4412                                                <div class="row">
4413                                                        <div class="col-sm-4">Label Text Alignment</div>
4414                                                        <div class="col-sm-8">
4415                                                               
4416                                                               
4417                                                                <input type="radio" class="with-gap" name="pref_label_text_align" id="pref_label_text_align_left" value="align_left" '.((!$preferences['field_preferences']['pref_label_text_align'] || $preferences['field_preferences']['pref_label_text_align']=='align_left' || $preferences['field_preferences']['pref_label_text_align']=='align_let') ? 'checked="checked"' : '').'>
4418                                                                <label for="pref_label_text_align_left">'.__('Left','nex-forms').'</label>
4419                                                               
4420                                                                <input type="radio" class="with-gap" name="pref_label_text_align" id="pref_label_text_align_right" value="align_right" '.(($preferences['field_preferences']['pref_label_text_align']=='align_right') ? 'checked="checked"' : '').'>
4421                                                                <label for="pref_label_text_align_right">'.__('Right','nex-forms').'</label>
4422                                                               
4423                                                                <input type="radio" class="with-gap" name="pref_label_text_align" id="pref_label_text_align_center" value="align_center" '.(($preferences['field_preferences']['pref_label_text_align']=='align_center') ? 'checked="checked"' : '').'>
4424                                                                <label for="pref_label_text_align_center">'.__('Center','nex-forms').'</label>
4425                                                        </div>
4426                                                </div>
4427                                               
4428                                                <div class="row">
4429                                                        <div class="col-sm-4">Label Size</div>
4430                                                        <div class="col-sm-8">
4431                                                               
4432                                                                <input type="radio" class="with-gap" name="pref_label_size" id="pref_label_size_sm" value="text-sm" '.(($preferences['field_preferences']['pref_label_size']=='text-sm') ? 'checked="checked"' : '').'>
4433                                                                <label for="pref_label_size_sm">'.__('Small','nex-forms').'</label>
4434                                                               
4435                                                                <input type="radio" class="with-gap" name="pref_label_size" id="pref_label_size_normal" value="" '.((!$preferences['field_preferences']['pref_label_size'] || $preferences['field_preferences']['pref_label_size']=='') ? 'checked="checked"' : '').'>
4436                                                                <label for="pref_label_size_normal">'.__('Normal','nex-forms').'</label>
4437                                                               
4438                                                                <input type="radio" class="with-gap" name="pref_label_size"  id="pref_label_size_lg" value="text-lg" '.(($preferences['field_preferences']['pref_label_size']=='text-lg') ? 'checked="checked"' : '').'>
4439                                                                <label for="pref_label_size_lg">'.__('Large','nex-forms').'</label>
4440                                                        </div>
4441                                                </div>
4442                                               
4443                                                <div class="row">
4444
4445                                                        <div class="col-sm-4">Show Sublabel</div>
4446                                                        <div class="col-sm-8">
4447                                                               
4448                                                               
4449                                                               
4450                                                                <input type="radio" class="with-gap" name="pref_sub_label"  id="pref_sub_label_01" value="on" '.(($preferences['field_preferences']['pref_sub_label']=='on') ? 'checked="checked"' : '').'>
4451                                                                <label for="pref_sub_label_01">'.__('Yes','nex-forms').'</label>
4452                                                               
4453                                                               
4454                                                                <input type="radio" class="with-gap" name="pref_sub_label"  id="pref_sub_label_02" value="off" '.(($preferences['field_preferences']['pref_sub_label']=='off' || !$preferences['field_preferences']['pref_sub_label']) ? 'checked="checked"' : '').'>
4455                                                                <label for="pref_sub_label_02">'.__('No','nex-forms').'</label>
4456                                                               
4457                                                               
4458                                                        </div>
4459                                                </div>
4460                                               
4461                                               
4462                                               
4463                                                <h5>Field Inputs</h5>
4464
4465                                                <div class="row">
4466                                                        <div class="col-sm-4">'.__('Input Text Alignment','nex-forms').'</div>
4467                                                        <div class="col-sm-8">
4468                                                               
4469                                                               
4470                                                               
4471                                                                <input type="radio" class="with-gap" name="pref_input_text_align" id="pref_input_text_align_left" value="align_left" '.((!$preferences['field_preferences']['pref_input_text_align'] || $preferences['field_preferences']['pref_input_text_align']=='align_left' || $preferences['field_preferences']['pref_input_text_align']=='aling_left') ? 'checked="checked"' : '').'>
4472                                                                <label for="pref_input_text_align_left">'.__('Left','nex-forms').'</label>
4473                                                               
4474                                                                <input type="radio" class="with-gap" name="pref_input_text_align" id="pref_input_text_align_right" value="align_right" '.(($preferences['field_preferences']['pref_input_text_align']=='align_right') ? 'checked="checked"' : '').'>
4475                                                                <label for="pref_input_text_align_right">'.__('Right','nex-forms').'</label>
4476                                                               
4477                                                                <input type="radio" class="with-gap" name="pref_input_text_align" id="pref_input_text_align_center" value="align_center" '.(($preferences['field_preferences']['pref_input_text_align']=='align_center') ? 'checked="checked"' : '').'>
4478                                                                <label for="pref_input_text_align_center">'.__('Center','nex-forms').'</label>
4479                                                        </div>
4480                                                </div>
4481                                               
4482                                                <div class="row">
4483                                                        <div class="col-sm-4">'.__('Input Size','nex-forms').'</div>
4484                                                        <div class="col-sm-8">
4485                                                               
4486                                                                <input type="radio" class="with-gap" name="pref_input_size" id="pref_input_size_sm" value="input-sm" '.(($preferences['field_preferences']['pref_input_size']=='input-sm') ? 'checked="checked"' : '').'>
4487                                                                <label for="pref_input_size_sm">'.__('Small','nex-forms').'</label>
4488                                                               
4489                                                                <input type="radio" class="with-gap" name="pref_input_size" id="pref_input_size_normal" value="" '.((!$preferences['field_preferences']['pref_input_size'] || $preferences['field_preferences']['pref_input_size']=='') ? 'checked="checked"' : '').'>
4490                                                                <label for="pref_input_size_normal">'.__('Normal','nex-forms').'</label>
4491                                                               
4492                                                                <input type="radio" class="with-gap" name="pref_input_size"  id="pref_input_size_lg" value="input-lg" '.(($preferences['field_preferences']['pref_input_size']=='input-lg') ? 'checked="checked"' : '').'>
4493                                                                <label for="pref_input_size_lg">'.__('Large','nex-forms').'</label>
4494                                                        </div>
4495                                                </div>
4496                                               
4497                                                <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save Field Preferences','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4498                                                <div style="clear:both"></div>
4499                                        </form>
4500                                        ';
4501                return $output; 
4502                }
4503               
4504               
4505                public function print_validation_pref(){
4506                        $theme = wp_get_theme();
4507                        $preferences = get_option('nex-forms-preferences');
4508                        $output = '';
4509                        $output .= '
4510                                <form name="validation-pref" id="validation-pref" action="'.admin_url('admin-ajax.php').'" method="post">       
4511                                       
4512                                        <div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div>
4513                                       
4514                                        <div class="row">
4515                                                <div class="col-sm-4">'.__('Required Field','nex-forms').'</div>
4516                                                <div class="col-sm-8">
4517                                                        <input type="text" name="pref_requered_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_requered_msg']) ? $preferences['validation_preferences']['pref_requered_msg'] : 'Required').'">
4518                                                </div>
4519                                        </div>
4520                                       
4521                                        <div class="row">
4522                                                <div class="col-sm-4">'.__('Incorect Email','nex-forms').'</div>
4523                                                <div class="col-sm-8">
4524                                                        <input type="text" name="pref_email_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_email_format_msg']) ? $preferences['validation_preferences']['pref_email_format_msg'] : 'Invalid email address').'">
4525                                                </div>
4526                                        </div>
4527                                        <div class="row">
4528                                                <div class="col-sm-4">'.__('Incorect Phone Number','nex-forms').'</div>
4529                                                <div class="col-sm-8">
4530                                                        <input type="text" name="pref_phone_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_phone_format_msg']) ? $preferences['validation_preferences']['pref_phone_format_msg'] : 'Invalid phone number').'">
4531                                                </div>
4532                                        </div>
4533                                        <div class="row">
4534                                                <div class="col-sm-4">'.__('Incorect URL','nex-forms').'</div>
4535                                                <div class="col-sm-8">
4536                                                        <input type="text" name="pref_url_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_url_format_msg']) ? $preferences['validation_preferences']['pref_url_format_msg'] : 'Invalid URL').'">
4537                                                </div>
4538                                        </div>
4539                                       
4540                                        <div class="row">
4541                                                <div class="col-sm-4">'.__('Numerical','nex-forms').'</div>
4542                                                <div class="col-sm-8">
4543                                                        <input type="text" name="pref_numbers_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_numbers_format_msg']) ? $preferences['validation_preferences']['pref_numbers_format_msg'] : 'Only numbers are allowed').'">
4544                                                </div>
4545                                        </div>
4546                                       
4547                                        <div class="row">
4548                                                <div class="col-sm-4">'.__('Alphabetical','nex-forms').'</div>
4549                                                <div class="col-sm-8">
4550                                                        <input type="text" name="pref_char_format_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_char_format_msg']) ? $preferences['validation_preferences']['pref_char_format_msg'] : 'Only text are allowed').'">
4551                                                </div>
4552                                        </div>
4553                                       
4554                                        <div class="row">
4555                                                <div class="col-sm-4">'.__('Incorect File Extension','nex-forms').'</div>
4556                                                <div class="col-sm-8">
4557                                                        <input type="text" name="pref_invalid_file_ext_msg" class="form-control" value="'.(($preferences['validation_preferences']['pref_invalid_file_ext_msg']) ? $preferences['validation_preferences']['pref_invalid_file_ext_msg'] : 'Invalid file extension').'">
4558                                                </div>
4559                                        </div>
4560                                       
4561                                        <div class="row">
4562                                                <div class="col-sm-4">'.__('Maximum File Size Exceeded','nex-forms').'</div>
4563                                                <div class="col-sm-8">
4564                                                        <input type="text" name="pref_max_file_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_max_file_exceded']) ? $preferences['validation_preferences']['pref_max_file_exceded'] : 'Maximum File Size of {x}MB Exceeded').'">
4565                                                </div>
4566                                        </div>
4567                                        <div class="row">
4568                                                <div class="col-sm-4">'.__('Minimum File Size Required','nex-forms').'</div>
4569                                                <div class="col-sm-8">
4570                                                        <input type="text" name="pref_min_file_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_min_file_exceded']) ? $preferences['validation_preferences']['pref_min_file_exceded'] : 'Minimum File Size of {x}MB Required').'">
4571                                                </div>
4572                                        </div>
4573                                        <div class="row">
4574                                                <div class="col-sm-4">'.__('Maximum Size for All Files Exceeded','nex-forms').'</div>
4575                                                <div class="col-sm-8">
4576                                                        <input type="text" name="pref_max_file_af_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_max_file_af_exceded']) ? $preferences['validation_preferences']['pref_max_file_af_exceded'] : 'Maximum Size for all files can not exceed {x}MB').'">
4577                                                </div>
4578                                        </div>
4579                                        <div class="row">
4580                                                <div class="col-sm-4">'.__('Maximum File Upload Limit Exceeded','nex-forms').'</div>
4581                                                <div class="col-sm-8">
4582                                                        <input type="text" name="pref_max_file_ul_exceded" class="form-control" value="'.(($preferences['validation_preferences']['pref_max_file_ul_exceded']) ? $preferences['validation_preferences']['pref_max_file_ul_exceded'] : 'Only a maximum of {x} files can be uploaded').'">
4583                                                </div>
4584                                        </div> 
4585                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save Validation Preferences','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4586                                        <div style="clear:both"></div>
4587                                </form>
4588                                ';
4589                       
4590                return $output; 
4591                }
4592               
4593                public function print_email_pref(){
4594                        $preferences = get_option('nex-forms-preferences');
4595                        $output = '';
4596                        $theme = wp_get_theme();
4597                        $output .= '
4598                                <form name="emails-pref" id="emails-pref" action="'.admin_url('admin-ajax.php').'" method="post">       
4599                                       
4600                                        <br /><div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div>
4601                                       
4602                                        <h5>'.__('Admin Email Presets','nex-forms').'</h5>
4603                                                                                                                       
4604                                                                                                                        <div class="row">
4605                                                                                                                                <div class="col-sm-4">'.__('From Address','nex-forms').'</div>
4606                                                                                                                                <div class="col-sm-8">
4607                                                                                                                                        <input type="text" name="pref_email_from_address" class="form-control" value="'.(($preferences['email_preferences']['pref_email_from_address']) ? $preferences['email_preferences']['pref_email_from_address'] : get_option('admin_email')).'">
4608                                                                                                                                </div>
4609                                                                                                                        </div>
4610                                                                                                                       
4611                                                                                                                        <div class="row">
4612                                                                                                                                <div class="col-sm-4">'.__('From Name','nex-forms').'</div>
4613                                                                                                                                <div class="col-sm-8">
4614                                                                                                                                        <input type="text" name="pref_email_from_name" class="form-control" value="'.(($preferences['email_preferences']['pref_email_from_name']) ? $preferences['email_preferences']['pref_email_from_name'] : get_option('blogname')).'">
4615                                                                                                                                </div>
4616                                                                                                                        </div>
4617                                                                                                                       
4618                                                                                                                        <div class="row">
4619                                                                                                                                <div class="col-sm-4">'.__('Recipients','nex-forms').'</div>
4620                                                                                                                                <div class="col-sm-8">
4621                                                                                                                                        <input type="text" name="pref_email_recipients" class="form-control" value="'.(($preferences['email_preferences']['pref_email_recipients']) ? $preferences['email_preferences']['pref_email_recipients'] : get_option('admin_email')).'">
4622                                                                                                                                </div>
4623                                                                                                                        </div>
4624                                                                                                                       
4625                                                                                                                        <div class="row">
4626                                                                                                                                <div class="col-sm-4">'.__('Subject','nex-forms').'</div>
4627                                                                                                                                <div class="col-sm-8">
4628                                                                                                                                        <input type="text" name="pref_email_subject" class="form-control" value="'.(($preferences['email_preferences']['pref_email_subject']) ? $preferences['email_preferences']['pref_email_subject'] : get_option('blogname').' NEX-Forms submission').'">
4629                                                                                                                                </div>
4630                                                                                                                        </div>
4631                                                                                                                       
4632                                                                                                                        <div class="row">
4633                                                                                                                                <div class="col-sm-4">'.__('Mail Body','nex-forms').'</div>
4634                                                                                                                                <div class="col-sm-8">
4635                                                                                                                                        <textarea name="pref_email_body" placeholder="'.__('Enter {{nf_form_data}} to display all submitted data from the form in a table','nex-forms').'" class="materialize-textarea">'.(($preferences['email_preferences']['pref_email_body']) ? $preferences['email_preferences']['pref_email_body'] : '{{nf_form_data}}').'</textarea>
4636                                                                                                                                </div>
4637                                                                                                                        </div>
4638                                                                                                                       
4639                                                                                                                        <h5>'.__('User Autoresponder Email Presets','nex-forms').'</h5>
4640                                                                                                                       
4641                                                                                                                       
4642                                                                                                                       
4643                                                                                                                        <div class="row">
4644                                                                                                                                <div class="col-sm-4">'.__('Subject<','nex-forms').'/div>
4645                                                                                                                                <div class="col-sm-8">
4646                                                                                                                                        <input type="text" name="pref_user_email_subject" class="form-control" value="'.(($preferences['email_preferences']['pref_user_email_subject']) ? $preferences['email_preferences']['pref_user_email_subject'] : get_option('blogname').' NEX-Forms submission').'">
4647                                                                                                                                </div>
4648                                                                                                                        </div>
4649                                                                                                                       
4650                                                                                                                        <div class="row">
4651                                                                                                                                <div class="col-sm-4">'.__('Mail Body','nex-forms').'</div>
4652                                                                                                                                <div class="col-sm-8">
4653                                                                                                                                        <textarea name="pref_user_email_body" placeholder="'.__('Enter {{nf_form_data}} to display all submitted data from the form in a table','nex-forms').'" class="materialize-textarea">'.(($preferences['email_preferences']['pref_user_email_body']) ? $preferences['email_preferences']['pref_user_email_body'] : 'Thank you for connecting with us. We will respond to you shortly.').'</textarea>
4654                                                                                                                                </div>
4655                                                                                                                        </div>
4656                                       
4657                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save Email Preferences','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4658                                        <div style="clear:both"></div>
4659                                </form>
4660                                ';
4661                       
4662                return $output; 
4663                }
4664               
4665                public function print_other_pref(){
4666                        $preferences = get_option('nex-forms-preferences');
4667                        $output = '';
4668                        $theme = wp_get_theme();
4669                        $output .= '
4670                                <form name="other-pref" id="other-pref" action="'.admin_url('admin-ajax.php').'" method="post">
4671                                        <div class="alert alert-info">'.__('NOTE: These presets does not affect already created forms and only takes effect on NEW forms!','nex-forms').'</div>
4672                                        <div class="row">
4673                                                <div class="col-sm-4">'.__('On-screen confirmation message','nex-forms').'</div>
4674                                                <div class="col-sm-8">
4675                                                        <textarea name="pref_other_on_screen_message" class="materialize-textarea">'.(($preferences['other_preferences']['pref_other_on_screen_message']) ? $preferences['other_preferences']['pref_other_on_screen_message'] : 'Thank you for connecting with us. We will respond to you shortly.').'</textarea>
4676                                                </div>
4677                                        </div>
4678                                               
4679                                        <button class="btn blue waves-effect waves-light" '.(($theme->Name=='NEX-Forms Demo') ? 'disabled="disabled"' : '').'>&nbsp;&nbsp;&nbsp;'.__('Save Other Preferences','nex-forms').'&nbsp;&nbsp;&nbsp;</button>
4680                                        <div style="clear:both"></div>
4681                                </form>
4682                                ';
4683                       
4684                return $output; 
4685                }
4686       
4687       
4688       
4689        }       
4690}
4691
4692$get_nf_dashboard = new NEXForms_dashboard();
4693
4694?>
Note: See TracBrowser for help on using the repository browser.