| 1 |
<?php |
| 2 |
$items = $this->db_obj->get_items(); |
| 3 |
$all_items = CBFunctions()->get_all_charts_count(); |
| 4 |
$chart_count_per_page = count($items) > 0 ? $all_items/$this->db_obj->get_pagination_count() : 0; |
| 5 |
$chart_paged = isset($_GET['paged']) && $_GET['paged'] != '' ? absint( sanitize_text_field($_GET['paged'])) : ''; |
| 6 |
$search = $this->db_obj->get_search_value(); |
| 7 |
$chart_max_id = Chart_Builder_Admin::get_max_id('charts'); |
| 8 |
$this->settings_obj = new Chart_Builder_Settings_DB_Actions($this->plugin_name); |
| 9 |
$chart_title_length = $this->settings_obj->get_listtables_title_length(); |
| 10 |
$filter_by_type = (isset($_GET['filterbytype']) && $_GET['filterbytype'] != "") ? intval(sanitize_text_field($_GET['filterbytype'])) : ''; |
| 11 |
$filter_by_source = (isset($_GET['filterbysource']) && $_GET['filterbysource'] != "") ? intval(sanitize_text_field($_GET['filterbysource'])) : ''; |
| 12 |
$filter_by_chart_source = (isset($_GET['filterbychartsource']) && $_GET['filterbychartsource'] != "") ? intval(sanitize_text_field($_GET['filterbychartsource'])) : ''; |
| 13 |
$filter_by_date = (isset($_GET['filterbydate']) && $_GET['filterbydate'] != "") ? sanitize_text_field($_GET['filterbydate']) : ''; |
| 14 |
$order_by = (isset($_GET['orderby']) && $_GET['orderby'] != "") ? sanitize_text_field($_GET['orderby']) : ''; |
| 15 |
$order = (isset($_GET['order']) && $_GET['order'] != "") ? sanitize_text_field($_GET['order']) : 'desc'; |
| 16 |
$chart_types = array( |
| 17 |
"Line Chart", |
| 18 |
"Bar Chart", |
| 19 |
"Pie Chart", |
| 20 |
"Column Chart", |
| 21 |
"Org Chart", |
| 22 |
"Donut Chart", |
| 23 |
); |
| 24 |
$chart_sources = array( |
| 25 |
"Manual", |
| 26 |
"Quiz Maker", |
| 27 |
"File Import", |
| 28 |
"Google Sheet", |
| 29 |
"Database Query", |
| 30 |
"Woocommerce", |
| 31 |
); |
| 32 |
$chart_source_types = array( |
| 33 |
"Google Charts", |
| 34 |
"Chart.js", |
| 35 |
); |
| 36 |
$chart_dates = array( |
| 37 |
'today' => __("Today", "chart-builder"), |
| 38 |
'yesterday' => __("Yesterday", "chart-builder"), |
| 39 |
'last_week' => __("Last Week", "chart-builder"), |
| 40 |
'last_month' => __("Last Month", "chart-builder"), |
| 41 |
'last_year' => __("Last Year", "chart-builder"), |
| 42 |
); |
| 43 |
$order_by_values = array( |
| 44 |
'title' => __("Title", "chart-builder"), |
| 45 |
'date_created' => __("Date created", "chart-builder"), |
| 46 |
'date_modified' => __("Date modified", "chart-builder"), |
| 47 |
); |
| 48 |
$order_values = array( |
| 49 |
'asc' => __("Ascending", "chart-builder"), |
| 50 |
'desc' => __("Descending", "chart-builder"), |
| 51 |
); |
| 52 |
$filter_by_author_data = $this->db_obj->get_searched_author_info(); |
| 53 |
|
| 54 |
$plus_icon_svg = "<span class=''><img src='". CHART_BUILDER_ADMIN_URL ."/images/icons/plus=icon.svg'></span>"; |
| 55 |
$youtube_icon_svg = "<span class=''><img src='". CHART_BUILDER_ADMIN_URL ."/images/icons/youtube-video-icon.svg'></span>"; |
| 56 |
|
| 57 |
?> |
| 58 |
<div class="wrap ays_charts_list_table"> |
| 59 |
<div class="ays-chart-heading-box"> |
| 60 |
<div class="ays-chart-wordpress-user-manual-box"> |
| 61 |
<a href="https://ays-pro.com/wordpress-chart-builder-plugin-user-manual" target="_blank" style="text-decoration: none;font-size: 13px;"> |
| 62 |
<i class="ays_fa ays_fa_file_text" ></i> |
| 63 |
<span style="margin-left: 3px;text-decoration: underline;">View Documentation</span> |
| 64 |
</a> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
<h1 class="wp-heading-inline"> |
| 68 |
<?php |
| 69 |
echo __( esc_html( get_admin_page_title() ), "chart-builder" ); |
| 70 |
?> |
| 71 |
</h1> |
| 72 |
|
| 73 |
<div class="ays-chart-add-new-button-box" style="margin-top: 10px;"> |
| 74 |
<?php |
| 75 |
echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary chart-add-new-bttn chart-add-new-button-new-design"> %s ' . __( 'Add New', "chart-builder" ) . '</a>', esc_attr( $_REQUEST['page'] ), 'add', $plus_icon_svg); |
| 76 |
?> |
| 77 |
</div> |
| 78 |
<div id="poststuff"> |
| 79 |
<div id="post-body" class="metabox-holder"> |
| 80 |
<div id="post-body-content"> |
| 81 |
<div class="meta-box-sortables ui-sortable chart-list-table-container"> |
| 82 |
<form method="post"> |
| 83 |
<div class="ays-chart-table-actions-row"> |
| 84 |
<div class="ays-chart-table-actions-row-section"> |
| 85 |
<div class="ays-chart-delete-button"> |
| 86 |
<button name="bulk_delete" id="ays-chart-bulk-delete" disabled><i class="ays_fa ays_fa_trash"></i><?php echo esc_html(__( 'Delete', "chart-builder" )); ?></button> |
| 87 |
<button type="submit" name="bulk_delete_confirm" id="ays-chart-bulk-delete-confirm" style="display: none;"></button> |
| 88 |
</div> |
| 89 |
<div class="ays-chart-filter-section"> |
| 90 |
<select name="filterbytype" id="ays-chart-filter-select"> |
| 91 |
<option value=""><?= __( "Select Type", "chart-builder" ) ?></option> |
| 92 |
<?php |
| 93 |
foreach ( $chart_types as $k => $v ): |
| 94 |
$selected = ( $filter_by_type == ($k+1) ) ? 'selected' : ''; |
| 95 |
?> |
| 96 |
<option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 97 |
<?php |
| 98 |
endforeach; |
| 99 |
?> |
| 100 |
</select> |
| 101 |
<select name="filterbysource" id="ays-chart-filter-source"> |
| 102 |
<option value=""><?= __( "Select Source", "chart-builder" ) ?></option> |
| 103 |
<?php |
| 104 |
foreach ( $chart_sources as $k => $v ): |
| 105 |
$disabled = $k >= 2 ? 'disabled' : '' ; |
| 106 |
$selected = ( $filter_by_source == ($k+1) ) ? 'selected' : ''; |
| 107 |
?> |
| 108 |
<option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> |
| 109 |
<?php |
| 110 |
endforeach; |
| 111 |
?> |
| 112 |
</select> |
| 113 |
<select name="filterbychartsource" id="ays-chart-filter-chart-source"> |
| 114 |
<option value=""><?= __( "Select Chart Source", "chart-builder" ) ?></option> |
| 115 |
<?php |
| 116 |
foreach ( $chart_source_types as $k => $v ): |
| 117 |
$disabled = $k >= 2 ? 'disabled' : '' ; |
| 118 |
$selected = ( $filter_by_chart_source == ($k+1) ) ? 'selected' : ''; |
| 119 |
?> |
| 120 |
<option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> |
| 121 |
<?php |
| 122 |
endforeach; |
| 123 |
?> |
| 124 |
</select> |
| 125 |
<select name="filterbydate" id="ays-chart-filter-date"> |
| 126 |
<option value=""><?= __( "Select Date", "chart-builder" ) ?></option> |
| 127 |
<?php |
| 128 |
foreach ( $chart_dates as $k => $v ): |
| 129 |
$selected = ( $filter_by_date == $k ) ? 'selected' : ''; |
| 130 |
?> |
| 131 |
<option value="<?php echo esc_attr($k); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 132 |
<?php |
| 133 |
endforeach; |
| 134 |
?> |
| 135 |
</select> |
| 136 |
<select name="filterbyauthor" id="ays-chart-filter-author"> |
| 137 |
<?php if (isset($filter_by_author_data) && !empty($filter_by_author_data)): ?> |
| 138 |
<option value="<?php echo esc_html($filter_by_author_data['ID'])?>" selected><?php echo esc_html($filter_by_author_data['display_name'])?></option> |
| 139 |
<?php endif; ?> |
| 140 |
</select> |
| 141 |
<select name="orderby" id="ays-chart-order-by"> |
| 142 |
<option value=""><?= __( "Order by", "chart-builder" ) ?></option> |
| 143 |
<?php |
| 144 |
foreach ( $order_by_values as $k => $v ): |
| 145 |
// $disabled = $k >= 2 ? 'disabled' : '' ; |
| 146 |
$selected = ( $order_by == $k ) ? 'selected' : ''; |
| 147 |
?> |
| 148 |
<option value="<?php echo esc_attr($k); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 149 |
<?php |
| 150 |
endforeach; |
| 151 |
?> |
| 152 |
</select> |
| 153 |
<select name="order" id="ays-chart-order"> |
| 154 |
<?php |
| 155 |
foreach ( $order_values as $k => $v ): |
| 156 |
$selected = ( $order == $k ) ? 'selected' : ''; |
| 157 |
?> |
| 158 |
<option value="<?php echo esc_attr($k); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 159 |
<?php |
| 160 |
endforeach; |
| 161 |
?> |
| 162 |
</select> |
| 163 |
<button type="submit" name="ays_chart_filter" id="ays-chart-filter"><?php echo esc_html(__( 'Filter', "chart-builder" )); ?></button> |
| 164 |
<button type="submit" name="ays_chart_filter_clear" id="ays-chart-filter-clear"><?php echo esc_html(__( 'Clear filters', "chart-builder" )); ?></button> |
| 165 |
</div> |
| 166 |
</div> |
| 167 |
<div class="ays-chart-search-block"> |
| 168 |
<input type="text" name="s" id="ays-chart-search-input" value="<?php echo $search; ?>"> |
| 169 |
<button type="submit" name="ays_chart_search" id="ays-chart-search"><?php echo esc_html(__( 'Search', "chart-builder" )); ?></button> |
| 170 |
</div> |
| 171 |
</div> |
| 172 |
<table class="chart-list-table table"> |
| 173 |
<thead> |
| 174 |
<tr> |
| 175 |
<th class="column-cb"> |
| 176 |
<input type="checkbox" class="form-check-input select-all" value="" /> |
| 177 |
</th> |
| 178 |
<th class="column-title"><?php echo esc_html(__( 'Title', "chart-builder" )); ?></th> |
| 179 |
<th class="column-type"><?php echo esc_html(__( 'Type', "chart-builder" )); ?></th> |
| 180 |
<th class="column-source-type"><?php echo esc_html(__( 'Source', "chart-builder" )); ?></th> |
| 181 |
<th class="column-chart-source"><?php echo esc_html(__( 'Chart Source', "chart-builder" )); ?></th> |
| 182 |
<th class="column-shortcode"><?php echo esc_html(__( 'Shortcode', "chart-builder" )); ?></th> |
| 183 |
<th class="column-author"><?php echo esc_html(__( 'Author', "chart-builder" )); ?></th> |
| 184 |
<th class="column-status"><?php echo esc_html(__( 'Status', "chart-builder" )); ?></th> |
| 185 |
<th class="column-date"><?php echo esc_html(__( 'Date', "chart-builder" )); ?></th> |
| 186 |
<th class="column-id"><?php echo esc_html(__( 'ID', "chart-builder" )); ?></th> |
| 187 |
</tr> |
| 188 |
</thead> |
| 189 |
<tbody> |
| 190 |
<?php if ( !empty( $items ) ): ?> |
| 191 |
<?php foreach ( $items as $key => $item ): ?> |
| 192 |
<tr> |
| 193 |
<td class="column-cb"> |
| 194 |
<input type="checkbox" class="form-check-input check-current-row" name="bulk-delete[]" value="<?php echo esc_attr($item['id']) ?>" /> |
| 195 |
</td> |
| 196 |
<td class="column-title"><?php |
| 197 |
if($item['status'] == 'trashed'){ |
| 198 |
$delete_nonce = wp_create_nonce( $this->plugin_name . '-delete-item' ); |
| 199 |
}else{ |
| 200 |
$delete_nonce = wp_create_nonce( $this->plugin_name . '-trash-item' ); |
| 201 |
} |
| 202 |
$publish_nonce = wp_create_nonce( $this->plugin_name . '-publish-item' ); |
| 203 |
$unpublish_nonce = wp_create_nonce( $this->plugin_name . '-unpublish-item' ); |
| 204 |
$duplicate_nonce = wp_create_nonce( $this->plugin_name . '-duplicate-item' ); |
| 205 |
$chart_title = stripcslashes( $item['title'] ); |
| 206 |
$q = esc_attr( $chart_title ); |
| 207 |
|
| 208 |
$restitle = Chart_Builder_Admin::ays_restriction_string("word", $chart_title, $chart_title_length); |
| 209 |
|
| 210 |
$title = sprintf( '<a href="?page=%s&action=%s&id=%d" title="%s">%s</a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ), $q, $restitle); |
| 211 |
|
| 212 |
$actions = array(); |
| 213 |
if($item['status'] == 'trashed'){ |
| 214 |
$title = sprintf( '<strong><a>%s</a></strong>', $restitle ); |
| 215 |
$actions['restore'] = sprintf( '<a href="?page=%s&action=%s&id=%d&_wpnonce=%s">'. __('Restore', "chart-builder") .'</a>', esc_attr( $_REQUEST['page'] ), 'restore', absint( $item['id'] ), $delete_nonce ); |
| 216 |
$actions['delete'] = sprintf( '<a class="ays_confirm_del" data-message="%s" href="?page=%s&action=%s&id=%s&_wpnonce=%s">'. __('Delete Permanently', "chart-builder") .'</a>', $restitle, esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce ); |
| 217 |
}else{ |
| 218 |
$actions['edit'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%d" data-bs-toggle="tooltip" title="'. esc_html(__('Edit',"chart-builder")) .'"><i class="ays_fa ays_fa_pen_to_square"></i></a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ) ); |
| 219 |
|
| 220 |
$draft_text = ''; |
| 221 |
if( $item['status'] == 'draft' && !( isset( $_GET['fstatus'] ) && $_GET['fstatus'] == 'draft' )){ |
| 222 |
$draft_text = ' — ' . '<span class="post-state">' . __( "Draft", "chart-builder" ) . '</span>'; |
| 223 |
$actions['publish'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Publish',"chart-builder")) .'"><i class="ays_fa ays_fa_unpublished"></i></a>', esc_attr( $_REQUEST['page'] ), 'publish', absint( $item['id'] ), $publish_nonce ); |
| 224 |
} else { |
| 225 |
$actions['unpublish'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Unpublish',"chart-builder")) .'"><i class="ays_fa ays_fa_published"></i></a>', esc_attr( $_REQUEST['page'] ), 'unpublish', absint( $item['id'] ), $unpublish_nonce ); |
| 226 |
} |
| 227 |
|
| 228 |
$title = sprintf( '<strong><a href="?page=%s&action=%s&id=%d" title="%s">%s</a>%s</strong>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ), $q, $restitle, $draft_text ); |
| 229 |
|
| 230 |
$actions['duplicate'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Duplicate',"chart-builder")) .'"><i class="ays_fa ays_fa_copy"></i></a>', esc_attr( $_REQUEST['page'] ), 'duplicate', absint( $item['id'] ), $duplicate_nonce ); |
| 231 |
|
| 232 |
$actions['delete'] = sprintf( '<a class="ays_chart_delete_confirm btn btn-danger btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Delete',"chart-builder")) .'"><i class="ays_fa ays_fa_trash_o"></i></a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce ); |
| 233 |
} |
| 234 |
echo wp_kses_post($title); |
| 235 |
|
| 236 |
echo '<p class="chart-list-table-actions-row">'; |
| 237 |
foreach ( $actions as $action => $action_html ){ |
| 238 |
$link_class = ''; |
| 239 |
// if( $action == 'delete' ){ |
| 240 |
// $link_class = 'link-danger'; |
| 241 |
// } |
| 242 |
echo '<span class="chart-list-table-action-link ' . $link_class . '">' . $action_html . '</span>'; |
| 243 |
} |
| 244 |
echo '</p>'; |
| 245 |
?></td> |
| 246 |
<td class="column-type"><?php |
| 247 |
switch ($item['source_chart_type']) { |
| 248 |
case 'line_chart': |
| 249 |
echo "<p><img src='" . CHART_BUILDER_ADMIN_URL . "/images/icons/line-chart.png" . "' width='20px'>"; |
| 250 |
echo "<span style='margin-left: 8px'>" . __('Line Chart', $this->plugin_name) . "</span></p>"; |
| 251 |
break; |
| 252 |
|
| 253 |
case 'bar_chart': |
| 254 |
echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/bar-chart.png" . "' width='20px'>"; |
| 255 |
echo "<span style='margin-left: 8px'>" . __('Bar Chart', "chart-builder") . "</span></p>"; |
| 256 |
break; |
| 257 |
|
| 258 |
case 'pie_chart': |
| 259 |
echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/pie-chart.png" . "' width='20px'>"; |
| 260 |
echo "<span style='margin-left: 8px'>" . __('Pie Chart', "chart-builder") . "</span></p>"; |
| 261 |
break; |
| 262 |
|
| 263 |
case 'column_chart': |
| 264 |
echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/column-chart.png" . "' width='20px'>"; |
| 265 |
echo "<span style='margin-left: 8px'>" . __('Column Chart', "chart-builder") . "</span></p>"; |
| 266 |
break; |
| 267 |
|
| 268 |
case 'donut_chart': |
| 269 |
echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/donut-chart.png" . "' width='20px'>"; |
| 270 |
echo "<span style='margin-left: 8px'>" . __('Donut Chart', "chart-builder") . "</span></p>"; |
| 271 |
break; |
| 272 |
|
| 273 |
case 'org_chart': |
| 274 |
echo "<p><img src='" . CHART_BUILDER_ADMIN_URL . "/images/icons/org-chart.png" . "' width='20px'>"; |
| 275 |
echo "<span style='margin-left: 8px'>" . __('Org Chart', $this->plugin_name) . "</span></p>"; |
| 276 |
break; |
| 277 |
} |
| 278 |
?></td> |
| 279 |
<td class="column-source-type"><?php |
| 280 |
switch ($item['source_type']) { |
| 281 |
case 'quiz_maker': |
| 282 |
echo "<span style='margin-left: 8px'>" . __('Quiz Maker', $this->plugin_name) . "</span>"; |
| 283 |
break; |
| 284 |
case 'manual': |
| 285 |
default: |
| 286 |
echo "<span style='margin-left: 8px'>" . __('Manual', $this->plugin_name) . "</span>"; |
| 287 |
break; |
| 288 |
} |
| 289 |
?></td> |
| 290 |
<td class="column-chart-source"><?php |
| 291 |
switch ($item['type']) { |
| 292 |
case 'chart-js': |
| 293 |
echo "<span style='margin-left: 8px'>" . __('Chart.js', $this->plugin_name) . "</span>"; |
| 294 |
break; |
| 295 |
case 'google-charts': |
| 296 |
default: |
| 297 |
echo "<span style='margin-left: 8px'>" . __('Google Charts', $this->plugin_name) . "</span>"; |
| 298 |
break; |
| 299 |
} |
| 300 |
?></td> |
| 301 |
<td class="column-shortcode"> |
| 302 |
<div class="ays-chart-shortcode-container"> |
| 303 |
<div class="ays-chart-copy-image" data-bs-toggle="tooltip" title="<?php echo esc_html(__('Click to copy',"chart-builder"));?>"> |
| 304 |
<img src='<?php echo esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/copy-image.svg" ?>'> |
| 305 |
</div> |
| 306 |
<!-- <input type="text" class="ays-chart-shortcode-input" onClick="this.setSelectionRange(0, this.value.length)" readonly value="<//?= esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" /> --> |
| 307 |
<input type="text" class="ays-chart-shortcode-input" readonly value="<?php echo esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" /> |
| 308 |
</div> |
| 309 |
</td> |
| 310 |
<td class="column-author"><?php |
| 311 |
$author = get_user_by("id", $item['author_id']); |
| 312 |
if( $author ){ |
| 313 |
$author_name = $author->data->display_name; |
| 314 |
echo esc_html($author_name); |
| 315 |
} else { |
| 316 |
echo '<span style="color:red">'.__('Deleted user', 'chart-builder').'</span>'; |
| 317 |
} |
| 318 |
?></td> |
| 319 |
<td class="column-status"><?php |
| 320 |
$status = ucfirst( $item['status'] ); |
| 321 |
$html = "<p style='font-size:14px;margin:0;'>" . $status . "</p>"; |
| 322 |
|
| 323 |
echo wp_kses_post( $html ); |
| 324 |
?></td> |
| 325 |
<td class="column-date"><?php |
| 326 |
$date = date( 'Y/m/d', strtotime( $item['date_modified'] ) ); |
| 327 |
$title_date = date( 'l jS \of F Y h:i:s A', strtotime( $item['date_modified'] ) ); |
| 328 |
$html = "<p style='font-size:14px;margin:0;text-decoration: dotted underline;' title='" . $title_date . "'>" . $date . "</p>"; |
| 329 |
|
| 330 |
echo wp_kses_post( $html ); |
| 331 |
?></td> |
| 332 |
<td class="column-id"><?php echo esc_attr($item['id']) ?></td> |
| 333 |
</tr> |
| 334 |
<?php endforeach; ?> |
| 335 |
<?php else: ?> |
| 336 |
<tr> |
| 337 |
<td colspan="8"><?php echo esc_html(__( 'There are no items yet.', "chart-builder" )); ?></td> |
| 338 |
</tr> |
| 339 |
<?php endif; ?> |
| 340 |
</tbody> |
| 341 |
</table> |
| 342 |
<div class="ays-chart-table-actions-row"> |
| 343 |
<div class="ays-chart-table-actions-row-section"> |
| 344 |
<div class="ays-chart-delete-button"> |
| 345 |
<button name="bulk_delete" id="ays-chart-bulk-delete-bottom" disabled><i class="ays_fa ays_fa_trash"></i><?php echo esc_html(__( 'Delete', "chart-builder" )); ?></button> |
| 346 |
<button type="submit" name="bulk_delete_confirm" id="ays-chart-bulk-delete-confirm-bottom" style="display: none;"></button> |
| 347 |
</div> |
| 348 |
<div class="ays-chart-filter-section"> |
| 349 |
<select name="filterbytype" id="ays-chart-filter-select-bottom"> |
| 350 |
<option value=""><?= __( "Select Type", "chart-builder" ) ?></option> |
| 351 |
<?php |
| 352 |
foreach ( $chart_types as $k => $v ): |
| 353 |
$selected = ( $filter_by_type == ($k+1) ) ? 'selected' : ''; |
| 354 |
?> |
| 355 |
<option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 356 |
<?php |
| 357 |
endforeach; |
| 358 |
?> |
| 359 |
</select> |
| 360 |
<select name="filterbysource" id="ays-chart-filter-source-bottom"> |
| 361 |
<option value=""><?= __( "Select Source", "chart-builder" ) ?></option> |
| 362 |
<?php |
| 363 |
foreach ( $chart_sources as $k => $v ): |
| 364 |
$disabled = $k >= 2 ? 'disabled' : '' ; |
| 365 |
$selected = ( $filter_by_source == ($k+1) ) ? 'selected' : ''; |
| 366 |
?> |
| 367 |
<option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> |
| 368 |
<?php |
| 369 |
endforeach; |
| 370 |
?> |
| 371 |
</select> |
| 372 |
<select name="filterbychartsource" id="ays-chart-filter-chart-source-bottom"> |
| 373 |
<option value=""><?= __( "Select Chart Source", "chart-builder" ) ?></option> |
| 374 |
<?php |
| 375 |
foreach ( $chart_source_types as $k => $v ): |
| 376 |
$disabled = $k >= 2 ? 'disabled' : '' ; |
| 377 |
$selected = ( $filter_by_chart_source == ($k+1) ) ? 'selected' : ''; |
| 378 |
?> |
| 379 |
<option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> |
| 380 |
<?php |
| 381 |
endforeach; |
| 382 |
?> |
| 383 |
</select> |
| 384 |
<select name="filterbydate" id="ays-chart-filter-date-bottom"> |
| 385 |
<option value=""><?= __( "Select Date", "chart-builder" ) ?></option> |
| 386 |
<?php |
| 387 |
foreach ( $chart_dates as $k => $v ): |
| 388 |
$selected = ( $filter_by_date == $k ) ? 'selected' : ''; |
| 389 |
?> |
| 390 |
<option value="<?php echo esc_attr($k); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 391 |
<?php |
| 392 |
endforeach; |
| 393 |
?> |
| 394 |
</select> |
| 395 |
<select name="filterbyauthor" id="ays-chart-filter-author-bottom"> |
| 396 |
<?php if (isset($filter_by_author_data) && !empty($filter_by_author_data)): ?> |
| 397 |
<option value="<?php echo esc_html($filter_by_author_data['ID'])?>" selected><?php echo esc_html($filter_by_author_data['display_name'])?></option> |
| 398 |
<?php endif; ?> |
| 399 |
</select> |
| 400 |
<select name="orderby" id="ays-chart-order-by-bottom"> |
| 401 |
<option value=""><?= __( "Order by", "chart-builder" ) ?></option> |
| 402 |
<?php |
| 403 |
foreach ( $order_by_values as $k => $v ): |
| 404 |
// $disabled = $k >= 2 ? 'disabled' : '' ; |
| 405 |
$selected = ( $order_by == $k ) ? 'selected' : ''; |
| 406 |
?> |
| 407 |
<option value="<?php echo esc_attr($k); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 408 |
<?php |
| 409 |
endforeach; |
| 410 |
?> |
| 411 |
</select> |
| 412 |
<select name="order" id="ays-chart-order-bottom"> |
| 413 |
<?php |
| 414 |
foreach ( $order_values as $k => $v ): |
| 415 |
$selected = ( $order == $k ) ? 'selected' : ''; |
| 416 |
?> |
| 417 |
<option value="<?php echo esc_attr($k); ?>" <?php echo esc_attr($selected); ?>><?php echo esc_html($v); ?></option> |
| 418 |
<?php |
| 419 |
endforeach; |
| 420 |
?> |
| 421 |
</select> |
| 422 |
<button type="submit" name="ays_chart_filter" id="ays-chart-filter-bottom"><?php echo esc_html(__( 'Filter', "chart-builder" )); ?></button> |
| 423 |
<button type="submit" name="ays_chart_filter_clear" id="ays-chart-filter-clear-bottom"><?php echo esc_html(__( 'Clear filters', "chart-builder" )); ?></button> |
| 424 |
</div> |
| 425 |
</div> |
| 426 |
<?php if($chart_count_per_page > 1):?> |
| 427 |
<div class> |
| 428 |
<nav aria-label="Pagination" class="m-0"> |
| 429 |
<ul class="pagination m-0 p-2"> |
| 430 |
<?php for( $i = 0; $i < $chart_count_per_page; $i++ ): |
| 431 |
$url = esc_url_raw( remove_query_arg( false ) ); |
| 432 |
$url = esc_url_raw( add_query_arg( array( |
| 433 |
'paged' => $i + 1 |
| 434 |
), $url ) ); |
| 435 |
|
| 436 |
$active = ''; |
| 437 |
if( $chart_paged != '' ){ |
| 438 |
if( $chart_paged == $i + 1 ) { |
| 439 |
$active = 'active'; |
| 440 |
} |
| 441 |
} else { |
| 442 |
wp_safe_redirect($_SERVER['REQUEST_URI'] . "&paged=1"); |
| 443 |
} |
| 444 |
?> |
| 445 |
<li class="page-item <?php echo esc_attr($active) ?>"> |
| 446 |
<a class="page-link" href="<?php echo esc_url($url) ?>"><?php echo esc_attr(absint($i)) + 1; ?></a> |
| 447 |
</li> |
| 448 |
<?php endfor; ?> |
| 449 |
</ul> |
| 450 |
</nav> |
| 451 |
</div> |
| 452 |
<?php endif; ?> |
| 453 |
</div> |
| 454 |
</form> |
| 455 |
</div> |
| 456 |
</div> |
| 457 |
</div> |
| 458 |
<br class="clear"> |
| 459 |
<div class="ays-chart-add-new-button-box"> |
| 460 |
<?php |
| 461 |
echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary chart-add-new-bttn chart-add-new-button-new-design"> %s ' . __( 'Add New', "chart-builder" ) . '</a>', esc_attr( $_REQUEST['page'] ), 'add', $plus_icon_svg); |
| 462 |
?> |
| 463 |
</div> |
| 464 |
<?php if($chart_max_id <= 3): ?> |
| 465 |
<div class="ays-chart-create-chart-video-box" style="margin: 0 auto 30px;"> |
| 466 |
<div class="ays-chart-create-chart-title"> |
| 467 |
<h4><?php echo __( "Create Your First Chart in Under One Minute", $this->plugin_name ); ?></h4> |
| 468 |
</div> |
| 469 |
<div class="ays-chart-create-chart-youtube-video"> |
| 470 |
<iframe width="560" height="315" src="https://www.youtube.com/embed/ysjUMK0HH3c" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" loading="lazy" allowfullscreen style="max-width: 100%;"></iframe> |
| 471 |
</div> |
| 472 |
<div class="ays_chart_small_hint_text_for_message_variables" style="text-align: center;"> |
| 473 |
<?php echo __( 'Please note that this video will disappear once you created 4 charts.', $this->plugin_name ); ?> |
| 474 |
</div> |
| 475 |
<div class="ays-chart-create-chart-youtube-video-button-box"> |
| 476 |
<?php echo sprintf( '<a href="?page=%s&action=%s" class="ays-chart-add-new-button-video chart-add-new-button-new-design"> %s ' . __('Add New', $this->plugin_name) . '</a>', esc_attr( $_REQUEST['page'] ), 'add', $plus_icon_svg);?> |
| 477 |
</div> |
| 478 |
</div> |
| 479 |
<?php else: ?> |
| 480 |
<div class="ays-chart-create-chart-video-box ays-chart-create-chart-video-box-only-link" style="margin: auto;"> |
| 481 |
<div class="ays-chart-create-chart-youtube-video"> |
| 482 |
<?php echo $youtube_icon_svg; ?> |
| 483 |
<a href="https://www.youtube.com/watch?v=ysjUMK0HH3c" target="_blank" style="color:#2271b1;text-decoration:none" title="YouTube video player"><?php echo __("How to create chart in one minute?", $this->plugin_name); ?></a> |
| 484 |
</div> |
| 485 |
</div> |
| 486 |
<?php endif; ?> |
| 487 |
</div> |
| 488 |
</div> |
| 489 |
|