| @@ -232,13 +232,22 @@ | ||
| 232 | 232 | $count = 0; |
| 233 | 233 | foreach ( $this->charts as $placeholder_id => $chart ) { |
| 234 | 234 | // show the sidebar after the first 3 charts. |
| 235 | 235 | $count++; |
| 236 | + $enable_controls = false; | |
| 237 | + $settings = isset( $chart['settings'] ) ? $chart['settings'] : array(); | |
| 238 | + if ( ! empty( $settings['controls']['controlType'] ) ) { | |
| 239 | + $column_index = $settings['controls']['filterColumnIndex']; | |
| 240 | + $column_label = $settings['controls']['filterColumnLabel']; | |
| 241 | + if ( 'false' !== $column_index || 'false' !== $column_label ) { | |
| 242 | + $enable_controls = true; | |
| 243 | + } | |
| 244 | + } | |
| 236 | 245 | if ( 3 === $count ) { |
| 237 | 246 | $this->_renderSidebar(); |
| 238 | - $this->_renderChartBox( $placeholder_id, $chart['id'] ); | |
| 247 | + $this->_renderChartBox( $placeholder_id, $chart['id'], $enable_controls ); | |
| 239 | 248 | } else { |
| 240 | - $this->_renderChartBox( $placeholder_id, $chart['id'] ); | |
| 249 | + $this->_renderChartBox( $placeholder_id, $chart['id'], $enable_controls ); | |
| 241 | 250 | } |
| 242 | 251 | } |
| 243 | 252 | // show the sidebar if there are less than 3 charts. |
| 244 | 253 | if ( $count < 3 ) { |
| @@ -281,9 +290,9 @@ | ||
| 281 | 290 | * |
| 282 | 291 | * @param string $placeholder_id The placeholder's id for the chart. |
| 283 | 292 | * @param int $chart_id The id of the chart. |
| 284 | 293 | */ |
| 285 | - private function _renderChartBox( $placeholder_id, $chart_id ) { | |
| 294 | + private function _renderChartBox( $placeholder_id, $chart_id, $with_filter = false ) { | |
| 286 | 295 | $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS ); |
| 287 | 296 | $title = '#' . $chart_id; |
| 288 | 297 | if ( ! empty( $settings[0]['title'] ) ) { |
| 289 | 298 | $title = $settings[0]['title']; |
| @@ -335,11 +344,18 @@ | ||
| 335 | 344 | $chart_status['title'] = __( 'Click to view the error', 'visualizer' ); |
| 336 | 345 | } |
| 337 | 346 | $shortcode = sprintf( '[visualizer id="%s" lazy="no" class=""]', $chart_id ); |
| 338 | 347 | echo '<div class="items"><div class="visualizer-chart"><div class="visualizer-chart-title">', esc_html( $title ), '</div>'; |
| 348 | + if ( Visualizer_Module::is_pro() && $with_filter ) { | |
| 349 | + echo '<div id="chart_wrapper_' . $placeholder_id . '">'; | |
| 350 | + echo '<div id="control_wrapper_' . $placeholder_id . '" class="vz-library-chart-filter"></div>'; | |
| 351 | + } | |
| 339 | 352 | echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">'; |
| 340 | 353 | echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">'; |
| 341 | 354 | echo '</div>'; |
| 355 | + if ( Visualizer_Module::is_pro() && $with_filter ) { | |
| 356 | + echo '</div>'; | |
| 357 | + } | |
| 342 | 358 | echo '<div class="visualizer-chart-footer visualizer-clearfix">'; |
| 343 | 359 | echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>'; |
| 344 | 360 | echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>'; |
| 345 | 361 | echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>'; |