mystickymenu
Last commit date
admin
1 week ago
dist
1 week ago
images
1 year ago
languages
1 week ago
class-email-signup.php
7 months ago
class-help.php
1 month ago
class-review-box.php
1 month ago
class-upgrade-box.php
1 month ago
index.php
8 years ago
mystickymenu-admin-widgetanalytics.php
1 week ago
mystickymenu-contact-leads.php
1 week ago
mystickymenu-deactivate-form.php
1 month ago
mystickymenu-fonts.php
2 years ago
mystickymenu-leads.php
1 week ago
mystickymenu-popup.php
1 month ago
mystickymenu-review-popup.php
9 months ago
mystickymenu.php
1 week ago
mystickymeny-new-welcomebar.php
1 week ago
readme.txt
1 week ago
recommended-plugins.php
7 months ago
uninstall.php
2 years ago
upgrade-to-pro.php
1 month ago
welcome-bar.php
1 week ago
mystickymenu-leads.php
207 lines
| 1 | <?php |
| 2 | global $wpdb; |
| 3 | $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status(); |
| 4 | if($is_shown) { |
| 5 | include_once MYSTICKYMENU_PATH . 'admin/email-signup.php'; |
| 6 | return; |
| 7 | } |
| 8 | $where_search = ''; |
| 9 | $table_name = $wpdb->prefix . "mystickymenu_contact_lists"; |
| 10 | $elements_widgets = get_option( 'mystickymenu-welcomebars' ); |
| 11 | |
| 12 | $custom_fields = array(); |
| 13 | if ( !empty($elements_widgets)) { |
| 14 | foreach( $elements_widgets as $key=>$value) { |
| 15 | $widget_no = '-'.$key; |
| 16 | if ( $key == 0 ) { |
| 17 | $widget_no = ''; |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | if ( isset($_REQUEST['search-contact']) && $_REQUEST['search-contact'] != '' ) { |
| 22 | $where_search = "WHERE contact_name like '%" . $_REQUEST['search-contact'] . "%' OR contact_email like '%".$_REQUEST['search-contact']."%' OR contact_phone like '%".$_REQUEST['search-contact']."%' OR widget_name like '%".$_REQUEST['search-contact']."%' "; |
| 23 | } |
| 24 | $customPagHTML = ""; |
| 25 | $total_query = "SELECT count(*) FROM ".$table_name ." {$where_search} ORDER BY ID DESC"; |
| 26 | $total = $wpdb->get_var( $total_query ); |
| 27 | $items_per_page = 20; |
| 28 | $page = ( isset( $_GET['cpage'] ) ) ? abs( (int) $_GET['cpage'] ) : 1; |
| 29 | $offset = ( $page * $items_per_page ) - $items_per_page; |
| 30 | $query = "SELECT * FROM " . $table_name ." {$where_search} ORDER BY ID DESC LIMIT {$offset}, {$items_per_page}"; |
| 31 | $result = $wpdb->get_results( $query ); |
| 32 | $total_page = ceil($total / $items_per_page); |
| 33 | $start_from = $offset + 1; |
| 34 | $to = $offset + min($items_per_page, count($result)); |
| 35 | |
| 36 | $download_file_url = plugins_url('mystickymenu-contact-leads.php?download_file=mystickybar_contact_leads.csv',__FILE__); |
| 37 | ?> |
| 38 | <!-- /**/ */ --> |
| 39 | <div class="sticky-header-content pt-6"> |
| 40 | <div class="wrap mystickymenu-wrap mystickymenu-dashboard"> |
| 41 | <div class="flex items-center justify-between h-full gap-8"> |
| 42 | <div class="heading-title flex flex-col gap-1 text-[#1d2327]"> |
| 43 | <h3><?php esc_html_e( 'Contact Form Leads', 'mystickymenu' ); ?></h3> |
| 44 | <?php if(count($result) > 0) { ?> |
| 45 | <div class="text-sm text-[#1d2327]"><?php esc_html_e('View and export all leads collected through your sticky bars.', 'mystickymenu') ?></div> |
| 46 | <?php } ?> |
| 47 | </div> |
| 48 | <div> |
| 49 | <?php if(count($result) > 0) { ?> |
| 50 | <a href="<?php echo esc_url(wp_nonce_url($download_file_url,'MSB_file_download', 'mystickymenu_nonce') ); ?>" class="msb-primary-button" id="wpappp_export_to_csv" value="Export to CSV" href="#"> |
| 51 | <?php esc_html_e('Export CSV', 'mystickymenu' );?> |
| 52 | </a> |
| 53 | <?php } ?> |
| 54 | </div> |
| 55 | </div> |
| 56 | <?php if(count($result) > 0 || !empty($where_search)) { ?> |
| 57 | <div class="border-1 border-[#F1F1F1] rounded-lg mt-5 msb-shadow msb-form-leads"> |
| 58 | <div class="top p-4 flex flex-col md:flex-row md:justify-between md:items-center"> |
| 59 | <div> |
| 60 | <?php if(count($result) > 0) { ?> |
| 61 | <form action="<?php echo admin_url("admin.php?page=my-sticky-menu-leads");?>" method="post"> |
| 62 | <div class="actions bulkactions"> |
| 63 | <input type="hidden" name="action" value="delete_message"> |
| 64 | <input type="submit" id="doaction" class="button action delete-button bg-red-100 border-1 border-red-400" value="<?php esc_attr_e('Delete', 'mystickymenu'); ?>"> |
| 65 | <?php wp_nonce_field( 'stickyelement-contatc-submit', 'stickyelement-contatc-submit' ); ?> |
| 66 | </div> |
| 67 | </form> |
| 68 | <?php } ?> |
| 69 | </div> |
| 70 | |
| 71 | <form action="<?php echo admin_url("admin.php?page=my-sticky-menu-leads");?>" method='get'> |
| 72 | <input type="hidden" name="page" value='my-sticky-menu-leads'/> |
| 73 | <div class="search-box relative"> |
| 74 | <label class="screen-reader-text" for="post-search-input"><?php esc_html_e( 'Search', 'mystickymenu');?></label> |
| 75 | <input type="search" id="post-search-input" class="search-input" name="search-contact" value="<?php echo (isset($_GET['search-contact']) && $_GET['search-contact'] != '') ? esc_attr($_GET['search-contact']) : ''; ?>" placeholder="Search by name, email, phone, widget name"> |
| 76 | <button type="submit" class="msb-search-button"> |
| 77 | <span class="sr-only"><?php esc_html_e( 'Search', 'mystickymenu' ); ?></span> |
| 78 | <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 79 | <path d="M15.833 15.834L12.208 12.209M14.1663 7.50065C14.1663 11.1825 11.1816 14.1673 7.49967 14.1673C3.81778 14.1673 0.833008 11.1825 0.833008 7.50065C0.833008 3.81875 3.81778 0.833984 7.49967 0.833984C11.1816 0.833984 14.1663 3.81875 14.1663 7.50065Z" stroke="#717680" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path> |
| 80 | </svg> |
| 81 | </button> |
| 82 | </div> |
| 83 | </form> |
| 84 | </div> |
| 85 | |
| 86 | <table border="1" class="responstable msb-table"> |
| 87 | <tr> |
| 88 | <th style="width:1%"><?php esc_html_e( 'Bulk', 'mystickymenu' );?></th> |
| 89 | <th><?php esc_html_e( 'ID', 'mystickymenu');?></th> |
| 90 | <th><?php esc_html_e( 'Widget Name', 'mystickymenu');?></th> |
| 91 | <th><?php esc_html_e( 'Name', 'mystickymenu');?></th> |
| 92 | <th><?php esc_html_e( 'Email', 'mystickymenu');?></th> |
| 93 | <th><?php esc_html_e( 'Phone', 'mystickymenu');?></th> |
| 94 | <th><?php esc_html_e( 'Date', 'mystickymenu');?></th> |
| 95 | <th class="w-20 text-center"><?php esc_html_e( 'URL', 'mystickymenu');?></th> |
| 96 | <th class="w-30 text-center"><?php esc_html_e( 'Delete', 'mystickymenu');?></th> |
| 97 | </tr> |
| 98 | <?php |
| 99 | $customPagHTML = ""; |
| 100 | $total_page = ceil($total / $items_per_page); |
| 101 | $widgets = []; |
| 102 | if($result){ |
| 103 | foreach ( $result as $res ) { |
| 104 | ?> |
| 105 | <tr> |
| 106 | <td class="text-center"><input id="cb-select-80" class="cb-select-blk" type="checkbox" name="delete_message[]" value="<?php echo esc_attr($res->ID);?>"></td> |
| 107 | <td class="text-sm!"><?php echo esc_html($res->ID);?></td> |
| 108 | <td class="text-sm!"> |
| 109 | <?php if($res->widget_id !== NULL && !empty($res->widget_id)) { |
| 110 | if(isset($widgets[$res->widget_id])) { |
| 111 | $widget_name = $widgets[$res->widget_id]; |
| 112 | } else { |
| 113 | $widget_data = get_option('mysticky_option_welcomebar' . '-' . $res->widget_id); |
| 114 | $widget_name = isset($widget_data['welcomebar-widget']) && !empty($widget_data['welcomebar-widget']) ? $widget_data['welcomebar-widget'] : $res->widget_name; |
| 115 | $widgets[$res->widget_id] = $widget_name; |
| 116 | } |
| 117 | ?> |
| 118 | <a class="text-[#1d2327]!" target="_blank" href="<?php echo admin_url( 'admin.php?page=my-stickymenu-welcomebar&widget=' . $res->widget_id );?>"> |
| 119 | <?php echo esc_html($widget_name); ?> |
| 120 | </a> |
| 121 | <?php } else { ?> |
| 122 | <?php echo esc_html($res->widget_name);?> |
| 123 | <?php } ?> |
| 124 | </td> |
| 125 | <td class="text-sm!"><?php echo esc_html($res->contact_name);?></td> |
| 126 | <td class="text-sm!"><?php echo esc_html($res->contact_email);?></td> |
| 127 | <td class="text-sm!"><?php echo esc_html($res->contact_phone);?></td> |
| 128 | <td class="text-sm!"><?php echo ( isset($res->message_date) ) ? esc_html($res->message_date) : '-' ;?></td> |
| 129 | <td class="text-sm! text-center"> |
| 130 | <?php if ( $res->page_link) :?> |
| 131 | <a class="external-link" href="<?php echo esc_url($res->page_link);?>" target="_blank"><span class="dashicons dashicons-external"></span></a> |
| 132 | <?php endif;?> |
| 133 | </td> |
| 134 | |
| 135 | <td class="text-sm! text-center"> |
| 136 | <button type="button" data-delete="<?php echo esc_html($res->ID);?>" class="mystickymenu-delete-entry text-red-500! cursor-pointer inline-flex items-center gap-1.5 border-1 border-red-500 py-0.5 px-1.5 rounded-sm hover:bg-red-50"> |
| 137 | <svg class="w-auto h-4" width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 138 | <path d="M0.75 4.08333H2.41667M2.41667 4.08333H15.75M2.41667 4.08333V15.75C2.41667 16.192 2.59226 16.6159 2.90482 16.9285C3.21738 17.2411 3.64131 17.4167 4.08333 17.4167H12.4167C12.8587 17.4167 13.2826 17.2411 13.5952 16.9285C13.9077 16.6159 14.0833 16.192 14.0833 15.75V4.08333H2.41667ZM4.91667 4.08333V2.41667C4.91667 1.97464 5.09226 1.55072 5.40482 1.23816C5.71738 0.925595 6.14131 0.75 6.58333 0.75H9.91667C10.3587 0.75 10.7826 0.925595 11.0952 1.23816C11.4077 1.55072 11.5833 1.97464 11.5833 2.41667V4.08333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> |
| 139 | </svg> |
| 140 | <?php esc_attr_e('Delete', 'mystickymenu');?> |
| 141 | </button> |
| 142 | </td> |
| 143 | </tr> |
| 144 | <?php } |
| 145 | } else { ?> |
| 146 | <tr> |
| 147 | <td colspan="9" align="center"> |
| 148 | <p class="mystickymenu-no-contact"> <?php esc_html_e('No Contact Form Leads Found!','mystickymenu');?> |
| 149 | </p> |
| 150 | </td> |
| 151 | </tr> |
| 152 | <?php } ?> |
| 153 | </table> |
| 154 | <?php if(count($result) > 0) { ?> |
| 155 | <div class="flex items-center flex-col md:flex-row justify-between gap-3 p-4"> |
| 156 | <div class="text-sm"> |
| 157 | Showing records from <?php echo esc_attr($start_from) ?> to <?php echo esc_attr($to) ?> from <?php echo esc_attr($total) ?> records |
| 158 | </div> |
| 159 | <?php if($total_page > 1){ ?> |
| 160 | <div class="contactleads-pagination"> |
| 161 | <?php |
| 162 | $big = 999999999; // need an unlikely integer |
| 163 | echo paginate_links( array( |
| 164 | 'base' => add_query_arg( 'cpage', '%#%' ), |
| 165 | 'format' => '', |
| 166 | 'current' => $page, |
| 167 | 'total' => $total_page |
| 168 | ) );?> |
| 169 | </div> |
| 170 | <?php }?> |
| 171 | </div> |
| 172 | <?php } ?> |
| 173 | </div> |
| 174 | |
| 175 | <?php if(count($result) > 0) { ?> |
| 176 | <div class="bg-red-50 border-1 border-red-400 rounded-lg p-4 mt-8 flex justify-between gap-10 items-center"> |
| 177 | <div class="flex gap-4 items-center"> |
| 178 | <div> |
| 179 | <div class="h-10 w-10 flex items-center justify-center bg-red-200 rounded-full text-red-600!"> |
| 180 | <svg class="w-auto h-4" width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 181 | <path d="M0.75 4.08333H2.41667M2.41667 4.08333H15.75M2.41667 4.08333V15.75C2.41667 16.192 2.59226 16.6159 2.90482 16.9285C3.21738 17.2411 3.64131 17.4167 4.08333 17.4167H12.4167C12.8587 17.4167 13.2826 17.2411 13.5952 16.9285C13.9077 16.6159 14.0833 16.192 14.0833 15.75V4.08333H2.41667ZM4.91667 4.08333V2.41667C4.91667 1.97464 5.09226 1.55072 5.40482 1.23816C5.71738 0.925595 6.14131 0.75 6.58333 0.75H9.91667C10.3587 0.75 10.7826 0.925595 11.0952 1.23816C11.4077 1.55072 11.5833 1.97464 11.5833 2.41667V4.08333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> |
| 182 | </svg> |
| 183 | </div> |
| 184 | </div> |
| 185 | <div class="flex flex-col gap-0.5 flex-1"> |
| 186 | <div class="text-base font-semibold"><?php esc_html_e('Delete all leads permanently','mystickymenu');?> </div> |
| 187 | <div><?php esc_html_e('This will permanently delete all leads from the database.','mystickymenu');?> </div> |
| 188 | </div> |
| 189 | </div> |
| 190 | <div> |
| 191 | <button type="button" class="wpappp_buton delete-all-leads-button" id="mystickymenu_delete_all_leads" > |
| 192 | <svg class="w-auto h-4" width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 193 | <path d="M0.75 4.08333H2.41667M2.41667 4.08333H15.75M2.41667 4.08333V15.75C2.41667 16.192 2.59226 16.6159 2.90482 16.9285C3.21738 17.2411 3.64131 17.4167 4.08333 17.4167H12.4167C12.8587 17.4167 13.2826 17.2411 13.5952 16.9285C13.9077 16.6159 14.0833 16.192 14.0833 15.75V4.08333H2.41667ZM4.91667 4.08333V2.41667C4.91667 1.97464 5.09226 1.55072 5.40482 1.23816C5.71738 0.925595 6.14131 0.75 6.58333 0.75H9.91667C10.3587 0.75 10.7826 0.925595 11.0952 1.23816C11.4077 1.55072 11.5833 1.97464 11.5833 2.41667V4.08333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> |
| 194 | </svg> |
| 195 | <?php esc_attr_e('Delete All Leads', 'mystickymenu' );?> |
| 196 | </button> |
| 197 | <input type="hidden" id="delete_nonce" name="delete_nonce" value="<?php echo esc_attr(wp_create_nonce('mysticky_menu_delete_nonce')) ?>" /> |
| 198 | </div> |
| 199 | </div> |
| 200 | <?php } ?> |
| 201 | <?php } else { ?> |
| 202 | <div class="border-1 border-[#F1F1F1] rounded-lg mt-5 py-10 text-base msb-shadow msb-form-leads text-center"> |
| 203 | <?php esc_html_e('No Contact Form Leads Yet', 'mystickymenu');?> |
| 204 | </div> |
| 205 | <?php } ?> |
| 206 | </div> |
| 207 | </div> |