function formcraft_basic_get_submissions() { global $fcb_meta, $forms_table, $submissions_table, $wpdb; if (!current_user_can($fcb_meta['user_can'])) { die; } $page = isset($_POST['page']) && ctype_digit($_POST['page']) ? $_POST['page'] - 1 : 0; $form = isset($_POST['form']) && ctype_digit($_POST['form']) ? $_POST['form'] : 0; $per_page = 10; $from = $page * $per_page; $to = $from + $per_page; if ($form == 0) { $submissions = $wpdb->get_results("SELECT id,form,form_name,created FROM {$submissions_table} ORDER BY created DESC LIMIT {$from}, {$per_page}", ARRAY_A); $total = $wpdb->get_var("SELECT COUNT(*) FROM {$submissions_table}"); } else { $submissions = $wpdb->get_results("SELECT id,form,form_name,created FROM {$submissions_table} WHERE form = {$form} ORDER BY created DESC LIMIT {$from}, {$to}", ARRAY_A); $total = $wpdb->get_var("SELECT COUNT(*) FROM {$submissions_table} WHERE form = {$form}"); } if (is_array($submissions) && count($submissions) > 0) { foreach ($submissions as $key => $value) { $submissions[$key]['created'] = fcb_time_ago(strtotime(current_time('mysql')) - strtotime($submissions[$key]['created'])); } echo json_encode(array('pages' => ceil($total / $per_page), 'submissions' => $submissions, 'total' => $total)); die; } else { echo json_encode(array('pages' => '0', 'total' => '0')); die; } }
'><?php echo $value->name; ?> </a></span> <span style='width:10%'><a href='admin.php?page=formcraft_basic_dashboard&id=<?php echo $value->id; ?> '><?php echo $form_views; ?> </a></span> <span style='width:30%'><a href='admin.php?page=formcraft_basic_dashboard&id=<?php echo $value->id; ?> '><?php echo fcb_time_ago(strtotime(current_time('mysql')) - strtotime($value->modified)); ?> </a></span> <span style='width:10%'><i data-id='<?php echo $value->id; ?> ' class='trash-icon trash-form icon-trash-1'></i></span> </div> <?php } } else { ?> <span class='no-subs-content' data-toggle="fcbmodal" data-target="#new_form_modal"><?php _e('Create New Form', 'formcraft_basic'); ?> </span>