| @@ -75,8 +75,14 @@ | ||
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | 77 | // this will allow us to open the correct source tab by default. |
| 78 | 78 | $source_of_chart = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) ); |
| 79 | + // both import from wp and import from db have the same source so we need to differentiate. | |
| 80 | + $filter_config = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_FILTER_CONFIG, true ); | |
| 81 | + // if filter config is present, then its import from wp. | |
| 82 | + if ( ! empty( $filter_config ) ) { | |
| 83 | + $source_of_chart .= '_wp'; | |
| 84 | + } | |
| 79 | 85 | $type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); |
| 80 | 86 | ?> |
| 81 | 87 | <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>" data-chart-source="<?php echo $source_of_chart; ?>" data-chart-type="<?php echo $type; ?>"></span> |
| 82 | 88 | <iframe id="thehole" name="thehole"></iframe> |
| @@ -111,9 +117,9 @@ | ||
| 111 | 117 | |
| 112 | 118 | <div class="viz-section-items section-items"> |
| 113 | 119 | <p class="viz-group-description"><?php _e( 'You can use this to import data from a remote CSV file. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?> </p> |
| 114 | 120 | <p class="viz-group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">', $this->type, '.csv</a>' ); ?></p> |
| 115 | - <p class="viz-group-description"> <?php _e( 'You can also import data from Google Spreadsheet, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p> | |
| 121 | + <p class="viz-group-description"> <?php _e( 'You can also import data from Google Spreadsheet, for more info check <a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p> | |
| 116 | 122 | <form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post" |
| 117 | 123 | target="thehole" enctype="multipart/form-data"> |
| 118 | 124 | <div class="remote-file-section"> |
| 119 | 125 | <input type="url" id="remote-data" name="remote_data" |
| @@ -131,10 +137,10 @@ | ||
| 131 | 137 | <span |
| 132 | 138 | class="dashicons dashicons-lock"></span></span> |
| 133 | 139 | <div class="viz-section-items section-items"> |
| 134 | 140 | <p class="viz-group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', 'visualizer' ); ?> </p> |
| 135 | - <p class="viz-group-description"> <?php _e( 'You can also synchronize with your Google Spreadsheet file, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p> | |
| 136 | - <p class="viz-group-description"> <?php _e( 'We will update the chart data based on your time interval preference by overwritting the current data with the one from the URL.', 'visualizer' ); ?></p> | |
| 141 | + <p class="viz-group-description"> <?php _e( 'You can also synchronize with your Google Spreadsheet file, for more info check <a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p> | |
| 142 | + <p class="viz-group-description"> <?php _e( 'We will update the chart data based on your time interval preference by overwriting the current data with the one from the URL.', 'visualizer' ); ?></p> | |
| 137 | 143 | <form id="vz-schedule-import" action="<?php echo $upload_link; ?>" method="post" |
| 138 | 144 | target="thehole" enctype="multipart/form-data"> |
| 139 | 145 | <div class="remote-file-section"> |
| 140 | 146 | <input type="url" id="vz-schedule-url" name="remote_data" |
| @@ -214,18 +220,51 @@ | ||
| 214 | 220 | </div> |
| 215 | 221 | </div> |
| 216 | 222 | </li> |
| 217 | 223 | |
| 218 | - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> "> | |
| 224 | + <?php | |
| 225 | + $save_filter = add_query_arg( | |
| 226 | + array( | |
| 227 | + 'action' => Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY, | |
| 228 | + 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY . Visualizer_Plugin::VERSION ), | |
| 229 | + 'chart' => $this->chart->ID, | |
| 230 | + ), admin_url( 'admin-ajax.php' ) | |
| 231 | + ); | |
| 232 | + ?> | |
| 233 | + <li class="viz-group visualizer_source_query_wp <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> "> | |
| 219 | 234 | <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span |
| 220 | 235 | class="dashicons dashicons-lock"></span></h2> |
| 221 | 236 | <div class="viz-group-content edit-data-content"> |
| 222 | 237 | <div> |
| 223 | 238 | <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p> |
| 224 | - <input type="button" id="filter-chart-button" class="button button-primary " | |
| 225 | - value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart" | |
| 226 | - data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" | |
| 227 | - data-t-chart="<?php _e( 'Create Filters', 'visualizer' ); ?>"> | |
| 239 | + <form id="vz-filter-wizard" action="<?php echo $save_filter; ?>" method="post" target="thehole"> | |
| 240 | + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from WordPress.', 'visualizer' ); ?></p> | |
| 241 | + <select name="refresh" id="vz-filter-import-time" class="visualizer-select"> | |
| 242 | + <?php | |
| 243 | + $bttn_label = 'visualizer_source_query_wp' === $source_of_chart ? __( 'Modify Filter', 'visualizer' ) : __( 'Create Filter', 'visualizer' ); | |
| 244 | + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true ); | |
| 245 | + $schedules = apply_filters( | |
| 246 | + 'visualizer_schedules', array( | |
| 247 | + '0' => __( 'Live', 'visualizer' ), | |
| 248 | + '1' => __( 'Each hour', 'visualizer' ), | |
| 249 | + '12' => __( 'Each 12 hours', 'visualizer' ), | |
| 250 | + '24' => __( 'Each day', 'visualizer' ), | |
| 251 | + '72' => __( 'Each 3 days', 'visualizer' ), | |
| 252 | + ) | |
| 253 | + ); | |
| 254 | + foreach ( $schedules as $num => $name ) { | |
| 255 | + $extra = $num == $hours ? 'selected' : ''; | |
| 256 | + ?> | |
| 257 | + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option> | |
| 258 | + <?php | |
| 259 | + } | |
| 260 | + ?> | |
| 261 | + </select> | |
| 262 | + | |
| 263 | + <input type="button" id="filter-chart-button" class="button button-secondary" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>"> | |
| 264 | + <input type="button" id="db-filter-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>"> | |
| 265 | + <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?> | |
| 266 | + </form> | |
| 228 | 267 | <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?> |
| 229 | 268 | </div> |
| 230 | 269 | </div> |
| 231 | 270 | </li> |
| @@ -243,44 +282,40 @@ | ||
| 243 | 282 | <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span |
| 244 | 283 | class="dashicons dashicons-lock"></span></h2> |
| 245 | 284 | <div class="viz-group-content edit-data-content"> |
| 246 | 285 | <div> |
| 247 | - <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p> | |
| 248 | - <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole"> | |
| 249 | - <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p> | |
| 250 | - <select name="refresh" id="vz-db-import-time" class="visualizer-select"> | |
| 251 | - <?php | |
| 252 | - $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' ); | |
| 253 | - $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true ); | |
| 254 | - $schedules = apply_filters( | |
| 255 | - 'visualizer_schedules', array( | |
| 256 | - '0' => __( 'Live', 'visualizer' ), | |
| 257 | - '1' => __( 'Each hour', 'visualizer' ), | |
| 258 | - '12' => __( 'Each 12 hours', 'visualizer' ), | |
| 259 | - '24' => __( 'Each day', 'visualizer' ), | |
| 260 | - '72' => __( 'Each 3 days', 'visualizer' ), | |
| 261 | - ) | |
| 262 | - ); | |
| 263 | - foreach ( $schedules as $num => $name ) { | |
| 264 | - $extra = $num == $hours ? 'selected' : ''; | |
| 286 | + <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p> | |
| 287 | + <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole"> | |
| 288 | + <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p> | |
| 289 | + <select name="refresh" id="vz-db-import-time" class="visualizer-select"> | |
| 290 | + <?php | |
| 291 | + $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' ); | |
| 292 | + $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true ); | |
| 293 | + $schedules = apply_filters( | |
| 294 | + 'visualizer_schedules', array( | |
| 295 | + '0' => __( 'Live', 'visualizer' ), | |
| 296 | + '1' => __( 'Each hour', 'visualizer' ), | |
| 297 | + '12' => __( 'Each 12 hours', 'visualizer' ), | |
| 298 | + '24' => __( 'Each day', 'visualizer' ), | |
| 299 | + '72' => __( 'Each 3 days', 'visualizer' ), | |
| 300 | + ) | |
| 301 | + ); | |
| 302 | + foreach ( $schedules as $num => $name ) { | |
| 303 | + $extra = $num == $hours ? 'selected' : ''; | |
| 304 | + ?> | |
| 305 | + <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option> | |
| 306 | + <?php | |
| 307 | + } | |
| 265 | 308 | ?> |
| 266 | - <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option> | |
| 267 | - <?php | |
| 268 | - } | |
| 269 | - ?> | |
| 270 | - </select> | |
| 271 | - <input type="hidden" name="params" id="viz-db-wizard-params"> | |
| 309 | + </select> | |
| 310 | + <input type="hidden" name="params" id="viz-db-wizard-params"> | |
| 272 | 311 | |
| 273 | - <input type="button" id="db-chart-button" class="button button-secondary " | |
| 274 | - value="<?php echo $bttn_label; ?>" data-current="chart" | |
| 275 | - data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" | |
| 276 | - data-t-chart="<?php echo $bttn_label; ?>"> | |
| 277 | - <input type="button" id="db-chart-save-button" class="button button-primary " | |
| 278 | - value="<?php _e( 'Save Schedule', 'visualizer' ); ?>"> | |
| 312 | + <input type="button" id="db-chart-button" class="button button-secondary" value="<?php echo $bttn_label; ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" data-t-chart="<?php echo $bttn_label; ?>"> | |
| 313 | + <input type="button" id="db-chart-save-button" class="button button-primary" value="<?php _e( 'Save Schedule', 'visualizer' ); ?>"> | |
| 279 | 314 | <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?> |
| 280 | - </form> | |
| 281 | - </div> | |
| 282 | - </div> | |
| 315 | + </form> | |
| 316 | + </div> | |
| 317 | + </div> | |
| 283 | 318 | </li> |
| 284 | 319 | |
| 285 | 320 | <?php |
| 286 | 321 | // we will auto-open the manual data feature but only when pro is active and source is empty. |
| @@ -325,8 +360,12 @@ | ||
| 325 | 360 | <form id="cancel-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>" method="post"> |
| 326 | 361 | <input type="hidden" name="cancel" value="1"> |
| 327 | 362 | </form> |
| 328 | 363 | </ul> |
| 364 | + </li> | |
| 365 | + | |
| 366 | + <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-docs"> | |
| 367 | + <h2><span class="dashicons dashicons-editor-help"></span><a href="https://docs.themeisle.com/category/657-visualizer" target="_blank"><?php _e( 'Docs', 'visualizer' ); ?></a></h2> | |
| 329 | 368 | </li> |
| 330 | 369 | |
| 331 | 370 | <?php $this->getPermissionsLink( $this->chart->ID ); ?> |
| 332 | 371 | |