Skip to content

Commit 2359ed6

Browse files
committed
added is bussiness check
1 parent 59b2f97 commit 2359ed6

File tree

1 file changed

+75
-72
lines changed

1 file changed

+75
-72
lines changed

classes/Visualizer/Render/Page/Data.php

Lines changed: 75 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
// +----------------------------------------------------------------------+
43
// | Copyright 2013 Madpixels (email : [email protected]) |
54
// +----------------------------------------------------------------------+
@@ -19,6 +18,7 @@
1918
// +----------------------------------------------------------------------+
2019
// | Author: Eugene Manuilov <[email protected]> |
2120
// +----------------------------------------------------------------------+
21+
2222
/**
2323
* Renders chart data setup page.
2424
*
@@ -65,9 +65,8 @@ protected function _renderSidebarContent() {
6565
'nonce' => wp_create_nonce(),
6666
'chart' => $this->chart->ID,
6767
), admin_url( 'admin-ajax.php' ) );
68-
6968
?>
70-
<span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID;?>"></span>
69+
<span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>"></span>
7170
<iframe id="thehole" name="thehole"></iframe>
7271
<ul class="group-wrapper full-height">
7372
<li class="group group-category open" id="vz-chart-source">
@@ -80,15 +79,15 @@ protected function _renderSidebarContent() {
8079
<h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
8180
<div class="group-content">
8281
<p class="group-description"><?php esc_html_e( 'Select and upload your data CSV file here. 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>
83-
<p class="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>
82+
<p class="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>
8483
<form id="vz-csv-file-form" action="<?php echo $upload_link ?>" method="post"
85-
target="thehole" enctype="multipart/form-data">
84+
target="thehole" enctype="multipart/form-data">
8685
<input type="hidden" id="remote-data" name="remote_data">
8786
<div class="">
8887
<input type="file" id="csv-file" name="local_data">
8988
</div>
9089
<input type="button" class="button button-primary" id="vz-import-file"
91-
value="<?php _e( 'Import', 'visualizer' ); ?>">
90+
value="<?php _e( 'Import', 'visualizer' ); ?>">
9291
</form>
9392
</div>
9493
</li>
@@ -100,130 +99,135 @@ protected function _renderSidebarContent() {
10099

101100
<div class="section-items">
102101
<p class="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>
103-
<p class="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>
102+
<p class="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>
104103
<p class="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>
105104
<form id="vz-one-time-import" action="<?php echo $upload_link ?>" method="post"
106-
target="thehole" enctype="multipart/form-data">
105+
target="thehole" enctype="multipart/form-data">
107106
<div class="remote-file-section">
108107
<input type="url" id="remote-data" name="remote_data"
109-
placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
110-
class="visualizer-input">
108+
placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
109+
class="visualizer-input">
111110

112111
</div>
113112
<input type="button" id="view-remote-file" class="button button-primary"
114-
value="<?php _e( 'Import', 'visualizer' ); ?>">
113+
value="<?php _e( 'Import', 'visualizer' ); ?>">
115114
</form>
116115
</div>
117116
</li>
118-
<li class="subsection <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature', 'schedule-chart' ); ?>">
119-
<span class="section-title visualizer-import-url-schedule"><?php _e( 'Schedule Import', 'visualizer' ); ?><span
117+
<li class="subsection <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?>">
118+
<span class="section-title visualizer-import-url-schedule"><?php _e( 'Schedule Import', 'visualizer' ); ?>
119+
<span
120120
class="dashicons dashicons-lock"></span></span>
121121
<div class="section-items">
122122
<p class="group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', 'visualizer' ); ?> </p>
123123
<p class="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>
124124
<p class="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>
125125
<form id="vz-schedule-import" action="<?php echo $upload_link ?>" method="post"
126-
target="thehole" enctype="multipart/form-data">
126+
target="thehole" enctype="multipart/form-data">
127127
<div class="remote-file-section">
128-
<input type="url" id="vz-schedule-url" name="remote_data" value="<?php echo get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true );?>"
129-
placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
130-
class="visualizer-input visualizer-remote-url">
128+
<input type="url" id="vz-schedule-url" name="remote_data"
129+
value="<?php echo get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true ); ?>"
130+
placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
131+
class="visualizer-input visualizer-remote-url">
131132
<p class="group-description"><?php _e( 'How often do you want to check the url', 'visualizer' ); ?></p>
132-
<select name="vz-import-time" id="vz-import-time" class="visualizer-select">
133-
<?php
134-
$hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
135-
$schedules = array(
136-
'1' => __( 'Each hour', 'visualizer' ),
137-
'12' => __( 'Each 12 hours', 'visualizer' ),
138-
'24' => __( 'Each day', 'visualizer' ),
139-
'36' => __( 'Each 3 days', 'visualizer' ),
140-
);
141-
foreach ( $schedules as $num => $name ) {
142-
$extra = $num == $hours ? 'selected' : '';
143-
?>
144-
<option value="<?php echo $num;?>" <?php echo $extra;?>><?php echo $name;?></option>
145-
<?php
146-
}
147-
?>
133+
<select name="vz-import-time" id="vz-import-time"
134+
class="visualizer-select">
135+
<?php
136+
$hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
137+
$schedules = array(
138+
'1' => __( 'Each hour', 'visualizer' ),
139+
'12' => __( 'Each 12 hours', 'visualizer' ),
140+
'24' => __( 'Each day', 'visualizer' ),
141+
'36' => __( 'Each 3 days', 'visualizer' ),
142+
);
143+
foreach ( $schedules as $num => $name ) {
144+
$extra = $num == $hours ? 'selected' : '';
145+
?>
146+
<option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
147+
<?php
148+
}
149+
?>
148150
</select>
149151
</div>
150152
<input type="button" id="vz-save-schedule" class="button button-primary"
151-
value="<?php _e( 'Save schedule', 'visualizer' ); ?>">
152-
153+
value="<?php _e( 'Save schedule', 'visualizer' ); ?>">
153154

154155
<?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
155156
</form>
156157
</div>
157158
</li>
158159
</ul>
159160
</li>
160-
<li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?> ">
161+
<li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class' ); ?> ">
161162
<h2 class="group-title sub-group"
162-
data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
163+
data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
163164
class="dashicons dashicons-lock"></span></h2>
164165
<div class="group-content edit-data-content">
165166
<div>
166167
<p class="group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
167168
<form>
168169
<select name="vz-import-from-chart" id="chart-id" class="visualizer-select">
169-
<?php
170-
$fetch_link = add_query_arg( array(
171-
'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
172-
'nonce' => wp_create_nonce(),
173-
), admin_url( 'admin-ajax.php' ) );
174-
175-
$query_args_charts = array(
176-
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
177-
'posts_per_page' => 300,
178-
'no_found_rows' => true,
179-
);
180-
$charts = array();
181-
$query = new WP_Query( $query_args_charts );
182-
while ( $query->have_posts() ) {
183-
$chart = $query->next_post();
184-
$settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
185-
?>
186-
<option value="<?php echo $chart->ID; ?>"><?php echo empty( $settings['title'] ) ? '#' . $chart->ID : $settings['title']; ?></option>
187-
<?php
188-
}
189-
?>
170+
<?php
171+
$fetch_link = add_query_arg( array(
172+
'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
173+
'nonce' => wp_create_nonce(),
174+
), admin_url( 'admin-ajax.php' ) );
175+
$query_args_charts = array(
176+
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
177+
'posts_per_page' => 300,
178+
'no_found_rows' => true,
179+
);
180+
$charts = array();
181+
$query = new WP_Query( $query_args_charts );
182+
while ( $query->have_posts() ) {
183+
$chart = $query->next_post();
184+
$settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
185+
?>
186+
<option value="<?php echo $chart->ID; ?>"><?php echo empty( $settings['title'] ) ? '#' . $chart->ID : $settings['title']; ?></option>
187+
<?php
188+
}
189+
?>
190190

191191
</select>
192192
</form>
193-
<input type="button" id="existing-chart" class="button button-primary"
194-
value="<?php _e( 'Import Chart', 'visualizer' ); ?>" data-viz-link="<?php echo $fetch_link;?>">
193+
<input type="button" id="existing-chart" class="button button-primary"
194+
value="<?php _e( 'Import Chart', 'visualizer' ); ?>"
195+
data-viz-link="<?php echo $fetch_link; ?>">
195196
<?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
196197
</div>
197198
</div>
198199
</li>
199200

200-
<li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?> ">
201+
<li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
201202
<h2 class="group-title sub-group"><?php _e( 'Import from Wordpress', 'visualizer' ); ?><span
202203
class="dashicons dashicons-lock"></span></h2>
203204
<div class="group-content edit-data-content">
204205
<div>
205206
<p class="group-description"><?php _e( 'You can import here data from Wordpress', 'visualizer' ); ?></p>
206207
<input type="button" id="filter-chart-button" class="button button-primary "
207-
value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart" data-t-filter="<?php _e( 'Show Chart', 'visualizer' );?>" data-t-chart="<?php _e( 'Create Filters', 'visualizer' );?>">
208-
<?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
208+
value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart"
209+
data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
210+
data-t-chart="<?php _e( 'Create Filters', 'visualizer' ); ?>">
211+
<?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
209212
</div>
210213
</div>
211214
</li>
212215

213-
214-
<li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?>">
216+
<li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>">
215217
<h2 class="group-title sub-group visualizer-editor-tab"
216-
data-current="chart"><?php _e( 'Edit current data', 'visualizer' ); ?><span
218+
data-current="chart"><?php _e( 'Edit current data', 'visualizer' ); ?><span
217219
class="dashicons dashicons-lock"></span></h2>
218-
<form id="editor-form" action="<?php echo $upload_link?>" method="post" target="thehole">
219-
<input type="hidden" id="chart-data" name="chart_data">
220-
</form>
220+
<form id="editor-form" action="<?php echo $upload_link ?>" method="post" target="thehole">
221+
<input type="hidden" id="chart-data" name="chart_data">
222+
</form>
221223

222224
<div class="group-content edit-data-content">
223225
<div>
224226
<p class="group-description"><?php _e( 'You can manually edit the chart data using the spreadsheet like editor.', 'visualizer' ); ?></p>
225227
<input type="button" id="editor-chart-button" class="button button-primary "
226-
value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart" data-t-editor="<?php _e( 'Show Chart', 'visualizer' );?>" data-t-chart="<?php _e( 'View Editor', 'visualizer' );?>">
228+
value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart"
229+
data-t-editor="<?php _e( 'Show Chart', 'visualizer' ); ?>"
230+
data-t-chart="<?php _e( 'View Editor', 'visualizer' ); ?>">
227231

228232
<?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
229233
</div>
@@ -240,7 +244,7 @@ class="dashicons dashicons-lock"></span></h2>
240244
</div>
241245
<ul class="group-content">
242246
<form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>"
243-
method="post">
247+
method="post">
244248
<?php echo $this->sidebar; ?>
245249
</form>
246250
</ul>
@@ -270,7 +274,6 @@ protected function _renderToolbar() {
270274
echo '</a>';
271275
echo '</div>';
272276
echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
273-
274277
echo '</div>';
275278

276279
}

0 commit comments

Comments
 (0)