1
1
<?php
2
-
3
2
// +----------------------------------------------------------------------+
4
3
// | Copyright 2013 Madpixels (email : [email protected] ) |
5
4
// +----------------------------------------------------------------------+
19
18
// +----------------------------------------------------------------------+
20
19
// | Author: Eugene Manuilov <[email protected] > |
21
20
// +----------------------------------------------------------------------+
21
+
22
22
/**
23
23
* Renders chart data setup page.
24
24
*
@@ -65,9 +65,8 @@ protected function _renderSidebarContent() {
65
65
'nonce ' => wp_create_nonce (),
66
66
'chart ' => $ this ->chart ->ID ,
67
67
), admin_url ( 'admin-ajax.php ' ) );
68
-
69
68
?>
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>
71
70
<iframe id="thehole" name="thehole"></iframe>
72
71
<ul class="group-wrapper full-height">
73
72
<li class="group group-category open" id="vz-chart-source">
@@ -80,15 +79,15 @@ protected function _renderSidebarContent() {
80
79
<h2 class="group-title sub-group visualizer-src-tab"><?php _e ( 'Import data from file ' , 'visualizer ' ); ?> </h2>
81
80
<div class="group-content">
82
81
<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>
84
83
<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">
86
85
<input type="hidden" id="remote-data" name="remote_data">
87
86
<div class="">
88
87
<input type="file" id="csv-file" name="local_data">
89
88
</div>
90
89
<input type="button" class="button button-primary" id="vz-import-file"
91
- value="<?php _e ( 'Import ' , 'visualizer ' ); ?> ">
90
+ value="<?php _e ( 'Import ' , 'visualizer ' ); ?> ">
92
91
</form>
93
92
</div>
94
93
</li>
@@ -100,130 +99,135 @@ protected function _renderSidebarContent() {
100
99
101
100
<div class="section-items">
102
101
<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>
104
103
<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>
105
104
<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">
107
106
<div class="remote-file-section">
108
107
<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">
111
110
112
111
</div>
113
112
<input type="button" id="view-remote-file" class="button button-primary"
114
- value="<?php _e ( 'Import ' , 'visualizer ' ); ?> ">
113
+ value="<?php _e ( 'Import ' , 'visualizer ' ); ?> ">
115
114
</form>
116
115
</div>
117
116
</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
120
120
class="dashicons dashicons-lock"></span></span>
121
121
<div class="section-items">
122
122
<p class="group-description"><?php _e ( 'You can choose here to synchronize your chart data with a remote CSV file. ' , 'visualizer ' ); ?> </p>
123
123
<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>
124
124
<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>
125
125
<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">
127
127
<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">
131
132
<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
+ ?>
148
150
</select>
149
151
</div>
150
152
<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 ' ); ?> ">
153
154
154
155
<?php echo apply_filters ( 'visualizer_pro_upsell ' , '' , 'schedule-chart ' ); ?>
155
156
</form>
156
157
</div>
157
158
</li>
158
159
</ul>
159
160
</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 ' ); ?> ">
161
162
<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
163
164
class="dashicons dashicons-lock"></span></h2>
164
165
<div class="group-content edit-data-content">
165
166
<div>
166
167
<p class="group-description"><?php _e ( 'You can import here data from your previously created charts ' , 'visualizer ' ); ?> </p>
167
168
<form>
168
169
<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
+ ?>
190
190
191
191
</select>
192
192
</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 ; ?> ">
195
196
<?php echo apply_filters ( 'visualizer_pro_upsell ' , '' ); ?>
196
197
</div>
197
198
</div>
198
199
</li>
199
200
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 ' ); ?> ">
201
202
<h2 class="group-title sub-group"><?php _e ( 'Import from Wordpress ' , 'visualizer ' ); ?> <span
202
203
class="dashicons dashicons-lock"></span></h2>
203
204
<div class="group-content edit-data-content">
204
205
<div>
205
206
<p class="group-description"><?php _e ( 'You can import here data from Wordpress ' , 'visualizer ' ); ?> </p>
206
207
<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 ' ); ?>
209
212
</div>
210
213
</div>
211
214
</li>
212
215
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 ' ); ?> ">
215
217
<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
217
219
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>
221
223
222
224
<div class="group-content edit-data-content">
223
225
<div>
224
226
<p class="group-description"><?php _e ( 'You can manually edit the chart data using the spreadsheet like editor. ' , 'visualizer ' ); ?> </p>
225
227
<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 ' ); ?> ">
227
231
228
232
<?php echo apply_filters ( 'visualizer_pro_upsell ' , '' ); ?>
229
233
</div>
@@ -240,7 +244,7 @@ class="dashicons dashicons-lock"></span></h2>
240
244
</div>
241
245
<ul class="group-content">
242
246
<form id="settings-form" action="<?php echo add_query_arg ( 'nonce ' , wp_create_nonce () ); ?> "
243
- method="post">
247
+ method="post">
244
248
<?php echo $ this ->sidebar ; ?>
245
249
</form>
246
250
</ul>
@@ -270,7 +274,6 @@ protected function _renderToolbar() {
270
274
echo '</a> ' ;
271
275
echo '</div> ' ;
272
276
echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value=" ' , $ this ->button , '"> ' ;
273
-
274
277
echo '</div> ' ;
275
278
276
279
}
0 commit comments