PluginProbe
Chartify – WordPress Chart Plugin / 3.7.8
Chartify – WordPress Chart Plugin v3.7.8
3.8.0 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 trunk 1.0.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 All 83 releases
chart-builder / admin / partials / charts / chart-builder-charts-display.php

chart-builder-charts-display.php in Chartify – WordPress Chart Plugin 3.7.8, at admin/partials/charts/chart-builder-charts-display.php

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