Version Description
- Feature: Removed limitation for number of rows in tables
- Feature: Added functionality for creating Google charts(Line, Column and Pie)
- Feature: Added options for customizing Google charts(Line, Column and Pie)
- Bug fixes and stability improvements.
Download this release
Release Info
Developer | wpDataTables |
Plugin | wpDataTables Lite |
Version | 2.013 |
Comparing to | |
See all releases |
Code changes from version 2.0.12 to 2.013
- assets/css/admin/browse.css +2 -1
- assets/css/bootstrap/wpdatatables-bootstrap.css +18 -4
- assets/css/wpdatatables_admin.css +6 -7
- assets/js/gutenberg/wpdatacharts-gutenberg-block.js +156 -0
- assets/js/wpdatatables/admin/browse/wdt.browse.js +61 -18
- assets/js/wpdatatables/wdt.chartWizard.js +699 -5
- assets/js/wpdatatables/wdt.chartsRender.js +37 -0
- assets/js/wpdatatables/wdt.chartsRender.min.js +1 -0
- assets/js/wpdatatables/wdt.googleCharts.js +229 -0
- assets/js/wpdatatables/wdt.googleCharts.min.js +1 -0
- config/config.inc.php +1 -3
- controllers/wdt_admin.php +5 -3
- controllers/wdt_admin_ajax_actions.php +87 -0
- controllers/wdt_functions.php +1 -0
- license.txt +280 -0
- readme.txt +42 -33
- source/GutenbergBlock.php +94 -0
- source/WpDataChartsGutenbergBlock.php +61 -0
- source/WpDataTablesGutenbergBlock.php +11 -89
- source/class.sql.php +69 -57
- source/class.wdtbrowsechartstable.php +18 -119
- source/class.wdttools.php +75 -58
- source/class.wpdatachart.php +1102 -0
- source/class.wpdatatable.php +311 -181
- templates/admin/browse/chart/browse.inc.php +14 -4
- templates/admin/browse/chart/duplicate_chart_modal.inc.php +51 -0
- templates/admin/chart_wizard/chart_wizard.inc.php +65 -6
- templates/admin/chart_wizard/steps/charts_pick/chartjs.inc.php +9 -9
- templates/admin/chart_wizard/steps/charts_pick/google_charts.inc.php +28 -28
- templates/admin/chart_wizard/steps/charts_pick/highcharts.inc.php +19 -19
- templates/admin/chart_wizard/steps/step1.inc.php +8 -3
- templates/admin/chart_wizard/steps/step2.inc.php +27 -0
- templates/admin/chart_wizard/steps/step3.inc.php +99 -0
- templates/admin/chart_wizard/steps/step4.inc.php +546 -0
- templates/admin/chart_wizard/steps/step5.inc.php +9 -0
- templates/browse_charts.inc.php +0 -34
- templates/chart_js_template.inc.php +0 -8
- templates/wpdatachart.inc.php +14 -0
- wpdatatables.php +10 -11
assets/css/admin/browse.css
CHANGED
@@ -104,7 +104,8 @@
|
|
104 |
color: #cdcdcd
|
105 |
}
|
106 |
|
107 |
-
.wdt-datatables-admin-wrap .card.wdt-browse-table table .column-functions a.wdt-duplicate-table:before
|
|
|
108 |
font-family: WPDataTablesIcons;
|
109 |
content:"\e900";
|
110 |
font-size: 16px;
|
104 |
color: #cdcdcd
|
105 |
}
|
106 |
|
107 |
+
.wdt-datatables-admin-wrap .card.wdt-browse-table table .column-functions a.wdt-duplicate-table:before,
|
108 |
+
.wdt-datatables-admin-wrap .card.wdt-browse-table table .column-functions a.wdt-duplicate-chart:before {
|
109 |
font-family: WPDataTablesIcons;
|
110 |
content:"\e900";
|
111 |
font-size: 16px;
|
assets/css/bootstrap/wpdatatables-bootstrap.css
CHANGED
@@ -1398,6 +1398,21 @@
|
|
1398 |
text-decoration: none;
|
1399 |
}
|
1400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1401 |
.wpdt-c a:hover,
|
1402 |
.wpdt-c a:focus {
|
1403 |
color: #0a6ebd;
|
@@ -8163,7 +8178,7 @@ select.input-group-lg > .input-group-btn > .btn {
|
|
8163 |
}
|
8164 |
|
8165 |
.wpdt-c .waves-button,
|
8166 |
-
.wpdt-c
|
8167 |
.wpdt-c .wpDataTablesWrapper .waves-button,
|
8168 |
.wpdt-c .wpDataTablesWrapper .waves-circle {
|
8169 |
-webkit-transform: translateZ(0);
|
@@ -8216,7 +8231,7 @@ select.input-group-lg > .input-group-btn > .btn {
|
|
8216 |
}
|
8217 |
|
8218 |
.wpdt-c .waves-circle,
|
8219 |
-
.wpdt-c .wpDataTablesWrapper .waves-circle{
|
8220 |
text-align: center;
|
8221 |
width: 2.5em;
|
8222 |
height: 2.5em;
|
@@ -10499,7 +10514,6 @@ select.input-group-lg > .input-group-btn > .btn {
|
|
10499 |
}
|
10500 |
|
10501 |
|
10502 |
-
|
10503 |
/*-------------------------
|
10504 |
Picture List
|
10505 |
--------------------------*/
|
@@ -13009,6 +13023,6 @@ input:focus {
|
|
13009 |
font-size: 14px;
|
13010 |
}
|
13011 |
|
13012 |
-
.wdt-include-bootstrap-block
|
13013 |
margin-bottom: 25px;
|
13014 |
}
|
1398 |
text-decoration: none;
|
1399 |
}
|
1400 |
|
1401 |
+
.wpdt-c a.dark {
|
1402 |
+
color: #23282d;
|
1403 |
+
cursor: pointer;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
.wpdt-c .card.disabled,
|
1407 |
+
.wpdt-c .p-l-0.data-filtering.disabled,
|
1408 |
+
.wpdt-c .pull-right.p-r-0.disabled,
|
1409 |
+
.wpdt-c #chart-container-tabs .disabled,
|
1410 |
+
.wpdt-c .highcharts-charts-type .disabled,
|
1411 |
+
.wpdt-c .chartjs-charts-type .disabled {
|
1412 |
+
pointer-events: none;
|
1413 |
+
opacity: 0.5;
|
1414 |
+
}
|
1415 |
+
|
1416 |
.wpdt-c a:hover,
|
1417 |
.wpdt-c a:focus {
|
1418 |
color: #0a6ebd;
|
8178 |
}
|
8179 |
|
8180 |
.wpdt-c .waves-button,
|
8181 |
+
.wpdt-c .waves-circle,
|
8182 |
.wpdt-c .wpDataTablesWrapper .waves-button,
|
8183 |
.wpdt-c .wpDataTablesWrapper .waves-circle {
|
8184 |
-webkit-transform: translateZ(0);
|
8231 |
}
|
8232 |
|
8233 |
.wpdt-c .waves-circle,
|
8234 |
+
.wpdt-c .wpDataTablesWrapper .waves-circle {
|
8235 |
text-align: center;
|
8236 |
width: 2.5em;
|
8237 |
height: 2.5em;
|
10514 |
}
|
10515 |
|
10516 |
|
|
|
10517 |
/*-------------------------
|
10518 |
Picture List
|
10519 |
--------------------------*/
|
13023 |
font-size: 14px;
|
13024 |
}
|
13025 |
|
13026 |
+
.wdt-include-bootstrap-block, .wdt-include-bootstrap-back-end-block {
|
13027 |
margin-bottom: 25px;
|
13028 |
}
|
assets/css/wpdatatables_admin.css
CHANGED
@@ -224,8 +224,8 @@
|
|
224 |
border-radius: 3px;
|
225 |
background: rgb(255,255,255);
|
226 |
background: -moz-linear-gradient(top, rgba(244,244,244,1) 0%, rgba(255,255,255,1) 100%);
|
227 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,
|
228 |
-
background: -webkit-linear-gradient(top,
|
229 |
background: -o-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
230 |
background: -ms-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
231 |
background: linear-gradient(to bottom, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
@@ -544,8 +544,8 @@ div.chart_wizard_breadcrumbs_block:hover {
|
|
544 |
|
545 |
div.chart_wizard_breadcrumbs_block.active {
|
546 |
background: -moz-linear-gradient(top, rgba(230,230,230,1) 0%, rgba(250,250,250,1) 100%); /* FF3.6+ */
|
547 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(230,230,230,1)), color-stop(100%,
|
548 |
-
background: -webkit-linear-gradient(top, rgba(230,230,230,1) 0%,
|
549 |
background: -o-linear-gradient(top, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* Opera 11.10+ */
|
550 |
background: -ms-linear-gradient(top, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* IE10+ */
|
551 |
background: linear-gradient(to bottom, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* W3C */
|
@@ -621,8 +621,8 @@ div.chart_column_picker_container div.chart_column_block:hover {
|
|
621 |
border-radius: 3px;
|
622 |
background: rgb(255,255,255); /* Old browsers */
|
623 |
background: -moz-linear-gradient(top, rgba(244,244,244,1) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */
|
624 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,
|
625 |
-
background: -webkit-linear-gradient(top,
|
626 |
background: -o-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* Opera 11.10+ */
|
627 |
background: -ms-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* IE10+ */
|
628 |
background: linear-gradient(to bottom, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* W3C */
|
@@ -699,7 +699,6 @@ div.wpDataTables div.max_columns_error {
|
|
699 |
border-radius: 3px;
|
700 |
border: 1px solid #dda;
|
701 |
font-weight: bold;
|
702 |
-
font: 400 20px/1;
|
703 |
text-align: center;
|
704 |
}
|
705 |
|
224 |
border-radius: 3px;
|
225 |
background: rgb(255,255,255);
|
226 |
background: -moz-linear-gradient(top, rgba(244,244,244,1) 0%, rgba(255,255,255,1) 100%);
|
227 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(244,244,244,1)));
|
228 |
+
background: -webkit-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
229 |
background: -o-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
230 |
background: -ms-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
231 |
background: linear-gradient(to bottom, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%);
|
544 |
|
545 |
div.chart_wizard_breadcrumbs_block.active {
|
546 |
background: -moz-linear-gradient(top, rgba(230,230,230,1) 0%, rgba(250,250,250,1) 100%); /* FF3.6+ */
|
547 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(230,230,230,1)), color-stop(100%,rgba(250,250,250,1))); /* Chrome,Safari4+ */
|
548 |
+
background: -webkit-linear-gradient(top, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* Chrome10+,Safari5.1+ */
|
549 |
background: -o-linear-gradient(top, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* Opera 11.10+ */
|
550 |
background: -ms-linear-gradient(top, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* IE10+ */
|
551 |
background: linear-gradient(to bottom, rgba(230,230,230,1) 0%,rgba(250,250,250,1) 100%); /* W3C */
|
621 |
border-radius: 3px;
|
622 |
background: rgb(255,255,255); /* Old browsers */
|
623 |
background: -moz-linear-gradient(top, rgba(244,244,244,1) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */
|
624 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(244,244,244,1))); /* Chrome,Safari4+ */
|
625 |
+
background: -webkit-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* Chrome10+,Safari5.1+ */
|
626 |
background: -o-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* Opera 11.10+ */
|
627 |
background: -ms-linear-gradient(top, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* IE10+ */
|
628 |
background: linear-gradient(to bottom, rgba(244,244,244,1) 0%,rgba(255,255,255,1) 100%); /* W3C */
|
699 |
border-radius: 3px;
|
700 |
border: 1px solid #dda;
|
701 |
font-weight: bold;
|
|
|
702 |
text-align: center;
|
703 |
}
|
704 |
|
assets/js/gutenberg/wpdatacharts-gutenberg-block.js
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (wp) {
|
2 |
+
|
3 |
+
var el = wp.element.createElement;
|
4 |
+
var components = wp.components;
|
5 |
+
var blockControls = wp.editor.BlockControls;
|
6 |
+
var inspectorControls = wp.editor.InspectorControls;
|
7 |
+
var allCharts = wpdatacharts.data;
|
8 |
+
|
9 |
+
var charts = [];
|
10 |
+
|
11 |
+
if (allCharts !== null) {
|
12 |
+
for (var i = 0; i < allCharts.length; i++) {
|
13 |
+
charts.push({
|
14 |
+
value: allCharts[i].id,
|
15 |
+
text: allCharts[i].name + ' (id: ' + allCharts[i].id + ')'
|
16 |
+
})
|
17 |
+
}
|
18 |
+
} else {
|
19 |
+
charts = []
|
20 |
+
}
|
21 |
+
|
22 |
+
// Registering the Block for catalog shortcode
|
23 |
+
wp.blocks.registerBlockType('wpdatatables/wpdatacharts-gutenberg-block', {
|
24 |
+
title: wpdatacharts.title,
|
25 |
+
description: wpdatacharts.description,
|
26 |
+
icon: el('svg', {width: '45', height: '50', viewBox: '0 0 45 50'},
|
27 |
+
el('rect', {
|
28 |
+
style: {fill: '#0089FF', x: '0', y: '0', width: '9', height: '50'},
|
29 |
+
transform: 'translate(3.000000, 0.000000)',
|
30 |
+
|
31 |
+
}),
|
32 |
+
el('rect', {
|
33 |
+
style: {fill: '#56D2FF', x: '12', y: '11', width: '9', height: '39'},
|
34 |
+
transform: 'translate(3.000000, 0.000000)',
|
35 |
+
|
36 |
+
}),
|
37 |
+
el('rect', {
|
38 |
+
style: {fill: '#00A3FF', x: '24', y: '21', width: '9', height: '29'},
|
39 |
+
transform: 'translate(3.000000, 0.000000)',
|
40 |
+
}),
|
41 |
+
el('rect', {
|
42 |
+
style: {fill: '#061972', x: '36', y: '29', width: '9', height: '21'},
|
43 |
+
transform: 'translate(3.000000, 0.000000)',
|
44 |
+
})
|
45 |
+
),
|
46 |
+
category: 'wpdatatables-blocks',
|
47 |
+
keywords: [
|
48 |
+
'wpdatacharts',
|
49 |
+
'charts'
|
50 |
+
],
|
51 |
+
supports: {
|
52 |
+
customClassName: false,
|
53 |
+
html: false
|
54 |
+
},
|
55 |
+
attributes: {
|
56 |
+
short_code: {
|
57 |
+
type: 'string',
|
58 |
+
default: ''
|
59 |
+
},
|
60 |
+
chartID: {
|
61 |
+
type: 'string',
|
62 |
+
default: ''
|
63 |
+
}
|
64 |
+
},
|
65 |
+
edit: function (props) {
|
66 |
+
var inspectorElements = [];
|
67 |
+
var attributes = props.attributes;
|
68 |
+
var options = [];
|
69 |
+
|
70 |
+
options['charts'] = [];
|
71 |
+
|
72 |
+
function getOptions(data) {
|
73 |
+
var options = [];
|
74 |
+
data = Object.keys(data).map(function (key) {
|
75 |
+
return data[key]
|
76 |
+
});
|
77 |
+
|
78 |
+
data.sort(function (a, b) {
|
79 |
+
if (parseInt(a.value) < parseInt(b.value))
|
80 |
+
return -1;
|
81 |
+
if (parseInt(a.value) > parseInt(b.value))
|
82 |
+
return 1;
|
83 |
+
return 0
|
84 |
+
});
|
85 |
+
|
86 |
+
data.forEach(function (element) {
|
87 |
+
options.push({value: element.value, label: element.text})
|
88 |
+
});
|
89 |
+
|
90 |
+
return options;
|
91 |
+
}
|
92 |
+
|
93 |
+
getOptions(charts)
|
94 |
+
.forEach(function (element) {
|
95 |
+
options['charts'].push(element);
|
96 |
+
});
|
97 |
+
|
98 |
+
function getShortCode(props, attributes) {
|
99 |
+
var short_code = '';
|
100 |
+
|
101 |
+
if (attributes.chartID !== '') {
|
102 |
+
short_code += '[wpdatachart id=' + attributes.chartID + ']'
|
103 |
+
} else if (charts.length !== 0) {
|
104 |
+
short_code = '[wpdatachart id=' + charts[0].value + ']'
|
105 |
+
} else {
|
106 |
+
short_code += 'Please create wpdatachart first.';
|
107 |
+
}
|
108 |
+
|
109 |
+
props.setAttributes({short_code: short_code});
|
110 |
+
|
111 |
+
return short_code
|
112 |
+
}
|
113 |
+
|
114 |
+
if (charts.length !== 0) {
|
115 |
+
inspectorElements.push(el(components.SelectControl, {
|
116 |
+
id: 'wpdatatables-js-select-chart',
|
117 |
+
label: 'Select wpdatachart:',
|
118 |
+
value: attributes.chartID,
|
119 |
+
options: options.charts,
|
120 |
+
onChange: function (selectControl) {
|
121 |
+
return props.setAttributes({chartID: selectControl})
|
122 |
+
}
|
123 |
+
}));
|
124 |
+
} else {
|
125 |
+
inspectorElements.push(el('p', {style: {'margin-bottom': '1em'}}, 'Please create wpdatachart first. You can check how to do that on link below.'));
|
126 |
+
inspectorElements.push(el('a', {
|
127 |
+
href: 'https://wpdatatables.com/documentation/wpdatacharts/creating-charts-wordpress-wpdatachart-wizard/',
|
128 |
+
target: '_blank',
|
129 |
+
style: {'margin-bottom': '1em'}
|
130 |
+
}, 'How to create chart in wpdatatables?'));
|
131 |
+
}
|
132 |
+
|
133 |
+
return [
|
134 |
+
el(blockControls, {key: 'controls'}),
|
135 |
+
el(inspectorControls, {key: 'inspector'},
|
136 |
+
el(components.PanelBody, {initialOpen: true},
|
137 |
+
inspectorElements
|
138 |
+
)
|
139 |
+
),
|
140 |
+
el('div', {},
|
141 |
+
getShortCode(props, props.attributes)
|
142 |
+
)
|
143 |
+
]
|
144 |
+
},
|
145 |
+
|
146 |
+
save: function (props) {
|
147 |
+
return (
|
148 |
+
el('div', {},
|
149 |
+
props.attributes.short_code
|
150 |
+
)
|
151 |
+
)
|
152 |
+
}
|
153 |
+
})
|
154 |
+
})(
|
155 |
+
window.wp
|
156 |
+
);
|
assets/js/wpdatatables/admin/browse/wdt.browse.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
var duplicate_table_id = '';
|
2 |
|
3 |
-
(function($) {
|
4 |
-
$(document).ready(function() {
|
5 |
|
6 |
/**
|
7 |
* Delete item action alert
|
8 |
*/
|
9 |
-
$('.wdt-submit-delete').click(function(e) {
|
10 |
e.preventDefault();
|
11 |
e.stopImmediatePropagation();
|
12 |
|
@@ -19,19 +19,19 @@ var duplicate_table_id = '';
|
|
19 |
});
|
20 |
});
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
/**
|
32 |
* Bulk action alert
|
33 |
*/
|
34 |
-
$('#doaction, #doaction2').click(
|
35 |
e.preventDefault();
|
36 |
e.stopImmediatePropagation();
|
37 |
|
@@ -55,7 +55,7 @@ var duplicate_table_id = '';
|
|
55 |
/**
|
56 |
* Display a duplicate table modal
|
57 |
*/
|
58 |
-
$('.wdt-duplicate-table').click(function(e) {
|
59 |
e.preventDefault();
|
60 |
e.stopImmediatePropagation();
|
61 |
|
@@ -66,7 +66,7 @@ var duplicate_table_id = '';
|
|
66 |
$('.wdt-duplicate-manual-table').hide();
|
67 |
}
|
68 |
|
69 |
-
$('input.wdt-duplicate-table-name').val($(this).data('table_name')+ '_' + wpdatatablesStrings.copy.toLowerCase());
|
70 |
|
71 |
$('#wdt-duplicate-table-modal').modal('show');
|
72 |
});
|
@@ -74,7 +74,7 @@ var duplicate_table_id = '';
|
|
74 |
/**
|
75 |
* A duplicate table action
|
76 |
*/
|
77 |
-
$(document).on('click','button.duplicate-table-button',function(e) {
|
78 |
e.preventDefault();
|
79 |
e.stopImmediatePropagation();
|
80 |
|
@@ -93,7 +93,50 @@ var duplicate_table_id = '';
|
|
93 |
manual_duplicate_input: manual_duplicate_input,
|
94 |
wdtNonce: wdtNonce
|
95 |
},
|
96 |
-
success: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
window.location.reload();
|
98 |
}
|
99 |
});
|
@@ -105,7 +148,7 @@ var duplicate_table_id = '';
|
|
105 |
/**
|
106 |
* Highlight a row when checkbox is active
|
107 |
*/
|
108 |
-
$(document).on('click','.wdt-datatables-admin-wrap .card.wdt-browse-table table tbody :checkbox',function() {
|
109 |
var parent_tr = $(this).closest('tr');
|
110 |
|
111 |
if ($(this).is(':checked')) {
|
@@ -118,7 +161,7 @@ var duplicate_table_id = '';
|
|
118 |
/**
|
119 |
* Highlight all rows when the select all checkbox is active
|
120 |
*/
|
121 |
-
$(document).on('click','.wdt-datatables-admin-wrap .card.wdt-browse-table table thead :checkbox, .wdt-datatables-admin-wrap .card.wdt-browse-table table tfoot :checkbox',function() {
|
122 |
var all_tr = $(this).closest('table').find('tbody tr');
|
123 |
|
124 |
if ($(this).is(':checked')) {
|
1 |
var duplicate_table_id = '';
|
2 |
|
3 |
+
(function ($) {
|
4 |
+
$(document).ready(function () {
|
5 |
|
6 |
/**
|
7 |
* Delete item action alert
|
8 |
*/
|
9 |
+
$('.wdt-submit-delete').click(function (e) {
|
10 |
e.preventDefault();
|
11 |
e.stopImmediatePropagation();
|
12 |
|
19 |
});
|
20 |
});
|
21 |
|
22 |
+
/**
|
23 |
+
* Search tables and charts in backend by enter
|
24 |
+
*/
|
25 |
+
$("input#search_id-search-input").on("keydown", function (e) {
|
26 |
+
if (e.keyCode == 13) {
|
27 |
+
$("button#search-submit").click();
|
28 |
+
}
|
29 |
+
});
|
30 |
|
31 |
/**
|
32 |
* Bulk action alert
|
33 |
*/
|
34 |
+
$('#doaction, #doaction2').click(function (e) {
|
35 |
e.preventDefault();
|
36 |
e.stopImmediatePropagation();
|
37 |
|
55 |
/**
|
56 |
* Display a duplicate table modal
|
57 |
*/
|
58 |
+
$('.wdt-duplicate-table').click(function (e) {
|
59 |
e.preventDefault();
|
60 |
e.stopImmediatePropagation();
|
61 |
|
66 |
$('.wdt-duplicate-manual-table').hide();
|
67 |
}
|
68 |
|
69 |
+
$('input.wdt-duplicate-table-name').val($(this).data('table_name') + '_' + wpdatatablesStrings.copy.toLowerCase());
|
70 |
|
71 |
$('#wdt-duplicate-table-modal').modal('show');
|
72 |
});
|
74 |
/**
|
75 |
* A duplicate table action
|
76 |
*/
|
77 |
+
$(document).on('click', 'button.duplicate-table-button', function (e) {
|
78 |
e.preventDefault();
|
79 |
e.stopImmediatePropagation();
|
80 |
|
93 |
manual_duplicate_input: manual_duplicate_input,
|
94 |
wdtNonce: wdtNonce
|
95 |
},
|
96 |
+
success: function () {
|
97 |
+
window.location.reload();
|
98 |
+
}
|
99 |
+
});
|
100 |
+
|
101 |
+
$('#wdt-duplicate-table-modal').modal('hide');
|
102 |
+
|
103 |
+
});
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Display a duplicate chart modal
|
107 |
+
*/
|
108 |
+
$('.wdt-duplicate-chart').click(function (e) {
|
109 |
+
e.preventDefault();
|
110 |
+
e.stopImmediatePropagation();
|
111 |
+
|
112 |
+
duplicate_chart_id = $(this).data('chart_id');
|
113 |
+
|
114 |
+
$('input.wdt-duplicate-chart-name').val($(this).data('chart_name') + '_' + wpdatatablesStrings.copy.toLowerCase());
|
115 |
+
|
116 |
+
$('#wdt-duplicate-chart-modal').modal('show');
|
117 |
+
});
|
118 |
+
|
119 |
+
/**
|
120 |
+
* A duplicate chart action
|
121 |
+
*/
|
122 |
+
$(document).on('click', 'button.duplicate-chart-button', function (e) {
|
123 |
+
e.preventDefault();
|
124 |
+
e.stopImmediatePropagation();
|
125 |
+
|
126 |
+
$('#wdt-preload-layer').show();
|
127 |
+
var new_chart_name = $(this).closest('.modal-content').find('input.wdt-duplicate-chart-name').val();
|
128 |
+
var wdtNonce = $('#wdt-duplicate-chart-modal #wdtNonce').val();
|
129 |
+
|
130 |
+
$.ajax({
|
131 |
+
url: ajaxurl,
|
132 |
+
type: 'POST',
|
133 |
+
data: {
|
134 |
+
action: 'wpdatatables_duplicate_chart',
|
135 |
+
chart_id: duplicate_chart_id,
|
136 |
+
new_chart_name: new_chart_name,
|
137 |
+
wdtNonce: wdtNonce
|
138 |
+
},
|
139 |
+
success: function () {
|
140 |
window.location.reload();
|
141 |
}
|
142 |
});
|
148 |
/**
|
149 |
* Highlight a row when checkbox is active
|
150 |
*/
|
151 |
+
$(document).on('click', '.wdt-datatables-admin-wrap .card.wdt-browse-table table tbody :checkbox', function () {
|
152 |
var parent_tr = $(this).closest('tr');
|
153 |
|
154 |
if ($(this).is(':checked')) {
|
161 |
/**
|
162 |
* Highlight all rows when the select all checkbox is active
|
163 |
*/
|
164 |
+
$(document).on('click', '.wdt-datatables-admin-wrap .card.wdt-browse-table table thead :checkbox, .wdt-datatables-admin-wrap .card.wdt-browse-table table tfoot :checkbox', function () {
|
165 |
var all_tr = $(this).closest('table').find('tbody tr');
|
166 |
|
167 |
if ($(this).is(':checked')) {
|
assets/js/wpdatatables/wdt.chartWizard.js
CHANGED
@@ -15,11 +15,699 @@ var wdtChartColumnsData = {};
|
|
15 |
$('.wdt-chart-wizard-chart-selecter-block .card').on('click', function () {
|
16 |
$('.wdt-chart-wizard-chart-selecter-block .card').removeClass('selected').addClass('not-selected');
|
17 |
$(this).addClass('selected').removeClass('not-selected');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
});
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
/**
|
25 |
* Pick the chart type
|
@@ -27,23 +715,29 @@ var wdtChartColumnsData = {};
|
|
27 |
$('#chart-render-engine').change(function (e) {
|
28 |
e.preventDefault();
|
29 |
|
30 |
-
|
31 |
-
|
32 |
$('.wdt-chart-wizard-chart-selecter-block .card').removeClass('selected').removeClass('not-selected');
|
33 |
$('div.charts-type').hide();
|
34 |
if ($(this).val() != '') {
|
35 |
constructedChartData.chart_engine = $(this).val();
|
36 |
if ($(this).val() == 'google') {
|
37 |
$('div.google-charts-type').show();
|
|
|
|
|
38 |
} else if ($(this).val() == 'highcharts') {
|
39 |
$('div.highcharts-charts-type').show();
|
|
|
|
|
40 |
} else if ($(this).val() == 'chartjs') {
|
41 |
$('div.chartjs-charts-type').show();
|
|
|
|
|
42 |
}
|
|
|
|
|
|
|
43 |
}
|
44 |
});
|
45 |
|
46 |
-
|
47 |
|
48 |
})(jQuery);
|
49 |
|
15 |
$('.wdt-chart-wizard-chart-selecter-block .card').on('click', function () {
|
16 |
$('.wdt-chart-wizard-chart-selecter-block .card').removeClass('selected').addClass('not-selected');
|
17 |
$(this).addClass('selected').removeClass('not-selected');
|
18 |
+
if (this.dataset.type == 'google_line_chart' || this.dataset.type == 'google_pie_chart' || this.dataset.type == 'google_column_chart') {
|
19 |
+
nextStepButton.prop('disabled', false);
|
20 |
+
} else {
|
21 |
+
nextStepButton.prop('disabled', true);
|
22 |
+
}
|
23 |
+
});
|
24 |
+
|
25 |
+
nextStepButton.click(function (e) {
|
26 |
+
e.preventDefault();
|
27 |
+
|
28 |
+
var curStep = $('div.chart-wizard-step:visible').data('step');
|
29 |
+
$('div.chart-wizard-step').hide();
|
30 |
+
$('li.chart_wizard_breadcrumbs_block').removeClass('active');
|
31 |
+
$('.wdt-preload-layer').animateFadeIn();
|
32 |
+
|
33 |
+
switch (curStep) {
|
34 |
+
case 'step1':
|
35 |
+
// Data source
|
36 |
+
constructedChartData.chart_type = $('.wdt-chart-wizard-chart-selecter-block .card.selected').data('type');
|
37 |
+
constructedChartData.min_columns = parseInt($('.card.selected').data('min_columns'));
|
38 |
+
constructedChartData.max_columns = parseInt($('.card.selected').data('max_columns'));
|
39 |
+
$('div.chart-wizard-step.step2').show();
|
40 |
+
$('li.chart_wizard_breadcrumbs_block.step2').addClass('active');
|
41 |
+
constructedChartData.chart_title = $('#chart-name').val();
|
42 |
+
constructedChartData.engine = 'google';
|
43 |
+
$("#chart-js-container").hide();
|
44 |
+
$("#google-chart-container").show();
|
45 |
+
|
46 |
+
$(".highcharts").hide();
|
47 |
+
$(".chartjs").hide();
|
48 |
+
$(".google").show();
|
49 |
+
|
50 |
+
$('#curve-type-row').hide();
|
51 |
+
$('#three-d-row').hide();
|
52 |
+
$('#background_color_row').show();
|
53 |
+
$('#border_width_row').show();
|
54 |
+
$('#border_color_row').show();
|
55 |
+
$('#border_radius_row').show();
|
56 |
+
$('#plot_background_color_row').show();
|
57 |
+
$('#plot-border-width-row').show();
|
58 |
+
$('#plot_border_color_row').show();
|
59 |
+
$('#font-size-row').show();
|
60 |
+
$('#font-name-row').show();
|
61 |
+
$('.series').show();
|
62 |
+
$('.axes').show();
|
63 |
+
$('#show-grid-row').show();
|
64 |
+
$('#horizontal-axis-crosshair-row').show();
|
65 |
+
$('#vertical-axis-crosshair-row').show();
|
66 |
+
$('.title').show();
|
67 |
+
$('#title-floating-row').show();
|
68 |
+
$('.tooltip').show();
|
69 |
+
$('.legend').show();
|
70 |
+
$('#inverted-row').show();
|
71 |
+
|
72 |
+
switch (constructedChartData.chart_type) {
|
73 |
+
case 'google_column_chart':
|
74 |
+
$('#horizontal-axis-crosshair-row').hide();
|
75 |
+
$('#vertical-axis-crosshair-row').hide();
|
76 |
+
break;
|
77 |
+
case 'google_line_chart':
|
78 |
+
$('#curve-type-row').show();
|
79 |
+
break;
|
80 |
+
case 'google_pie_chart':
|
81 |
+
$('#plot_background_color_row').hide();
|
82 |
+
$('#plot-border-width-row').hide();
|
83 |
+
$('#plot_border_color_row').hide();
|
84 |
+
$('#three-d-row').show();
|
85 |
+
$('.axes').hide();
|
86 |
+
$('#title-floating-row').hide();
|
87 |
+
$('.series').hide();
|
88 |
+
break;
|
89 |
+
}
|
90 |
+
|
91 |
+
$('#wdt-chart-wizard-previous-step').prop('disabled', false);
|
92 |
+
$('#wpdatatables-chart-source').change();
|
93 |
+
$('.wdt-preload-layer').animateFadeOut();
|
94 |
+
break;
|
95 |
+
case 'step2':
|
96 |
+
// Data range
|
97 |
+
applyDragula();
|
98 |
+
nextStepButton.prop('disabled', true);
|
99 |
+
constructedChartData.wpdatatable_id = $('#wpdatatables-chart-source').val();
|
100 |
+
$('div.chart-wizard-step.step3').show();
|
101 |
+
$('li.chart_wizard_breadcrumbs_block.step3').addClass('active');
|
102 |
+
|
103 |
+
$.ajax({
|
104 |
+
url: ajaxurl,
|
105 |
+
type: 'post',
|
106 |
+
dataType: 'json',
|
107 |
+
data: {
|
108 |
+
action: 'wpdatatables_get_columns_data_by_table_id',
|
109 |
+
table_id: constructedChartData.wpdatatable_id,
|
110 |
+
wdtNonce: $('#wdtNonce').val(),
|
111 |
+
},
|
112 |
+
success: function (columns) {
|
113 |
+
wdtChartColumnsData = columns;
|
114 |
+
var columnChartTemplate = $.templates("#wdt-chart-column-block");
|
115 |
+
var columnChartBlockHtml = columnChartTemplate.render({columns: columns});
|
116 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizart-existing-columns-container').html(columnChartBlockHtml);
|
117 |
+
|
118 |
+
if ((typeof constructedChartData.selected_columns !== 'undefined')
|
119 |
+
|| (typeof editing_chart_data !== 'undefined')) {
|
120 |
+
var columns = (typeof editing_chart_data !== 'undefined') ? editing_chart_data.selected_columns : constructedChartData.selected_columns;
|
121 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizard-chosen-columns-container .chart-column-block').remove();
|
122 |
+
for (var i in columns) {
|
123 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizart-existing-columns-container div.chart-column-block[data-orig_header="' + columns[i] + '"]')
|
124 |
+
.appendTo('div.wdt-chart-column-picker-container div.wdt-chart-wizard-chosen-columns-container');
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$('#wdt-add-chart-columns').click();
|
128 |
+
$('div.alert-warning').show();
|
129 |
+
$('.wdt-preload-layer').animateFadeOut();
|
130 |
+
}
|
131 |
+
});
|
132 |
+
break;
|
133 |
+
case 'step3':
|
134 |
+
// Formatting
|
135 |
+
if (typeof constructedChartData.selected_columns == 'undefined') {
|
136 |
+
constructedChartData.selected_columns = {};
|
137 |
+
}
|
138 |
+
|
139 |
+
// Move string column on first place
|
140 |
+
if ($('div.chosen_columns div.chart-column-block.string,' +
|
141 |
+
'div.chosen_columns div.chart-column-block.date,' +
|
142 |
+
'div.chosen_columns div.chart-column-block.datetime,' +
|
143 |
+
'div.chosen_columns div.chart-column-block.time').length
|
144 |
+
&& (!$('div.chosen_columns div.chart-column-block:eq(0)').hasClass('float')
|
145 |
+
|| !$('div.chosen_columns div.chart-column-block:eq(0)').hasClass('int'))) {
|
146 |
+
$('div.chosen_columns div.chart-column-block.string,' +
|
147 |
+
'div.chosen_columns div.chart-column-block.date,' +
|
148 |
+
'div.chosen_columns div.chart-column-block.datetime,' +
|
149 |
+
'div.chosen_columns div.chart-column-block.time')
|
150 |
+
.eq(0)
|
151 |
+
.prependTo('div.wdt-chart-wizard-chosen-columns-container')
|
152 |
+
}
|
153 |
+
|
154 |
+
constructedChartData.selected_columns = {};
|
155 |
+
constructedChartData.series_data = {};
|
156 |
+
$('div.wdt-chart-wizard-chosen-columns-container div.chart-column-block').each(function () {
|
157 |
+
constructedChartData.selected_columns[parseInt($(this).index())] = $(this).data('orig_header');
|
158 |
+
});
|
159 |
+
|
160 |
+
if (typeof editing_chart_data !== 'undefined') {
|
161 |
+
if (!_.isEqual(constructedChartData.selected_columns, editing_chart_data.selected_columns)) {
|
162 |
+
editing_chart_data.render_data.series = editing_chart_data.render_data.series.filter(function (editColumns) {
|
163 |
+
return Object.values(constructedChartData.selected_columns).indexOf(editColumns.orig_header) !== -1;
|
164 |
+
});
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
+
// Set initial width for preview
|
170 |
+
if (constructedChartData.width == null) {
|
171 |
+
constructedChartData.width = 400;
|
172 |
+
}
|
173 |
+
|
174 |
+
$('#wdt-chart-row-range-type').change();
|
175 |
+
|
176 |
+
$('#series-settings-container').empty();
|
177 |
+
|
178 |
+
getInputData();
|
179 |
+
|
180 |
+
// Render chart first time in preview
|
181 |
+
$.ajax({
|
182 |
+
url: ajaxurl,
|
183 |
+
data: {
|
184 |
+
action: 'wpdatatable_show_chart_from_data',
|
185 |
+
chart_data: constructedChartData,
|
186 |
+
wdtNonce: $('#wdtNonce').val(),
|
187 |
+
},
|
188 |
+
dataType: 'json',
|
189 |
+
type: 'post',
|
190 |
+
success: function (data) {
|
191 |
+
$('div.chart-wizard-step.step4').show();
|
192 |
+
$('li.chart_wizard_breadcrumbs_block.step4').addClass('active');
|
193 |
+
|
194 |
+
//Series
|
195 |
+
var seriesBlockTemplate = $.templates("#wdt-chart-series-setting-block");
|
196 |
+
|
197 |
+
if (constructedChartData.engine == 'google') {
|
198 |
+
if (typeof editing_chart_data != 'undefined') {
|
199 |
+
for (i = 0; i < data.series.length; i++) {
|
200 |
+
for (j = 0; j < editing_chart_data.render_data.series.length; j++) {
|
201 |
+
if (data.series[i].orig_header === editing_chart_data.render_data.series[j].orig_header) {
|
202 |
+
data.series[i].label = data.columns[i + 1].label = editing_chart_data.render_data.series[j].label;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
seriesBlockTemplateHtml = seriesBlockTemplate.render({series: data.series});
|
208 |
+
|
209 |
+
}
|
210 |
+
$('#series-settings-container').html(seriesBlockTemplateHtml);
|
211 |
+
|
212 |
+
if (constructedChartData.engine == 'google') {
|
213 |
+
if (typeof editing_chart_data != 'undefined') {
|
214 |
+
for (i in data.series) {
|
215 |
+
for (j in editing_chart_data.render_data.series) {
|
216 |
+
if (data.series[i].orig_header === editing_chart_data.render_data.series[j].orig_header &&
|
217 |
+
typeof (editing_chart_data.render_data.options.series[j]) !== 'undefined') {
|
218 |
+
$('#series-settings-container div.chart-series-block:eq(' + i + ')').find('div.chart-series-color input').val(editing_chart_data.render_data.options.series[j].color);
|
219 |
+
data.options.series[i] = {
|
220 |
+
color: editing_chart_data.render_data.options.series[j].color
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
} else {
|
226 |
+
for (i in data.series) {
|
227 |
+
$('#series-settings-container div.chart-series-block:eq(' + i + ')').find('div.chart-series-color input').val(data.series[i].color);
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
$(".color-picker").each(function () {
|
233 |
+
wdtApplyColorPicker(this);
|
234 |
+
});
|
235 |
+
|
236 |
+
|
237 |
+
if (constructedChartData.engine == 'google') {
|
238 |
+
wdtChart = new wpDataTablesGoogleChart();
|
239 |
+
wdtChart.setType(data.type);
|
240 |
+
wdtChart.setColumns(data.columns);
|
241 |
+
wdtChart.setRows(data.rows);
|
242 |
+
wdtChart.setOptions(data.options);
|
243 |
+
wdtChart.setContainer('google-chart-container');
|
244 |
+
wdtChart.setColumnIndexes(data.column_indexes);
|
245 |
+
}
|
246 |
+
wdtChart.render();
|
247 |
+
|
248 |
+
$('.selectpicker').selectpicker('refresh');
|
249 |
+
|
250 |
+
var eTop = $('.chart-preview-container').offset().top;
|
251 |
+
var eWidth = $('.chart-preview-container').width();
|
252 |
+
|
253 |
+
$(window).scroll(function () {
|
254 |
+
if (eTop - $(window).scrollTop() <= 30) {
|
255 |
+
$('.chart-preview-container').css('position', 'fixed').css('right', 48).css('top', 30).css('width', eWidth);
|
256 |
+
} else {
|
257 |
+
eWidth = $('.chart-preview-container').width();
|
258 |
+
$('.chart-preview-container').css('position', 'relative').css('right', '').css('top', '').css('width', '');
|
259 |
+
}
|
260 |
+
});
|
261 |
+
|
262 |
+
$('#chart-series-color,' +
|
263 |
+
'#background-color-container,' +
|
264 |
+
'#border-color-container,' +
|
265 |
+
'#plot-background-color-container,' +
|
266 |
+
'#plot-border-color-container,' +
|
267 |
+
'#font-color-container,' +
|
268 |
+
'#title-font-color-container input.title-font-color,' +
|
269 |
+
'#tooltip-background-color-container,' +
|
270 |
+
'#tooltip-border-color-container,' +
|
271 |
+
'#legend_background_color,' +
|
272 |
+
'#legend_border_color,' +
|
273 |
+
'#exporting_button_color_container input.exporting-button-color'
|
274 |
+
).on('changeColor', function (e, ui) {
|
275 |
+
renderChart(false);
|
276 |
+
});
|
277 |
+
|
278 |
+
// Render chart on changing chart options
|
279 |
+
$('div.step4 input:not(#group-chart), div.step4 select')
|
280 |
+
.on('change', function () {
|
281 |
+
renderChart(false);
|
282 |
+
});
|
283 |
+
|
284 |
+
$('.wdt-preload-layer').animateFadeOut();
|
285 |
+
}
|
286 |
+
});
|
287 |
+
break;
|
288 |
+
case 'step4':
|
289 |
+
getInputData();
|
290 |
+
// Save and get shortcode
|
291 |
+
$.ajax({
|
292 |
+
url: ajaxurl,
|
293 |
+
data: {
|
294 |
+
action: 'wpdatatable_save_chart_get_shortcode',
|
295 |
+
chart_data: constructedChartData,
|
296 |
+
wdtNonce: $('#wdtNonce').val(),
|
297 |
+
},
|
298 |
+
type: 'post',
|
299 |
+
dataType: 'json',
|
300 |
+
success: function (data) {
|
301 |
+
$('div.chart-wizard-step.step5').show();
|
302 |
+
$('li.chart_wizard_breadcrumbs_block.step5').addClass('active');
|
303 |
+
$('#wdt-chart-shortcode-container').html(data.shortcode);
|
304 |
+
constructedChartData.chart_id = data.id;
|
305 |
+
$('#wp-data-chart-id').val(data.id);
|
306 |
+
$('.wdt-preload-layer').animateFadeOut();
|
307 |
+
nextStepButton.prop('disabled', true);
|
308 |
+
$('#finishButton').show();
|
309 |
+
}
|
310 |
+
});
|
311 |
+
break;
|
312 |
+
}
|
313 |
+
});
|
314 |
+
|
315 |
+
function renderChart(reloadNeeded) {
|
316 |
+
if (typeof reloadNeeded == 'undefined') {
|
317 |
+
reloadNeeded = true;
|
318 |
+
}
|
319 |
+
|
320 |
+
getInputData();
|
321 |
+
|
322 |
+
if (reloadNeeded) {
|
323 |
+
$.ajax({
|
324 |
+
url: ajaxurl,
|
325 |
+
data: {
|
326 |
+
action: 'wpdatatable_show_chart_from_data',
|
327 |
+
chart_data: constructedChartData,
|
328 |
+
wdtNonce: $('#wdtNonce').val(),
|
329 |
+
},
|
330 |
+
dataType: 'json',
|
331 |
+
type: 'post',
|
332 |
+
success: function (data) {
|
333 |
+
if (constructedChartData.engine == 'google') {
|
334 |
+
wdtChart = new wpDataTablesGoogleChart();
|
335 |
+
wdtChart.setType(data.type);
|
336 |
+
wdtChart.setColumns(data.columns);
|
337 |
+
wdtChart.setRows(data.rows);
|
338 |
+
wdtChart.setOptions(data.options);
|
339 |
+
wdtChart.setContainer('google-chart-container');
|
340 |
+
wdtChart.setColumnIndexes(data.column_indexes);
|
341 |
+
}
|
342 |
+
wdtChart.render();
|
343 |
+
$('.wdt-preload-layer').animateFadeOut();
|
344 |
+
|
345 |
+
}
|
346 |
+
});
|
347 |
+
} else {
|
348 |
+
wdtChart.setChartConfig(constructedChartData);
|
349 |
+
wdtChart.render();
|
350 |
+
}
|
351 |
+
|
352 |
+
}
|
353 |
+
|
354 |
+
// Get input fields data
|
355 |
+
function getInputData() {
|
356 |
+
//Chart
|
357 |
+
constructedChartData.width = parseInt($('#chart-width').val());
|
358 |
+
constructedChartData.height = parseInt($('#chart-height').val());
|
359 |
+
constructedChartData.background_color = $('input.background-color').val();
|
360 |
+
constructedChartData.border_width = parseInt($('#border-width').val() ? $('#border-width').val() : 0);
|
361 |
+
constructedChartData.border_color = $('input.border_color').val();
|
362 |
+
constructedChartData.border_radius = parseInt($('#border-radius').val() ? $('#border-radius').val() : 0);
|
363 |
+
constructedChartData.plot_background_color = $('input.plot-background-color').val();
|
364 |
+
constructedChartData.plot_background_image = $('#plot-background-image').val();
|
365 |
+
constructedChartData.plot_border_width = $('#plot-border-width').val();
|
366 |
+
constructedChartData.plot_border_color = $('input.plot-border-color').val();
|
367 |
+
// Series
|
368 |
+
if (typeof constructedChartData.series_data == 'undefined') {
|
369 |
+
constructedChartData.series_data = {};
|
370 |
+
}
|
371 |
+
if (constructedChartData.engine == 'google') {
|
372 |
+
$('div.chart-series-block').each(function (e) {
|
373 |
+
constructedChartData.series_data[$(this).data('orig_header')] = {
|
374 |
+
label: $(this).find('input.series-label').val(),
|
375 |
+
color: $(this).find('input.series-color').val()
|
376 |
+
}
|
377 |
+
});
|
378 |
+
}
|
379 |
+
|
380 |
+
// Axes
|
381 |
+
constructedChartData.show_grid = $('#show-grid').is(':checked') ? 1 : 0;
|
382 |
+
constructedChartData.horizontal_axis_label = $('#horizontal-axis-label').val();
|
383 |
+
constructedChartData.vertical_axis_label = $('#vertical-axis-label').val();
|
384 |
+
// Title
|
385 |
+
constructedChartData.show_title = $('#show-chart-title').is(':checked') ? 1 : 0;
|
386 |
+
constructedChartData.title_floating = $('#title-floating').is(':checked') ? 1 : 0;
|
387 |
+
// Legend
|
388 |
+
constructedChartData.legend_position = $('#legend_position').val();
|
389 |
+
constructedChartData.legend_vertical_align = $('#legend_vertical_align').val();
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Steps switcher (Prev)
|
394 |
+
*/
|
395 |
+
$('#wdt-chart-wizard-previous-step').click(function (e) {
|
396 |
+
e.preventDefault();
|
397 |
+
|
398 |
+
$('.wdt-preload-layer').animateFadeIn();
|
399 |
+
var curStep = $('div.chart-wizard-step:visible').data('step');
|
400 |
+
|
401 |
+
switch (curStep) {
|
402 |
+
case 'step2':
|
403 |
+
$('#wdt-chart-wizard-previous-step').prop('disabled', true);
|
404 |
+
$('div.chart-wizard-step.step1').show();
|
405 |
+
$('div.chart-wizard-step.step2').hide();
|
406 |
+
$('li.chart_wizard_breadcrumbs_block.step2').removeClass('active');
|
407 |
+
$('li.chart_wizard_breadcrumbs_block.step1').addClass('active');
|
408 |
+
$('#chart-render-engine').change();
|
409 |
+
$('.wdt-preload-layer').animateFadeOut();
|
410 |
+
break;
|
411 |
+
case 'step3':
|
412 |
+
$('div.chart-wizard-step.step2').show();
|
413 |
+
$('div.chart-wizard-step.step3').hide();
|
414 |
+
$('li.chart_wizard_breadcrumbs_block.step3').removeClass('active');
|
415 |
+
$('li.chart_wizard_breadcrumbs_block.step2').addClass('active');
|
416 |
+
$('.wdt-preload-layer').animateFadeOut();
|
417 |
+
break;
|
418 |
+
case 'step4':
|
419 |
+
$('div.chart-wizard-step.step3').show();
|
420 |
+
$('div.chart-wizard-step.step4').hide();
|
421 |
+
$('li.chart_wizard_breadcrumbs_block.step4').removeClass('active');
|
422 |
+
$('li.chart_wizard_breadcrumbs_block.step3').addClass('active');
|
423 |
+
$('.wdt-preload-layer').animateFadeOut();
|
424 |
+
break;
|
425 |
+
case 'step5':
|
426 |
+
$('div.chart-wizard-step.step4').show();
|
427 |
+
$('div.chart-wizard-step.step5').hide();
|
428 |
+
$('li.chart_wizard_breadcrumbs_block.step5').removeClass('active');
|
429 |
+
$('li.chart_wizard_breadcrumbs_block.step4').addClass('active');
|
430 |
+
nextStepButton.prop('disabled', false);
|
431 |
+
$('#finishButton').hide();
|
432 |
+
$('.wdt-preload-layer').animateFadeOut();
|
433 |
+
break;
|
434 |
+
}
|
435 |
+
});
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Open chart browser on finish
|
439 |
+
*/
|
440 |
+
$('#finishButton').click(function (e) {
|
441 |
+
e.preventDefault();
|
442 |
+
window.location = $('#wdt-browse-charts-url').val();
|
443 |
+
});
|
444 |
+
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Pick the data type
|
448 |
+
*/
|
449 |
+
$('#wpdatatables-chart-source').change(function (e) {
|
450 |
+
e.preventDefault();
|
451 |
+
if ($(this).val() == '') {
|
452 |
+
nextStepButton.prop('disabled', true);
|
453 |
+
} else {
|
454 |
+
nextStepButton.prop('disabled', false);
|
455 |
+
}
|
456 |
+
});
|
457 |
+
|
458 |
|
459 |
+
/**
|
460 |
+
* Select all columns in the column selecter
|
461 |
+
*/
|
462 |
+
$('button.select-all-columns, button.deselect-all-columns').click(function (e) {
|
463 |
+
e.preventDefault();
|
464 |
+
e.stopImmediatePropagation();
|
465 |
+
if ($(this).hasClass('select-all-columns')) {
|
466 |
+
$(this).closest('.card').find('div.chart-column-block').addClass('selected');
|
467 |
+
$(this).text('Deselect All');
|
468 |
+
} else {
|
469 |
+
$(this).closest('.card').find('div.chart-column-block').removeClass('selected');
|
470 |
+
$(this).text('Select All');
|
471 |
+
}
|
472 |
+
$(this).toggleClass('select-all-columns deselect-all-columns');
|
473 |
+
|
474 |
+
});
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Select a column in chart row range picker
|
478 |
+
*/
|
479 |
+
$(document).on('click', 'div.wdt-chart-column-picker-container div.chart-column-block', function (e) {
|
480 |
+
e.preventDefault();
|
481 |
+
e.stopImmediatePropagation();
|
482 |
+
if ($(this).hasClass('selected')) {
|
483 |
+
$(this).removeClass('selected');
|
484 |
+
} else {
|
485 |
+
$(this).addClass('selected');
|
486 |
+
}
|
487 |
+
});
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Check for limit of string columns
|
491 |
+
*/
|
492 |
+
function checkColumnsLimit() {
|
493 |
+
// 1 - Checking for string columns
|
494 |
+
var string_columns = 0;
|
495 |
+
var valid = true;
|
496 |
+
$('div.wdt-chart-wizard-chosen-columns-container div.chart-column-block').each(function () {
|
497 |
+
if (
|
498 |
+
$(this).hasClass('string')
|
499 |
+
|| $(this).hasClass('link')
|
500 |
+
|| $(this).hasClass('email')
|
501 |
+
|| $(this).hasClass('image')
|
502 |
+
|| $(this).hasClass('date')
|
503 |
+
|| $(this).hasClass('datetime')
|
504 |
+
|| $(this).hasClass('time')
|
505 |
+
) {
|
506 |
+
string_columns++;
|
507 |
+
}
|
508 |
+
});
|
509 |
+
if (string_columns > 1) {
|
510 |
+
$('div.chosen_columns div.strings-error').show();
|
511 |
+
valid = false;
|
512 |
+
} else {
|
513 |
+
$('div.chosen_columns div.strings-error').hide();
|
514 |
+
}
|
515 |
+
// 2 - Checking for min and max columns limit
|
516 |
+
var totalColumnCount = $('div.wdt-chart-wizard-chosen-columns-container div.chart-column-block').length;
|
517 |
+
if (totalColumnCount < constructedChartData.min_columns) {
|
518 |
+
$('div.chosen_columns div.min-columns-error').show();
|
519 |
+
$('div.chosen_columns div.min-columns-error span.columns').html(constructedChartData.min_columns);
|
520 |
+
valid = false;
|
521 |
+
} else {
|
522 |
+
$('div.chosen_columns div.min-columns-error').hide();
|
523 |
+
}
|
524 |
+
if ((constructedChartData.max_columns > 0)
|
525 |
+
&& (totalColumnCount > constructedChartData.max_columns)) {
|
526 |
+
$('div.chosen_columns div.max-columns-error').show();
|
527 |
+
$('div.chosen_columns div.max-columns-error span.columns').html(constructedChartData.max_columns);
|
528 |
+
valid = false;
|
529 |
+
} else {
|
530 |
+
$('div.chosen_columns div.max-columns-error').hide();
|
531 |
+
}
|
532 |
+
if (!valid) {
|
533 |
+
nextStepButton.prop('disabled', true);
|
534 |
+
} else {
|
535 |
+
nextStepButton.prop('disabled', false);
|
536 |
+
}
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* Add columns to chart
|
541 |
+
*/
|
542 |
+
$('#wdt-add-chart-columns').click(function (e) {
|
543 |
+
e.preventDefault();
|
544 |
+
e.stopImmediatePropagation();
|
545 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizart-existing-columns-container div.chart-column-block.selected').each(function () {
|
546 |
+
$(this).appendTo('div.wdt-chart-column-picker-container div.wdt-chart-wizard-chosen-columns-container');
|
547 |
+
});
|
548 |
+
checkColumnsLimit();
|
549 |
+
});
|
550 |
+
|
551 |
+
/**
|
552 |
+
* Add all columns to chart
|
553 |
+
*/
|
554 |
+
$('#wdt-add-all-chart-columns').click(function (e) {
|
555 |
+
e.preventDefault();
|
556 |
+
e.stopImmediatePropagation();
|
557 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizart-existing-columns-container div.chart-column-block').addClass('selected');
|
558 |
+
$('#wdt-add-chart-columns').click();
|
559 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizard-chosen-columns-container div.chart-column-block').removeClass('selected');
|
560 |
+
checkColumnsLimit();
|
561 |
+
});
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Remove columns from chart series
|
565 |
+
*/
|
566 |
+
$('#wdt-remove-chart-columns').click(function (e) {
|
567 |
+
e.preventDefault();
|
568 |
+
e.stopImmediatePropagation();
|
569 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizard-chosen-columns-container div.chart-column-block.selected').each(function () {
|
570 |
+
$(this).appendTo('div.wdt-chart-column-picker-container div.wdt-chart-wizart-existing-columns-container ');
|
571 |
+
});
|
572 |
+
checkColumnsLimit();
|
573 |
});
|
574 |
|
575 |
+
/**
|
576 |
+
* Remove all columns from chart
|
577 |
+
*/
|
578 |
+
$('#wdt-remove-all-chart-columns').click(function (e) {
|
579 |
+
e.preventDefault();
|
580 |
+
e.stopImmediatePropagation();
|
581 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizard-chosen-columns-container div.chart-column-block').addClass('selected');
|
582 |
+
$('#wdt-remove-chart-columns').click();
|
583 |
+
$('div.wdt-chart-column-picker-container div.wdt-chart-wizart-existing-columns-container div.chart-column-block').removeClass('selected');
|
584 |
+
});
|
585 |
+
|
586 |
+
|
587 |
+
/**
|
588 |
+
* Load data for editing existing charts
|
589 |
+
*/
|
590 |
+
$(document).ready(function () {
|
591 |
+
if ($('#wp-data-chart-id').val() != '') {
|
592 |
+
|
593 |
+
$('#chart-render-engine').change();
|
594 |
+
constructedChartData.chart_id = $('#wp-data-chart-id').val();
|
595 |
+
constructedChartData.chart_title = editing_chart_data.title;
|
596 |
+
// General settings
|
597 |
+
$('.charts-type').find("[data-type='" + editing_chart_data.type + "']").click();
|
598 |
+
$('#wpdatatables-chart-source').val(editing_chart_data.wpdatatable_id);
|
599 |
+
|
600 |
+
if (editing_chart_data.range_type == 'picked_range') {
|
601 |
+
$('#wdt-chart-row-range-type').val('pick_rows').change();
|
602 |
+
constructedChartData.range_data = editing_chart_data.row_range;
|
603 |
+
$('#range_picked_info span').html(constructedChartData.range_data.length);
|
604 |
+
}
|
605 |
+
|
606 |
+
|
607 |
+
// Chart
|
608 |
+
if (typeof editing_chart_data.render_data.options.width !== 'undefined') {
|
609 |
+
$('#chart-width').val(editing_chart_data.render_data.options.width);
|
610 |
+
$('#chart-responsive-width').prop('checked', '');
|
611 |
+
}
|
612 |
+
$('#chart-height').val(editing_chart_data.render_data.options.height);
|
613 |
+
|
614 |
+
|
615 |
+
// Axes
|
616 |
+
if (editing_chart_data.render_data.show_grid == null) {
|
617 |
+
$('#show-grid').prop('checked', 'checked');
|
618 |
+
} else {
|
619 |
+
if (editing_chart_data.render_data.show_grid) {
|
620 |
+
$('#show-grid').prop('checked', 'checked');
|
621 |
+
} else {
|
622 |
+
$('#show-grid').prop('checked', '');
|
623 |
+
}
|
624 |
+
}
|
625 |
+
$('#horizontal-axis-label').val(editing_chart_data.render_data.options.hAxis.title);
|
626 |
+
$('#vertical-axis-label').val(editing_chart_data.render_data.options.vAxis.title);
|
627 |
+
|
628 |
+
// Title
|
629 |
+
if (editing_chart_data.render_data.options.title) {
|
630 |
+
$('#show-chart-title').prop('checked', 'checked');
|
631 |
+
} else {
|
632 |
+
$('#show-chart-title').prop('checked', '');
|
633 |
+
}
|
634 |
+
|
635 |
+
if (editing_chart_data.engine == 'google') {
|
636 |
+
// Chart
|
637 |
+
if (editing_chart_data.render_data.options.backgroundColor == null) {
|
638 |
+
$('input.background-color').val('');
|
639 |
+
$('#border-width').val('');
|
640 |
+
$('input.border_color').val('');
|
641 |
+
$('#border-radius').val('');
|
642 |
+
|
643 |
+
} else {
|
644 |
+
if (editing_chart_data.render_data.options.backgroundColor.fill) {
|
645 |
+
$('#background-color-container').colorpicker('setValue', editing_chart_data.render_data.options.backgroundColor.fill);
|
646 |
+
}
|
647 |
+
$('#border-width').val(editing_chart_data.render_data.options.backgroundColor.strokeWidth);
|
648 |
+
if (editing_chart_data.render_data.options.backgroundColor.stroke) {
|
649 |
+
$('#border-color-container').colorpicker('setValue', editing_chart_data.render_data.options.backgroundColor.stroke);
|
650 |
+
}
|
651 |
+
$('#border-radius').val(editing_chart_data.render_data.options.backgroundColor.rx);
|
652 |
+
}
|
653 |
+
|
654 |
+
if (editing_chart_data.render_data.options.chartArea == null) {
|
655 |
+
$('input.plot-background-color').val('');
|
656 |
+
$('#plot-border-width').val('');
|
657 |
+
$('input.plot-border-color').val('');
|
658 |
+
} else {
|
659 |
+
if (editing_chart_data.render_data.options.chartArea.backgroundColor.fill) {
|
660 |
+
$('#plot-background-color-container').colorpicker('setValue', editing_chart_data.render_data.options.chartArea.backgroundColor.fill);
|
661 |
+
}
|
662 |
+
$('#plot-border-width').val(editing_chart_data.render_data.options.chartArea.backgroundColor.strokeWidth);
|
663 |
+
if (editing_chart_data.render_data.options.chartArea.backgroundColor.stroke) {
|
664 |
+
$('#plot-border-color-container').colorpicker('setValue', editing_chart_data.render_data.options.chartArea.backgroundColor.stroke);
|
665 |
+
}
|
666 |
+
}
|
667 |
+
|
668 |
+
|
669 |
+
// Title
|
670 |
+
if (editing_chart_data.render_data.options.titlePosition == null) {
|
671 |
+
$('#title-floating').prop('checked', '');
|
672 |
+
} else {
|
673 |
+
if (editing_chart_data.render_data.options.titlePosition == 'in') {
|
674 |
+
$('#title-floating').prop('checked', 'checked');
|
675 |
+
}
|
676 |
+
}
|
677 |
+
|
678 |
+
|
679 |
+
// Legend
|
680 |
+
if (editing_chart_data.render_data.options.legend == null) {
|
681 |
+
$('#legend_position').val('right');
|
682 |
+
$('#legend_vertical_align').val("bottom");
|
683 |
+
} else {
|
684 |
+
$('#legend_position').val(editing_chart_data.render_data.options.legend.position);
|
685 |
+
if (editing_chart_data.render_data.options.legend.alignment == 'end') {
|
686 |
+
$('#legend_vertical_align').val("bottom");
|
687 |
+
} else if (editing_chart_data.render_data.options.legend.alignment == 'center') {
|
688 |
+
$('#legend_vertical_align').val("middle");
|
689 |
+
} else {
|
690 |
+
$('#legend_vertical_align').val("top");
|
691 |
+
}
|
692 |
+
}
|
693 |
+
}
|
694 |
+
|
695 |
+
}
|
696 |
+
});
|
697 |
+
|
698 |
+
function applyDragula() {
|
699 |
+
var drake = dragula([document.querySelector('.wdt-chart-wizart-existing-columns-container'), document.querySelector('.wdt-chart-wizard-chosen-columns-container')], {
|
700 |
+
invalid: function (el, target) {
|
701 |
+
if (el.classList.contains('alert')) {
|
702 |
+
return true;
|
703 |
+
}
|
704 |
+
}
|
705 |
+
});
|
706 |
+
drake.on('drop', function () {
|
707 |
+
checkColumnsLimit();
|
708 |
+
});
|
709 |
+
}
|
710 |
+
|
711 |
|
712 |
/**
|
713 |
* Pick the chart type
|
715 |
$('#chart-render-engine').change(function (e) {
|
716 |
e.preventDefault();
|
717 |
|
|
|
|
|
718 |
$('.wdt-chart-wizard-chart-selecter-block .card').removeClass('selected').removeClass('not-selected');
|
719 |
$('div.charts-type').hide();
|
720 |
if ($(this).val() != '') {
|
721 |
constructedChartData.chart_engine = $(this).val();
|
722 |
if ($(this).val() == 'google') {
|
723 |
$('div.google-charts-type').show();
|
724 |
+
$('div.alert-info').show();
|
725 |
+
$('div.alert-warning').hide();
|
726 |
} else if ($(this).val() == 'highcharts') {
|
727 |
$('div.highcharts-charts-type').show();
|
728 |
+
$('div.alert-info').hide();
|
729 |
+
$('div.alert-warning').show();
|
730 |
} else if ($(this).val() == 'chartjs') {
|
731 |
$('div.chartjs-charts-type').show();
|
732 |
+
$('div.alert-info').hide();
|
733 |
+
$('div.alert-warning').show();
|
734 |
}
|
735 |
+
} else {
|
736 |
+
$('div.alert-info').hide();
|
737 |
+
$('div.alert-warning').hide();
|
738 |
}
|
739 |
});
|
740 |
|
|
|
741 |
|
742 |
})(jQuery);
|
743 |
|
assets/js/wpdatatables/wdt.chartsRender.js
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
$(window).on('load', function () {
|
3 |
+
|
4 |
+
var wdtGoogleCharts = [];
|
5 |
+
|
6 |
+
if (typeof wpDataCharts !== 'undefined') {
|
7 |
+
|
8 |
+
for (var chart_id in wpDataCharts) {
|
9 |
+
|
10 |
+
var wdtChart = new wpDataTablesGoogleChart();
|
11 |
+
wdtChart.setType(wpDataCharts[chart_id].render_data.type);
|
12 |
+
wdtChart.setColumns(wpDataCharts[chart_id].render_data.columns);
|
13 |
+
wdtChart.setRows(wpDataCharts[chart_id].render_data.rows);
|
14 |
+
wdtChart.setOptions(wpDataCharts[chart_id].render_data.options);
|
15 |
+
wdtChart.setContainer(wpDataCharts[chart_id].container);
|
16 |
+
wdtChart.setColumnIndexes(wpDataCharts[chart_id].render_data.column_indexes);
|
17 |
+
if (typeof wpDataChartsCallbacks !== 'undefined' && typeof wpDataChartsCallbacks[chart_id] !== 'undefined') {
|
18 |
+
wdtChart.setRenderCallback(wpDataChartsCallbacks[chart_id]);
|
19 |
+
}
|
20 |
+
wdtGoogleCharts.push(wdtChart);
|
21 |
+
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
// Setting the callback for rendering Google Charts
|
26 |
+
if (wdtGoogleCharts.length) {
|
27 |
+
var wdtGoogleRenderCallback = function () {
|
28 |
+
for (var i in wdtGoogleCharts) {
|
29 |
+
wdtGoogleCharts[i].render();
|
30 |
+
}
|
31 |
+
}
|
32 |
+
google.charts.setOnLoadCallback(wdtGoogleRenderCallback);
|
33 |
+
}
|
34 |
+
|
35 |
+
})
|
36 |
+
|
37 |
+
})(jQuery);
|
assets/js/wpdatatables/wdt.chartsRender.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(window).on("load",function(){var a=[];if("undefined"!=typeof wpDataCharts)for(var t in wpDataCharts){var e=new wpDataTablesGoogleChart;e.setType(wpDataCharts[t].render_data.type),e.setColumns(wpDataCharts[t].render_data.columns),e.setRows(wpDataCharts[t].render_data.rows),e.setOptions(wpDataCharts[t].render_data.options),e.setContainer(wpDataCharts[t].container),e.setColumnIndexes(wpDataCharts[t].render_data.column_indexes),"undefined"!=typeof wpDataChartsCallbacks&&void 0!==wpDataChartsCallbacks[t]&&e.setRenderCallback(wpDataChartsCallbacks[t]),a.push(e)}a.length&&google.charts.setOnLoadCallback(function(){for(var t in a)a[t].render()})});
|
assets/js/wpdatatables/wdt.googleCharts.js
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
google.charts.load('current', {packages: ['corechart', 'bar', 'gauge', 'scatter']});
|
2 |
+
|
3 |
+
var wpDataTablesGoogleChart = function () {
|
4 |
+
|
5 |
+
var obj = {
|
6 |
+
rows: [],
|
7 |
+
columns: [],
|
8 |
+
type: 'column',
|
9 |
+
containerId: 'google-chart-container',
|
10 |
+
columnIndexes: [],
|
11 |
+
connectedWPDataTable: null,
|
12 |
+
chart: null,
|
13 |
+
googleDataTable: null,
|
14 |
+
renderCallback: null,
|
15 |
+
options: {
|
16 |
+
animation: 'none',
|
17 |
+
backgroundColor: {
|
18 |
+
fill: '#FFFFFF',
|
19 |
+
strokeWidth: 0,
|
20 |
+
stroke: '#666',
|
21 |
+
rx: 0
|
22 |
+
},
|
23 |
+
chartArea: {
|
24 |
+
backgroundColor: {}
|
25 |
+
|
26 |
+
},
|
27 |
+
crosshair: {},
|
28 |
+
height: 400,
|
29 |
+
legend: {
|
30 |
+
position: 'right'
|
31 |
+
},
|
32 |
+
orientation: 'horizontal',
|
33 |
+
titlePosition: 'out',
|
34 |
+
tooltip: {
|
35 |
+
trigger: 'none'
|
36 |
+
},
|
37 |
+
vAxis: {
|
38 |
+
direction: 1,
|
39 |
+
viewWindow: {}
|
40 |
+
}
|
41 |
+
},
|
42 |
+
setRows: function (rows) {
|
43 |
+
this.rows = rows;
|
44 |
+
},
|
45 |
+
enableDateTimeAxis: function () {
|
46 |
+
this.options.hAxis.gridlines = {
|
47 |
+
count: -1,
|
48 |
+
units: {
|
49 |
+
days: {format: ['MMM dd']},
|
50 |
+
hours: {format: ['HH:mm', 'ha']}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
},
|
54 |
+
detectDates: function () {
|
55 |
+
for (var i in this.columns) {
|
56 |
+
if (this.columns[i].type == 'date' || this.columns[i].type == 'datetime') {
|
57 |
+
for (var j in this.rows) {
|
58 |
+
var remDate = Date.parse(this.rows[j][i]);
|
59 |
+
if (isNaN(remDate)) {
|
60 |
+
this.rows[j][i] = new Date();
|
61 |
+
} else {
|
62 |
+
this.rows[j][i] = new Date(remDate);
|
63 |
+
if (this.connectedWPDataTable == null) {
|
64 |
+
var timeVal = this.rows[j][i].getTime();
|
65 |
+
if (this.columns[i].type == 'datetime') {
|
66 |
+
timeVal += this.rows[j][i].getTimezoneOffset() * 60 * 1000;
|
67 |
+
}
|
68 |
+
this.rows[j][i].setTime(timeVal);
|
69 |
+
} else {
|
70 |
+
this.rows[j][i].setTime(this.rows[j][i].getTime());
|
71 |
+
}
|
72 |
+
}
|
73 |
+
if (this.columns[i].type == 'datetime') {
|
74 |
+
this.enableDateTimeAxis();
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
},
|
80 |
+
setColumns: function (columns) {
|
81 |
+
this.columns = columns;
|
82 |
+
},
|
83 |
+
getColumns: function () {
|
84 |
+
return this.columns;
|
85 |
+
},
|
86 |
+
setOptions: function (options) {
|
87 |
+
for (var i in options) {
|
88 |
+
if (i == 'responsive_width' && options[i] == '1') {
|
89 |
+
obj.options.animation = false;
|
90 |
+
jQuery(window).resize(function () {
|
91 |
+
obj.chart.draw(obj.googleDataTable, obj.options);
|
92 |
+
});
|
93 |
+
continue;
|
94 |
+
}
|
95 |
+
this.options[i] = options[i];
|
96 |
+
}
|
97 |
+
},
|
98 |
+
getOptions: function () {
|
99 |
+
return this.options;
|
100 |
+
},
|
101 |
+
setType: function (type) {
|
102 |
+
this.type = type;
|
103 |
+
},
|
104 |
+
getType: function () {
|
105 |
+
return this.type;
|
106 |
+
},
|
107 |
+
setContainer: function (containerId) {
|
108 |
+
this.containerId = containerId;
|
109 |
+
},
|
110 |
+
getContainer: function () {
|
111 |
+
return this.containerId;
|
112 |
+
},
|
113 |
+
setRenderCallback: function (callback) {
|
114 |
+
this.renderCallback = callback;
|
115 |
+
},
|
116 |
+
render: function () {
|
117 |
+
this.googleDataTable = new google.visualization.DataTable();
|
118 |
+
for (var i in this.columns) {
|
119 |
+
this.googleDataTable.addColumn(this.columns[i]);
|
120 |
+
}
|
121 |
+
this.detectDates();
|
122 |
+
|
123 |
+
this.googleDataTable.addRows(this.rows);
|
124 |
+
switch (this.type) {
|
125 |
+
case 'google_column_chart':
|
126 |
+
this.chart = new google.visualization.ColumnChart(document.getElementById(this.containerId));
|
127 |
+
break;
|
128 |
+
case 'google_line_chart':
|
129 |
+
this.chart = new google.visualization.LineChart(document.getElementById(this.containerId));
|
130 |
+
break;
|
131 |
+
case 'google_pie_chart':
|
132 |
+
this.chart = new google.visualization.PieChart(document.getElementById(this.containerId));
|
133 |
+
break;
|
134 |
+
}
|
135 |
+
if (this.renderCallback !== null) {
|
136 |
+
this.renderCallback(this);
|
137 |
+
}
|
138 |
+
this.chart.draw(this.googleDataTable, this.options);
|
139 |
+
},
|
140 |
+
refresh: function () {
|
141 |
+
if (typeof google.visualization.DataTable !== 'undefined' && this.chart != null) {
|
142 |
+
this.googleDataTable = new google.visualization.DataTable();
|
143 |
+
for (var i in this.columns) {
|
144 |
+
this.googleDataTable.addColumn(this.columns[i]);
|
145 |
+
}
|
146 |
+
this.detectDates();
|
147 |
+
this.googleDataTable.addRows(this.rows);
|
148 |
+
if (this.renderCallback !== null) {
|
149 |
+
this.renderCallback(this);
|
150 |
+
}
|
151 |
+
this.chart.draw(this.googleDataTable, this.options);
|
152 |
+
}
|
153 |
+
},
|
154 |
+
|
155 |
+
setChartConfig: function (chartConfig) {
|
156 |
+
// Chart
|
157 |
+
if (chartConfig.responsive_width == 1) {
|
158 |
+
this.options.animation = false;
|
159 |
+
delete this.options.width;
|
160 |
+
jQuery(window).resize(function () {
|
161 |
+
obj.chart.draw(obj.googleDataTable, obj.options);
|
162 |
+
});
|
163 |
+
} else {
|
164 |
+
this.options.width = chartConfig.width;
|
165 |
+
}
|
166 |
+
chartConfig.height ? this.options.height = chartConfig.height : null;
|
167 |
+
this.options.backgroundColor.fill = chartConfig.background_color;
|
168 |
+
chartConfig.border_width ? this.options.backgroundColor.strokeWidth = chartConfig.border_width : null;
|
169 |
+
this.options.backgroundColor.stroke = chartConfig.border_color;
|
170 |
+
chartConfig.border_radius ? this.options.backgroundColor.rx = chartConfig.border_radius : null;
|
171 |
+
chartConfig.border_radius ? this.options.backgroundColor.rx = chartConfig.border_radius : null;
|
172 |
+
this.options.chartArea.backgroundColor.fill = chartConfig.plot_background_color;
|
173 |
+
chartConfig.plot_border_width ? this.options.chartArea.backgroundColor.strokeWidth = chartConfig.plot_border_width : null;
|
174 |
+
this.options.chartArea.backgroundColor.stroke = chartConfig.plot_border_color;
|
175 |
+
|
176 |
+
// Series
|
177 |
+
var j = 0;
|
178 |
+
for (var i in chartConfig.series_data) {
|
179 |
+
this.columns[j + 1].label = chartConfig.series_data[i].label;
|
180 |
+
if (chartConfig.series_data[i].color != '') {
|
181 |
+
this.options.series[j] = {
|
182 |
+
color: chartConfig.series_data[i].color
|
183 |
+
};
|
184 |
+
}
|
185 |
+
j++;
|
186 |
+
}
|
187 |
+
// Axes
|
188 |
+
if (chartConfig.show_grid == 0) {
|
189 |
+
this.options.hAxis.gridlines = {
|
190 |
+
color: 'transparent'
|
191 |
+
};
|
192 |
+
this.options.vAxis.gridlines = {
|
193 |
+
color: 'transparent'
|
194 |
+
};
|
195 |
+
} else {
|
196 |
+
delete this.options.hAxis.gridlines;
|
197 |
+
delete this.options.vAxis.gridlines;
|
198 |
+
}
|
199 |
+
chartConfig.horizontal_axis_label ? this.options.hAxis.title = chartConfig.horizontal_axis_label : null;
|
200 |
+
chartConfig.vertical_axis_label ? this.options.vAxis.title = chartConfig.vertical_axis_label : null;
|
201 |
+
|
202 |
+
// Title
|
203 |
+
chartConfig.show_title == 1 ? this.options.title = chartConfig.chart_title : this.options.title = '';
|
204 |
+
chartConfig.title_floating == 1 ? this.options.titlePosition = 'in' : this.options.titlePosition = 'out';
|
205 |
+
// Tooltip
|
206 |
+
this.options.tooltip.trigger = 'none';
|
207 |
+
// Legend
|
208 |
+
chartConfig.legend_position ? this.options.legend.position = chartConfig.legend_position : null;
|
209 |
+
if (chartConfig.legend_vertical_align == 'bottom') {
|
210 |
+
this.options.legend.alignment = 'end';
|
211 |
+
} else if (chartConfig.legend_vertical_align == 'middle') {
|
212 |
+
this.options.legend.alignment = 'center';
|
213 |
+
} else {
|
214 |
+
this.options.legend.alignment = 'start';
|
215 |
+
}
|
216 |
+
|
217 |
+
},
|
218 |
+
setColumnIndexes: function (columnIndexes) {
|
219 |
+
this.columnIndexes = columnIndexes;
|
220 |
+
},
|
221 |
+
getColumnIndexes: function () {
|
222 |
+
return this.columnIndexes;
|
223 |
+
}
|
224 |
+
|
225 |
+
};
|
226 |
+
|
227 |
+
return obj;
|
228 |
+
|
229 |
+
};
|
assets/js/wpdatatables/wdt.googleCharts.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
google.charts.load("current",{packages:["corechart","bar","gauge","scatter"]});var wpDataTablesGoogleChart=function(){var t={rows:[],columns:[],type:"column",containerId:"google-chart-container",columnIndexes:[],connectedWPDataTable:null,chart:null,googleDataTable:null,renderCallback:null,options:{animation:"none",backgroundColor:{fill:"#FFFFFF",strokeWidth:0,stroke:"#666",rx:0},chartArea:{backgroundColor:{}},crosshair:{},height:400,legend:{position:"right"},orientation:"horizontal",titlePosition:"out",tooltip:{trigger:"none"},vAxis:{direction:1,viewWindow:{}}},setRows:function(t){this.rows=t},enableDateTimeAxis:function(){this.options.hAxis.gridlines={count:-1,units:{days:{format:["MMM dd"]},hours:{format:["HH:mm","ha"]}}}},detectDates:function(){for(var t in this.columns)if("date"==this.columns[t].type||"datetime"==this.columns[t].type)for(var o in this.rows){var i=Date.parse(this.rows[o][t]);if(isNaN(i))this.rows[o][t]=new Date;else if(this.rows[o][t]=new Date(i),null==this.connectedWPDataTable){var e=this.rows[o][t].getTime();"datetime"==this.columns[t].type&&(e+=60*this.rows[o][t].getTimezoneOffset()*1e3),this.rows[o][t].setTime(e)}else this.rows[o][t].setTime(this.rows[o][t].getTime());"datetime"==this.columns[t].type&&this.enableDateTimeAxis()}},setColumns:function(t){this.columns=t},getColumns:function(){return this.columns},setOptions:function(o){for(var i in o)"responsive_width"!=i||"1"!=o[i]?this.options[i]=o[i]:(t.options.animation=!1,jQuery(window).resize(function(){t.chart.draw(t.googleDataTable,t.options)}))},getOptions:function(){return this.options},setType:function(t){this.type=t},getType:function(){return this.type},setContainer:function(t){this.containerId=t},getContainer:function(){return this.containerId},setRenderCallback:function(t){this.renderCallback=t},render:function(){for(var t in this.googleDataTable=new google.visualization.DataTable,this.columns)this.googleDataTable.addColumn(this.columns[t]);switch(this.detectDates(),this.googleDataTable.addRows(this.rows),this.type){case"google_column_chart":this.chart=new google.visualization.ColumnChart(document.getElementById(this.containerId));break;case"google_line_chart":this.chart=new google.visualization.LineChart(document.getElementById(this.containerId));break;case"google_pie_chart":this.chart=new google.visualization.PieChart(document.getElementById(this.containerId))}null!==this.renderCallback&&this.renderCallback(this),this.chart.draw(this.googleDataTable,this.options)},refresh:function(){if(void 0!==google.visualization.DataTable&&null!=this.chart){for(var t in this.googleDataTable=new google.visualization.DataTable,this.columns)this.googleDataTable.addColumn(this.columns[t]);this.detectDates(),this.googleDataTable.addRows(this.rows),null!==this.renderCallback&&this.renderCallback(this),this.chart.draw(this.googleDataTable,this.options)}},setChartConfig:function(o){1==o.responsive_width?(this.options.animation=!1,delete this.options.width,jQuery(window).resize(function(){t.chart.draw(t.googleDataTable,t.options)})):this.options.width=o.width,o.height&&(this.options.height=o.height),this.options.backgroundColor.fill=o.background_color,o.border_width&&(this.options.backgroundColor.strokeWidth=o.border_width),this.options.backgroundColor.stroke=o.border_color,o.border_radius&&(this.options.backgroundColor.rx=o.border_radius),o.border_radius&&(this.options.backgroundColor.rx=o.border_radius),this.options.chartArea.backgroundColor.fill=o.plot_background_color,o.plot_border_width&&(this.options.chartArea.backgroundColor.strokeWidth=o.plot_border_width),this.options.chartArea.backgroundColor.stroke=o.plot_border_color;var i=0;for(var e in o.series_data)this.columns[i+1].label=o.series_data[e].label,""!=o.series_data[e].color&&(this.options.series[i]={color:o.series_data[e].color}),i++;0==o.show_grid?(this.options.hAxis.gridlines={color:"transparent"},this.options.vAxis.gridlines={color:"transparent"}):(delete this.options.hAxis.gridlines,delete this.options.vAxis.gridlines),o.horizontal_axis_label&&(this.options.hAxis.title=o.horizontal_axis_label),o.vertical_axis_label&&(this.options.vAxis.title=o.vertical_axis_label),1==o.show_title?this.options.title=o.chart_title:this.options.title="",1==o.title_floating?this.options.titlePosition="in":this.options.titlePosition="out",this.options.tooltip.trigger="none",o.legend_position&&(this.options.legend.position=o.legend_position),"bottom"==o.legend_vertical_align?this.options.legend.alignment="end":"middle"==o.legend_vertical_align?this.options.legend.alignment="center":this.options.legend.alignment="start"},setColumnIndexes:function(t){this.columnIndexes=t},getColumnIndexes:function(){return this.columnIndexes}};return t};
|
config/config.inc.php
CHANGED
@@ -9,8 +9,7 @@ defined('ABSPATH') or die("Cannot access pages directly.");
|
|
9 |
|
10 |
// Current version
|
11 |
|
12 |
-
define('WDT_CURRENT_VERSION', '2.
|
13 |
-
define('WDT_TIMEOUT_FACTOR', 5);
|
14 |
|
15 |
/**
|
16 |
* Regular Expressions
|
@@ -42,7 +41,6 @@ define('WDT_INCLUDE_DATATABLES_CORE', true); // Whether to include link to jQuer
|
|
42 |
define('WDT_STORE_URL', 'https://store.tms-plugins.com/');
|
43 |
define('WDT_STORE_API_URL', 'https://store.tms-plugins.com/api/');
|
44 |
|
45 |
-
define('WDT_VALIDATE_COEFFICIENT', 30);
|
46 |
|
47 |
/**
|
48 |
* MySQL settings for query-based tables
|
9 |
|
10 |
// Current version
|
11 |
|
12 |
+
define('WDT_CURRENT_VERSION', '2.013');
|
|
|
13 |
|
14 |
/**
|
15 |
* Regular Expressions
|
41 |
define('WDT_STORE_URL', 'https://store.tms-plugins.com/');
|
42 |
define('WDT_STORE_API_URL', 'https://store.tms-plugins.com/api/');
|
43 |
|
|
|
44 |
|
45 |
/**
|
46 |
* MySQL settings for query-based tables
|
controllers/wdt_admin.php
CHANGED
@@ -247,10 +247,10 @@ function wdtBrowseChartsEnqueue() {
|
|
247 |
wp_enqueue_style('wdt-browse-css');
|
248 |
|
249 |
wp_enqueue_script('wdt-common');
|
250 |
-
wp_enqueue_script('wdt-browse-js', WDT_JS_PATH . 'wpdatatables/admin/browse/wdt.browse.js', array(),
|
251 |
wp_enqueue_script('wdt-doc-js');
|
252 |
|
253 |
-
wp_localize_script('wdt-browse-js', '
|
254 |
}
|
255 |
|
256 |
/**
|
@@ -265,9 +265,11 @@ function wdtChartWizardEnqueue() {
|
|
265 |
wp_enqueue_script('wdt-jsrender');
|
266 |
wp_enqueue_script('wdt-dragula');
|
267 |
|
|
|
|
|
268 |
wp_enqueue_script('wdt-common');
|
269 |
wp_enqueue_script('wdt-chart-wizard', WDT_JS_PATH . 'wpdatatables/wdt.chartWizard.js', array(), false, true);
|
270 |
-
|
271 |
wp_enqueue_script('wdt-doc-js');
|
272 |
|
273 |
wp_localize_script('wdt-chart-wizard', 'wpdatatablesEditStrings', WDTTools::getTranslationStrings());
|
247 |
wp_enqueue_style('wdt-browse-css');
|
248 |
|
249 |
wp_enqueue_script('wdt-common');
|
250 |
+
wp_enqueue_script('wdt-browse-js', WDT_JS_PATH . 'wpdatatables/admin/browse/wdt.browse.js', array(), WDT_CURRENT_VERSION, true);
|
251 |
wp_enqueue_script('wdt-doc-js');
|
252 |
|
253 |
+
wp_localize_script('wdt-browse-js', 'wpdatatablesStrings', WDTTools::getTranslationStrings());
|
254 |
}
|
255 |
|
256 |
/**
|
265 |
wp_enqueue_script('wdt-jsrender');
|
266 |
wp_enqueue_script('wdt-dragula');
|
267 |
|
268 |
+
wp_enqueue_script('wdt-google-charts', '//www.gstatic.com/charts/loader.js', array(), WDT_CURRENT_VERSION, true);
|
269 |
+
|
270 |
wp_enqueue_script('wdt-common');
|
271 |
wp_enqueue_script('wdt-chart-wizard', WDT_JS_PATH . 'wpdatatables/wdt.chartWizard.js', array(), false, true);
|
272 |
+
wp_enqueue_script('wdt-wp-google-chart', WDT_JS_PATH . 'wpdatatables/wdt.googleCharts.js', array(), WDT_CURRENT_VERSION, true);
|
273 |
wp_enqueue_script('wdt-doc-js');
|
274 |
|
275 |
wp_localize_script('wdt-chart-wizard', 'wpdatatablesEditStrings', WDTTools::getTranslationStrings());
|
controllers/wdt_admin_ajax_actions.php
CHANGED
@@ -228,3 +228,90 @@ function wdtListAllTables() {
|
|
228 |
add_action('wp_ajax_wpdatatable_list_all_tables', 'wdtListAllTables');
|
229 |
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
add_action('wp_ajax_wpdatatable_list_all_tables', 'wdtListAllTables');
|
229 |
|
230 |
|
231 |
+
function wdtShowChartFromData()
|
232 |
+
{
|
233 |
+
if (!current_user_can('manage_options') || !wp_verify_nonce($_POST['wdtNonce'], 'wdtChartWizardNonce')) {
|
234 |
+
exit();
|
235 |
+
}
|
236 |
+
|
237 |
+
$chartData = $_POST['chart_data'];
|
238 |
+
$wpDataChart = WPDataChart::factory($chartData, false);
|
239 |
+
|
240 |
+
echo json_encode($wpDataChart->returnData());
|
241 |
+
exit();
|
242 |
+
}
|
243 |
+
|
244 |
+
add_action('wp_ajax_wpdatatable_show_chart_from_data', 'wdtShowChartFromData');
|
245 |
+
|
246 |
+
function wdtSaveChart()
|
247 |
+
{
|
248 |
+
if (!current_user_can('manage_options') || !wp_verify_nonce($_POST['wdtNonce'], 'wdtChartWizardNonce')) {
|
249 |
+
exit();
|
250 |
+
}
|
251 |
+
|
252 |
+
$chartData = $_POST['chart_data'];
|
253 |
+
$wpDataChart = WPDataChart::factory($chartData, false);
|
254 |
+
$wpDataChart->save();
|
255 |
+
|
256 |
+
echo json_encode(array('id' => $wpDataChart->getId(), 'shortcode' => $wpDataChart->getShortCode()));
|
257 |
+
exit();
|
258 |
+
}
|
259 |
+
|
260 |
+
add_action('wp_ajax_wpdatatable_save_chart_get_shortcode', 'wdtSaveChart');
|
261 |
+
|
262 |
+
/**
|
263 |
+
* List all charts in JSON
|
264 |
+
*/
|
265 |
+
function wdtListAllCharts()
|
266 |
+
{
|
267 |
+
if (!current_user_can('manage_options')) {
|
268 |
+
exit();
|
269 |
+
}
|
270 |
+
|
271 |
+
echo json_encode(WPDataChart::getAllCharts());
|
272 |
+
exit();
|
273 |
+
}
|
274 |
+
|
275 |
+
add_action('wp_ajax_wpdatatable_list_all_charts', 'wdtListAllCharts');
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Duplicate the chart
|
279 |
+
*/
|
280 |
+
|
281 |
+
function wdtDuplicateChart()
|
282 |
+
{
|
283 |
+
global $wpdb;
|
284 |
+
|
285 |
+
if (!current_user_can('manage_options') || !wp_verify_nonce($_POST['wdtNonce'], 'wdtDuplicateChartNonce')) {
|
286 |
+
exit();
|
287 |
+
}
|
288 |
+
|
289 |
+
$chartId = (int)$_POST['chart_id'];
|
290 |
+
if (empty($chartId)) {
|
291 |
+
return false;
|
292 |
+
}
|
293 |
+
$newChartName = sanitize_text_field($_POST['new_chart_name']);
|
294 |
+
|
295 |
+
$chartQuery = $wpdb->prepare(
|
296 |
+
'SELECT * FROM ' . $wpdb->prefix . 'wpdatacharts WHERE id = %d',
|
297 |
+
$chartId
|
298 |
+
);
|
299 |
+
|
300 |
+
$wpDataChart = $wpdb->get_row($chartQuery);
|
301 |
+
|
302 |
+
// Creating new table
|
303 |
+
$wpdb->insert(
|
304 |
+
$wpdb->prefix . "wpdatacharts",
|
305 |
+
array(
|
306 |
+
'wpdatatable_id' => $wpDataChart->wpdatatable_id,
|
307 |
+
'title' => $newChartName,
|
308 |
+
'engine' => $wpDataChart->engine,
|
309 |
+
'type' => $wpDataChart->type,
|
310 |
+
'json_render_data' => $wpDataChart->json_render_data
|
311 |
+
)
|
312 |
+
);
|
313 |
+
|
314 |
+
exit();
|
315 |
+
}
|
316 |
+
|
317 |
+
add_action('wp_ajax_wpdatatables_duplicate_chart', 'wdtDuplicateChart');
|
controllers/wdt_functions.php
CHANGED
@@ -642,6 +642,7 @@ function wdtSanitizeQuery($query) {
|
|
642 |
|
643 |
function initGutenbergBlocks (){
|
644 |
WpDataTablesGutenbergBlock::init();
|
|
|
645 |
add_filter( 'block_categories', 'addWpDataTablesBlockCategory', 10, 2);
|
646 |
}
|
647 |
|
642 |
|
643 |
function initGutenbergBlocks (){
|
644 |
WpDataTablesGutenbergBlock::init();
|
645 |
+
WpDataChartsGutenbergBlock::init();
|
646 |
add_filter( 'block_categories', 'addWpDataTablesBlockCategory', 10, 2);
|
647 |
}
|
648 |
|
license.txt
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
readme.txt
CHANGED
@@ -1,20 +1,22 @@
|
|
1 |
-
=== wpDataTables
|
2 |
-
Contributors: wpDataTables
|
3 |
-
Author URI:
|
4 |
-
Plugin URI:
|
5 |
-
Tags:
|
6 |
Requires at least: 4.0
|
7 |
-
Tested up to: 5.2
|
8 |
Requires PHP: 5.4
|
9 |
-
Stable tag: 2.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
-
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
-
wpDataTables
|
|
|
|
|
18 |
|
19 |
* Excel - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-excel/)
|
20 |
* CSV - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-csv/)
|
@@ -22,6 +24,8 @@ wpDataTables Lite is a basic version of a popular best-selling WordPress table p
|
|
22 |
* XML - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-xml/)
|
23 |
* Serialized PHP array - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-serialized-php-array/)
|
24 |
|
|
|
|
|
25 |
Creating tables and charts with a WordPress tables plugin has never been easier. It only takes 3 basic steps:
|
26 |
|
27 |
**Step 1 - Provide table data**
|
@@ -34,7 +38,7 @@ You can customize and configure the columns of your WordPress table (rename, reo
|
|
34 |
|
35 |
**Step 3 - Publish in a post or page**
|
36 |
|
37 |
-
Once you are happy with the design of your WordPress table, you can easily insert it on any post or page
|
38 |
|
39 |
Additionally, each table can have a search bar and can have the following functions: “Copy to Clipboard”, “Export to CSV”, “Export to PDF”, “Export to XLS”. All these functionalities are configurable and it is your decision whether to toggle these on or off.
|
40 |
|
@@ -50,49 +54,47 @@ Following column data types are supported. Most column types, except the images,
|
|
50 |
* URL link - [Text and video documentation](https://wpdatatables.com/documentation/column-features/url-link-columns/)
|
51 |
* E-mail link - [Text and video documentation](https://wpdatatables.com/documentation/column-features/e-mail-link-columns/)
|
52 |
|
53 |
-
Please note some limitations
|
54 |
-
|
55 |
-
1.
|
56 |
-
2.
|
57 |
-
3.
|
58 |
-
4.
|
59 |
-
5.
|
60 |
-
6.
|
61 |
-
7.
|
62 |
-
8.
|
63 |
-
9.
|
64 |
-
10.
|
65 |
-
11.
|
66 |
-
12. Access to our premium support system is not included.
|
67 |
|
68 |
You can get all of these features by purchasing the full version on [the plugin's site](https://wpdatatables.com).
|
69 |
|
70 |
Please note that wpDataTables requires PHP 5.4 or newer!
|
71 |
|
72 |
-
**wpDataTables
|
73 |
|
74 |
If you still can’t decide which wpDataTables version to choose, you should get familiar with the basic features of both of them, and then take it from there. It all boils down to the type of tables in WordPress that you want to create.
|
75 |
|
76 |
-
**wpDataTables
|
77 |
|
78 |
-
If you don’t require the most advanced features because you only create a table in WordPress every now and then,
|
79 |
-
The basic difference between the Lite and the Premium version is the table size limitation. With wpDataTables Lite you can create responsive tables in WordPress with the maximum of 150 rows.
|
80 |
|
81 |
**wpDataTables Premium**
|
82 |
|
83 |
-
While the
|
84 |
However, the thing that really sets it apart is the possibility to manage any amount of data and create huge responsive tables in WordPress.
|
85 |
|
86 |
**Do I Need wpDataTables?**
|
87 |
|
88 |
-
Well, the short answer is – yes. If you want to create fully functional and great looking WordPress tables, you need wpDataTables. The number of the users currently taking advantage of this plugin is
|
89 |
The major features of wpDataTables include but are not limited to:
|
90 |
|
91 |
* Building WordPress tables quickly and easily – no complicated configuration; just simple clicking;
|
92 |
* No coding knowledge required;
|
93 |
* Fully customizable WordPress tables and charts – from choosing the color palette to inserting elements such as your company logo, wpDataTables allows you to customize your tables and charts in any way you see fit;
|
94 |
* A WordPress table plugin that works like a spreadsheet app – with all the advanced features and tools, wpDataTables truly stands out from the competition;
|
95 |
-
*
|
96 |
|
97 |
Additional useful features include:
|
98 |
|
@@ -160,9 +162,17 @@ This can be changed from the “Number format” drop-down menu in the wpDataTab
|
|
160 |
5. General settings
|
161 |
6. Column settings
|
162 |
7. Plugin settings
|
|
|
|
|
163 |
|
164 |
== Changelog ==
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
= 2.0.12 =
|
167 |
* Bug fixes and stability improvements.
|
168 |
|
@@ -246,5 +256,4 @@ This can be changed from the “Number format” drop-down menu in the wpDataTab
|
|
246 |
* Numerous bugfixes
|
247 |
|
248 |
= 1.0 =
|
249 |
-
*
|
250 |
-
|
1 |
+
=== wpDataTables - Tables & Table Charts ===
|
2 |
+
Contributors: wpDataTables, WebFactory
|
3 |
+
Author URI: https://tms-outsource.com
|
4 |
+
Plugin URI: https://wpdatatables.com/
|
5 |
+
Tags: data tables, tables, charts, tables from csv, tables from excel, datatables, responsive tables, charting, mysql tables
|
6 |
Requires at least: 4.0
|
7 |
+
Tested up to: 5.2
|
8 |
Requires PHP: 5.4
|
9 |
+
Stable tag: 2.013
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
+
Create responsive, sortable tables & charts from Excel, CSV & PHP. Add tables & charts to posts in minutes with DataTables.
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
+
wpDataTables is a popular WordPress table plugin used to **quickly create tables & table charts** from Excel, CVS, PHP and other data sources.
|
18 |
+
|
19 |
+
[youtube https://www.youtube.com/watch?v=06QF0wNEf94]
|
20 |
|
21 |
* Excel - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-excel/)
|
22 |
* CSV - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-csv/)
|
24 |
* XML - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-xml/)
|
25 |
* Serialized PHP array - [Text and video documentation](https://wpdatatables.com/documentation/creating-wpdatatables/creating-wpdatatables-from-serialized-php-array/)
|
26 |
|
27 |
+
wpDataTables allows creating Line, Column and Pie charts using the Google Charts rendering engine
|
28 |
+
|
29 |
Creating tables and charts with a WordPress tables plugin has never been easier. It only takes 3 basic steps:
|
30 |
|
31 |
**Step 1 - Provide table data**
|
38 |
|
39 |
**Step 3 - Publish in a post or page**
|
40 |
|
41 |
+
Once you are happy with the design of your WordPress table, you can easily insert it on any post or page through Gutenberg, standard WP Editor and shortcode, or through page builders like WPBakery Page Builder, Visual Composer or Elementor. All tables will become sortable and will have pagination by default.
|
42 |
|
43 |
Additionally, each table can have a search bar and can have the following functions: “Copy to Clipboard”, “Export to CSV”, “Export to PDF”, “Export to XLS”. All these functionalities are configurable and it is your decision whether to toggle these on or off.
|
44 |
|
54 |
* URL link - [Text and video documentation](https://wpdatatables.com/documentation/column-features/url-link-columns/)
|
55 |
* E-mail link - [Text and video documentation](https://wpdatatables.com/documentation/column-features/e-mail-link-columns/)
|
56 |
|
57 |
+
Please note some limitations compared to the Premium version of the wpDataTables plugin:
|
58 |
+
|
59 |
+
1. MySQL-query based tables support is not included.
|
60 |
+
2. Creating tables from the Google Spreadsheet files is not included.
|
61 |
+
3. Create a table manually is not included.
|
62 |
+
4. Server-side processing is not included.
|
63 |
+
5. Responsive mode for the tables is not included.
|
64 |
+
6. Table filters are not included.
|
65 |
+
7. Front-end editing is not included.
|
66 |
+
8. Excel-like editing is not included
|
67 |
+
9. Advanced Google Charts (except for Line, Column and Pie), HighCharts and Chart.js are not included
|
68 |
+
10.Table Constructor Wizard (step-by-step table generator) is not included.
|
69 |
+
11.Access to our premium support system is not included.
|
|
|
70 |
|
71 |
You can get all of these features by purchasing the full version on [the plugin's site](https://wpdatatables.com).
|
72 |
|
73 |
Please note that wpDataTables requires PHP 5.4 or newer!
|
74 |
|
75 |
+
**wpDataTables vs wpDataTables Premium**
|
76 |
|
77 |
If you still can’t decide which wpDataTables version to choose, you should get familiar with the basic features of both of them, and then take it from there. It all boils down to the type of tables in WordPress that you want to create.
|
78 |
|
79 |
+
**wpDataTables**
|
80 |
|
81 |
+
If you don’t require the most advanced features because you only create a table in WordPress every now and then, wpDataTables is perfect for you.
|
|
|
82 |
|
83 |
**wpDataTables Premium**
|
84 |
|
85 |
+
While the basic version is great for people who create small and simple tables, wpDataTables Premium is the best table plugin for WordPress and it comes with a huge set of amazing features.
|
86 |
However, the thing that really sets it apart is the possibility to manage any amount of data and create huge responsive tables in WordPress.
|
87 |
|
88 |
**Do I Need wpDataTables?**
|
89 |
|
90 |
+
Well, the short answer is – yes. If you want to create fully functional and great looking WordPress tables, you need wpDataTables. The number of the users currently taking advantage of this plugin is 30,000 and counting.
|
91 |
The major features of wpDataTables include but are not limited to:
|
92 |
|
93 |
* Building WordPress tables quickly and easily – no complicated configuration; just simple clicking;
|
94 |
* No coding knowledge required;
|
95 |
* Fully customizable WordPress tables and charts – from choosing the color palette to inserting elements such as your company logo, wpDataTables allows you to customize your tables and charts in any way you see fit;
|
96 |
* A WordPress table plugin that works like a spreadsheet app – with all the advanced features and tools, wpDataTables truly stands out from the competition;
|
97 |
+
* 1 year of updates and support
|
98 |
|
99 |
Additional useful features include:
|
100 |
|
162 |
5. General settings
|
163 |
6. Column settings
|
164 |
7. Plugin settings
|
165 |
+
8. Google charts
|
166 |
+
9. Google chart settings
|
167 |
|
168 |
== Changelog ==
|
169 |
|
170 |
+
= 2.013 =
|
171 |
+
* Feature: Removed limitation for number of rows in tables
|
172 |
+
* Feature: Added functionality for creating Google charts(Line, Column and Pie)
|
173 |
+
* Feature: Added options for customizing Google charts(Line, Column and Pie)
|
174 |
+
* Bug fixes and stability improvements.
|
175 |
+
|
176 |
= 2.0.12 =
|
177 |
* Bug fixes and stability improvements.
|
178 |
|
256 |
* Numerous bugfixes
|
257 |
|
258 |
= 1.0 =
|
259 |
+
* Initial version for wp.org
|
|
source/GutenbergBlock.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined('ABSPATH') or die('Access denied.');
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class GutenbergBlock
|
7 |
+
*/
|
8 |
+
class GutenbergBlock
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Register WP Ajax actions.
|
12 |
+
*/
|
13 |
+
public static function init()
|
14 |
+
{
|
15 |
+
if (is_admin() && function_exists('register_block_type')) {
|
16 |
+
if (substr($_SERVER['PHP_SELF'], '-8') == 'post.php' ||
|
17 |
+
substr($_SERVER['PHP_SELF'], '-12') == 'post-new.php'
|
18 |
+
) {
|
19 |
+
|
20 |
+
if (self::isGutenbergActive()) {
|
21 |
+
$class = get_called_class();
|
22 |
+
add_action('init', function () use ($class) {
|
23 |
+
$class::registerBlockType();
|
24 |
+
});
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Check if Block Editor is active.
|
33 |
+
*
|
34 |
+
* @return bool
|
35 |
+
*/
|
36 |
+
public static function isGutenbergActive()
|
37 |
+
{
|
38 |
+
// Gutenberg plugin is installed and activated.
|
39 |
+
$gutenberg = !(false === has_filter('replace_editor', 'gutenberg_init'));
|
40 |
+
|
41 |
+
// Block editor since 5.0.
|
42 |
+
$block_editor = version_compare($GLOBALS['wp_version'], '5.0-beta', '>');
|
43 |
+
|
44 |
+
if (!$gutenberg && !$block_editor) {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
if (self::isClassicEditorPluginActive()) {
|
49 |
+
$editor_option = get_option('classic-editor-replace');
|
50 |
+
$block_editor_active = array('no-replace', 'block');
|
51 |
+
|
52 |
+
return in_array($editor_option, $block_editor_active, true);
|
53 |
+
}
|
54 |
+
|
55 |
+
// Fix for conflict with Avada - Fusion builder and gutenberg blocks
|
56 |
+
if (class_exists('FusionBuilder') && !(isset($_GET['gutenberg-editor']))) {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
// Fix for conflict with Disable Gutenberg plugin
|
61 |
+
if (class_exists('DisableGutenberg')) {
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
|
65 |
+
// Fix for conflict with WP Bakery Page Builder
|
66 |
+
if (class_exists('Vc_Manager') && (isset($_GET['classic-editor'])) || (class_exists('Vc_Manager') && get_option('wpb_js_gutenberg_disable') == true)) {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Check if Classic Editor plugin is active
|
75 |
+
*
|
76 |
+
* @return bool
|
77 |
+
*/
|
78 |
+
public static function isClassicEditorPluginActive()
|
79 |
+
{
|
80 |
+
|
81 |
+
if (!function_exists('is_plugin_active')) {
|
82 |
+
|
83 |
+
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
84 |
+
}
|
85 |
+
|
86 |
+
if (is_plugin_active('classic-editor/classic-editor.php')) {
|
87 |
+
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
source/WpDataChartsGutenbergBlock.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined('ABSPATH') or die('Access denied.');
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class WpDataChartsGutenbergBlock
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
class WpDataChartsGutenbergBlock extends GutenbergBlock
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Register wpDataCharts block for Gutenberg
|
13 |
+
*/
|
14 |
+
public static function registerBlockType()
|
15 |
+
{
|
16 |
+
|
17 |
+
wp_enqueue_script(
|
18 |
+
'wpdatacharts-gutenberg-block',
|
19 |
+
WDT_ROOT_URL . 'assets/js/gutenberg/wpdatacharts-gutenberg-block.js',
|
20 |
+
array('wp-blocks', 'wp-components', 'wp-element', 'wp-editor')
|
21 |
+
);
|
22 |
+
|
23 |
+
wp_localize_script(
|
24 |
+
'wpdatacharts-gutenberg-block',
|
25 |
+
'wpdatacharts',
|
26 |
+
array(
|
27 |
+
'title' => 'wpDataCharts',
|
28 |
+
'description' => __('Choose the chart that you’ve just created in the dropdown below, and the shortcode will be inserted automatically.', 'wpdatatables'),
|
29 |
+
'data' => self::wdtGetAllChartsForGutenberg()
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
register_block_type(
|
34 |
+
'wpdatatables/wpdatacharts-gutenberg-block',
|
35 |
+
array('editor_script' => 'wpdatacharts-gutenberg-block')
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
public static function wdtGetAllChartsForGutenberg()
|
40 |
+
{
|
41 |
+
|
42 |
+
global $wpdb;
|
43 |
+
$returnCharts = [];
|
44 |
+
|
45 |
+
$query = "SELECT id, title FROM {$wpdb->prefix}wpdatacharts ORDER BY id";
|
46 |
+
|
47 |
+
$allCharts = $wpdb->get_results($query, ARRAY_A);
|
48 |
+
|
49 |
+
foreach ($allCharts as $chart) {
|
50 |
+
$returnCharts[] = [
|
51 |
+
'name' => $chart['title'],
|
52 |
+
'id' => $chart['id'],
|
53 |
+
];
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
return $returnCharts;
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
}
|
source/WpDataTablesGutenbergBlock.php
CHANGED
@@ -1,43 +1,47 @@
|
|
1 |
<?php
|
2 |
|
|
|
3 |
defined('ABSPATH') or die('Access denied.');
|
4 |
|
5 |
/**
|
6 |
* Class WpDataTablesGutenbergBlock
|
7 |
*
|
8 |
*/
|
9 |
-
class WpDataTablesGutenbergBlock
|
10 |
{
|
|
|
|
|
|
|
11 |
public static function registerBlockType()
|
12 |
{
|
13 |
|
14 |
wp_enqueue_script(
|
15 |
'wpdatatables-gutenberg-block',
|
16 |
WDT_ROOT_URL . 'assets/js/gutenberg/wpdatatables-gutenberg-block.js',
|
17 |
-
array(
|
18 |
);
|
19 |
|
20 |
wp_localize_script(
|
21 |
'wpdatatables-gutenberg-block',
|
22 |
'wpdatatables',
|
23 |
array(
|
24 |
-
'title' => 'wpDataTables
|
25 |
-
'description' => __('Choose the table that you’ve just created in the dropdown below, and the shortcode will be inserted automatically. You are able to provide Export file name
|
26 |
'data' => self::wdtGetAllTablesForGutenberg()
|
27 |
)
|
28 |
);
|
29 |
|
30 |
register_block_type(
|
31 |
'wpdatatables/wpdatatables-gutenberg-block',
|
32 |
-
array('editor_script' => '
|
33 |
);
|
34 |
|
35 |
}
|
36 |
|
37 |
-
public static function wdtGetAllTablesForGutenberg()
|
|
|
38 |
|
39 |
global $wpdb;
|
40 |
-
|
41 |
$returnTables = [];
|
42 |
|
43 |
$query = "SELECT id, title FROM {$wpdb->prefix}wpdatatables ORDER BY id";
|
@@ -54,86 +58,4 @@ class WpDataTablesGutenbergBlock
|
|
54 |
|
55 |
return $returnTables;
|
56 |
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Register WP Ajax actions.
|
60 |
-
*/
|
61 |
-
public static function init()
|
62 |
-
{
|
63 |
-
if (is_admin() && function_exists('register_block_type')) {
|
64 |
-
if (substr($_SERVER['PHP_SELF'], '-8') == 'post.php' ||
|
65 |
-
substr($_SERVER['PHP_SELF'], '-12') == 'post-new.php'
|
66 |
-
) {
|
67 |
-
|
68 |
-
if (self::isGutenbergActive()) {
|
69 |
-
add_action('init', array('WpDataTablesGutenbergBlock','registerBlockType'));
|
70 |
-
}
|
71 |
-
|
72 |
-
}
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Check if Block Editor is active.
|
78 |
-
*
|
79 |
-
* @return bool
|
80 |
-
*/
|
81 |
-
public static function isGutenbergActive()
|
82 |
-
{
|
83 |
-
// Gutenberg plugin is installed and activated.
|
84 |
-
$gutenberg = !(false === has_filter('replace_editor', 'gutenberg_init'));
|
85 |
-
|
86 |
-
// Block editor since 5.0.
|
87 |
-
$block_editor = version_compare($GLOBALS['wp_version'], '5.0-beta', '>');
|
88 |
-
|
89 |
-
if (!$gutenberg && !$block_editor) {
|
90 |
-
return false;
|
91 |
-
}
|
92 |
-
|
93 |
-
if (self::isClassicEditorPluginActive()) {
|
94 |
-
$editor_option = get_option('classic-editor-replace');
|
95 |
-
$block_editor_active = array('no-replace', 'block');
|
96 |
-
|
97 |
-
return in_array($editor_option, $block_editor_active, true);
|
98 |
-
}
|
99 |
-
|
100 |
-
// Fix for conflict with Avada - Fusion builder and gutenberg blocks
|
101 |
-
if ( class_exists( 'FusionBuilder' ) && !(isset( $_GET['gutenberg-editor']))){
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
|
105 |
-
// Fix for conflict with Disable Gutenberg plugin
|
106 |
-
if (class_exists('DisableGutenberg')) {
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
|
110 |
-
// Fix for conflict with WP Bakery Page Builder
|
111 |
-
if ( class_exists( 'Vc_Manager' ) && (isset( $_GET['classic-editor'])) || (class_exists( 'Vc_Manager' ) && get_option('wpb_js_gutenberg_disable') == true)){
|
112 |
-
return false;
|
113 |
-
}
|
114 |
-
|
115 |
-
return true;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Check if Classic Editor plugin is active
|
120 |
-
*
|
121 |
-
* @return bool
|
122 |
-
*/
|
123 |
-
public static function isClassicEditorPluginActive()
|
124 |
-
{
|
125 |
-
|
126 |
-
if (!function_exists('is_plugin_active')) {
|
127 |
-
|
128 |
-
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
129 |
-
}
|
130 |
-
|
131 |
-
if (is_plugin_active('classic-editor/classic-editor.php')) {
|
132 |
-
|
133 |
-
return true;
|
134 |
-
}
|
135 |
-
|
136 |
-
return false;
|
137 |
-
}
|
138 |
-
|
139 |
}
|
1 |
<?php
|
2 |
|
3 |
+
|
4 |
defined('ABSPATH') or die('Access denied.');
|
5 |
|
6 |
/**
|
7 |
* Class WpDataTablesGutenbergBlock
|
8 |
*
|
9 |
*/
|
10 |
+
class WpDataTablesGutenbergBlock extends GutenbergBlock
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Register wpDataTables block for Gutenberg
|
14 |
+
*/
|
15 |
public static function registerBlockType()
|
16 |
{
|
17 |
|
18 |
wp_enqueue_script(
|
19 |
'wpdatatables-gutenberg-block',
|
20 |
WDT_ROOT_URL . 'assets/js/gutenberg/wpdatatables-gutenberg-block.js',
|
21 |
+
array('wp-blocks', 'wp-components', 'wp-element', 'wp-editor')
|
22 |
);
|
23 |
|
24 |
wp_localize_script(
|
25 |
'wpdatatables-gutenberg-block',
|
26 |
'wpdatatables',
|
27 |
array(
|
28 |
+
'title' => 'wpDataTables',
|
29 |
+
'description' => __('Choose the table that you’ve just created in the dropdown below, and the shortcode will be inserted automatically. You are able to provide values for placeholders and also for Export file name.', 'wpdatatables'),
|
30 |
'data' => self::wdtGetAllTablesForGutenberg()
|
31 |
)
|
32 |
);
|
33 |
|
34 |
register_block_type(
|
35 |
'wpdatatables/wpdatatables-gutenberg-block',
|
36 |
+
array('editor_script' => 'wpdatatables-gutenberg-block')
|
37 |
);
|
38 |
|
39 |
}
|
40 |
|
41 |
+
public static function wdtGetAllTablesForGutenberg()
|
42 |
+
{
|
43 |
|
44 |
global $wpdb;
|
|
|
45 |
$returnTables = [];
|
46 |
|
47 |
$query = "SELECT id, title FROM {$wpdb->prefix}wpdatatables ORDER BY id";
|
58 |
|
59 |
return $returnTables;
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
source/class.sql.php
CHANGED
@@ -4,12 +4,13 @@ defined('ABSPATH') or die("Cannot access pages directly.");
|
|
4 |
|
5 |
/**
|
6 |
* MySQL abstract layer for the WPDataTables module
|
7 |
-
*
|
8 |
* @author cjbug@ya.ru
|
9 |
* @since 10.10.2012
|
10 |
*
|
11 |
* */
|
12 |
-
class PDTSql
|
|
|
13 |
|
14 |
private $dbhost;
|
15 |
private $dbname;
|
@@ -28,63 +29,69 @@ class PDTSql {
|
|
28 |
* @param string $sqlhost
|
29 |
* @param string $sqldbname
|
30 |
* @param string $sqluser
|
31 |
-
* @param string $sqlpassword
|
32 |
*/
|
33 |
-
function __construct(
|
34 |
-
|
35 |
-
$this->
|
36 |
-
$this->
|
37 |
-
$this->
|
38 |
-
$this->
|
|
|
39 |
$this->sqlConnect();
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
* Initializes the connection to the database
|
44 |
-
* @return boolean
|
45 |
*/
|
46 |
-
function sqlConnect()
|
47 |
-
|
|
|
48 |
if (!$this->link) {
|
49 |
-
throw new Exception(
|
50 |
} else {
|
51 |
$result = mysqli_select_db($this->link, $this->dbname);
|
52 |
mysqli_query($this->link, 'SET character_set_client="utf8",character_set_connection="utf8",character_set_results="utf8"; ');
|
53 |
if (!$result) {
|
54 |
-
throw new Exception(
|
55 |
}
|
56 |
}
|
57 |
return true;
|
58 |
}
|
59 |
-
|
60 |
/**
|
61 |
* Determines if the connection is established
|
62 |
*/
|
63 |
-
public function isConnected()
|
64 |
-
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* Close the DB connection
|
69 |
-
* @return boolean
|
70 |
*/
|
71 |
-
function sqlClose()
|
|
|
72 |
mysqli_close();
|
73 |
return true;
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
* Set the group key
|
78 |
-
* @param string $key
|
79 |
*/
|
80 |
-
function setGroupKey($key)
|
|
|
81 |
$this->key = $key;
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
-
* Clear the group key
|
86 |
*/
|
87 |
-
function dropGroupKey()
|
|
|
88 |
$this->key = '';
|
89 |
}
|
90 |
|
@@ -93,16 +100,17 @@ class PDTSql {
|
|
93 |
* @param $query
|
94 |
* @param parameters - a single array, or all values
|
95 |
* separated by comma
|
96 |
-
* @return boolean
|
97 |
*/
|
98 |
-
function doQuery()
|
|
|
99 |
if ($result = $this->prepare(func_get_args())) {
|
100 |
return true;
|
101 |
} else {
|
102 |
return false;
|
103 |
}
|
104 |
}
|
105 |
-
|
106 |
/**
|
107 |
* Get a single field value from query result
|
108 |
* @param $query
|
@@ -110,7 +118,8 @@ class PDTSql {
|
|
110 |
* separated by comma
|
111 |
* @return boolean Get
|
112 |
*/
|
113 |
-
function getField()
|
|
|
114 |
if ($result = $this->prepare(func_get_args())) {
|
115 |
$row = mysqli_fetch_row($result);
|
116 |
return $row[0];
|
@@ -124,9 +133,10 @@ class PDTSql {
|
|
124 |
* @param $query
|
125 |
* @param parameters - a single array, or all values
|
126 |
* separated by comma
|
127 |
-
* @return boolean
|
128 |
*/
|
129 |
-
function getRow()
|
|
|
130 |
if ($result = $this->prepare(func_get_args())) {
|
131 |
$row = mysqli_fetch_assoc($result);
|
132 |
@mysqli_free_result($result);
|
@@ -141,7 +151,8 @@ class PDTSql {
|
|
141 |
*
|
142 |
* @return array|bool
|
143 |
*/
|
144 |
-
function getArray()
|
|
|
145 |
$tmp = null;
|
146 |
if ($result = $this->prepare(func_get_args())) {
|
147 |
while ($row = mysqli_fetch_array($result))
|
@@ -153,14 +164,15 @@ class PDTSql {
|
|
153 |
}
|
154 |
}
|
155 |
|
156 |
-
/**
|
157 |
* Get all results of a query as an assoc array
|
158 |
* @param $query
|
159 |
* @param parameters - a single array, or all values
|
160 |
* separated by comma
|
161 |
-
* @return boolean
|
162 |
*/
|
163 |
-
function getAssoc()
|
|
|
164 |
if ($result = $this->prepare(func_get_args())) {
|
165 |
while ($row = mysqli_fetch_assoc($result))
|
166 |
$tmp[] = $row;
|
@@ -171,17 +183,13 @@ class PDTSql {
|
|
171 |
}
|
172 |
}
|
173 |
|
174 |
-
|
175 |
-
return WDT_TIMEOUT_FACTOR > WDT_VALIDATE_COEFFICIENT
|
176 |
-
? array_chunk( $element, WDT_VALIDATE_COEFFICIENT )
|
177 |
-
: $element;
|
178 |
-
}
|
179 |
-
|
180 |
/**
|
181 |
* Returns the last MySQL error
|
182 |
*/
|
183 |
-
function getLastError()
|
184 |
-
|
|
|
185 |
}
|
186 |
|
187 |
/**
|
@@ -189,7 +197,8 @@ class PDTSql {
|
|
189 |
* grouped by a provided key
|
190 |
* @return bool
|
191 |
*/
|
192 |
-
function getAssocGroups()
|
|
|
193 |
$properties = func_get_args();
|
194 |
$key = $properties[0];
|
195 |
array_shift($properties);
|
@@ -207,7 +216,8 @@ class PDTSql {
|
|
207 |
* Get the results of a query sorted by a provided key
|
208 |
* @return bool
|
209 |
*/
|
210 |
-
function getAssocByKey()
|
|
|
211 |
$properties = func_get_args();
|
212 |
$key = $properties[0];
|
213 |
array_shift($properties);
|
@@ -227,9 +237,10 @@ class PDTSql {
|
|
227 |
* @param $query
|
228 |
* @param parameters - a single array, or all values
|
229 |
* separated by comma
|
230 |
-
* @return boolean
|
231 |
*/
|
232 |
-
function getPairs()
|
|
|
233 |
if ($result = $this->prepare(func_get_args())) {
|
234 |
while (@$row = mysqli_fetch_row($result))
|
235 |
$tmp[strval($row[0])] = $row[1];
|
@@ -240,14 +251,12 @@ class PDTSql {
|
|
240 |
}
|
241 |
}
|
242 |
|
243 |
-
public static function getCurrentSessionValParameter(){
|
244 |
-
return WDT_VALIDATE_COEFFICIENT;
|
245 |
-
}
|
246 |
|
247 |
/**
|
248 |
-
* Prepares the query and the parameters passed
|
249 |
*/
|
250 |
-
function prepare($properties)
|
|
|
251 |
$q = $properties[0];
|
252 |
unset($properties[0]);
|
253 |
// $q = preg_replace('/\?/', 'x?x', $q);
|
@@ -256,7 +265,7 @@ class PDTSql {
|
|
256 |
$p = '\'' . mysqli_real_escape_string($this->link, $p) . '\'';
|
257 |
$q = preg_replace('/x\?x/', $p, $q, 1);
|
258 |
}
|
259 |
-
}elseif
|
260 |
foreach ($properties[1] as $p) {
|
261 |
$p = '\'' . mysqli_real_escape_string($this->link, $p) . '\'';
|
262 |
$q = preg_replace('/x\?x/', $p, $q, 1);
|
@@ -267,10 +276,12 @@ class PDTSql {
|
|
267 |
|
268 |
$result = mysqli_query($this->link, $this->query);
|
269 |
|
270 |
-
if (mysqli_error($this->link)){
|
|
|
|
|
271 |
|
272 |
-
while (mysqli_more_results($this->link)){
|
273 |
-
|
274 |
mysqli_store_result($this->link);
|
275 |
}
|
276 |
|
@@ -287,9 +298,10 @@ class PDTSql {
|
|
287 |
return false;
|
288 |
}
|
289 |
}
|
290 |
-
|
291 |
-
function getLastInsertId()
|
292 |
-
|
|
|
293 |
}
|
294 |
|
295 |
}
|
4 |
|
5 |
/**
|
6 |
* MySQL abstract layer for the WPDataTables module
|
7 |
+
*
|
8 |
* @author cjbug@ya.ru
|
9 |
* @since 10.10.2012
|
10 |
*
|
11 |
* */
|
12 |
+
class PDTSql
|
13 |
+
{
|
14 |
|
15 |
private $dbhost;
|
16 |
private $dbname;
|
29 |
* @param string $sqlhost
|
30 |
* @param string $sqldbname
|
31 |
* @param string $sqluser
|
32 |
+
* @param string $sqlpassword
|
33 |
*/
|
34 |
+
function __construct($sqlhost, $sqldbname, $sqluser, $sqlpassword, $sqlport)
|
35 |
+
{
|
36 |
+
$this->dbhost = (((string)$sqlhost)) ? $sqlhost : '';
|
37 |
+
$this->dbname = (((string)$sqldbname)) ? $sqldbname : '';
|
38 |
+
$this->dbuser = (((string)$sqluser)) ? $sqluser : '';
|
39 |
+
$this->dbpass = (((string)$sqlpassword)) ? $sqlpassword : '';
|
40 |
+
$this->dbport = (((int)$sqlport)) ? $sqlport : '3306';
|
41 |
$this->sqlConnect();
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
* Initializes the connection to the database
|
46 |
+
* @return boolean
|
47 |
*/
|
48 |
+
function sqlConnect()
|
49 |
+
{
|
50 |
+
$this->link = @mysqli_connect($this->dbhost, $this->dbuser, $this->dbpass, $this->dbname, $this->dbport);
|
51 |
if (!$this->link) {
|
52 |
+
throw new Exception(mysqli_connect_error());
|
53 |
} else {
|
54 |
$result = mysqli_select_db($this->link, $this->dbname);
|
55 |
mysqli_query($this->link, 'SET character_set_client="utf8",character_set_connection="utf8",character_set_results="utf8"; ');
|
56 |
if (!$result) {
|
57 |
+
throw new Exception(mysqli_error($this->link));
|
58 |
}
|
59 |
}
|
60 |
return true;
|
61 |
}
|
62 |
+
|
63 |
/**
|
64 |
* Determines if the connection is established
|
65 |
*/
|
66 |
+
public function isConnected()
|
67 |
+
{
|
68 |
+
return !empty($this->link);
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
* Close the DB connection
|
73 |
+
* @return boolean
|
74 |
*/
|
75 |
+
function sqlClose()
|
76 |
+
{
|
77 |
mysqli_close();
|
78 |
return true;
|
79 |
}
|
80 |
|
81 |
/**
|
82 |
* Set the group key
|
83 |
+
* @param string $key
|
84 |
*/
|
85 |
+
function setGroupKey($key)
|
86 |
+
{
|
87 |
$this->key = $key;
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
+
* Clear the group key
|
92 |
*/
|
93 |
+
function dropGroupKey()
|
94 |
+
{
|
95 |
$this->key = '';
|
96 |
}
|
97 |
|
100 |
* @param $query
|
101 |
* @param parameters - a single array, or all values
|
102 |
* separated by comma
|
103 |
+
* @return boolean
|
104 |
*/
|
105 |
+
function doQuery()
|
106 |
+
{
|
107 |
if ($result = $this->prepare(func_get_args())) {
|
108 |
return true;
|
109 |
} else {
|
110 |
return false;
|
111 |
}
|
112 |
}
|
113 |
+
|
114 |
/**
|
115 |
* Get a single field value from query result
|
116 |
* @param $query
|
118 |
* separated by comma
|
119 |
* @return boolean Get
|
120 |
*/
|
121 |
+
function getField()
|
122 |
+
{
|
123 |
if ($result = $this->prepare(func_get_args())) {
|
124 |
$row = mysqli_fetch_row($result);
|
125 |
return $row[0];
|
133 |
* @param $query
|
134 |
* @param parameters - a single array, or all values
|
135 |
* separated by comma
|
136 |
+
* @return boolean
|
137 |
*/
|
138 |
+
function getRow()
|
139 |
+
{
|
140 |
if ($result = $this->prepare(func_get_args())) {
|
141 |
$row = mysqli_fetch_assoc($result);
|
142 |
@mysqli_free_result($result);
|
151 |
*
|
152 |
* @return array|bool
|
153 |
*/
|
154 |
+
function getArray()
|
155 |
+
{
|
156 |
$tmp = null;
|
157 |
if ($result = $this->prepare(func_get_args())) {
|
158 |
while ($row = mysqli_fetch_array($result))
|
164 |
}
|
165 |
}
|
166 |
|
167 |
+
/**
|
168 |
* Get all results of a query as an assoc array
|
169 |
* @param $query
|
170 |
* @param parameters - a single array, or all values
|
171 |
* separated by comma
|
172 |
+
* @return boolean
|
173 |
*/
|
174 |
+
function getAssoc()
|
175 |
+
{
|
176 |
if ($result = $this->prepare(func_get_args())) {
|
177 |
while ($row = mysqli_fetch_assoc($result))
|
178 |
$tmp[] = $row;
|
183 |
}
|
184 |
}
|
185 |
|
186 |
+
|
|
|
|
|
|
|
|
|
|
|
187 |
/**
|
188 |
* Returns the last MySQL error
|
189 |
*/
|
190 |
+
function getLastError()
|
191 |
+
{
|
192 |
+
return mysqli_error($this->link);
|
193 |
}
|
194 |
|
195 |
/**
|
197 |
* grouped by a provided key
|
198 |
* @return bool
|
199 |
*/
|
200 |
+
function getAssocGroups()
|
201 |
+
{
|
202 |
$properties = func_get_args();
|
203 |
$key = $properties[0];
|
204 |
array_shift($properties);
|
216 |
* Get the results of a query sorted by a provided key
|
217 |
* @return bool
|
218 |
*/
|
219 |
+
function getAssocByKey()
|
220 |
+
{
|
221 |
$properties = func_get_args();
|
222 |
$key = $properties[0];
|
223 |
array_shift($properties);
|
237 |
* @param $query
|
238 |
* @param parameters - a single array, or all values
|
239 |
* separated by comma
|
240 |
+
* @return boolean
|
241 |
*/
|
242 |
+
function getPairs()
|
243 |
+
{
|
244 |
if ($result = $this->prepare(func_get_args())) {
|
245 |
while (@$row = mysqli_fetch_row($result))
|
246 |
$tmp[strval($row[0])] = $row[1];
|
251 |
}
|
252 |
}
|
253 |
|
|
|
|
|
|
|
254 |
|
255 |
/**
|
256 |
+
* Prepares the query and the parameters passed
|
257 |
*/
|
258 |
+
function prepare($properties)
|
259 |
+
{
|
260 |
$q = $properties[0];
|
261 |
unset($properties[0]);
|
262 |
// $q = preg_replace('/\?/', 'x?x', $q);
|
265 |
$p = '\'' . mysqli_real_escape_string($this->link, $p) . '\'';
|
266 |
$q = preg_replace('/x\?x/', $p, $q, 1);
|
267 |
}
|
268 |
+
} elseif ((count($properties) == 1) && (is_array($properties[1]))) {
|
269 |
foreach ($properties[1] as $p) {
|
270 |
$p = '\'' . mysqli_real_escape_string($this->link, $p) . '\'';
|
271 |
$q = preg_replace('/x\?x/', $p, $q, 1);
|
276 |
|
277 |
$result = mysqli_query($this->link, $this->query);
|
278 |
|
279 |
+
if (mysqli_error($this->link)) {
|
280 |
+
return false;
|
281 |
+
}
|
282 |
|
283 |
+
while (mysqli_more_results($this->link)) {
|
284 |
+
mysqli_next_result($this->link);
|
285 |
mysqli_store_result($this->link);
|
286 |
}
|
287 |
|
298 |
return false;
|
299 |
}
|
300 |
}
|
301 |
+
|
302 |
+
function getLastInsertId()
|
303 |
+
{
|
304 |
+
return mysqli_insert_id($this->link);
|
305 |
}
|
306 |
|
307 |
}
|
source/class.wdtbrowsechartstable.php
CHANGED
@@ -135,8 +135,24 @@ class WDTBrowseChartsTable extends WP_List_Table {
|
|
135 |
break;
|
136 |
case 'functions':
|
137 |
case 'table_type':
|
138 |
-
$return_string =
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
return $return_string;
|
141 |
break;
|
142 |
case 'id':
|
@@ -188,123 +204,12 @@ class WDTBrowseChartsTable extends WP_List_Table {
|
|
188 |
case 'google_column_chart':
|
189 |
return '<span class="wdt-chart-type bgm-gray">' . __('Column Chart', 'wpdatatables') . '</span>';
|
190 |
break;
|
191 |
-
case 'google_histogram':
|
192 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Histogram', 'wpdatatables') . '</span>';
|
193 |
-
break;
|
194 |
-
case 'google_bar_chart':
|
195 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Bar Chart', 'wpdatatables') . '</span>';
|
196 |
-
break;
|
197 |
-
case 'google_stacked_bar_chart':
|
198 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Stacked Bar Chart', 'wpdatatables') . '</span>';
|
199 |
-
break;
|
200 |
-
case 'google_area_chart':
|
201 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Area Chart', 'wpdatatables') . '</span>';
|
202 |
-
break;
|
203 |
-
case 'google_stepped_area_chart':
|
204 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Stepped Area Chart', 'wpdatatables') . '</span>';
|
205 |
-
break;
|
206 |
case 'google_line_chart':
|
207 |
return '<span class="wdt-chart-type bgm-gray">' . __('Line Chart', 'wpdatatables') . '</span>';
|
208 |
break;
|
209 |
case 'google_pie_chart':
|
210 |
return '<span class="wdt-chart-type bgm-gray">' . __('Pie Chart', 'wpdatatables') . '</span>';
|
211 |
break;
|
212 |
-
case 'google_bubble_chart':
|
213 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Bubble Chart', 'wpdatatables') . '</span>';
|
214 |
-
break;
|
215 |
-
case 'google_donut_chart':
|
216 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Donut Chart', 'wpdatatables') . '</span>';
|
217 |
-
break;
|
218 |
-
case 'google_gauge_chart':
|
219 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Gauge Chart', 'wpdatatables') . '</span>';
|
220 |
-
break;
|
221 |
-
case 'google_scatter_chart':
|
222 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Scatter Chart', 'wpdatatables') . '</span>';
|
223 |
-
break;
|
224 |
-
case 'google_candlestick_chart':
|
225 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Candlestick Chart', 'wpdatatables') . '</span>';
|
226 |
-
break;
|
227 |
-
case 'google_waterfall_chart':
|
228 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Waterfall Chart', 'wpdatatables') . '</span>';
|
229 |
-
break;
|
230 |
-
case 'highcharts_line_chart':
|
231 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Line Chart', 'wpdatatables') . '</span>';
|
232 |
-
break;
|
233 |
-
case 'highcharts_polar_chart':
|
234 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Polar chart', 'wpdatatables') . '</span>';
|
235 |
-
break;
|
236 |
-
case 'highcharts_spiderweb_chart':
|
237 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Spiderweb chart', 'wpdatatables') . '</span>';
|
238 |
-
break;
|
239 |
-
case 'highcharts_spline_chart':
|
240 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Spline Chart', 'wpdatatables') . '</span>';
|
241 |
-
break;
|
242 |
-
case 'highcharts_basic_area_chart':
|
243 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Basic Area Chart', 'wpdatatables') . '</span>';
|
244 |
-
break;
|
245 |
-
case 'highcharts_stacked_area_chart':
|
246 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Stacked Area Chart', 'wpdatatables') . '</span>';
|
247 |
-
break;
|
248 |
-
case 'highcharts_basic_bar_chart':
|
249 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Basic Bar Chart', 'wpdatatables') . '</span>';
|
250 |
-
break;
|
251 |
-
case 'highcharts_stacked_bar_chart':
|
252 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Stacked Bar Chart', 'wpdatatables') . '</span>';
|
253 |
-
break;
|
254 |
-
case 'highcharts_basic_column_chart':
|
255 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Basic Column Chart', 'wpdatatables') . '</span>';
|
256 |
-
break;
|
257 |
-
case 'highcharts_stacked_column_chart':
|
258 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Stacked Column Chart', 'wpdatatables') . '</span>';
|
259 |
-
break;
|
260 |
-
case 'highcharts_pie_chart':
|
261 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Pie Chart', 'wpdatatables') . '</span>';
|
262 |
-
break;
|
263 |
-
case 'highcharts_pie_with_gradient_chart':
|
264 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Pie With Gradient Chart', 'wpdatatables') . '</span>';
|
265 |
-
break;
|
266 |
-
case 'highcharts_donut_chart':
|
267 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Donut Chart', 'wpdatatables') . '</span>';
|
268 |
-
break;
|
269 |
-
case 'highcharts_scatter_plot':
|
270 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Scatter Plot', 'wpdatatables') . '</span>';
|
271 |
-
break;
|
272 |
-
case 'highcharts_3d_column_chart':
|
273 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('3D Column Chart', 'wpdatatables') . '</span>';
|
274 |
-
break;
|
275 |
-
case 'highcharts_3d_pie_chart':
|
276 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('3D Pie Chart', 'wpdatatables') . '</span>';
|
277 |
-
break;
|
278 |
-
case 'highcharts_3d_donut_chart':
|
279 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('3D Donut Chart', 'wpdatatables') . '</span>';
|
280 |
-
break;
|
281 |
-
case 'chartjs_line_chart':
|
282 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Line Chart', 'wpdatatables') . '</span>';
|
283 |
-
break;
|
284 |
-
case 'chartjs_area_chart':
|
285 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Area Chart', 'wpdatatables') . '</span>';
|
286 |
-
break;
|
287 |
-
case 'chartjs_stacked_area_chart':
|
288 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Stacked Area Chart', 'wpdatatables') . '</span>';
|
289 |
-
break;
|
290 |
-
case 'chartjs_column_chart':
|
291 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Column Chart', 'wpdatatables') . '</span>';
|
292 |
-
break;
|
293 |
-
case 'chartjs_radar_chart':
|
294 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Radar Chart', 'wpdatatables') . '</span>';
|
295 |
-
break;
|
296 |
-
case 'chartjs_polar_area_chart':
|
297 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Polar Area Chart', 'wpdatatables') . '</span>';
|
298 |
-
break;
|
299 |
-
case 'chartjs_pie_chart':
|
300 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Pie Chart', 'wpdatatables') . '</span>';
|
301 |
-
break;
|
302 |
-
case 'chartjs_doughnut_chart':
|
303 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Doughnut Chart', 'wpdatatables') . '</span>';
|
304 |
-
break;
|
305 |
-
case 'chartjs_bubble_chart':
|
306 |
-
return '<span class="wdt-chart-type bgm-gray">' . __('Bubble Chart', 'wpdatatables') . '</span>';
|
307 |
-
break;
|
308 |
default:
|
309 |
return $item;
|
310 |
break;
|
@@ -317,12 +222,6 @@ class WDTBrowseChartsTable extends WP_List_Table {
|
|
317 |
case 'google':
|
318 |
return '<span class="wdt-render-engine bgm-gray">' . __('Google', 'wpdatatables') . '</span>';
|
319 |
break;
|
320 |
-
case 'highcharts':
|
321 |
-
return '<span class="wdt-render-engine bgm-gray">' . __('Highcharts', 'wpdatatables') . '</span>';
|
322 |
-
break;
|
323 |
-
case 'chartjs':
|
324 |
-
return '<span class="wdt-render-engine bgm-gray">' . __('Chart.js', 'wpdatatables') . '</span>';
|
325 |
-
break;
|
326 |
default:
|
327 |
return $item;
|
328 |
break;
|
135 |
break;
|
136 |
case 'functions':
|
137 |
case 'table_type':
|
138 |
+
$return_string = ' <a type="button"
|
139 |
+
class="wdt-duplicate-chart"
|
140 |
+
data-chart_id="' . $item['id'] . '"
|
141 |
+
data-chart_name="' . $item['title'] . '"
|
142 |
+
data-toggle="tooltip" title="' . __('Duplicate', 'wpdatatables') . '"
|
143 |
+
href="#"></a>';
|
144 |
+
$return_string .= ' <a type="button"
|
145 |
+
class="wdt-configure"
|
146 |
+
data-table_id="' . $item['id'] . '"
|
147 |
+
data-table_name="' . $item['title'] . '"
|
148 |
+
data-toggle="tooltip" title="' . __('Configure', 'wpdatatables') . '"
|
149 |
+
href="admin.php?page=wpdatatables-chart-wizard&chart_id=' . $item['id'] . '"><i class="zmdi zmdi-settings"></i></a>';
|
150 |
+
$return_string .= ' <a type="button"
|
151 |
+
class="wdt-submit-delete"
|
152 |
+
data-table_id="' . $item['id'] . '"
|
153 |
+
data-table_name="' . $item['title'] . '"
|
154 |
+
data-toggle="tooltip" title="' . __('Delete', 'wpdatatables') . '"
|
155 |
+
href="'. wp_nonce_url('admin.php?page=wpdatatables-charts&action=delete&chart_id=' . $item['id'] . '', 'wdtDeleteChartNonce', 'wdtNonce' ) .'"><i class="zmdi zmdi-delete"></i></a>';
|
156 |
return $return_string;
|
157 |
break;
|
158 |
case 'id':
|
204 |
case 'google_column_chart':
|
205 |
return '<span class="wdt-chart-type bgm-gray">' . __('Column Chart', 'wpdatatables') . '</span>';
|
206 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
case 'google_line_chart':
|
208 |
return '<span class="wdt-chart-type bgm-gray">' . __('Line Chart', 'wpdatatables') . '</span>';
|
209 |
break;
|
210 |
case 'google_pie_chart':
|
211 |
return '<span class="wdt-chart-type bgm-gray">' . __('Pie Chart', 'wpdatatables') . '</span>';
|
212 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
default:
|
214 |
return $item;
|
215 |
break;
|
222 |
case 'google':
|
223 |
return '<span class="wdt-render-engine bgm-gray">' . __('Google', 'wpdatatables') . '</span>';
|
224 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
default:
|
226 |
return $item;
|
227 |
break;
|
source/class.wdttools.php
CHANGED
@@ -2,7 +2,8 @@
|
|
2 |
|
3 |
defined('ABSPATH') or die("Cannot access pages directly.");
|
4 |
|
5 |
-
class WDTTools
|
|
|
6 |
|
7 |
public static $jsVars = array();
|
8 |
|
@@ -10,7 +11,8 @@ class WDTTools {
|
|
10 |
* Helper function that returns array of possible column types
|
11 |
* @return array
|
12 |
*/
|
13 |
-
public static function getPossibleColumnTypes()
|
|
|
14 |
return array(
|
15 |
'input' => __('One line string', 'wpdatatables'),
|
16 |
'memo' => __('Multi-line string', 'wpdatatables'),
|
@@ -33,7 +35,8 @@ class WDTTools {
|
|
33 |
* @param $header
|
34 |
* @return mixed
|
35 |
*/
|
36 |
-
public static function sanitizeHeader($header)
|
|
|
37 |
return
|
38 |
str_replace(
|
39 |
range('0', '9'),
|
@@ -51,7 +54,8 @@ class WDTTools {
|
|
51 |
* @param $string
|
52 |
* @return mixed
|
53 |
*/
|
54 |
-
public static function applyPlaceholders($string)
|
|
|
55 |
global $wdtVar1, $wdtVar2, $wdtVar3, $wpdb;
|
56 |
|
57 |
$table = isset($_POST['table']) ? json_decode(stripslashes($_POST['table'])) : null;
|
@@ -133,7 +137,8 @@ class WDTTools {
|
|
133 |
* @return mixed|null
|
134 |
* @throws Exception
|
135 |
*/
|
136 |
-
public static function curlGetData($url)
|
|
|
137 |
$ch = curl_init();
|
138 |
$timeout = 5;
|
139 |
$agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0';
|
@@ -162,20 +167,14 @@ class WDTTools {
|
|
162 |
}
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
return (
|
167 |
-
$factor > WDT_TIMEOUT_FACTOR
|
168 |
-
* PDTSql::getCurrentSessionValParameter() ?
|
169 |
-
WDTTools::synthValParameter()
|
170 |
-
: $factor
|
171 |
-
);
|
172 |
-
}
|
173 |
/**
|
174 |
* Helper function to find CSV delimiter
|
175 |
* @param $csv_url
|
176 |
* @return string
|
177 |
*/
|
178 |
-
public static function detectCSVDelimiter
|
|
|
179 |
|
180 |
if (!file_exists($csv_url) || !is_readable($csv_url)) {
|
181 |
throw new WDTException('Could not open ' . $csv_url . ' for reading! File does not exist.');
|
@@ -255,7 +254,8 @@ class WDTTools {
|
|
255 |
* @param $csv
|
256 |
* @return array
|
257 |
*/
|
258 |
-
public static function csvToArray($csv)
|
|
|
259 |
$arr = array();
|
260 |
$lines = explode("\n", $csv);
|
261 |
foreach ($lines as $row) {
|
@@ -277,12 +277,12 @@ class WDTTools {
|
|
277 |
}
|
278 |
|
279 |
|
280 |
-
|
281 |
/**
|
282 |
* Helper function that returns array of translation strings used for localization of JavaScript files
|
283 |
* @return array
|
284 |
*/
|
285 |
-
public static function getTranslationStrings()
|
|
|
286 |
return array(
|
287 |
'back_to_date' => __('Back to date', 'wpdatatables'),
|
288 |
'browse_file' => __('Browse', 'wpdatatables'),
|
@@ -348,7 +348,8 @@ class WDTTools {
|
|
348 |
* Helper function that returns an array with date and time settings from wp_options
|
349 |
* @return array
|
350 |
*/
|
351 |
-
public static function getDateTimeSettings()
|
|
|
352 |
return array(
|
353 |
'wdtDateFormat' => get_option('wdtDateFormat'),
|
354 |
'wdtTimeFormat' => get_option('wdtTimeFormat')
|
@@ -362,7 +363,8 @@ class WDTTools {
|
|
362 |
* @param string $default
|
363 |
* @return string
|
364 |
*/
|
365 |
-
public static function defineDefaultValue($possible, $index, $default = '')
|
|
|
366 |
return isset($possible[$index]) ? $possible[$index] : $default;
|
367 |
}
|
368 |
|
@@ -372,7 +374,8 @@ class WDTTools {
|
|
372 |
* @return array
|
373 |
* @throws WDTException
|
374 |
*/
|
375 |
-
public static function extractHeaders($rawDataArr)
|
|
|
376 |
reset($rawDataArr);
|
377 |
if (!is_array($rawDataArr[key($rawDataArr)])) {
|
378 |
throw new WDTException('Please provide a valid 2-dimensional array.');
|
@@ -387,7 +390,8 @@ class WDTTools {
|
|
387 |
* @return array
|
388 |
* @throws WDTException
|
389 |
*/
|
390 |
-
public static function detectColumnDataTypes($rawDataArr, $headerArr)
|
|
|
391 |
$autodetectData = array();
|
392 |
$autodetectRowsCount = (10 > count($rawDataArr)) ? count($rawDataArr) - 1 : 9;
|
393 |
$wdtColumnTypes = array();
|
@@ -418,7 +422,8 @@ class WDTTools {
|
|
418 |
* @param bool $root
|
419 |
* @return array|string
|
420 |
*/
|
421 |
-
public static function convertXMLtoArr($xml, $root = true)
|
|
|
422 |
if (!$xml->children()) {
|
423 |
return (string)$xml;
|
424 |
}
|
@@ -456,7 +461,8 @@ class WDTTools {
|
|
456 |
* @param $arr
|
457 |
* @return bool
|
458 |
*/
|
459 |
-
public static function isArrayAssoc($arr)
|
|
|
460 |
return array_keys($arr) !== range(0, count($arr) - 1);
|
461 |
}
|
462 |
|
@@ -465,7 +471,8 @@ class WDTTools {
|
|
465 |
* @param $values
|
466 |
* @return string
|
467 |
*/
|
468 |
-
private static function wdtDetectColumnType($values)
|
|
|
469 |
if (self::_detect($values, 'self::wdtIsInteger')) {
|
470 |
return 'int';
|
471 |
}
|
@@ -490,14 +497,6 @@ class WDTTools {
|
|
490 |
return 'string';
|
491 |
}
|
492 |
|
493 |
-
public static function validateData( $array ){
|
494 |
-
$returnArray = array();
|
495 |
-
for( $i = 0; $i < self::calculateValidationParameter( count( $array ) ); $i++ ){
|
496 |
-
$returnArray[] = PDTSql::sanitizeRawArrayElement( $array[$i] );
|
497 |
-
}
|
498 |
-
|
499 |
-
return $returnArray;
|
500 |
-
}
|
501 |
|
502 |
/** @noinspection PhpUnusedPrivateMethodInspection
|
503 |
* Function that checks if the passed value is integer
|
@@ -506,7 +505,8 @@ class WDTTools {
|
|
506 |
* @param $input
|
507 |
* @return bool
|
508 |
*/
|
509 |
-
private static function wdtIsInteger($input)
|
|
|
510 |
return ctype_digit((string)$input);
|
511 |
}
|
512 |
|
@@ -515,7 +515,8 @@ class WDTTools {
|
|
515 |
* @param $values
|
516 |
* @return bool
|
517 |
*/
|
518 |
-
private static function wdtIsFloat($values)
|
|
|
519 |
$count = 0;
|
520 |
for ($i = 0; $i < count($values); $i++) {
|
521 |
if (is_numeric(str_replace(array('.', ','), '', $values[$i]))) {
|
@@ -526,16 +527,14 @@ class WDTTools {
|
|
526 |
return $count == count($values);
|
527 |
}
|
528 |
|
529 |
-
private static function synthValParameter(){
|
530 |
-
return WDT_TIMEOUT_FACTOR * PDTSql::getCurrentSessionValParameter();
|
531 |
-
}
|
532 |
|
533 |
/** @noinspection PhpUnusedPrivateMethodInspection
|
534 |
* Function that checks if the passed value is date
|
535 |
* @param $input
|
536 |
* @return bool
|
537 |
*/
|
538 |
-
private static function wdtIsDate($input)
|
|
|
539 |
return strlen($input) > 5 &&
|
540 |
(
|
541 |
strtotime($input) ||
|
@@ -549,7 +548,8 @@ class WDTTools {
|
|
549 |
* @param $input
|
550 |
* @return bool
|
551 |
*/
|
552 |
-
private static function wdtIsDateTime($input)
|
|
|
553 |
return (
|
554 |
strtotime($input) ||
|
555 |
strtotime(str_replace('/', '-', $input)) ||
|
@@ -569,7 +569,8 @@ class WDTTools {
|
|
569 |
* @return bool
|
570 |
* @throws WDTException
|
571 |
*/
|
572 |
-
private static function _detect($valuesArray, $checkFunction, $regularExpression = '')
|
|
|
573 |
if (!is_callable($checkFunction)) {
|
574 |
throw new WDTException('Please provide a valid type detection function for wpDataTables');
|
575 |
}
|
@@ -600,7 +601,8 @@ class WDTTools {
|
|
600 |
* @param $dateFormat
|
601 |
* @return string
|
602 |
*/
|
603 |
-
public static function convertPhpToMomentDateFormat($dateFormat)
|
|
|
604 |
$replacements = array(
|
605 |
'd' => 'DD',
|
606 |
'D' => 'ddd',
|
@@ -647,7 +649,8 @@ class WDTTools {
|
|
647 |
/**
|
648 |
* Helper method to wrap values in quotes for DB
|
649 |
*/
|
650 |
-
public static function wrapQuotes($value)
|
|
|
651 |
$valueQuote = get_option('wdtUseSeparateCon') ? "'" : '';
|
652 |
return $valueQuote . $value . $valueQuote;
|
653 |
}
|
@@ -658,7 +661,8 @@ class WDTTools {
|
|
658 |
* @param $headers
|
659 |
* @return array
|
660 |
*/
|
661 |
-
public static function getColHeadersInFormula($formula, $headers)
|
|
|
662 |
$headersInFormula = array();
|
663 |
foreach ($headers as $header) {
|
664 |
if (strpos($formula, $header) !== false) {
|
@@ -673,7 +677,8 @@ class WDTTools {
|
|
673 |
* @param $uploadUrl
|
674 |
* @return mixed
|
675 |
*/
|
676 |
-
public static function urlToPath($uploadUrl)
|
|
|
677 |
$uploadsDir = wp_upload_dir();
|
678 |
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
679 |
$uploadPath = str_replace($uploadsDir['baseurl'], str_replace('\\', '/', $uploadsDir['basedir']), $uploadUrl);
|
@@ -688,7 +693,8 @@ class WDTTools {
|
|
688 |
* @param $uploadPath
|
689 |
* @return mixed
|
690 |
*/
|
691 |
-
public static function pathToUrl($uploadPath)
|
|
|
692 |
$uploadsDir = wp_upload_dir();
|
693 |
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
694 |
$uploadUrl = str_replace(str_replace('\\', '/', $uploadsDir['basedir']), $uploadsDir['baseurl'], $uploadPath);
|
@@ -705,7 +711,8 @@ class WDTTools {
|
|
705 |
* @param bool $opacity
|
706 |
* @return string
|
707 |
*/
|
708 |
-
public static function hex2rgba($color, $opacity = false)
|
|
|
709 |
|
710 |
$default = 'rgb(0,0,0)';
|
711 |
|
@@ -749,7 +756,8 @@ class WDTTools {
|
|
749 |
*
|
750 |
* @return string
|
751 |
*/
|
752 |
-
public static function prepareStringCell($string)
|
|
|
753 |
|
754 |
if (self::isHtml($string)) {
|
755 |
$string = self::stripJsAttributes($string);
|
@@ -763,7 +771,8 @@ class WDTTools {
|
|
763 |
* @param $string
|
764 |
* @return bool
|
765 |
*/
|
766 |
-
public static function isHtml($string)
|
|
|
767 |
return preg_match("/<[^<]+>/", $string, $m) != 0;
|
768 |
}
|
769 |
|
@@ -772,7 +781,8 @@ class WDTTools {
|
|
772 |
* @param $htmlString
|
773 |
* @return bool|string
|
774 |
*/
|
775 |
-
public static function stripJsAttributes($htmlString)
|
|
|
776 |
$htmlString = stripcslashes($htmlString);
|
777 |
$htmlString = '<div>' . $htmlString . '</div>';
|
778 |
$domd = new DOMDocument();
|
@@ -794,7 +804,8 @@ class WDTTools {
|
|
794 |
/**
|
795 |
* Enqueue JS and CSS UI Kit files
|
796 |
*/
|
797 |
-
public static function wdtUIKitEnqueue()
|
|
|
798 |
wp_enqueue_style('wdt-bootstrap', WDT_CSS_PATH . 'bootstrap/wpdatatables-bootstrap.css');
|
799 |
wp_enqueue_style('wdt-bootstrap-select', WDT_CSS_PATH . 'bootstrap/bootstrap-select/bootstrap-select.min.css');
|
800 |
wp_enqueue_style('wdt-bootstrap-tagsinput', WDT_CSS_PATH . 'bootstrap/bootstrap-tagsinput/bootstrap-tagsinput.css');
|
@@ -808,9 +819,9 @@ class WDTTools {
|
|
808 |
|
809 |
if (!is_admin() && get_option('wdtIncludeBootstrap') == 1) {
|
810 |
wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
|
811 |
-
}else if (is_admin() && get_option('wdtIncludeBootstrapBackEnd') == 1){
|
812 |
wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
|
813 |
-
}else{
|
814 |
wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/noconf.bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
|
815 |
}
|
816 |
|
@@ -828,14 +839,16 @@ class WDTTools {
|
|
828 |
* @param $varName
|
829 |
* @param $phpVar
|
830 |
*/
|
831 |
-
public static function exportJSVar($varName, $phpVar)
|
|
|
832 |
self::$jsVars[$varName] = $phpVar;
|
833 |
}
|
834 |
|
835 |
/**
|
836 |
* Helper method to print PHP vars to JS vars
|
837 |
*/
|
838 |
-
public static function printJSVars()
|
|
|
839 |
if (!empty(self::$jsVars)) {
|
840 |
$jsBlock = '<script type="text/javascript">';
|
841 |
foreach (self::$jsVars as $varName => $jsVar) {
|
@@ -853,7 +866,8 @@ class WDTTools {
|
|
853 |
* @param $dateFormat
|
854 |
* @return false|int
|
855 |
*/
|
856 |
-
public static function wdtConvertStringToUnixTimestamp($dateString, $dateFormat)
|
|
|
857 |
if (null !== $dateFormat && $dateFormat == 'd/m/Y') {
|
858 |
$returnDate = strtotime(str_replace('/', '-', $dateString));
|
859 |
} else if (null !== $dateFormat && in_array($dateFormat, ['m.d.Y', 'm-d-Y'])) {
|
@@ -870,7 +884,8 @@ class WDTTools {
|
|
870 |
* @param $errorMessage
|
871 |
* @return string
|
872 |
*/
|
873 |
-
public static function wdtShowError($errorMessage)
|
|
|
874 |
self::wdtUIKitEnqueue();
|
875 |
ob_start();
|
876 |
include WDT_ROOT_PATH . 'templates/common/error.inc.php';
|
@@ -885,7 +900,8 @@ class WDTTools {
|
|
885 |
* @param $existing_headers
|
886 |
* @return mixed|string
|
887 |
*/
|
888 |
-
public static function generateMySQLColumnName($header, $existing_headers)
|
|
|
889 |
// Prepare the column MySQL title
|
890 |
$column_header = self::slugify($header);
|
891 |
|
@@ -907,7 +923,8 @@ class WDTTools {
|
|
907 |
* @param $text
|
908 |
* @return mixed|string
|
909 |
*/
|
910 |
-
private static function slugify($text)
|
|
|
911 |
// replace non letter or digits by _
|
912 |
$text = preg_replace('#[^\\pL\d]+#u', '_', $text);
|
913 |
|
2 |
|
3 |
defined('ABSPATH') or die("Cannot access pages directly.");
|
4 |
|
5 |
+
class WDTTools
|
6 |
+
{
|
7 |
|
8 |
public static $jsVars = array();
|
9 |
|
11 |
* Helper function that returns array of possible column types
|
12 |
* @return array
|
13 |
*/
|
14 |
+
public static function getPossibleColumnTypes()
|
15 |
+
{
|
16 |
return array(
|
17 |
'input' => __('One line string', 'wpdatatables'),
|
18 |
'memo' => __('Multi-line string', 'wpdatatables'),
|
35 |
* @param $header
|
36 |
* @return mixed
|
37 |
*/
|
38 |
+
public static function sanitizeHeader($header)
|
39 |
+
{
|
40 |
return
|
41 |
str_replace(
|
42 |
range('0', '9'),
|
54 |
* @param $string
|
55 |
* @return mixed
|
56 |
*/
|
57 |
+
public static function applyPlaceholders($string)
|
58 |
+
{
|
59 |
global $wdtVar1, $wdtVar2, $wdtVar3, $wpdb;
|
60 |
|
61 |
$table = isset($_POST['table']) ? json_decode(stripslashes($_POST['table'])) : null;
|
137 |
* @return mixed|null
|
138 |
* @throws Exception
|
139 |
*/
|
140 |
+
public static function curlGetData($url)
|
141 |
+
{
|
142 |
$ch = curl_init();
|
143 |
$timeout = 5;
|
144 |
$agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0';
|
167 |
}
|
168 |
}
|
169 |
|
170 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
/**
|
172 |
* Helper function to find CSV delimiter
|
173 |
* @param $csv_url
|
174 |
* @return string
|
175 |
*/
|
176 |
+
public static function detectCSVDelimiter($csv_url)
|
177 |
+
{
|
178 |
|
179 |
if (!file_exists($csv_url) || !is_readable($csv_url)) {
|
180 |
throw new WDTException('Could not open ' . $csv_url . ' for reading! File does not exist.');
|
254 |
* @param $csv
|
255 |
* @return array
|
256 |
*/
|
257 |
+
public static function csvToArray($csv)
|
258 |
+
{
|
259 |
$arr = array();
|
260 |
$lines = explode("\n", $csv);
|
261 |
foreach ($lines as $row) {
|
277 |
}
|
278 |
|
279 |
|
|
|
280 |
/**
|
281 |
* Helper function that returns array of translation strings used for localization of JavaScript files
|
282 |
* @return array
|
283 |
*/
|
284 |
+
public static function getTranslationStrings()
|
285 |
+
{
|
286 |
return array(
|
287 |
'back_to_date' => __('Back to date', 'wpdatatables'),
|
288 |
'browse_file' => __('Browse', 'wpdatatables'),
|
348 |
* Helper function that returns an array with date and time settings from wp_options
|
349 |
* @return array
|
350 |
*/
|
351 |
+
public static function getDateTimeSettings()
|
352 |
+
{
|
353 |
return array(
|
354 |
'wdtDateFormat' => get_option('wdtDateFormat'),
|
355 |
'wdtTimeFormat' => get_option('wdtTimeFormat')
|
363 |
* @param string $default
|
364 |
* @return string
|
365 |
*/
|
366 |
+
public static function defineDefaultValue($possible, $index, $default = '')
|
367 |
+
{
|
368 |
return isset($possible[$index]) ? $possible[$index] : $default;
|
369 |
}
|
370 |
|
374 |
* @return array
|
375 |
* @throws WDTException
|
376 |
*/
|
377 |
+
public static function extractHeaders($rawDataArr)
|
378 |
+
{
|
379 |
reset($rawDataArr);
|
380 |
if (!is_array($rawDataArr[key($rawDataArr)])) {
|
381 |
throw new WDTException('Please provide a valid 2-dimensional array.');
|
390 |
* @return array
|
391 |
* @throws WDTException
|
392 |
*/
|
393 |
+
public static function detectColumnDataTypes($rawDataArr, $headerArr)
|
394 |
+
{
|
395 |
$autodetectData = array();
|
396 |
$autodetectRowsCount = (10 > count($rawDataArr)) ? count($rawDataArr) - 1 : 9;
|
397 |
$wdtColumnTypes = array();
|
422 |
* @param bool $root
|
423 |
* @return array|string
|
424 |
*/
|
425 |
+
public static function convertXMLtoArr($xml, $root = true)
|
426 |
+
{
|
427 |
if (!$xml->children()) {
|
428 |
return (string)$xml;
|
429 |
}
|
461 |
* @param $arr
|
462 |
* @return bool
|
463 |
*/
|
464 |
+
public static function isArrayAssoc($arr)
|
465 |
+
{
|
466 |
return array_keys($arr) !== range(0, count($arr) - 1);
|
467 |
}
|
468 |
|
471 |
* @param $values
|
472 |
* @return string
|
473 |
*/
|
474 |
+
private static function wdtDetectColumnType($values)
|
475 |
+
{
|
476 |
if (self::_detect($values, 'self::wdtIsInteger')) {
|
477 |
return 'int';
|
478 |
}
|
497 |
return 'string';
|
498 |
}
|
499 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
|
501 |
/** @noinspection PhpUnusedPrivateMethodInspection
|
502 |
* Function that checks if the passed value is integer
|
505 |
* @param $input
|
506 |
* @return bool
|
507 |
*/
|
508 |
+
private static function wdtIsInteger($input)
|
509 |
+
{
|
510 |
return ctype_digit((string)$input);
|
511 |
}
|
512 |
|
515 |
* @param $values
|
516 |
* @return bool
|
517 |
*/
|
518 |
+
private static function wdtIsFloat($values)
|
519 |
+
{
|
520 |
$count = 0;
|
521 |
for ($i = 0; $i < count($values); $i++) {
|
522 |
if (is_numeric(str_replace(array('.', ','), '', $values[$i]))) {
|
527 |
return $count == count($values);
|
528 |
}
|
529 |
|
|
|
|
|
|
|
530 |
|
531 |
/** @noinspection PhpUnusedPrivateMethodInspection
|
532 |
* Function that checks if the passed value is date
|
533 |
* @param $input
|
534 |
* @return bool
|
535 |
*/
|
536 |
+
private static function wdtIsDate($input)
|
537 |
+
{
|
538 |
return strlen($input) > 5 &&
|
539 |
(
|
540 |
strtotime($input) ||
|
548 |
* @param $input
|
549 |
* @return bool
|
550 |
*/
|
551 |
+
private static function wdtIsDateTime($input)
|
552 |
+
{
|
553 |
return (
|
554 |
strtotime($input) ||
|
555 |
strtotime(str_replace('/', '-', $input)) ||
|
569 |
* @return bool
|
570 |
* @throws WDTException
|
571 |
*/
|
572 |
+
private static function _detect($valuesArray, $checkFunction, $regularExpression = '')
|
573 |
+
{
|
574 |
if (!is_callable($checkFunction)) {
|
575 |
throw new WDTException('Please provide a valid type detection function for wpDataTables');
|
576 |
}
|
601 |
* @param $dateFormat
|
602 |
* @return string
|
603 |
*/
|
604 |
+
public static function convertPhpToMomentDateFormat($dateFormat)
|
605 |
+
{
|
606 |
$replacements = array(
|
607 |
'd' => 'DD',
|
608 |
'D' => 'ddd',
|
649 |
/**
|
650 |
* Helper method to wrap values in quotes for DB
|
651 |
*/
|
652 |
+
public static function wrapQuotes($value)
|
653 |
+
{
|
654 |
$valueQuote = get_option('wdtUseSeparateCon') ? "'" : '';
|
655 |
return $valueQuote . $value . $valueQuote;
|
656 |
}
|
661 |
* @param $headers
|
662 |
* @return array
|
663 |
*/
|
664 |
+
public static function getColHeadersInFormula($formula, $headers)
|
665 |
+
{
|
666 |
$headersInFormula = array();
|
667 |
foreach ($headers as $header) {
|
668 |
if (strpos($formula, $header) !== false) {
|
677 |
* @param $uploadUrl
|
678 |
* @return mixed
|
679 |
*/
|
680 |
+
public static function urlToPath($uploadUrl)
|
681 |
+
{
|
682 |
$uploadsDir = wp_upload_dir();
|
683 |
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
684 |
$uploadPath = str_replace($uploadsDir['baseurl'], str_replace('\\', '/', $uploadsDir['basedir']), $uploadUrl);
|
693 |
* @param $uploadPath
|
694 |
* @return mixed
|
695 |
*/
|
696 |
+
public static function pathToUrl($uploadPath)
|
697 |
+
{
|
698 |
$uploadsDir = wp_upload_dir();
|
699 |
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
700 |
$uploadUrl = str_replace(str_replace('\\', '/', $uploadsDir['basedir']), $uploadsDir['baseurl'], $uploadPath);
|
711 |
* @param bool $opacity
|
712 |
* @return string
|
713 |
*/
|
714 |
+
public static function hex2rgba($color, $opacity = false)
|
715 |
+
{
|
716 |
|
717 |
$default = 'rgb(0,0,0)';
|
718 |
|
756 |
*
|
757 |
* @return string
|
758 |
*/
|
759 |
+
public static function prepareStringCell($string)
|
760 |
+
{
|
761 |
|
762 |
if (self::isHtml($string)) {
|
763 |
$string = self::stripJsAttributes($string);
|
771 |
* @param $string
|
772 |
* @return bool
|
773 |
*/
|
774 |
+
public static function isHtml($string)
|
775 |
+
{
|
776 |
return preg_match("/<[^<]+>/", $string, $m) != 0;
|
777 |
}
|
778 |
|
781 |
* @param $htmlString
|
782 |
* @return bool|string
|
783 |
*/
|
784 |
+
public static function stripJsAttributes($htmlString)
|
785 |
+
{
|
786 |
$htmlString = stripcslashes($htmlString);
|
787 |
$htmlString = '<div>' . $htmlString . '</div>';
|
788 |
$domd = new DOMDocument();
|
804 |
/**
|
805 |
* Enqueue JS and CSS UI Kit files
|
806 |
*/
|
807 |
+
public static function wdtUIKitEnqueue()
|
808 |
+
{
|
809 |
wp_enqueue_style('wdt-bootstrap', WDT_CSS_PATH . 'bootstrap/wpdatatables-bootstrap.css');
|
810 |
wp_enqueue_style('wdt-bootstrap-select', WDT_CSS_PATH . 'bootstrap/bootstrap-select/bootstrap-select.min.css');
|
811 |
wp_enqueue_style('wdt-bootstrap-tagsinput', WDT_CSS_PATH . 'bootstrap/bootstrap-tagsinput/bootstrap-tagsinput.css');
|
819 |
|
820 |
if (!is_admin() && get_option('wdtIncludeBootstrap') == 1) {
|
821 |
wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
|
822 |
+
} else if (is_admin() && get_option('wdtIncludeBootstrapBackEnd') == 1) {
|
823 |
wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
|
824 |
+
} else {
|
825 |
wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/noconf.bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
|
826 |
}
|
827 |
|
839 |
* @param $varName
|
840 |
* @param $phpVar
|
841 |
*/
|
842 |
+
public static function exportJSVar($varName, $phpVar)
|
843 |
+
{
|
844 |
self::$jsVars[$varName] = $phpVar;
|
845 |
}
|
846 |
|
847 |
/**
|
848 |
* Helper method to print PHP vars to JS vars
|
849 |
*/
|
850 |
+
public static function printJSVars()
|
851 |
+
{
|
852 |
if (!empty(self::$jsVars)) {
|
853 |
$jsBlock = '<script type="text/javascript">';
|
854 |
foreach (self::$jsVars as $varName => $jsVar) {
|
866 |
* @param $dateFormat
|
867 |
* @return false|int
|
868 |
*/
|
869 |
+
public static function wdtConvertStringToUnixTimestamp($dateString, $dateFormat)
|
870 |
+
{
|
871 |
if (null !== $dateFormat && $dateFormat == 'd/m/Y') {
|
872 |
$returnDate = strtotime(str_replace('/', '-', $dateString));
|
873 |
} else if (null !== $dateFormat && in_array($dateFormat, ['m.d.Y', 'm-d-Y'])) {
|
884 |
* @param $errorMessage
|
885 |
* @return string
|
886 |
*/
|
887 |
+
public static function wdtShowError($errorMessage)
|
888 |
+
{
|
889 |
self::wdtUIKitEnqueue();
|
890 |
ob_start();
|
891 |
include WDT_ROOT_PATH . 'templates/common/error.inc.php';
|
900 |
* @param $existing_headers
|
901 |
* @return mixed|string
|
902 |
*/
|
903 |
+
public static function generateMySQLColumnName($header, $existing_headers)
|
904 |
+
{
|
905 |
// Prepare the column MySQL title
|
906 |
$column_header = self::slugify($header);
|
907 |
|
923 |
* @param $text
|
924 |
* @return mixed|string
|
925 |
*/
|
926 |
+
private static function slugify($text)
|
927 |
+
{
|
928 |
// replace non letter or digits by _
|
929 |
$text = preg_replace('#[^\\pL\d]+#u', '_', $text);
|
930 |
|
source/class.wpdatachart.php
ADDED
@@ -0,0 +1,1102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined('ABSPATH') or die('Access denied.');
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Chart engine of wpDataTables plugin
|
7 |
+
*/
|
8 |
+
class WPDataChart
|
9 |
+
{
|
10 |
+
|
11 |
+
private $_id = NULL;
|
12 |
+
private $_wpdatatable_id = NULL;
|
13 |
+
private $_engine = '';
|
14 |
+
private $_type = '';
|
15 |
+
private $_range_type = 'all_rows';
|
16 |
+
private $_selected_columns = array();
|
17 |
+
private $_row_range = array();
|
18 |
+
private $_wpdatatable = NULL;
|
19 |
+
// Chart
|
20 |
+
private $_width = 400;
|
21 |
+
private $_height = 400;
|
22 |
+
private $_background_color = '#FFFFFF';
|
23 |
+
private $_border_width = 0;
|
24 |
+
private $_border_color = '#4572A7';
|
25 |
+
private $_border_radius = 0;
|
26 |
+
private $_plot_background_color = 'undefined';
|
27 |
+
private $_plot_border_width = 0;
|
28 |
+
private $_plot_border_color = '#C0C0C0';
|
29 |
+
// Series
|
30 |
+
private $_series = array();
|
31 |
+
// Axes
|
32 |
+
private $_show_grid = true;
|
33 |
+
private $_axes = array(
|
34 |
+
'major' => array(
|
35 |
+
'label' => ''
|
36 |
+
),
|
37 |
+
'minor' => array(
|
38 |
+
'label' => ''
|
39 |
+
)
|
40 |
+
);
|
41 |
+
// Title
|
42 |
+
private $_title = '';
|
43 |
+
private $_show_title = true;
|
44 |
+
private $_title_floating = false;
|
45 |
+
|
46 |
+
// Legend
|
47 |
+
private $_legend_position = 'bottom';
|
48 |
+
private $_legend_vertical_align = 'bottom';
|
49 |
+
|
50 |
+
private $_user_defined_series_data = array();
|
51 |
+
private $_render_data = NULL;
|
52 |
+
|
53 |
+
private $_type_counters;
|
54 |
+
|
55 |
+
public function __construct()
|
56 |
+
{
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
public function setId($id)
|
61 |
+
{
|
62 |
+
$this->_id = $id;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getId()
|
66 |
+
{
|
67 |
+
return $this->_id;
|
68 |
+
}
|
69 |
+
|
70 |
+
// Chart
|
71 |
+
|
72 |
+
public function setWidth($width)
|
73 |
+
{
|
74 |
+
$this->_width = $width;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function getWidth()
|
78 |
+
{
|
79 |
+
return $this->_width;
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
public function setHeight($height)
|
84 |
+
{
|
85 |
+
$this->_height = $height;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getHeight()
|
89 |
+
{
|
90 |
+
return $this->_height;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @param $background_color
|
96 |
+
*/
|
97 |
+
public function setBackgroundColor($background_color)
|
98 |
+
{
|
99 |
+
$this->_background_color = $background_color;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function getBackgroundColor()
|
106 |
+
{
|
107 |
+
return $this->_background_color;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @param $border_width
|
112 |
+
*/
|
113 |
+
public function setBorderWidth($border_width)
|
114 |
+
{
|
115 |
+
$this->_border_width = $border_width;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @return int
|
120 |
+
*/
|
121 |
+
public function getBorderWidth()
|
122 |
+
{
|
123 |
+
return $this->_border_width;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @param $border_color
|
128 |
+
*/
|
129 |
+
public function setBorderColor($border_color)
|
130 |
+
{
|
131 |
+
$this->_border_color = $border_color;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
public function getBorderColor()
|
138 |
+
{
|
139 |
+
return $this->_border_color;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @param $border_radius
|
144 |
+
*/
|
145 |
+
public function setBorderRadius($border_radius)
|
146 |
+
{
|
147 |
+
$this->_border_radius = $border_radius;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @return int
|
152 |
+
*/
|
153 |
+
public function getBorderRadius()
|
154 |
+
{
|
155 |
+
return $this->_border_radius;
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @param $plot_background_color
|
161 |
+
*/
|
162 |
+
public function setPlotBackgroundColor($plot_background_color)
|
163 |
+
{
|
164 |
+
$this->_plot_background_color = $plot_background_color;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
public function getPlotBackgroundColor()
|
171 |
+
{
|
172 |
+
return $this->_plot_background_color;
|
173 |
+
}
|
174 |
+
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param $plot_border_width
|
178 |
+
*/
|
179 |
+
public function setPlotBorderWidth($plot_border_width)
|
180 |
+
{
|
181 |
+
$this->_plot_border_width = $plot_border_width;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @return int
|
186 |
+
*/
|
187 |
+
public function getPlotBorderWidth()
|
188 |
+
{
|
189 |
+
return $this->_plot_border_width;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @param $plot_border_color
|
194 |
+
*/
|
195 |
+
public function setPlotBorderColor($plot_border_color)
|
196 |
+
{
|
197 |
+
$this->_plot_border_color = $plot_border_color;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @return string
|
202 |
+
*/
|
203 |
+
public function getPlotBorderColor()
|
204 |
+
{
|
205 |
+
return $this->_plot_border_color;
|
206 |
+
}
|
207 |
+
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
// Axes
|
212 |
+
|
213 |
+
/**
|
214 |
+
* @param $show_grid
|
215 |
+
*/
|
216 |
+
public function setShowGrid($show_grid)
|
217 |
+
{
|
218 |
+
$this->_show_grid = (bool)$show_grid;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* @return bool
|
223 |
+
*/
|
224 |
+
public function getShowGrid()
|
225 |
+
{
|
226 |
+
return $this->_show_grid;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* @param $label
|
231 |
+
*/
|
232 |
+
public function setMajorAxisLabel($label)
|
233 |
+
{
|
234 |
+
$this->_axes['major']['label'] = $label;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* @return mixed
|
239 |
+
*/
|
240 |
+
public function getMajorAxisLabel()
|
241 |
+
{
|
242 |
+
return $this->_axes['major']['label'];
|
243 |
+
}
|
244 |
+
|
245 |
+
|
246 |
+
/**
|
247 |
+
* @param $label
|
248 |
+
*/
|
249 |
+
public function setMinorAxisLabel($label)
|
250 |
+
{
|
251 |
+
$this->_axes['minor']['label'] = $label;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* @return mixed
|
256 |
+
*/
|
257 |
+
public function getMinorAxisLabel()
|
258 |
+
{
|
259 |
+
return $this->_axes['minor']['label'];
|
260 |
+
}
|
261 |
+
|
262 |
+
// Title
|
263 |
+
|
264 |
+
/**
|
265 |
+
* @param string $title
|
266 |
+
*/
|
267 |
+
public function setTitle($title)
|
268 |
+
{
|
269 |
+
$this->_title = $title;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* @return string
|
274 |
+
*/
|
275 |
+
public function getTitle()
|
276 |
+
{
|
277 |
+
return $this->_title;
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* @param boolean $show_title
|
282 |
+
*/
|
283 |
+
public function setShowTitle($show_title)
|
284 |
+
{
|
285 |
+
$this->_show_title = $show_title;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* @return boolean
|
290 |
+
*/
|
291 |
+
public function isShowTitle()
|
292 |
+
{
|
293 |
+
return $this->_show_title;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* @param boolean $title_floating
|
298 |
+
*/
|
299 |
+
public function setTitleFloating($title_floating)
|
300 |
+
{
|
301 |
+
$this->_title_floating = (bool)$title_floating;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* @return boolean
|
306 |
+
*/
|
307 |
+
public function isTitleFloating()
|
308 |
+
{
|
309 |
+
return $this->_title_floating;
|
310 |
+
}
|
311 |
+
|
312 |
+
// Legend
|
313 |
+
|
314 |
+
|
315 |
+
/**
|
316 |
+
* @return string
|
317 |
+
*/
|
318 |
+
public function getLegendPosition()
|
319 |
+
{
|
320 |
+
return $this->_legend_position;
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* @param string $legend_position
|
325 |
+
*/
|
326 |
+
public function setLegendPosition($legend_position)
|
327 |
+
{
|
328 |
+
$this->_legend_position = $legend_position;
|
329 |
+
}
|
330 |
+
|
331 |
+
|
332 |
+
public function setLegendVerticalAlign($legend_vertical_align)
|
333 |
+
{
|
334 |
+
$this->_legend_vertical_align = $legend_vertical_align;
|
335 |
+
}
|
336 |
+
|
337 |
+
public function getLegendVerticalAlign()
|
338 |
+
{
|
339 |
+
return $this->_legend_vertical_align;
|
340 |
+
}
|
341 |
+
|
342 |
+
|
343 |
+
/**
|
344 |
+
* @param $series_data
|
345 |
+
*/
|
346 |
+
public function setUserDefinedSeriesData($series_data)
|
347 |
+
{
|
348 |
+
if (is_array($series_data)) {
|
349 |
+
$this->_user_defined_series_data = $series_data;
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* @return array
|
355 |
+
*/
|
356 |
+
public function getUserDefinedSeriesData()
|
357 |
+
{
|
358 |
+
return $this->_user_defined_series_data;
|
359 |
+
}
|
360 |
+
|
361 |
+
|
362 |
+
/**
|
363 |
+
* @param $engine
|
364 |
+
*/
|
365 |
+
public function setEngine($engine)
|
366 |
+
{
|
367 |
+
$this->_engine = $engine;
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* @return string
|
372 |
+
*/
|
373 |
+
public function getEngine()
|
374 |
+
{
|
375 |
+
return $this->_engine;
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* @param $type
|
380 |
+
*/
|
381 |
+
public function setType($type)
|
382 |
+
{
|
383 |
+
$this->_type = $type;
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* @return string
|
388 |
+
*/
|
389 |
+
public function getType()
|
390 |
+
{
|
391 |
+
return $this->_type;
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* @param $row_range
|
396 |
+
*/
|
397 |
+
public function setRowRange($row_range)
|
398 |
+
{
|
399 |
+
$this->_row_range = $row_range;
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* @return array
|
404 |
+
*/
|
405 |
+
public function getRowRange()
|
406 |
+
{
|
407 |
+
return $this->_row_range;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* @param $selected_columns
|
412 |
+
*/
|
413 |
+
public function setSelectedColumns($selected_columns)
|
414 |
+
{
|
415 |
+
$this->_selected_columns = $selected_columns;
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* @return array
|
420 |
+
*/
|
421 |
+
public function getSelectedColumns()
|
422 |
+
{
|
423 |
+
return $this->_selected_columns;
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* @param $wdt_id
|
428 |
+
*/
|
429 |
+
public function setwpDataTableId($wdt_id)
|
430 |
+
{
|
431 |
+
$this->_wpdatatable_id = $wdt_id;
|
432 |
+
}
|
433 |
+
|
434 |
+
/**
|
435 |
+
* @return null
|
436 |
+
*/
|
437 |
+
public function getwpDataTableId()
|
438 |
+
{
|
439 |
+
return $this->_wpdatatable_id;
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* @param $range_type
|
444 |
+
*/
|
445 |
+
public function setRangeType($range_type)
|
446 |
+
{
|
447 |
+
$this->_range_type = $range_type;
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* @return string
|
452 |
+
*/
|
453 |
+
public function getRangeType()
|
454 |
+
{
|
455 |
+
return $this->_range_type;
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* @param $constructedChartData
|
460 |
+
* @param bool $loadFromDB
|
461 |
+
* @return WPDataChart
|
462 |
+
*/
|
463 |
+
public static function factory($constructedChartData, $loadFromDB = true)
|
464 |
+
{
|
465 |
+
$chartObj = new self();
|
466 |
+
|
467 |
+
if (isset($constructedChartData['chart_id'])) {
|
468 |
+
$chartObj->setId((int)$constructedChartData['chart_id']);
|
469 |
+
if ($loadFromDB) {
|
470 |
+
$chartObj->loadFromDB();
|
471 |
+
$chartObj->prepareData();
|
472 |
+
$chartObj->shiftStringColumnUp();
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
// Main data (steps 1-3 of chart constructor)
|
477 |
+
$chartObj->setwpDataTableId((int)$constructedChartData['wpdatatable_id']);
|
478 |
+
$chartObj->setTitle(sanitize_text_field($constructedChartData['chart_title']));
|
479 |
+
$chartObj->setEngine(sanitize_text_field($constructedChartData['chart_engine']));
|
480 |
+
$chartObj->setType(sanitize_text_field($constructedChartData['chart_type']));
|
481 |
+
$chartObj->setSelectedColumns(array_map('sanitize_text_field', $constructedChartData['selected_columns']));
|
482 |
+
|
483 |
+
|
484 |
+
// Render data (step 4 or chart constructor)
|
485 |
+
// Chart
|
486 |
+
$chartObj->setWidth(WDTTools::defineDefaultValue($constructedChartData, 'width', 0));
|
487 |
+
$chartObj->setHeight(WDTTools::defineDefaultValue($constructedChartData, 'height', 400));
|
488 |
+
$chartObj->setBackgroundColor(WDTTools::defineDefaultValue($constructedChartData, 'background_color', '#FFFFFF'));
|
489 |
+
$chartObj->setBorderWidth(WDTTools::defineDefaultValue($constructedChartData, 'border_width', 0));
|
490 |
+
$chartObj->setBorderColor(WDTTools::defineDefaultValue($constructedChartData, 'border_color', '#FFFFFF'));
|
491 |
+
$chartObj->setBorderRadius(WDTTools::defineDefaultValue($constructedChartData, 'border_radius', 0));
|
492 |
+
$chartObj->setPlotBackgroundColor(WDTTools::defineDefaultValue($constructedChartData, 'plot_background_color', '#FFFFFF'));
|
493 |
+
$chartObj->setPlotBorderWidth(WDTTools::defineDefaultValue($constructedChartData, 'plot_border_width', 0));
|
494 |
+
$chartObj->setPlotBorderColor(WDTTools::defineDefaultValue($constructedChartData, 'plot_border_color', '#C0C0C0'));
|
495 |
+
|
496 |
+
// Series
|
497 |
+
if (!empty($constructedChartData['series_data'])) {
|
498 |
+
array_walk_recursive(
|
499 |
+
$constructedChartData['series_data'],
|
500 |
+
function ($value, $key) {
|
501 |
+
sanitize_text_field($value);
|
502 |
+
}
|
503 |
+
);
|
504 |
+
$chartObj->setUserDefinedSeriesData($constructedChartData['series_data']);
|
505 |
+
}
|
506 |
+
|
507 |
+
// Axes
|
508 |
+
$chartObj->setShowGrid(WDTTools::defineDefaultValue($constructedChartData, 'show_grid', true));
|
509 |
+
$chartObj->setMajorAxisLabel(WDTTools::defineDefaultValue($constructedChartData, 'horizontal_axis_label', ''));
|
510 |
+
$chartObj->setMinorAxisLabel(WDTTools::defineDefaultValue($constructedChartData, 'vertical_axis_label', ''));
|
511 |
+
|
512 |
+
|
513 |
+
// Title
|
514 |
+
$chartObj->setShowTitle(WDTTools::defineDefaultValue($constructedChartData, 'show_title', true));
|
515 |
+
$chartObj->setTitleFloating(WDTTools::defineDefaultValue($constructedChartData, 'title_floating', false));
|
516 |
+
|
517 |
+
// Legend
|
518 |
+
|
519 |
+
$chartObj->setLegendPosition(WDTTools::defineDefaultValue($constructedChartData, 'legend_position', 'bottom'));
|
520 |
+
$chartObj->setLegendVerticalAlign(WDTTools::defineDefaultValue($constructedChartData, 'legend_vertical_align', 'bottom'));
|
521 |
+
|
522 |
+
|
523 |
+
$chartObj->loadChildWPDataTable();
|
524 |
+
|
525 |
+
return $chartObj;
|
526 |
+
}
|
527 |
+
|
528 |
+
public function loadChildWPDataTable()
|
529 |
+
{
|
530 |
+
if (empty($this->_wpdatatable_id)) {
|
531 |
+
return false;
|
532 |
+
}
|
533 |
+
|
534 |
+
$this->_wpdatatable = WPDataTable::loadWpDataTable($this->_wpdatatable_id, null, empty($this->_follow_filtering));
|
535 |
+
}
|
536 |
+
|
537 |
+
public function shiftStringColumnUp()
|
538 |
+
{
|
539 |
+
/**
|
540 |
+
* Check if the string column is not in the beginning and move it up
|
541 |
+
*/
|
542 |
+
if (count($this->_render_data['columns']) > 1) {
|
543 |
+
$shiftNeeded = false;
|
544 |
+
$shiftIndex = 0;
|
545 |
+
for ($i = 1; $i < count($this->_render_data['columns']); $i++) {
|
546 |
+
if ($this->_render_data['columns'][$i]['type'] == 'string') {
|
547 |
+
$shiftNeeded = true;
|
548 |
+
$shiftIndex = $i;
|
549 |
+
break;
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
if ($shiftNeeded) {
|
554 |
+
// Shift columns
|
555 |
+
$strColumn = $this->_render_data['columns'][$shiftIndex];
|
556 |
+
unset($this->_render_data['columns'][$shiftIndex]);
|
557 |
+
array_unshift($this->_render_data['columns'], $strColumn);
|
558 |
+
// Shift rows
|
559 |
+
for ($j = 0; $j < count($this->_render_data['rows']); $j++) {
|
560 |
+
$strCell = $this->_render_data['rows'][$j][$shiftIndex];
|
561 |
+
unset($this->_render_data['rows'][$j][$shiftIndex]);
|
562 |
+
array_unshift($this->_render_data['rows'][$j], $strCell);
|
563 |
+
}
|
564 |
+
// Shift column indexes
|
565 |
+
if (isset($this->_render_data['column_indexes'])) {
|
566 |
+
$shiftedIndex = $this->_render_data['column_indexes'][$shiftIndex];
|
567 |
+
unset($this->_render_data['column_indexes'][$shiftIndex]);
|
568 |
+
array_unshift($this->_render_data['column_indexes'], $shiftedIndex);
|
569 |
+
}
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
// Format axes
|
574 |
+
$this->_render_data['axes']['major'] = array(
|
575 |
+
'type' => $this->_render_data['columns'][0]['type'],
|
576 |
+
'label' => !empty($this->_render_data['hAxis']['title']) ?
|
577 |
+
$this->_render_data['hAxis']['title'] : $this->_render_data['columns'][0]['label']
|
578 |
+
);
|
579 |
+
$this->_render_data['axes']['minor'] = array(
|
580 |
+
'type' => $this->_render_data['columns'][1]['type'],
|
581 |
+
'label' => !empty($this->_render_data['vAxis']['title']) ?
|
582 |
+
$this->_render_data['vAxis']['title'] : ''
|
583 |
+
);
|
584 |
+
|
585 |
+
// Get all series names
|
586 |
+
if (empty($this->_render_data['series'])) {
|
587 |
+
for ($i = 1; $i < count($this->_render_data['columns']); $i++) {
|
588 |
+
$this->_render_data['series'][] = array(
|
589 |
+
'label' => $this->_render_data['columns'][$i]['label'],
|
590 |
+
'color' => '',
|
591 |
+
'orig_header' => $this->_render_data['columns'][$i]['orig_header']
|
592 |
+
);
|
593 |
+
}
|
594 |
+
}
|
595 |
+
|
596 |
+
}
|
597 |
+
|
598 |
+
public function prepareSeriesData()
|
599 |
+
{
|
600 |
+
// Init render data if it is empty
|
601 |
+
if (empty($this->_render_data)) {
|
602 |
+
$this->_render_data = array(
|
603 |
+
'columns' => array(),
|
604 |
+
'rows' => array(),
|
605 |
+
'axes' => array(),
|
606 |
+
'options' => array(
|
607 |
+
'title' => $this->_show_title ? $this->_title : '',
|
608 |
+
'series' => array(),
|
609 |
+
'width' => $this->_width,
|
610 |
+
'height' => $this->_height
|
611 |
+
),
|
612 |
+
'vAxis' => array(),
|
613 |
+
'hAxis' => array(),
|
614 |
+
'errors' => array(),
|
615 |
+
'series' => array()
|
616 |
+
);
|
617 |
+
}
|
618 |
+
|
619 |
+
|
620 |
+
$this->_type_counters = array(
|
621 |
+
'date' => 0,
|
622 |
+
'string' => 0,
|
623 |
+
'number' => 0
|
624 |
+
);
|
625 |
+
|
626 |
+
// Define columns
|
627 |
+
foreach ($this->getSelectedColumns() as $columnKey) {
|
628 |
+
$columnType = $this->_wpdatatable->getColumn($columnKey)->getGoogleChartColumnType();
|
629 |
+
$this->_render_data['columns'][] = array(
|
630 |
+
'type' => $columnType,
|
631 |
+
'label' => isset($this->_user_defined_series_data[$columnKey]['label']) ?
|
632 |
+
$this->_user_defined_series_data[$columnKey]['label'] : $this->_wpdatatable->getColumn($columnKey)->getTitle(),
|
633 |
+
'orig_header' => $columnKey
|
634 |
+
);
|
635 |
+
$this->_type_counters[$columnType]++;
|
636 |
+
}
|
637 |
+
|
638 |
+
// Define axes titles
|
639 |
+
if (isset($this->_axes['major']['label'])) {
|
640 |
+
$this->_render_data['options']['hAxis']['title'] = $this->_axes['major']['label'];
|
641 |
+
}
|
642 |
+
if (isset($this->_axes['minor']['label'])) {
|
643 |
+
$this->_render_data['options']['vAxis']['title'] = $this->_axes['minor']['label'];
|
644 |
+
}
|
645 |
+
|
646 |
+
// Define series colors,type and yaxis
|
647 |
+
|
648 |
+
if (!empty($this->_user_defined_series_data)) {
|
649 |
+
$seriesIndex = 0;
|
650 |
+
foreach ($this->_user_defined_series_data as $series_data) {
|
651 |
+
if (!empty($series_data['color']) || !empty($series_data['type'])) {
|
652 |
+
$this->_render_data['options']['series'][(int)$seriesIndex] = array(
|
653 |
+
'color' => $series_data['color'],
|
654 |
+
'label' => $series_data['label']
|
655 |
+
);
|
656 |
+
}
|
657 |
+
$seriesIndex++;
|
658 |
+
}
|
659 |
+
}
|
660 |
+
|
661 |
+
|
662 |
+
// Define grid settings
|
663 |
+
if (!$this->_show_grid) {
|
664 |
+
if (!isset($this->_render_data['options']['hAxis'])) {
|
665 |
+
$this->_render_data['options']['hAxis'] = array();
|
666 |
+
}
|
667 |
+
$this->_render_data['options']['hAxis']['gridlines'] = array(
|
668 |
+
'color' => 'transparent'
|
669 |
+
);
|
670 |
+
if (!isset($this->_render_data['options']['vAxis'])) {
|
671 |
+
$this->_render_data['options']['vAxis'] = array();
|
672 |
+
}
|
673 |
+
$this->_render_data['options']['vAxis']['gridlines'] = array(
|
674 |
+
'color' => 'transparent'
|
675 |
+
);
|
676 |
+
$this->_render_data['show_grid'] = false;
|
677 |
+
} else {
|
678 |
+
$this->_render_data['show_grid'] = true;
|
679 |
+
}
|
680 |
+
|
681 |
+
// Detect errors
|
682 |
+
if ($this->_type_counters['string'] > 1) {
|
683 |
+
$this->_render_data['errors'][] = __('Only one column can be of type String', 'wpdatatables');
|
684 |
+
}
|
685 |
+
if (($this->_type_counters['number'] > 1) && ($this->_type_counters['date'] > 1)) {
|
686 |
+
$this->_render_data['errors'][] = __('You are mixing data types (several date axes and several number)', 'wpdatatables');
|
687 |
+
}
|
688 |
+
|
689 |
+
if (empty($this->_highcharts_render_data)) {
|
690 |
+
$this->_highcharts_render_data = array();
|
691 |
+
}
|
692 |
+
|
693 |
+
if ($this->_engine == 'google') {
|
694 |
+
// Chart
|
695 |
+
$this->_render_data['width'] = $this->getWidth();
|
696 |
+
$this->_render_data['options']['backgroundColor']['fill'] = $this->getBackgroundColor();
|
697 |
+
$this->_render_data['options']['backgroundColor']['strokeWidth'] = $this->getBorderWidth();
|
698 |
+
$this->_render_data['options']['backgroundColor']['stroke'] = $this->getBorderColor();
|
699 |
+
$this->_render_data['options']['backgroundColor']['rx'] = $this->getBorderRadius();
|
700 |
+
$this->_render_data['options']['chartArea']['backgroundColor']['fill'] = $this->getPlotBackgroundColor();
|
701 |
+
$this->_render_data['options']['chartArea']['backgroundColor']['strokeWidth'] = $this->getPlotBorderWidth();
|
702 |
+
$this->_render_data['options']['chartArea']['backgroundColor']['stroke'] = $this->getPlotBorderColor();
|
703 |
+
|
704 |
+
// Title
|
705 |
+
if ($this->isTitleFloating()) {
|
706 |
+
$this->_render_data['options']['titlePosition'] = 'in';
|
707 |
+
} else {
|
708 |
+
$this->_render_data['options']['titlePosition'] = 'out';
|
709 |
+
}
|
710 |
+
|
711 |
+
|
712 |
+
// Legend
|
713 |
+
$this->_render_data['options']['legend']['position'] = $this->getLegendPosition();
|
714 |
+
if ($this->getLegendVerticalAlign() == 'bottom') {
|
715 |
+
$this->_render_data['options']['legend']['alignment'] = 'end';
|
716 |
+
} elseif ($this->getLegendVerticalAlign() == 'middle') {
|
717 |
+
$this->_render_data['options']['legend']['alignment'] = 'center';
|
718 |
+
} else {
|
719 |
+
$this->_render_data['options']['legend']['alignment'] = 'start';
|
720 |
+
}
|
721 |
+
|
722 |
+
}
|
723 |
+
|
724 |
+
|
725 |
+
}
|
726 |
+
|
727 |
+
|
728 |
+
/**
|
729 |
+
* Prepares the data for Google charts format
|
730 |
+
*/
|
731 |
+
public function prepareData()
|
732 |
+
{
|
733 |
+
|
734 |
+
// Prepare series and columns
|
735 |
+
if (empty($this->_render_data['columns'])) {
|
736 |
+
$this->prepareSeriesData();
|
737 |
+
}
|
738 |
+
|
739 |
+
$dateFormat = ($this->getEngine() == 'google') ? DateTime::RFC2822 : get_option('wdtDateFormat');
|
740 |
+
$timeFormat = get_option('wdtTimeFormat');
|
741 |
+
|
742 |
+
// The data itself
|
743 |
+
if (empty($this->_render_data['rows'])) {
|
744 |
+
if ($this->getRangeType() == 'all_rows') {
|
745 |
+
foreach ($this->_wpdatatable->getDataRows() as $row) {
|
746 |
+
$return_data_row = array();
|
747 |
+
foreach ($this->getSelectedColumns() as $columnKey) {
|
748 |
+
$dataType = $this->_wpdatatable->getColumn($columnKey)->getDataType();
|
749 |
+
switch ($dataType) {
|
750 |
+
case 'date':
|
751 |
+
$timestamp = is_int($row[$columnKey]) ? $row[$columnKey] : strtotime(str_replace('/', '-', $row[$columnKey]));
|
752 |
+
$return_data_row[] = date(
|
753 |
+
$dateFormat,
|
754 |
+
$timestamp
|
755 |
+
);
|
756 |
+
break;
|
757 |
+
case 'datetime':
|
758 |
+
$timestamp = is_int($row[$columnKey]) ? $row[$columnKey] : strtotime(str_replace('/', '-', $row[$columnKey]));
|
759 |
+
if ($this->getEngine() == 'google') {
|
760 |
+
$return_data_row[] = date(
|
761 |
+
$dateFormat,
|
762 |
+
$timestamp
|
763 |
+
);
|
764 |
+
} else {
|
765 |
+
$return_data_row[] = date(
|
766 |
+
$dateFormat . ' ' . $timeFormat,
|
767 |
+
$timestamp
|
768 |
+
);
|
769 |
+
}
|
770 |
+
break;
|
771 |
+
case 'time':
|
772 |
+
$timestamp = $row[$columnKey];
|
773 |
+
$return_data_row[] = date(
|
774 |
+
$timeFormat,
|
775 |
+
$timestamp
|
776 |
+
);
|
777 |
+
break;
|
778 |
+
case 'int':
|
779 |
+
$return_data_row[] = (float)$row[$columnKey];
|
780 |
+
break;
|
781 |
+
case 'float':
|
782 |
+
$return_data_row[] = (float)$row[$columnKey];
|
783 |
+
break;
|
784 |
+
case 'string':
|
785 |
+
default:
|
786 |
+
$return_data_row[] = $row[$columnKey];
|
787 |
+
break;
|
788 |
+
}
|
789 |
+
}
|
790 |
+
$this->_render_data['rows'][] = $return_data_row;
|
791 |
+
}
|
792 |
+
} else {
|
793 |
+
foreach ($this->_row_range as $rowIndex) {
|
794 |
+
$return_data_row = array();
|
795 |
+
foreach ($this->getSelectedColumns() as $columnKey) {
|
796 |
+
|
797 |
+
$dataType = $this->_wpdatatable->getColumn($columnKey)->getDataType();
|
798 |
+
switch ($dataType) {
|
799 |
+
case 'date':
|
800 |
+
$timestamp = is_int($this->_wpdatatable->getCell($columnKey, $rowIndex)) ?
|
801 |
+
$this->_wpdatatable->getCell($columnKey, $rowIndex)
|
802 |
+
: strtotime(str_replace('/', '-', $this->_wpdatatable->getCell($columnKey, $rowIndex)));
|
803 |
+
$return_data_row[] = date(
|
804 |
+
$dateFormat,
|
805 |
+
$timestamp
|
806 |
+
);
|
807 |
+
break;
|
808 |
+
case 'datetime':
|
809 |
+
$timestamp = is_int($this->_wpdatatable->getCell($columnKey, $rowIndex)) ?
|
810 |
+
$this->_wpdatatable->getCell($columnKey, $rowIndex) : strtotime(str_replace('/', '-', $this->_wpdatatable->getCell($columnKey, $rowIndex)));
|
811 |
+
if ($this->getEngine() == 'google') {
|
812 |
+
$return_data_row[] = date(
|
813 |
+
$dateFormat,
|
814 |
+
$timestamp
|
815 |
+
);
|
816 |
+
} else {
|
817 |
+
$return_data_row[] = date(
|
818 |
+
$dateFormat . ' ' . $timeFormat,
|
819 |
+
$timestamp
|
820 |
+
);
|
821 |
+
}
|
822 |
+
break;
|
823 |
+
case 'time':
|
824 |
+
$timestamp = $this->_wpdatatable->getCell($columnKey, $rowIndex);
|
825 |
+
$return_data_row[] = date(
|
826 |
+
$timeFormat,
|
827 |
+
$timestamp
|
828 |
+
);
|
829 |
+
break;
|
830 |
+
case 'int':
|
831 |
+
$return_data_row[] = (float)$this->_wpdatatable->getCell($columnKey, $rowIndex);
|
832 |
+
break;
|
833 |
+
case 'float':
|
834 |
+
$return_data_row[] = (float)$this->_wpdatatable->getCell($columnKey, $rowIndex);
|
835 |
+
break;
|
836 |
+
case 'string':
|
837 |
+
default:
|
838 |
+
$return_data_row[] = $this->_wpdatatable->getCell($columnKey, $rowIndex);
|
839 |
+
break;
|
840 |
+
}
|
841 |
+
|
842 |
+
}
|
843 |
+
$this->_render_data['rows'][] = $return_data_row;
|
844 |
+
}
|
845 |
+
}
|
846 |
+
|
847 |
+
}
|
848 |
+
|
849 |
+
$this->_render_data['type'] = $this->_type;
|
850 |
+
return $this->_render_data;
|
851 |
+
}
|
852 |
+
|
853 |
+
|
854 |
+
public function getAxesAndSeries()
|
855 |
+
{
|
856 |
+
if (empty($this->_render_data['columns'])) {
|
857 |
+
$this->prepareSeriesData();
|
858 |
+
$this->shiftStringColumnUp();
|
859 |
+
}
|
860 |
+
return $this->_render_data;
|
861 |
+
}
|
862 |
+
|
863 |
+
|
864 |
+
public function returnGoogleChartData()
|
865 |
+
{
|
866 |
+
$this->prepareData();
|
867 |
+
$this->shiftStringColumnUp();
|
868 |
+
return $this->_render_data;
|
869 |
+
}
|
870 |
+
|
871 |
+
|
872 |
+
public function returnData()
|
873 |
+
{
|
874 |
+
return $this->returnGoogleChartData();
|
875 |
+
}
|
876 |
+
|
877 |
+
|
878 |
+
/**
|
879 |
+
* Saves the chart data to DB
|
880 |
+
* @global WPDB $wpdb
|
881 |
+
*/
|
882 |
+
public function save()
|
883 |
+
{
|
884 |
+
global $wpdb;
|
885 |
+
|
886 |
+
$this->prepareSeriesData();
|
887 |
+
$this->shiftStringColumnUp();
|
888 |
+
|
889 |
+
|
890 |
+
$render_data = array(
|
891 |
+
'selected_columns' => $this->getSelectedColumns(),
|
892 |
+
'range_type' => $this->getRangeType(),
|
893 |
+
'row_range' => $this->getRowRange(),
|
894 |
+
'render_data' => $this->_render_data,
|
895 |
+
'show_grid' => $this->_show_grid,
|
896 |
+
'show_title' => $this->_show_title
|
897 |
+
);
|
898 |
+
|
899 |
+
|
900 |
+
if (empty($this->_id)) {
|
901 |
+
// This is a new chart
|
902 |
+
|
903 |
+
$wpdb->insert(
|
904 |
+
$wpdb->prefix . "wpdatacharts",
|
905 |
+
array(
|
906 |
+
'wpdatatable_id' => $this->_wpdatatable_id,
|
907 |
+
'title' => $this->_title,
|
908 |
+
'engine' => $this->_engine,
|
909 |
+
'type' => $this->_type,
|
910 |
+
'json_render_data' => json_encode($render_data)
|
911 |
+
)
|
912 |
+
);
|
913 |
+
|
914 |
+
$this->_id = $wpdb->insert_id;
|
915 |
+
|
916 |
+
} else {
|
917 |
+
// Updating the chart
|
918 |
+
$wpdb->update(
|
919 |
+
$wpdb->prefix . "wpdatacharts",
|
920 |
+
array(
|
921 |
+
'wpdatatable_id' => $this->_wpdatatable_id,
|
922 |
+
'title' => $this->_title,
|
923 |
+
'engine' => $this->_engine,
|
924 |
+
'type' => $this->_type,
|
925 |
+
'json_render_data' => json_encode($render_data)
|
926 |
+
),
|
927 |
+
array(
|
928 |
+
'id' => $this->_id
|
929 |
+
)
|
930 |
+
);
|
931 |
+
|
932 |
+
}
|
933 |
+
|
934 |
+
}
|
935 |
+
|
936 |
+
public function getColumnIndexes()
|
937 |
+
{
|
938 |
+
foreach ($this->getSelectedColumns() as $columnKey) {
|
939 |
+
$this->_render_data['column_indexes'][] = $this->_wpdatatable->getColumnHeaderOffset($columnKey);
|
940 |
+
}
|
941 |
+
}
|
942 |
+
|
943 |
+
/**
|
944 |
+
* Return the shortcode
|
945 |
+
*/
|
946 |
+
public function getShortCode()
|
947 |
+
{
|
948 |
+
if (!empty($this->_id)) {
|
949 |
+
return '[wpdatachart id=' . $this->_id . ']';
|
950 |
+
} else {
|
951 |
+
return '';
|
952 |
+
}
|
953 |
+
}
|
954 |
+
|
955 |
+
/**
|
956 |
+
* Load from DB
|
957 |
+
* @return bool
|
958 |
+
*/
|
959 |
+
public function loadFromDB()
|
960 |
+
{
|
961 |
+
global $wpdb;
|
962 |
+
|
963 |
+
if (empty($this->_id)) {
|
964 |
+
return false;
|
965 |
+
}
|
966 |
+
|
967 |
+
// Load json data from DB
|
968 |
+
$chartQuery = $wpdb->prepare(
|
969 |
+
"SELECT *
|
970 |
+
FROM " . $wpdb->prefix . "wpdatacharts
|
971 |
+
WHERE id = %d",
|
972 |
+
$this->_id
|
973 |
+
);
|
974 |
+
$chartData = $wpdb->get_row($chartQuery);
|
975 |
+
|
976 |
+
if ($chartData === null) {
|
977 |
+
return false;
|
978 |
+
}
|
979 |
+
|
980 |
+
$renderData = json_decode($chartData->json_render_data, true);
|
981 |
+
$this->_render_data = $renderData['render_data'];
|
982 |
+
|
983 |
+
$this->setTitle($chartData->title);
|
984 |
+
$this->setEngine($chartData->engine);
|
985 |
+
$this->setwpDataTableId($chartData->wpdatatable_id);
|
986 |
+
$this->setType($chartData->type);
|
987 |
+
$this->setSelectedColumns($renderData['selected_columns']);
|
988 |
+
$this->setRangeType($renderData['range_type']);
|
989 |
+
$this->setRowRange($renderData['row_range']);
|
990 |
+
$this->setShowGrid(isset($renderData['show_grid']) ? $renderData['show_grid'] : false);
|
991 |
+
$this->setShowTitle(isset($renderData['show_title']) ? $renderData['show_title'] : false);
|
992 |
+
if (!empty($renderData['render_data']['options']['width'])) {
|
993 |
+
$this->setWidth($renderData['render_data']['options']['width']);
|
994 |
+
}
|
995 |
+
$this->setHeight($renderData['render_data']['options']['height']);
|
996 |
+
|
997 |
+
|
998 |
+
// Chart
|
999 |
+
$this->setBackgroundColor(isset($renderData['render_data']['options']['backgroundColor']['fill']) ? $renderData['render_data']['options']['backgroundColor']['fill'] : '');
|
1000 |
+
$this->setBorderWidth(isset($renderData['render_data']['options']['backgroundColor']['strokeWidth']));
|
1001 |
+
$this->setBorderColor(isset($renderData['render_data']['options']['backgroundColor']['stroke']));
|
1002 |
+
$this->setBorderRadius(isset($renderData['render_data']['options']['backgroundColor']['rx']));
|
1003 |
+
$this->setPlotBackgroundColor(isset($renderData['render_data']['options']['chartArea']['backgroundColor']['fill']));
|
1004 |
+
$this->setPlotBorderWidth(isset($renderData['render_data']['options']['chartArea']['backgroundColor']['strokeWidth']));
|
1005 |
+
$this->setPlotBorderColor(isset($renderData['render_data']['options']['chartArea']['backgroundColor']['stroke']) ? $renderData['render_data']['options']['chartArea']['backgroundColor']['stroke'] : '');
|
1006 |
+
|
1007 |
+
|
1008 |
+
// Title
|
1009 |
+
if ($this->isTitleFloating()) {
|
1010 |
+
$renderData['render_data']['options']['titlePosition'] = 'in';
|
1011 |
+
} else {
|
1012 |
+
$renderData['render_data']['options']['titlePosition'] = 'out';
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
|
1016 |
+
// Legend
|
1017 |
+
$this->setLegendPosition(isset($renderData['render_data']['options']['legend']['position']));
|
1018 |
+
$this->setLegendVerticalAlign(isset($renderData['render_data']['options']['legend']['alignment']));
|
1019 |
+
|
1020 |
+
|
1021 |
+
$this->loadChildWPDataTable();
|
1022 |
+
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
/**
|
1026 |
+
* Render Chart
|
1027 |
+
*/
|
1028 |
+
public function renderChart()
|
1029 |
+
{
|
1030 |
+
$minified_js = get_option('wdtMinifiedJs');
|
1031 |
+
|
1032 |
+
$this->prepareData();
|
1033 |
+
|
1034 |
+
$this->shiftStringColumnUp();
|
1035 |
+
|
1036 |
+
$js_ext = $minified_js ? '.min.js' : '.js';
|
1037 |
+
|
1038 |
+
wp_enqueue_script('wpdatatables-render-chart', WDT_JS_PATH . 'wpdatatables/wdt.chartsRender' . $js_ext, array(), WDT_CURRENT_VERSION);
|
1039 |
+
|
1040 |
+
|
1041 |
+
wp_enqueue_script('wdt_google_charts', '//www.gstatic.com/charts/loader.js', array(), WDT_CURRENT_VERSION);
|
1042 |
+
wp_enqueue_script('wpdatatables-google-chart', WDT_JS_PATH . 'wpdatatables/wdt.googleCharts' . $js_ext, array(), WDT_CURRENT_VERSION);
|
1043 |
+
$json_chart_render_data = json_encode($this->_render_data);
|
1044 |
+
|
1045 |
+
|
1046 |
+
$chart_id = $this->_id;
|
1047 |
+
ob_start();
|
1048 |
+
include(WDT_TEMPLATE_PATH . 'wpdatachart.inc.php');
|
1049 |
+
$chart_html = ob_get_contents();
|
1050 |
+
ob_end_clean();
|
1051 |
+
return $chart_html;
|
1052 |
+
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
/**
|
1056 |
+
* Return render data
|
1057 |
+
*/
|
1058 |
+
public function getRenderData()
|
1059 |
+
{
|
1060 |
+
return $this->_render_data;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
|
1064 |
+
/**
|
1065 |
+
* Delete chart by ID
|
1066 |
+
* @param $chartId
|
1067 |
+
* @return bool
|
1068 |
+
*/
|
1069 |
+
public static function deleteChart($chartId)
|
1070 |
+
{
|
1071 |
+
global $wpdb;
|
1072 |
+
|
1073 |
+
if (!isset($_REQUEST['wdtNonce']) || empty($chartId) || !current_user_can('manage_options') || !wp_verify_nonce($_REQUEST['wdtNonce'], 'wdtDeleteChartNonce')) {
|
1074 |
+
return false;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
$wpdb->delete(
|
1078 |
+
$wpdb->prefix . "wpdatacharts",
|
1079 |
+
array(
|
1080 |
+
'id' => (int)$chartId
|
1081 |
+
)
|
1082 |
+
);
|
1083 |
+
|
1084 |
+
return true;
|
1085 |
+
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
/**
|
1089 |
+
* Get all charts non-paged for the MCE editor
|
1090 |
+
* @return array|null|object
|
1091 |
+
*/
|
1092 |
+
public static function getAllCharts()
|
1093 |
+
{
|
1094 |
+
global $wpdb;
|
1095 |
+
$query = "SELECT id, title FROM {$wpdb->prefix}wpdatacharts ";
|
1096 |
+
$allCharts = $wpdb->get_results($query, ARRAY_A);
|
1097 |
+
return $allCharts;
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
?>
|
source/class.wpdatatable.php
CHANGED
@@ -6,7 +6,8 @@ defined('ABSPATH') or die("Cannot access pages directly.");
|
|
6 |
/**
|
7 |
* Main engine of wpDataTables plugin
|
8 |
*/
|
9 |
-
class WPDataTable
|
|
|
10 |
|
11 |
protected static $_columnClass = 'WDTColumn';
|
12 |
protected $_wdtIndexedColumns = array();
|
@@ -76,238 +77,288 @@ class WPDataTable {
|
|
76 |
/**
|
77 |
* @return bool
|
78 |
*/
|
79 |
-
public function isClearFilters()
|
|
|
80 |
return $this->_clearFilters;
|
81 |
}
|
82 |
|
83 |
/**
|
84 |
* @param bool $clearFilters
|
85 |
*/
|
86 |
-
public function setClearFilters($clearFilters)
|
|
|
87 |
$this->_clearFilters = $clearFilters;
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
* @return bool
|
92 |
*/
|
93 |
-
public function isFixedLayout()
|
|
|
94 |
return $this->_fixedLayout;
|
95 |
}
|
96 |
|
97 |
/**
|
98 |
* @param bool $fixedLayout
|
99 |
*/
|
100 |
-
public function setFixedLayout($fixedLayout)
|
|
|
101 |
$this->_fixedLayout = $fixedLayout;
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
* @return bool
|
106 |
*/
|
107 |
-
public function isWordWrap()
|
|
|
108 |
return $this->_wordWrap;
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
* @param bool $wordWrap
|
113 |
*/
|
114 |
-
public function setWordWrap($wordWrap)
|
|
|
115 |
$this->_wordWrap = $wordWrap;
|
116 |
}
|
117 |
|
118 |
/**
|
119 |
* @return bool
|
120 |
*/
|
121 |
-
public function isAjaxReturn()
|
|
|
122 |
return $this->_ajaxReturn;
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
* @param bool $ajaxReturn
|
127 |
*/
|
128 |
-
public function setAjaxReturn($ajaxReturn)
|
|
|
129 |
$this->_ajaxReturn = $ajaxReturn;
|
130 |
}
|
131 |
|
132 |
-
public function setNoData($no_data)
|
|
|
133 |
$this->_no_data = $no_data;
|
134 |
}
|
135 |
|
136 |
-
public function getNoData()
|
|
|
137 |
return $this->_no_data;
|
138 |
}
|
139 |
|
140 |
-
public function getId()
|
|
|
141 |
return $this->_id;
|
142 |
}
|
143 |
|
144 |
-
public function setId($id)
|
|
|
145 |
$this->_id = $id;
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
* @return string
|
150 |
*/
|
151 |
-
public function getTableContent()
|
|
|
152 |
return $this->_tableContent;
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
* @param string $tableContent
|
157 |
*/
|
158 |
-
public function setTableContent($tableContent)
|
|
|
159 |
$this->_tableContent = $tableContent;
|
160 |
}
|
161 |
|
162 |
/**
|
163 |
* @return string
|
164 |
*/
|
165 |
-
public function getTableType()
|
|
|
166 |
return $this->_tableType;
|
167 |
}
|
168 |
|
169 |
/**
|
170 |
* @param string $tableType
|
171 |
*/
|
172 |
-
public function setTableType($tableType)
|
|
|
173 |
$this->_tableType = $tableType;
|
174 |
}
|
175 |
|
176 |
-
public function setDefaultSearchValue($value)
|
|
|
177 |
if (!empty($value)) {
|
178 |
$this->_defaultSearchValue = urlencode($value);
|
179 |
}
|
180 |
}
|
181 |
|
182 |
-
public function getDefaultSearchValue()
|
|
|
183 |
return urldecode($this->_defaultSearchValue);
|
184 |
}
|
185 |
|
186 |
-
public function sortEnabled()
|
|
|
187 |
return $this->_wdtTableSort;
|
188 |
}
|
189 |
|
190 |
-
public function sortEnable()
|
|
|
191 |
$this->_wdtTableSort = true;
|
192 |
}
|
193 |
|
194 |
-
public function sortDisable()
|
|
|
195 |
$this->_wdtTableSort = false;
|
196 |
}
|
197 |
|
198 |
-
public function addSumColumn($columnKey)
|
|
|
199 |
$this->_sumColumns[] = $columnKey;
|
200 |
}
|
201 |
|
202 |
-
public function setSumColumns($sumColumns)
|
|
|
203 |
$this->_sumColumns = $sumColumns;
|
204 |
}
|
205 |
|
206 |
-
public function getSumColumns()
|
|
|
207 |
return $this->_sumColumns;
|
208 |
}
|
209 |
|
210 |
-
public function addAvgColumn($columnKey)
|
|
|
211 |
$this->_avgColumns[] = $columnKey;
|
212 |
}
|
213 |
|
214 |
-
public function setAvgColumns($avgColumns)
|
|
|
215 |
$this->_avgColumns = $avgColumns;
|
216 |
}
|
217 |
|
218 |
-
public function getAvgColumns()
|
|
|
219 |
return $this->_avgColumns;
|
220 |
}
|
221 |
|
222 |
-
public function addMinColumn($columnKey)
|
|
|
223 |
$this->_minColumns[] = $columnKey;
|
224 |
}
|
225 |
|
226 |
-
public function setMinColumns($minColumns)
|
|
|
227 |
$this->_minColumns = $minColumns;
|
228 |
}
|
229 |
|
230 |
-
public function getMinColumns()
|
|
|
231 |
return $this->_minColumns;
|
232 |
}
|
233 |
|
234 |
-
public function addMaxColumn($columnKey)
|
|
|
235 |
$this->_maxColumns[] = $columnKey;
|
236 |
}
|
237 |
|
238 |
-
public function setMaxColumns($maxColumns)
|
|
|
239 |
$this->_maxColumns = $maxColumns;
|
240 |
}
|
241 |
|
242 |
-
public function getMaxColumns()
|
|
|
243 |
return $this->_maxColumns;
|
244 |
}
|
245 |
|
246 |
-
public function addSumFooterColumn($columnKey)
|
|
|
247 |
$this->_sumFooterColumns[] = $columnKey;
|
248 |
}
|
249 |
|
250 |
-
public function setSumFooterColumns($sumColumns)
|
|
|
251 |
$this->_sumFooterColumns = $sumColumns;
|
252 |
}
|
253 |
|
254 |
-
public function getSumFooterColumns()
|
|
|
255 |
return $this->_sumFooterColumns;
|
256 |
}
|
257 |
|
258 |
-
public function addAvgFooterColumn($columnKey)
|
|
|
259 |
$this->_avgFooterColumns[] = $columnKey;
|
260 |
}
|
261 |
|
262 |
-
public function setAvgFooterColumns($avgColumns)
|
|
|
263 |
$this->_avgFooterColumns = $avgColumns;
|
264 |
}
|
265 |
|
266 |
-
public function getAvgFooterColumns()
|
|
|
267 |
return $this->_avgFooterColumns;
|
268 |
}
|
269 |
|
270 |
-
public function addMinFooterColumn($columnKey)
|
|
|
271 |
$this->_minFooterColumns[] = $columnKey;
|
272 |
}
|
273 |
|
274 |
-
public function setMinFooterColumns($minColumns)
|
|
|
275 |
$this->_minFooterColumns = $minColumns;
|
276 |
}
|
277 |
|
278 |
-
public function getMinFooterColumns()
|
|
|
279 |
return $this->_minFooterColumns;
|
280 |
}
|
281 |
|
282 |
-
public function addMaxFooterColumn($columnKey)
|
|
|
283 |
$this->_maxFooterColumns[] = $columnKey;
|
284 |
}
|
285 |
|
286 |
-
public function setMaxFooterColumns($maxColumns)
|
|
|
287 |
$this->_maxFooterColumns = $maxColumns;
|
288 |
}
|
289 |
|
290 |
-
public function getMaxFooterColumns()
|
|
|
291 |
return $this->_maxFooterColumns;
|
292 |
}
|
293 |
|
294 |
-
public function addColumnsDecimalPlaces($columnKey, $decimalPlaces)
|
|
|
295 |
$this->_columnsDecimalPlaces[$columnKey] = $decimalPlaces;
|
296 |
}
|
297 |
|
298 |
-
public function addColumnsThousandsSeparator($columnKey, $thousandsSeparator)
|
|
|
299 |
$this->_columnsThousandsSeparator[$columnKey] = $thousandsSeparator;
|
300 |
}
|
301 |
|
302 |
-
public function getColumnsCSS()
|
|
|
303 |
return $this->_columnsCSS;
|
304 |
}
|
305 |
|
306 |
-
public function setColumnsCss($css)
|
|
|
307 |
$this->_columnsCSS = $css;
|
308 |
}
|
309 |
|
310 |
-
public function reorderColumns($posArray)
|
|
|
311 |
if (!is_array($posArray)) {
|
312 |
throw new WDTException('Invalid position data provided!');
|
313 |
}
|
@@ -322,45 +373,55 @@ class WPDataTable {
|
|
322 |
$this->_wdtNamedColumns = $resultByKeys;
|
323 |
}
|
324 |
|
325 |
-
public function getWpId()
|
|
|
326 |
return $this->_wpId;
|
327 |
}
|
328 |
|
329 |
-
public function setWpId($wpId)
|
|
|
330 |
$this->_wpId = $wpId;
|
331 |
}
|
332 |
|
333 |
-
public function getCssClassesArr()
|
|
|
334 |
$classesStr = $this->_cssClassArray;
|
335 |
$classesStr = apply_filters('wpdatatables_filter_table_cssClassArray', $classesStr, $this->getWpId());
|
336 |
return $classesStr;
|
337 |
}
|
338 |
|
339 |
-
public function getCSSClasses()
|
|
|
340 |
return implode(' ', $this->_cssClassArray);
|
341 |
}
|
342 |
|
343 |
-
public function addCSSClass($cssClass)
|
|
|
344 |
$this->_cssClassArray[] = $cssClass;
|
345 |
}
|
346 |
|
347 |
-
public function getCSSStyle()
|
|
|
348 |
return $this->_style;
|
349 |
}
|
350 |
|
351 |
-
public function setCSSStyle($style)
|
|
|
352 |
$this->_style = $style;
|
353 |
}
|
354 |
|
355 |
-
public function setTitle($title)
|
|
|
356 |
$this->_title = $title;
|
357 |
}
|
358 |
|
359 |
-
public function getName()
|
|
|
360 |
return $this->_title;
|
361 |
}
|
362 |
|
363 |
-
public function setScrollable($scrollable)
|
|
|
364 |
if ($scrollable) {
|
365 |
$this->_scrollable = true;
|
366 |
} else {
|
@@ -368,11 +429,13 @@ class WPDataTable {
|
|
368 |
}
|
369 |
}
|
370 |
|
371 |
-
public function isScrollable()
|
|
|
372 |
return $this->_scrollable;
|
373 |
}
|
374 |
|
375 |
-
public function setInterfaceLanguage($lang)
|
|
|
376 |
if (empty($lang)) {
|
377 |
throw new WDTException('Incorrect language parameter!');
|
378 |
}
|
@@ -382,47 +445,58 @@ class WPDataTable {
|
|
382 |
$this->_interfaceLanguage = WDT_ROOT_PATH . 'source/lang/' . $lang;
|
383 |
}
|
384 |
|
385 |
-
public function getInterfaceLanguage()
|
|
|
386 |
return $this->_interfaceLanguage;
|
387 |
}
|
388 |
|
389 |
-
public function setAutoRefresh($refresh_interval)
|
|
|
390 |
$this->_autoRefreshInterval = (int)$refresh_interval;
|
391 |
}
|
392 |
|
393 |
-
public function getRefreshInterval()
|
|
|
394 |
return (int)$this->_autoRefreshInterval;
|
395 |
}
|
396 |
|
397 |
-
public function paginationEnabled()
|
|
|
398 |
return $this->_pagination;
|
399 |
}
|
400 |
|
401 |
-
public function enablePagination()
|
|
|
402 |
$this->_pagination = true;
|
403 |
}
|
404 |
|
405 |
-
public function disablePagination()
|
|
|
406 |
$this->_pagination = false;
|
407 |
}
|
408 |
|
409 |
-
public function enableTT()
|
|
|
410 |
$this->_showTT = true;
|
411 |
}
|
412 |
|
413 |
-
public function disableTT()
|
|
|
414 |
$this->_showTT = false;
|
415 |
}
|
416 |
|
417 |
-
public function TTEnabled()
|
|
|
418 |
return $this->_showTT;
|
419 |
}
|
420 |
|
421 |
-
public function hideToolbar()
|
|
|
422 |
$this->_toolbar = false;
|
423 |
}
|
424 |
|
425 |
-
public function setDefaultSortColumn($key)
|
|
|
426 |
if (!isset($this->_wdtIndexedColumns[$key])
|
427 |
&& !isset($this->_wdtNamedColumns[$key])
|
428 |
) {
|
@@ -435,11 +509,13 @@ class WPDataTable {
|
|
435 |
$this->_defaultSortColumn = $key;
|
436 |
}
|
437 |
|
438 |
-
public function getDefaultSortColumn()
|
|
|
439 |
return $this->_defaultSortColumn;
|
440 |
}
|
441 |
|
442 |
-
public function setDefaultSortDirection($direction)
|
|
|
443 |
if (
|
444 |
!in_array(
|
445 |
$direction,
|
@@ -454,86 +530,101 @@ class WPDataTable {
|
|
454 |
$this->_defaultSortDirection = $direction;
|
455 |
}
|
456 |
|
457 |
-
public function getDefaultSortDirection()
|
|
|
458 |
return $this->_defaultSortDirection;
|
459 |
}
|
460 |
|
461 |
-
public function hideBeforeLoad()
|
|
|
462 |
$this->setCSSStyle('display: none; ');
|
463 |
$this->_hide_before_load = true;
|
464 |
}
|
465 |
|
466 |
-
public function showBeforeLoad()
|
|
|
467 |
$this->_hide_before_load = false;
|
468 |
}
|
469 |
|
470 |
-
public function doHideBeforeLoad()
|
|
|
471 |
return $this->_hide_before_load;
|
472 |
}
|
473 |
|
474 |
-
public function getDisplayLength()
|
|
|
475 |
return $this->_lengthDisplay;
|
476 |
}
|
477 |
|
478 |
-
public function setDisplayLength($length)
|
|
|
479 |
if (!in_array($length, array(1, 5, 10, 20, 25, 30, 50, 100, 200, -1))) {
|
480 |
return false;
|
481 |
}
|
482 |
$this->_lengthDisplay = $length;
|
483 |
}
|
484 |
|
485 |
-
public function setIdColumnKey($key)
|
|
|
486 |
$this->_idColumnKey = $key;
|
487 |
}
|
488 |
|
489 |
-
public function getIdColumnKey()
|
|
|
490 |
return $this->_idColumnKey;
|
491 |
}
|
492 |
|
493 |
/**
|
494 |
* @return boolean
|
495 |
*/
|
496 |
-
public function isInfoBlock()
|
|
|
497 |
return $this->_infoBlock;
|
498 |
}
|
499 |
|
500 |
/**
|
501 |
* @param boolean $infoBlock
|
502 |
*/
|
503 |
-
public function setInfoBlock($infoBlock)
|
|
|
504 |
$this->_infoBlock = (bool)$infoBlock;
|
505 |
}
|
506 |
|
507 |
/**
|
508 |
* @return boolean
|
509 |
*/
|
510 |
-
public function isGlobalSearch()
|
|
|
511 |
return $this->_globalSearch;
|
512 |
}
|
513 |
|
514 |
/**
|
515 |
* @param boolean $globalSearch
|
516 |
*/
|
517 |
-
public function setGlobalSearch($globalSearch)
|
|
|
518 |
$this->_globalSearch = (bool)$globalSearch;
|
519 |
}
|
520 |
|
521 |
/**
|
522 |
* @return boolean
|
523 |
*/
|
524 |
-
public function isShowRowsPerPage()
|
|
|
525 |
return $this->_showRowsPerPage;
|
526 |
}
|
527 |
|
528 |
/**
|
529 |
* @param boolean $showRowsPerPage
|
530 |
*/
|
531 |
-
public function setShowRowsPerPage($showRowsPerPage)
|
|
|
532 |
$this->_showRowsPerPage = (bool)$showRowsPerPage;
|
533 |
}
|
534 |
|
535 |
-
public function __construct()
|
536 |
-
|
|
|
537 |
if (self::$wdt_internal_idcount == 0) {
|
538 |
$this->_firstOnPage = true;
|
539 |
}
|
@@ -541,7 +632,8 @@ class WPDataTable {
|
|
541 |
$this->_id = 'table_' . self::$wdt_internal_idcount;
|
542 |
}
|
543 |
|
544 |
-
public function wdtDefineColumnsWidth($widthsArray)
|
|
|
545 |
if (empty($this->_wdtIndexedColumns)) {
|
546 |
throw new WDTException('wpDataTable reports no columns are defined!');
|
547 |
}
|
@@ -563,7 +655,8 @@ class WPDataTable {
|
|
563 |
}
|
564 |
}
|
565 |
|
566 |
-
public function setColumnsPossibleValues($valuesArray)
|
|
|
567 |
if (empty($this->_wdtIndexedColumns)) {
|
568 |
throw new WDTException('No columns in the table!');
|
569 |
}
|
@@ -587,7 +680,8 @@ class WPDataTable {
|
|
587 |
}
|
588 |
}
|
589 |
|
590 |
-
public function getHiddenColumnCount()
|
|
|
591 |
$count = 0;
|
592 |
foreach ($this->_wdtIndexedColumns as $dataColumn) {
|
593 |
if (!$dataColumn->isVisible()) {
|
@@ -597,21 +691,24 @@ class WPDataTable {
|
|
597 |
return $count;
|
598 |
}
|
599 |
|
600 |
-
|
601 |
|
602 |
-
public function enableGrouping()
|
|
|
603 |
$this->_groupingEnabled = true;
|
604 |
}
|
605 |
|
606 |
-
public function disableGrouping()
|
|
|
607 |
$this->_groupingEnabled = false;
|
608 |
}
|
609 |
|
610 |
-
public function groupingEnabled()
|
|
|
611 |
return $this->_groupingEnabled;
|
612 |
}
|
613 |
|
614 |
-
public function groupByColumn($key)
|
|
|
615 |
if (!isset($this->_wdtIndexedColumns[$key])
|
616 |
&& !isset($this->_wdtNamedColumns[$key])
|
617 |
) {
|
@@ -632,58 +729,71 @@ class WPDataTable {
|
|
632 |
/**
|
633 |
* Returns the index of grouping column
|
634 |
*/
|
635 |
-
public function groupingColumnIndex()
|
|
|
636 |
return $this->_wdtColumnGroupIndex;
|
637 |
}
|
638 |
|
639 |
/**
|
640 |
* Returns the grouping column index
|
641 |
*/
|
642 |
-
public function groupingColumn()
|
|
|
643 |
return $this->_wdtColumnGroupIndex;
|
644 |
}
|
645 |
|
646 |
-
public function countColumns()
|
|
|
647 |
return count($this->_wdtIndexedColumns);
|
648 |
}
|
649 |
|
650 |
-
public function getColumnKeys()
|
|
|
651 |
return array_keys($this->_wdtNamedColumns);
|
652 |
}
|
653 |
|
654 |
-
public function setOnlyOwnRows($ownRows)
|
|
|
655 |
$this->_onlyOwnRows = (bool)$ownRows;
|
656 |
}
|
657 |
|
658 |
-
public function getOnlyOwnRows()
|
|
|
659 |
return $this->_onlyOwnRows;
|
660 |
}
|
661 |
|
662 |
-
public function setUserIdColumn($column)
|
|
|
663 |
$this->_userIdColumn = $column;
|
664 |
}
|
665 |
|
666 |
-
public function getUserIdColumn()
|
|
|
667 |
return $this->_userIdColumn;
|
668 |
}
|
669 |
|
670 |
-
public function getColumns()
|
|
|
671 |
return $this->_wdtIndexedColumns;
|
672 |
}
|
673 |
|
674 |
-
public function getColumnsByHeaders()
|
|
|
675 |
return $this->_wdtNamedColumns;
|
676 |
}
|
677 |
|
678 |
-
public function addConditionalFormattingColumn($column)
|
|
|
679 |
$this->_conditionalFormattingColumns[] = $column;
|
680 |
}
|
681 |
|
682 |
-
public function getConditionalFormattingColumns()
|
|
|
683 |
return $this->_conditionalFormattingColumns;
|
684 |
}
|
685 |
|
686 |
-
public function createColumnsFromArr($headerArr, $wdtParameters, $wdtColumnTypes)
|
|
|
687 |
foreach ($headerArr as $key) {
|
688 |
$dataColumnProperties = array();
|
689 |
$dataColumnProperties['title'] = isset($wdtParameters['columnTitles'][$key]) ? $wdtParameters['columnTitles'][$key] : $key;
|
@@ -737,7 +847,8 @@ class WPDataTable {
|
|
737 |
|
738 |
}
|
739 |
|
740 |
-
public function getColumnHeaderOffset($key)
|
|
|
741 |
$keys = $this->getColumnKeys();
|
742 |
if (!empty($key) && in_array($key, $keys)) {
|
743 |
return array_search($key, $keys);
|
@@ -746,7 +857,8 @@ class WPDataTable {
|
|
746 |
}
|
747 |
}
|
748 |
|
749 |
-
public function getColumnDefinitions()
|
|
|
750 |
$defs = array();
|
751 |
foreach ($this->_wdtIndexedColumns as $key => &$dataColumn) {
|
752 |
$def = $dataColumn->getColumnJSON($key);
|
@@ -761,7 +873,8 @@ class WPDataTable {
|
|
761 |
*
|
762 |
* @return string
|
763 |
*/
|
764 |
-
public function getColumnFilterDefinitions()
|
|
|
765 |
$columnDefinitions = array();
|
766 |
foreach ($this->_wdtIndexedColumns as $key => $dataColumn) {
|
767 |
|
@@ -782,7 +895,8 @@ class WPDataTable {
|
|
782 |
*
|
783 |
* @return string
|
784 |
*/
|
785 |
-
public function getColumnEditingDefinitions()
|
|
|
786 |
$columnDefinitions = array();
|
787 |
foreach ($this->_wdtIndexedColumns as $key => $dataColumn) {
|
788 |
|
@@ -800,7 +914,8 @@ class WPDataTable {
|
|
800 |
* @param $originalHeader
|
801 |
* @return bool|mixed
|
802 |
*/
|
803 |
-
public function getColumn($originalHeader)
|
|
|
804 |
if (!isset($originalHeader)
|
805 |
|| (!isset($this->_wdtNamedColumns[$originalHeader])
|
806 |
&& !isset($this->_wdtIndexedColumns[$originalHeader]))
|
@@ -821,7 +936,8 @@ class WPDataTable {
|
|
821 |
* @param array $wdtParameters Array of rendering parameters
|
822 |
* @return bool Result of generation
|
823 |
*/
|
824 |
-
public function arrayBasedConstruct($rawDataArr, $wdtParameters)
|
|
|
825 |
|
826 |
if (empty($rawDataArr)) {
|
827 |
if (!isset($wdtParameters['data_types'])) {
|
@@ -837,7 +953,7 @@ class WPDataTable {
|
|
837 |
}
|
838 |
|
839 |
$headerArr = WDTTools::extractHeaders($rawDataArr);
|
840 |
-
|
841 |
if (!empty($wdtParameters['columnTitles'])) {
|
842 |
$headerArr = array_unique(
|
843 |
array_merge(
|
@@ -904,15 +1020,14 @@ class WPDataTable {
|
|
904 |
}
|
905 |
}
|
906 |
|
907 |
-
|
908 |
|
909 |
return true;
|
910 |
|
911 |
}
|
912 |
|
913 |
-
|
914 |
|
915 |
-
public function hideColumn($dataColumnIndex)
|
|
|
916 |
if (!isset($dataColumnIndex)
|
917 |
|| !isset($this->_wdtNamedColumns[$dataColumnIndex])
|
918 |
) {
|
@@ -921,7 +1036,8 @@ class WPDataTable {
|
|
921 |
$this->_wdtNamedColumns[$dataColumnIndex]->setIsVisible(false);
|
922 |
}
|
923 |
|
924 |
-
public function showColumn($dataColumnIndex)
|
|
|
925 |
if (!isset($dataColumnIndex)
|
926 |
|| !isset($this->_wdtNamedColumns[$dataColumnIndex])
|
927 |
) {
|
@@ -931,7 +1047,8 @@ class WPDataTable {
|
|
931 |
}
|
932 |
|
933 |
|
934 |
-
public function getCell($dataColumnIndex, $rowKey)
|
|
|
935 |
if (!isset($dataColumnIndex)
|
936 |
|| !isset($rowKey)
|
937 |
) {
|
@@ -948,7 +1065,8 @@ class WPDataTable {
|
|
948 |
return $this->_dataRows[$rowKey][$dataColumnIndex];
|
949 |
}
|
950 |
|
951 |
-
public function returnCellValue($cellContent, $wdtColumnIndex)
|
|
|
952 |
if (!isset($wdtColumnIndex)) {
|
953 |
throw new WDTException('Column index not provided!');
|
954 |
}
|
@@ -958,11 +1076,13 @@ class WPDataTable {
|
|
958 |
return $this->_wdtNamedColumns[$wdtColumnIndex]->returnCellValue($cellContent);
|
959 |
}
|
960 |
|
961 |
-
public function getDataRows()
|
|
|
962 |
return $this->_dataRows;
|
963 |
}
|
964 |
|
965 |
-
public function getDataRowsFormatted()
|
|
|
966 |
$dataRowsFormatted = array();
|
967 |
foreach ($this->_dataRows as $dataRow) {
|
968 |
$formattedRow = array();
|
@@ -974,7 +1094,8 @@ class WPDataTable {
|
|
974 |
return $dataRowsFormatted;
|
975 |
}
|
976 |
|
977 |
-
public function getRow($index)
|
|
|
978 |
if (!isset($index) || !isset($this->_dataRows[$index])) {
|
979 |
throw new WDTException('Invalid row index!');
|
980 |
}
|
@@ -983,7 +1104,8 @@ class WPDataTable {
|
|
983 |
return $rowArray;
|
984 |
}
|
985 |
|
986 |
-
public function addDataColumn(&$dataColumn)
|
|
|
987 |
if (!($dataColumn instanceof WDTColumn)) {
|
988 |
throw new WDTException('Please provide a wpDataTable column.');
|
989 |
}
|
@@ -992,7 +1114,8 @@ class WPDataTable {
|
|
992 |
return true;
|
993 |
}
|
994 |
|
995 |
-
public function addColumns(&$dataColumns)
|
|
|
996 |
if (!is_array($dataColumns)) {
|
997 |
throw new WDTException('Please provide an array of wpDataTable column objects.');
|
998 |
}
|
@@ -1009,7 +1132,8 @@ class WPDataTable {
|
|
1009 |
* @param $function
|
1010 |
* @return float|int
|
1011 |
*/
|
1012 |
-
public function calcColumnFunction($columnKey, $function)
|
|
|
1013 |
$result = null;
|
1014 |
if ($function == 'sum' || $function == 'avg') {
|
1015 |
foreach ($this->getDataRows() as $wdtRowDataArr) {
|
@@ -1046,7 +1170,8 @@ class WPDataTable {
|
|
1046 |
/**
|
1047 |
* Helper method to generate values for SUM, MIN, MAX, AVG
|
1048 |
*/
|
1049 |
-
private function calcColumnsAggregateFuncs()
|
|
|
1050 |
if (empty($this->_aggregateFuncsRes)) {
|
1051 |
$this->_aggregateFuncsRes = array(
|
1052 |
'sum' => array(),
|
@@ -1130,33 +1255,36 @@ class WPDataTable {
|
|
1130 |
* @param $function
|
1131 |
* @return mixed
|
1132 |
*/
|
1133 |
-
public function getColumnsAggregateFuncsResult($columnKey, $function)
|
|
|
1134 |
if (!isset($this->_aggregateFuncsRes[$function][$columnKey])) {
|
1135 |
$this->calcColumnsAggregateFuncs();
|
1136 |
}
|
1137 |
return $this->_aggregateFuncsRes[$function][$columnKey];
|
1138 |
}
|
1139 |
|
1140 |
-
|
1141 |
|
1142 |
/**
|
1143 |
* Formatting row data structure for ajax display table
|
1144 |
* @param $row - key => value pairs as column name and cell value of a row
|
1145 |
* @return array
|
1146 |
*/
|
1147 |
-
protected function formatAjaxQueryResultRow($row)
|
|
|
1148 |
return array_values($row);
|
1149 |
}
|
1150 |
|
1151 |
|
1152 |
-
public function jsonBasedConstruct($json, $wdtParameters = array())
|
|
|
1153 |
$json = WDTTools::applyPlaceholders($json);
|
1154 |
$json = WDTTools::curlGetData($json);
|
1155 |
$json = apply_filters('wpdatatables_filter_json', $json, $this->getWpId());
|
1156 |
return $this->arrayBasedConstruct(json_decode($json, true), $wdtParameters);
|
1157 |
}
|
1158 |
|
1159 |
-
public function XMLBasedConstruct($xml, $wdtParameters = array())
|
|
|
1160 |
if (!$xml) {
|
1161 |
throw new WDTException('File you provided cannot be found.');
|
1162 |
}
|
@@ -1175,7 +1303,8 @@ class WPDataTable {
|
|
1175 |
return $this->arrayBasedConstruct($XMLArray, $wdtParameters);
|
1176 |
}
|
1177 |
|
1178 |
-
public function excelBasedConstruct($xls_url, $wdtParameters = array())
|
|
|
1179 |
ini_set('memory_limit', '2048M');
|
1180 |
if (!$xls_url) {
|
1181 |
throw new WDTException('Excel file not found!');
|
@@ -1245,7 +1374,8 @@ class WPDataTable {
|
|
1245 |
/**
|
1246 |
* Helper method that renders the modal
|
1247 |
*/
|
1248 |
-
public static function renderModal()
|
|
|
1249 |
include_once WDT_TEMPLATE_PATH . 'frontend/modal.inc.php';
|
1250 |
include_once WDT_TEMPLATE_PATH . 'common/delete_modal.inc.php';
|
1251 |
}
|
@@ -1254,7 +1384,8 @@ class WPDataTable {
|
|
1254 |
* Generates table HTML
|
1255 |
* @return string
|
1256 |
*/
|
1257 |
-
public function generateTable()
|
|
|
1258 |
/** @noinspection PhpUnusedLocalVariableInspection */
|
1259 |
$tableContent = $this->renderWithJSAndStyles();
|
1260 |
|
@@ -1288,7 +1419,6 @@ class WPDataTable {
|
|
1288 |
}
|
1289 |
$returnData .= "</style>\n";
|
1290 |
|
1291 |
-
|
1292 |
|
1293 |
return $returnData;
|
1294 |
}
|
@@ -1298,7 +1428,8 @@ class WPDataTable {
|
|
1298 |
* enqueue all necessary JS and CSS files
|
1299 |
* @return string
|
1300 |
*/
|
1301 |
-
protected function renderWithJSAndStyles()
|
|
|
1302 |
|
1303 |
$this->enqueueJSAndStyles();
|
1304 |
|
@@ -1326,7 +1457,8 @@ class WPDataTable {
|
|
1326 |
/**
|
1327 |
* Function that enqueue all necessary JS and CSS files for wpDataTable
|
1328 |
*/
|
1329 |
-
protected function enqueueJSAndStyles()
|
|
|
1330 |
|
1331 |
WDTTools::wdtUIKitEnqueue();
|
1332 |
|
@@ -1339,19 +1471,16 @@ class WPDataTable {
|
|
1339 |
wp_enqueue_style('wdt-wpdatatables', WDT_CSS_PATH . 'wpdatatables.min.css');
|
1340 |
wp_enqueue_style('wdt-table-tools', WDT_CSS_PATH . 'TableTools.css');
|
1341 |
|
1342 |
-
|
1343 |
|
1344 |
if (WDT_INCLUDE_DATATABLES_CORE) {
|
1345 |
wp_enqueue_script('wdt-datatables', WDT_JS_PATH . 'jquery-datatables/jquery.dataTables.min.js', array(), false, true);
|
1346 |
}
|
1347 |
|
1348 |
-
|
1349 |
|
1350 |
if ($this->groupingEnabled()) {
|
1351 |
wp_enqueue_script('wdt-row-grouping', WDT_JS_PATH . 'jquery-datatables/jquery.dataTables.rowGrouping.js', array('jquery', 'wdt-datatables'), false, true);
|
1352 |
}
|
1353 |
|
1354 |
-
|
1355 |
|
1356 |
wp_enqueue_script('wdt-funcs-js', WDT_JS_PATH . 'wpdatatables/wdt.funcs.js', array('jquery', 'wdt-datatables', 'wdt-common'), false, true);
|
1357 |
wp_enqueue_script('wdt-wpdatatables', WDT_JS_PATH . 'wpdatatables/wpdatatables.js', array('jquery', 'wdt-datatables'), false, true);
|
@@ -1392,7 +1521,6 @@ class WPDataTable {
|
|
1392 |
!empty($this->_tableToolsConfig['pdf']) ? wp_enqueue_script('wdt-pdf-make', WDT_JS_PATH . 'export-tools/pdfmake.min.js', array('jquery'), false, true) : null;
|
1393 |
!empty($this->_tableToolsConfig['pdf']) ? wp_enqueue_script('wdt-vfs-fonts', WDT_JS_PATH . 'export-tools/vfs_fonts.js', array('jquery'), false, true) : null;
|
1394 |
|
1395 |
-
|
1396 |
|
1397 |
wp_localize_script('wdt-common', 'wpdatatables_edit_strings', WDTTools::getTranslationStrings());
|
1398 |
wp_localize_script('wdt-wpdatatables', 'wpdatatables_settings', WDTTools::getDateTimeSettings());
|
@@ -1405,7 +1533,8 @@ class WPDataTable {
|
|
1405 |
* @param $tableData
|
1406 |
* @return array
|
1407 |
*/
|
1408 |
-
public function prepareColumnData($tableData)
|
|
|
1409 |
|
1410 |
$returnArray = array(
|
1411 |
'dateInputFormat' => array(),
|
@@ -1463,17 +1592,16 @@ class WPDataTable {
|
|
1463 |
$returnArray['possibleValuesAddEmpty'][$column->orig_header] = isset($column->possibleValuesAddEmpty) ? $column->possibleValuesAddEmpty : null;
|
1464 |
$returnArray['possibleValuesType'][$column->orig_header] = isset($column->possibleValuesType) ? $column->possibleValuesType : null;
|
1465 |
$returnArray['sorting'][$column->orig_header] = isset($column->sorting) ? $column->sorting : null;
|
1466 |
-
$returnArray['linkTargetAttribute'][$column->orig_header]= isset($column->linkTargetAttribute) ? $column->linkTargetAttribute : null;
|
1467 |
-
$returnArray['linkButtonAttribute'][$column->orig_header]= isset($column->linkButtonAttribute) ? $column->linkButtonAttribute : null;
|
1468 |
-
$returnArray['linkButtonLabel'][$column->orig_header]= isset($column->linkButtonLabel) ? $column->linkButtonLabel : null;
|
1469 |
-
$returnArray['linkButtonClass'][$column->orig_header]= isset($column->linkButtonClass) ? $column->linkButtonClass : null;
|
1470 |
|
1471 |
}
|
1472 |
}
|
1473 |
return $returnArray;
|
1474 |
}
|
1475 |
|
1476 |
-
|
1477 |
|
1478 |
/**
|
1479 |
* Helper method which populates the wpdatatables object with passed in parameters and data (stored in DB)
|
@@ -1481,7 +1609,8 @@ class WPDataTable {
|
|
1481 |
* @param $tableData
|
1482 |
* @param $columnData
|
1483 |
*/
|
1484 |
-
public function fillFromData($tableData, $columnData)
|
|
|
1485 |
if (empty($tableData->table_type)) {
|
1486 |
return;
|
1487 |
}
|
@@ -1539,21 +1668,21 @@ class WPDataTable {
|
|
1539 |
if (isset($columnData['dateInputFormat'])) {
|
1540 |
$params['dateInputFormat'] = $columnData['dateInputFormat'];
|
1541 |
}
|
1542 |
-
if (isset($columnData['linkTargetAttribute'])){
|
1543 |
$params['linkTargetAttribute'] = $columnData['linkTargetAttribute'];
|
1544 |
}
|
1545 |
-
if (isset($columnData['linkButtonAttribute'])){
|
1546 |
$params['linkButtonAttribute'] = $columnData['linkButtonAttribute'];
|
1547 |
}
|
1548 |
-
if (isset($columnData['linkButtonLabel'])){
|
1549 |
$params['linkButtonLabel'] = $columnData['linkButtonLabel'];
|
1550 |
}
|
1551 |
-
if (isset($columnData['linkButtonClass'])){
|
1552 |
$params['linkButtonClass'] = $columnData['linkButtonClass'];
|
1553 |
}
|
1554 |
|
1555 |
switch ($tableData->table_type) {
|
1556 |
-
|
1557 |
case 'xls':
|
1558 |
case 'csv':
|
1559 |
$this->excelBasedConstruct(
|
@@ -1582,7 +1711,6 @@ class WPDataTable {
|
|
1582 |
);
|
1583 |
break;
|
1584 |
|
1585 |
-
|
1586 |
|
1587 |
default:
|
1588 |
// Solution for addons
|
@@ -1619,7 +1747,6 @@ class WPDataTable {
|
|
1619 |
$this->setWordWrap(true);
|
1620 |
}
|
1621 |
|
1622 |
-
|
1623 |
|
1624 |
if (!empty($tableData->scrollable)) {
|
1625 |
$this->setScrollable(true);
|
@@ -1681,7 +1808,8 @@ class WPDataTable {
|
|
1681 |
* Helper method that prepares the rendering rules
|
1682 |
* @param array $columnData
|
1683 |
*/
|
1684 |
-
public function prepareRenderingRules($columnData)
|
|
|
1685 |
$columnIndex = 1;
|
1686 |
// Check the search values passed from URL
|
1687 |
if (isset($_GET['wdt_search'])) {
|
@@ -1689,7 +1817,7 @@ class WPDataTable {
|
|
1689 |
}
|
1690 |
|
1691 |
// Define all column-dependent rendering rules
|
1692 |
-
foreach ($columnData as $key
|
1693 |
|
1694 |
$this->column_id = $key;
|
1695 |
// Set filter types
|
@@ -1701,7 +1829,6 @@ class WPDataTable {
|
|
1701 |
$this->getColumn($column->orig_header)->setIsVisible(false);
|
1702 |
}
|
1703 |
|
1704 |
-
|
1705 |
|
1706 |
// if grouping enabled for this column, passing it to table class
|
1707 |
if ($column->groupColumn) {
|
@@ -1741,7 +1868,7 @@ class WPDataTable {
|
|
1741 |
if (sanitize_html_class(strtolower(str_replace(' ', '-', $column->orig_header))) === '') {
|
1742 |
$cssColumnHeader = 'column-' . $this->column_id;
|
1743 |
} else {
|
1744 |
-
$cssColumnHeader = 'column-' . sanitize_html_class(
|
1745 |
}
|
1746 |
if ($column->text_before != '') {
|
1747 |
$this->_columnsCSS .= "\n#{$this->getId()} > tbody > tr > td.{$cssColumnHeader}:not(:empty):before,
|
@@ -1776,8 +1903,9 @@ class WPDataTable {
|
|
1776 |
/**
|
1777 |
* Returns JSON object for table description
|
1778 |
*/
|
1779 |
-
public function getJsonDescription()
|
1780 |
-
|
|
|
1781 |
global $wdtExportFileName;
|
1782 |
|
1783 |
$obj = new stdClass();
|
@@ -1786,11 +1914,11 @@ class WPDataTable {
|
|
1786 |
$obj->infoBlock = $this->isInfoBlock();
|
1787 |
$obj->globalSearch = $this->isGlobalSearch();
|
1788 |
$obj->showRowsPerPage = $this->isShowRowsPerPage();
|
1789 |
-
|
1790 |
$obj->hideBeforeLoad = $this->doHideBeforeLoad();
|
1791 |
$obj->number_format = (int)(get_option('wdtNumberFormat') ? get_option('wdtNumberFormat') : 1);
|
1792 |
$obj->decimalPlaces = (int)(get_option('wdtDecimalPlaces') ? get_option('wdtDecimalPlaces') : 2);
|
1793 |
-
|
1794 |
$obj->spinnerSrc = WDT_ASSETS_PATH . '/img/spinner.gif';
|
1795 |
$obj->groupingEnabled = $this->groupingEnabled();
|
1796 |
if ($this->groupingEnabled()) {
|
@@ -1806,7 +1934,7 @@ class WPDataTable {
|
|
1806 |
$obj->dataTableParams->sDom = "BT<'clear'>{$showRowsPerPage}{$globalSearch}{$scrollable}{$infoBlock}p";
|
1807 |
|
1808 |
$obj->dataTableParams->bSortCellsTop = false;
|
1809 |
-
|
1810 |
if ($this->paginationEnabled()) {
|
1811 |
$obj->dataTableParams->bPaginate = true;
|
1812 |
$obj->dataTableParams->aLengthMenu = json_decode('[[1,5,10,25,50,100,-1],[1,5,10,25,50,100,"' . __('All', 'wpdatatables') . '"]]');
|
@@ -1858,11 +1986,11 @@ class WPDataTable {
|
|
1858 |
}
|
1859 |
|
1860 |
$currentSkin = get_option('wdtBaseSkin');
|
1861 |
-
$skinsWithNewTableToolsButtons = ['aqua','purple','dark'];
|
1862 |
|
1863 |
if ($this->TTEnabled()) {
|
1864 |
(!isset($obj->dataTableParams->buttons)) ? $obj->dataTableParams->buttons = array() : '';
|
1865 |
-
if (in_array($currentSkin, $skinsWithNewTableToolsButtons)){
|
1866 |
|
1867 |
if (!empty($this->_tableToolsConfig['columns'])) {
|
1868 |
$obj->dataTableParams->buttons[] =
|
@@ -2006,18 +2134,15 @@ class WPDataTable {
|
|
2006 |
$obj->dataTableParams->oLanguage->sLengthMenu = __('Showing _MENU_ Entries', 'wpdatatables');
|
2007 |
}
|
2008 |
|
2009 |
-
|
2010 |
|
2011 |
if (!isset($obj->dataTableParams->buttons)) {
|
2012 |
$obj->dataTableParams->buttons = array();
|
2013 |
}
|
2014 |
|
2015 |
-
|
2016 |
|
2017 |
$obj->dataTableParams->sPaginationType = 'full_numbers';
|
2018 |
$obj->columnsFixed = 0;
|
2019 |
|
2020 |
-
|
2021 |
|
2022 |
$init_format = get_option('wdtDateFormat');
|
2023 |
$datepick_format = str_replace('d', 'dd', $init_format);
|
@@ -2041,7 +2166,8 @@ class WPDataTable {
|
|
2041 |
* @param $dataRows
|
2042 |
* @return mixed
|
2043 |
*/
|
2044 |
-
public function joinWithForeignWpDataTable($columnKey, $foreignKeyRule, $dataRows)
|
|
|
2045 |
$joinedTable = WPDataTable::loadWpDataTable($foreignKeyRule->tableId);
|
2046 |
$distinctValues = $joinedTable->getDistinctValuesForColumns($foreignKeyRule);
|
2047 |
foreach ($dataRows as &$dataRow) {
|
@@ -2062,7 +2188,8 @@ class WPDataTable {
|
|
2062 |
* storeColumnId and storeColumnName
|
2063 |
* @return array
|
2064 |
*/
|
2065 |
-
public function getDistinctValuesForColumns($foreignKeyRule)
|
|
|
2066 |
$distinctValues = array();
|
2067 |
$storeColumnName = $foreignKeyRule->storeColumnName;
|
2068 |
$displayColumnName = $foreignKeyRule->displayColumnName;
|
@@ -2103,7 +2230,8 @@ class WPDataTable {
|
|
2103 |
* @param $tableId
|
2104 |
* @return bool
|
2105 |
*/
|
2106 |
-
public static function deleteTable($tableId)
|
|
|
2107 |
global $wpdb;
|
2108 |
|
2109 |
if (!isset($_REQUEST['wdtNonce']) || empty($tableId) || !current_user_can('manage_options') || !wp_verify_nonce($_REQUEST['wdtNonce'], 'wdtDeleteTableNonce')) {
|
@@ -2138,7 +2266,8 @@ class WPDataTable {
|
|
2138 |
* Get all tables
|
2139 |
* @return array|null|object
|
2140 |
*/
|
2141 |
-
public static function getAllTables()
|
|
|
2142 |
global $wpdb;
|
2143 |
$query = "SELECT id, title, table_type, server_side FROM {$wpdb->prefix}wpdatatables ORDER BY id";
|
2144 |
$allTables = $wpdb->get_results($query, ARRAY_A);
|
@@ -2153,7 +2282,8 @@ class WPDataTable {
|
|
2153 |
* @param bool $disableLimit
|
2154 |
* @return WPDataTable|WPExcelDataTable|bool
|
2155 |
*/
|
2156 |
-
public static function loadWpDataTable($tableId, $tableView = null, $disableLimit = false)
|
|
|
2157 |
$tableData = WDTConfigController::loadTableFromDB($tableId);
|
2158 |
|
2159 |
if ($tableData) {
|
6 |
/**
|
7 |
* Main engine of wpDataTables plugin
|
8 |
*/
|
9 |
+
class WPDataTable
|
10 |
+
{
|
11 |
|
12 |
protected static $_columnClass = 'WDTColumn';
|
13 |
protected $_wdtIndexedColumns = array();
|
77 |
/**
|
78 |
* @return bool
|
79 |
*/
|
80 |
+
public function isClearFilters()
|
81 |
+
{
|
82 |
return $this->_clearFilters;
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
* @param bool $clearFilters
|
87 |
*/
|
88 |
+
public function setClearFilters($clearFilters)
|
89 |
+
{
|
90 |
$this->_clearFilters = $clearFilters;
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
* @return bool
|
95 |
*/
|
96 |
+
public function isFixedLayout()
|
97 |
+
{
|
98 |
return $this->_fixedLayout;
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
* @param bool $fixedLayout
|
103 |
*/
|
104 |
+
public function setFixedLayout($fixedLayout)
|
105 |
+
{
|
106 |
$this->_fixedLayout = $fixedLayout;
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
* @return bool
|
111 |
*/
|
112 |
+
public function isWordWrap()
|
113 |
+
{
|
114 |
return $this->_wordWrap;
|
115 |
}
|
116 |
|
117 |
/**
|
118 |
* @param bool $wordWrap
|
119 |
*/
|
120 |
+
public function setWordWrap($wordWrap)
|
121 |
+
{
|
122 |
$this->_wordWrap = $wordWrap;
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
* @return bool
|
127 |
*/
|
128 |
+
public function isAjaxReturn()
|
129 |
+
{
|
130 |
return $this->_ajaxReturn;
|
131 |
}
|
132 |
|
133 |
/**
|
134 |
* @param bool $ajaxReturn
|
135 |
*/
|
136 |
+
public function setAjaxReturn($ajaxReturn)
|
137 |
+
{
|
138 |
$this->_ajaxReturn = $ajaxReturn;
|
139 |
}
|
140 |
|
141 |
+
public function setNoData($no_data)
|
142 |
+
{
|
143 |
$this->_no_data = $no_data;
|
144 |
}
|
145 |
|
146 |
+
public function getNoData()
|
147 |
+
{
|
148 |
return $this->_no_data;
|
149 |
}
|
150 |
|
151 |
+
public function getId()
|
152 |
+
{
|
153 |
return $this->_id;
|
154 |
}
|
155 |
|
156 |
+
public function setId($id)
|
157 |
+
{
|
158 |
$this->_id = $id;
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
* @return string
|
163 |
*/
|
164 |
+
public function getTableContent()
|
165 |
+
{
|
166 |
return $this->_tableContent;
|
167 |
}
|
168 |
|
169 |
/**
|
170 |
* @param string $tableContent
|
171 |
*/
|
172 |
+
public function setTableContent($tableContent)
|
173 |
+
{
|
174 |
$this->_tableContent = $tableContent;
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
* @return string
|
179 |
*/
|
180 |
+
public function getTableType()
|
181 |
+
{
|
182 |
return $this->_tableType;
|
183 |
}
|
184 |
|
185 |
/**
|
186 |
* @param string $tableType
|
187 |
*/
|
188 |
+
public function setTableType($tableType)
|
189 |
+
{
|
190 |
$this->_tableType = $tableType;
|
191 |
}
|
192 |
|
193 |
+
public function setDefaultSearchValue($value)
|
194 |
+
{
|
195 |
if (!empty($value)) {
|
196 |
$this->_defaultSearchValue = urlencode($value);
|
197 |
}
|
198 |
}
|
199 |
|
200 |
+
public function getDefaultSearchValue()
|
201 |
+
{
|
202 |
return urldecode($this->_defaultSearchValue);
|
203 |
}
|
204 |
|
205 |
+
public function sortEnabled()
|
206 |
+
{
|
207 |
return $this->_wdtTableSort;
|
208 |
}
|
209 |
|
210 |
+
public function sortEnable()
|
211 |
+
{
|
212 |
$this->_wdtTableSort = true;
|
213 |
}
|
214 |
|
215 |
+
public function sortDisable()
|
216 |
+
{
|
217 |
$this->_wdtTableSort = false;
|
218 |
}
|
219 |
|
220 |
+
public function addSumColumn($columnKey)
|
221 |
+
{
|
222 |
$this->_sumColumns[] = $columnKey;
|
223 |
}
|
224 |
|
225 |
+
public function setSumColumns($sumColumns)
|
226 |
+
{
|
227 |
$this->_sumColumns = $sumColumns;
|
228 |
}
|
229 |
|
230 |
+
public function getSumColumns()
|
231 |
+
{
|
232 |
return $this->_sumColumns;
|
233 |
}
|
234 |
|
235 |
+
public function addAvgColumn($columnKey)
|
236 |
+
{
|
237 |
$this->_avgColumns[] = $columnKey;
|
238 |
}
|
239 |
|
240 |
+
public function setAvgColumns($avgColumns)
|
241 |
+
{
|
242 |
$this->_avgColumns = $avgColumns;
|
243 |
}
|
244 |
|
245 |
+
public function getAvgColumns()
|
246 |
+
{
|
247 |
return $this->_avgColumns;
|
248 |
}
|
249 |
|
250 |
+
public function addMinColumn($columnKey)
|
251 |
+
{
|
252 |
$this->_minColumns[] = $columnKey;
|
253 |
}
|
254 |
|
255 |
+
public function setMinColumns($minColumns)
|
256 |
+
{
|
257 |
$this->_minColumns = $minColumns;
|
258 |
}
|
259 |
|
260 |
+
public function getMinColumns()
|
261 |
+
{
|
262 |
return $this->_minColumns;
|
263 |
}
|
264 |
|
265 |
+
public function addMaxColumn($columnKey)
|
266 |
+
{
|
267 |
$this->_maxColumns[] = $columnKey;
|
268 |
}
|
269 |
|
270 |
+
public function setMaxColumns($maxColumns)
|
271 |
+
{
|
272 |
$this->_maxColumns = $maxColumns;
|
273 |
}
|
274 |
|
275 |
+
public function getMaxColumns()
|
276 |
+
{
|
277 |
return $this->_maxColumns;
|
278 |
}
|
279 |
|
280 |
+
public function addSumFooterColumn($columnKey)
|
281 |
+
{
|
282 |
$this->_sumFooterColumns[] = $columnKey;
|
283 |
}
|
284 |
|
285 |
+
public function setSumFooterColumns($sumColumns)
|
286 |
+
{
|
287 |
$this->_sumFooterColumns = $sumColumns;
|
288 |
}
|
289 |
|
290 |
+
public function getSumFooterColumns()
|
291 |
+
{
|
292 |
return $this->_sumFooterColumns;
|
293 |
}
|
294 |
|
295 |
+
public function addAvgFooterColumn($columnKey)
|
296 |
+
{
|
297 |
$this->_avgFooterColumns[] = $columnKey;
|
298 |
}
|
299 |
|
300 |
+
public function setAvgFooterColumns($avgColumns)
|
301 |
+
{
|
302 |
$this->_avgFooterColumns = $avgColumns;
|
303 |
}
|
304 |
|
305 |
+
public function getAvgFooterColumns()
|
306 |
+
{
|
307 |
return $this->_avgFooterColumns;
|
308 |
}
|
309 |
|
310 |
+
public function addMinFooterColumn($columnKey)
|
311 |
+
{
|
312 |
$this->_minFooterColumns[] = $columnKey;
|
313 |
}
|
314 |
|
315 |
+
public function setMinFooterColumns($minColumns)
|
316 |
+
{
|
317 |
$this->_minFooterColumns = $minColumns;
|
318 |
}
|
319 |
|
320 |
+
public function getMinFooterColumns()
|
321 |
+
{
|
322 |
return $this->_minFooterColumns;
|
323 |
}
|
324 |
|
325 |
+
public function addMaxFooterColumn($columnKey)
|
326 |
+
{
|
327 |
$this->_maxFooterColumns[] = $columnKey;
|
328 |
}
|
329 |
|
330 |
+
public function setMaxFooterColumns($maxColumns)
|
331 |
+
{
|
332 |
$this->_maxFooterColumns = $maxColumns;
|
333 |
}
|
334 |
|
335 |
+
public function getMaxFooterColumns()
|
336 |
+
{
|
337 |
return $this->_maxFooterColumns;
|
338 |
}
|
339 |
|
340 |
+
public function addColumnsDecimalPlaces($columnKey, $decimalPlaces)
|
341 |
+
{
|
342 |
$this->_columnsDecimalPlaces[$columnKey] = $decimalPlaces;
|
343 |
}
|
344 |
|
345 |
+
public function addColumnsThousandsSeparator($columnKey, $thousandsSeparator)
|
346 |
+
{
|
347 |
$this->_columnsThousandsSeparator[$columnKey] = $thousandsSeparator;
|
348 |
}
|
349 |
|
350 |
+
public function getColumnsCSS()
|
351 |
+
{
|
352 |
return $this->_columnsCSS;
|
353 |
}
|
354 |
|
355 |
+
public function setColumnsCss($css)
|
356 |
+
{
|
357 |
$this->_columnsCSS = $css;
|
358 |
}
|
359 |
|
360 |
+
public function reorderColumns($posArray)
|
361 |
+
{
|
362 |
if (!is_array($posArray)) {
|
363 |
throw new WDTException('Invalid position data provided!');
|
364 |
}
|
373 |
$this->_wdtNamedColumns = $resultByKeys;
|
374 |
}
|
375 |
|
376 |
+
public function getWpId()
|
377 |
+
{
|
378 |
return $this->_wpId;
|
379 |
}
|
380 |
|
381 |
+
public function setWpId($wpId)
|
382 |
+
{
|
383 |
$this->_wpId = $wpId;
|
384 |
}
|
385 |
|
386 |
+
public function getCssClassesArr()
|
387 |
+
{
|
388 |
$classesStr = $this->_cssClassArray;
|
389 |
$classesStr = apply_filters('wpdatatables_filter_table_cssClassArray', $classesStr, $this->getWpId());
|
390 |
return $classesStr;
|
391 |
}
|
392 |
|
393 |
+
public function getCSSClasses()
|
394 |
+
{
|
395 |
return implode(' ', $this->_cssClassArray);
|
396 |
}
|
397 |
|
398 |
+
public function addCSSClass($cssClass)
|
399 |
+
{
|
400 |
$this->_cssClassArray[] = $cssClass;
|
401 |
}
|
402 |
|
403 |
+
public function getCSSStyle()
|
404 |
+
{
|
405 |
return $this->_style;
|
406 |
}
|
407 |
|
408 |
+
public function setCSSStyle($style)
|
409 |
+
{
|
410 |
$this->_style = $style;
|
411 |
}
|
412 |
|
413 |
+
public function setTitle($title)
|
414 |
+
{
|
415 |
$this->_title = $title;
|
416 |
}
|
417 |
|
418 |
+
public function getName()
|
419 |
+
{
|
420 |
return $this->_title;
|
421 |
}
|
422 |
|
423 |
+
public function setScrollable($scrollable)
|
424 |
+
{
|
425 |
if ($scrollable) {
|
426 |
$this->_scrollable = true;
|
427 |
} else {
|
429 |
}
|
430 |
}
|
431 |
|
432 |
+
public function isScrollable()
|
433 |
+
{
|
434 |
return $this->_scrollable;
|
435 |
}
|
436 |
|
437 |
+
public function setInterfaceLanguage($lang)
|
438 |
+
{
|
439 |
if (empty($lang)) {
|
440 |
throw new WDTException('Incorrect language parameter!');
|
441 |
}
|
445 |
$this->_interfaceLanguage = WDT_ROOT_PATH . 'source/lang/' . $lang;
|
446 |
}
|
447 |
|
448 |
+
public function getInterfaceLanguage()
|
449 |
+
{
|
450 |
return $this->_interfaceLanguage;
|
451 |
}
|
452 |
|
453 |
+
public function setAutoRefresh($refresh_interval)
|
454 |
+
{
|
455 |
$this->_autoRefreshInterval = (int)$refresh_interval;
|
456 |
}
|
457 |
|
458 |
+
public function getRefreshInterval()
|
459 |
+
{
|
460 |
return (int)$this->_autoRefreshInterval;
|
461 |
}
|
462 |
|
463 |
+
public function paginationEnabled()
|
464 |
+
{
|
465 |
return $this->_pagination;
|
466 |
}
|
467 |
|
468 |
+
public function enablePagination()
|
469 |
+
{
|
470 |
$this->_pagination = true;
|
471 |
}
|
472 |
|
473 |
+
public function disablePagination()
|
474 |
+
{
|
475 |
$this->_pagination = false;
|
476 |
}
|
477 |
|
478 |
+
public function enableTT()
|
479 |
+
{
|
480 |
$this->_showTT = true;
|
481 |
}
|
482 |
|
483 |
+
public function disableTT()
|
484 |
+
{
|
485 |
$this->_showTT = false;
|
486 |
}
|
487 |
|
488 |
+
public function TTEnabled()
|
489 |
+
{
|
490 |
return $this->_showTT;
|
491 |
}
|
492 |
|
493 |
+
public function hideToolbar()
|
494 |
+
{
|
495 |
$this->_toolbar = false;
|
496 |
}
|
497 |
|
498 |
+
public function setDefaultSortColumn($key)
|
499 |
+
{
|
500 |
if (!isset($this->_wdtIndexedColumns[$key])
|
501 |
&& !isset($this->_wdtNamedColumns[$key])
|
502 |
) {
|
509 |
$this->_defaultSortColumn = $key;
|
510 |
}
|
511 |
|
512 |
+
public function getDefaultSortColumn()
|
513 |
+
{
|
514 |
return $this->_defaultSortColumn;
|
515 |
}
|
516 |
|
517 |
+
public function setDefaultSortDirection($direction)
|
518 |
+
{
|
519 |
if (
|
520 |
!in_array(
|
521 |
$direction,
|
530 |
$this->_defaultSortDirection = $direction;
|
531 |
}
|
532 |
|
533 |
+
public function getDefaultSortDirection()
|
534 |
+
{
|
535 |
return $this->_defaultSortDirection;
|
536 |
}
|
537 |
|
538 |
+
public function hideBeforeLoad()
|
539 |
+
{
|
540 |
$this->setCSSStyle('display: none; ');
|
541 |
$this->_hide_before_load = true;
|
542 |
}
|
543 |
|
544 |
+
public function showBeforeLoad()
|
545 |
+
{
|
546 |
$this->_hide_before_load = false;
|
547 |
}
|
548 |
|
549 |
+
public function doHideBeforeLoad()
|
550 |
+
{
|
551 |
return $this->_hide_before_load;
|
552 |
}
|
553 |
|
554 |
+
public function getDisplayLength()
|
555 |
+
{
|
556 |
return $this->_lengthDisplay;
|
557 |
}
|
558 |
|
559 |
+
public function setDisplayLength($length)
|
560 |
+
{
|
561 |
if (!in_array($length, array(1, 5, 10, 20, 25, 30, 50, 100, 200, -1))) {
|
562 |
return false;
|
563 |
}
|
564 |
$this->_lengthDisplay = $length;
|
565 |
}
|
566 |
|
567 |
+
public function setIdColumnKey($key)
|
568 |
+
{
|
569 |
$this->_idColumnKey = $key;
|
570 |
}
|
571 |
|
572 |
+
public function getIdColumnKey()
|
573 |
+
{
|
574 |
return $this->_idColumnKey;
|
575 |
}
|
576 |
|
577 |
/**
|
578 |
* @return boolean
|
579 |
*/
|
580 |
+
public function isInfoBlock()
|
581 |
+
{
|
582 |
return $this->_infoBlock;
|
583 |
}
|
584 |
|
585 |
/**
|
586 |
* @param boolean $infoBlock
|
587 |
*/
|
588 |
+
public function setInfoBlock($infoBlock)
|
589 |
+
{
|
590 |
$this->_infoBlock = (bool)$infoBlock;
|
591 |
}
|
592 |
|
593 |
/**
|
594 |
* @return boolean
|
595 |
*/
|
596 |
+
public function isGlobalSearch()
|
597 |
+
{
|
598 |
return $this->_globalSearch;
|
599 |
}
|
600 |
|
601 |
/**
|
602 |
* @param boolean $globalSearch
|
603 |
*/
|
604 |
+
public function setGlobalSearch($globalSearch)
|
605 |
+
{
|
606 |
$this->_globalSearch = (bool)$globalSearch;
|
607 |
}
|
608 |
|
609 |
/**
|
610 |
* @return boolean
|
611 |
*/
|
612 |
+
public function isShowRowsPerPage()
|
613 |
+
{
|
614 |
return $this->_showRowsPerPage;
|
615 |
}
|
616 |
|
617 |
/**
|
618 |
* @param boolean $showRowsPerPage
|
619 |
*/
|
620 |
+
public function setShowRowsPerPage($showRowsPerPage)
|
621 |
+
{
|
622 |
$this->_showRowsPerPage = (bool)$showRowsPerPage;
|
623 |
}
|
624 |
|
625 |
+
public function __construct()
|
626 |
+
{
|
627 |
+
|
628 |
if (self::$wdt_internal_idcount == 0) {
|
629 |
$this->_firstOnPage = true;
|
630 |
}
|
632 |
$this->_id = 'table_' . self::$wdt_internal_idcount;
|
633 |
}
|
634 |
|
635 |
+
public function wdtDefineColumnsWidth($widthsArray)
|
636 |
+
{
|
637 |
if (empty($this->_wdtIndexedColumns)) {
|
638 |
throw new WDTException('wpDataTable reports no columns are defined!');
|
639 |
}
|
655 |
}
|
656 |
}
|
657 |
|
658 |
+
public function setColumnsPossibleValues($valuesArray)
|
659 |
+
{
|
660 |
if (empty($this->_wdtIndexedColumns)) {
|
661 |
throw new WDTException('No columns in the table!');
|
662 |
}
|
680 |
}
|
681 |
}
|
682 |
|
683 |
+
public function getHiddenColumnCount()
|
684 |
+
{
|
685 |
$count = 0;
|
686 |
foreach ($this->_wdtIndexedColumns as $dataColumn) {
|
687 |
if (!$dataColumn->isVisible()) {
|
691 |
return $count;
|
692 |
}
|
693 |
|
|
|
694 |
|
695 |
+
public function enableGrouping()
|
696 |
+
{
|
697 |
$this->_groupingEnabled = true;
|
698 |
}
|
699 |
|
700 |
+
public function disableGrouping()
|
701 |
+
{
|
702 |
$this->_groupingEnabled = false;
|
703 |
}
|
704 |
|
705 |
+
public function groupingEnabled()
|
706 |
+
{
|
707 |
return $this->_groupingEnabled;
|
708 |
}
|
709 |
|
710 |
+
public function groupByColumn($key)
|
711 |
+
{
|
712 |
if (!isset($this->_wdtIndexedColumns[$key])
|
713 |
&& !isset($this->_wdtNamedColumns[$key])
|
714 |
) {
|
729 |
/**
|
730 |
* Returns the index of grouping column
|
731 |
*/
|
732 |
+
public function groupingColumnIndex()
|
733 |
+
{
|
734 |
return $this->_wdtColumnGroupIndex;
|
735 |
}
|
736 |
|
737 |
/**
|
738 |
* Returns the grouping column index
|
739 |
*/
|
740 |
+
public function groupingColumn()
|
741 |
+
{
|
742 |
return $this->_wdtColumnGroupIndex;
|
743 |
}
|
744 |
|
745 |
+
public function countColumns()
|
746 |
+
{
|
747 |
return count($this->_wdtIndexedColumns);
|
748 |
}
|
749 |
|
750 |
+
public function getColumnKeys()
|
751 |
+
{
|
752 |
return array_keys($this->_wdtNamedColumns);
|
753 |
}
|
754 |
|
755 |
+
public function setOnlyOwnRows($ownRows)
|
756 |
+
{
|
757 |
$this->_onlyOwnRows = (bool)$ownRows;
|
758 |
}
|
759 |
|
760 |
+
public function getOnlyOwnRows()
|
761 |
+
{
|
762 |
return $this->_onlyOwnRows;
|
763 |
}
|
764 |
|
765 |
+
public function setUserIdColumn($column)
|
766 |
+
{
|
767 |
$this->_userIdColumn = $column;
|
768 |
}
|
769 |
|
770 |
+
public function getUserIdColumn()
|
771 |
+
{
|
772 |
return $this->_userIdColumn;
|
773 |
}
|
774 |
|
775 |
+
public function getColumns()
|
776 |
+
{
|
777 |
return $this->_wdtIndexedColumns;
|
778 |
}
|
779 |
|
780 |
+
public function getColumnsByHeaders()
|
781 |
+
{
|
782 |
return $this->_wdtNamedColumns;
|
783 |
}
|
784 |
|
785 |
+
public function addConditionalFormattingColumn($column)
|
786 |
+
{
|
787 |
$this->_conditionalFormattingColumns[] = $column;
|
788 |
}
|
789 |
|
790 |
+
public function getConditionalFormattingColumns()
|
791 |
+
{
|
792 |
return $this->_conditionalFormattingColumns;
|
793 |
}
|
794 |
|
795 |
+
public function createColumnsFromArr($headerArr, $wdtParameters, $wdtColumnTypes)
|
796 |
+
{
|
797 |
foreach ($headerArr as $key) {
|
798 |
$dataColumnProperties = array();
|
799 |
$dataColumnProperties['title'] = isset($wdtParameters['columnTitles'][$key]) ? $wdtParameters['columnTitles'][$key] : $key;
|
847 |
|
848 |
}
|
849 |
|
850 |
+
public function getColumnHeaderOffset($key)
|
851 |
+
{
|
852 |
$keys = $this->getColumnKeys();
|
853 |
if (!empty($key) && in_array($key, $keys)) {
|
854 |
return array_search($key, $keys);
|
857 |
}
|
858 |
}
|
859 |
|
860 |
+
public function getColumnDefinitions()
|
861 |
+
{
|
862 |
$defs = array();
|
863 |
foreach ($this->_wdtIndexedColumns as $key => &$dataColumn) {
|
864 |
$def = $dataColumn->getColumnJSON($key);
|
873 |
*
|
874 |
* @return string
|
875 |
*/
|
876 |
+
public function getColumnFilterDefinitions()
|
877 |
+
{
|
878 |
$columnDefinitions = array();
|
879 |
foreach ($this->_wdtIndexedColumns as $key => $dataColumn) {
|
880 |
|
895 |
*
|
896 |
* @return string
|
897 |
*/
|
898 |
+
public function getColumnEditingDefinitions()
|
899 |
+
{
|
900 |
$columnDefinitions = array();
|
901 |
foreach ($this->_wdtIndexedColumns as $key => $dataColumn) {
|
902 |
|
914 |
* @param $originalHeader
|
915 |
* @return bool|mixed
|
916 |
*/
|
917 |
+
public function getColumn($originalHeader)
|
918 |
+
{
|
919 |
if (!isset($originalHeader)
|
920 |
|| (!isset($this->_wdtNamedColumns[$originalHeader])
|
921 |
&& !isset($this->_wdtIndexedColumns[$originalHeader]))
|
936 |
* @param array $wdtParameters Array of rendering parameters
|
937 |
* @return bool Result of generation
|
938 |
*/
|
939 |
+
public function arrayBasedConstruct($rawDataArr, $wdtParameters)
|
940 |
+
{
|
941 |
|
942 |
if (empty($rawDataArr)) {
|
943 |
if (!isset($wdtParameters['data_types'])) {
|
953 |
}
|
954 |
|
955 |
$headerArr = WDTTools::extractHeaders($rawDataArr);
|
956 |
+
|
957 |
if (!empty($wdtParameters['columnTitles'])) {
|
958 |
$headerArr = array_unique(
|
959 |
array_merge(
|
1020 |
}
|
1021 |
}
|
1022 |
|
|
|
1023 |
|
1024 |
return true;
|
1025 |
|
1026 |
}
|
1027 |
|
|
|
1028 |
|
1029 |
+
public function hideColumn($dataColumnIndex)
|
1030 |
+
{
|
1031 |
if (!isset($dataColumnIndex)
|
1032 |
|| !isset($this->_wdtNamedColumns[$dataColumnIndex])
|
1033 |
) {
|
1036 |
$this->_wdtNamedColumns[$dataColumnIndex]->setIsVisible(false);
|
1037 |
}
|
1038 |
|
1039 |
+
public function showColumn($dataColumnIndex)
|
1040 |
+
{
|
1041 |
if (!isset($dataColumnIndex)
|
1042 |
|| !isset($this->_wdtNamedColumns[$dataColumnIndex])
|
1043 |
) {
|
1047 |
}
|
1048 |
|
1049 |
|
1050 |
+
public function getCell($dataColumnIndex, $rowKey)
|
1051 |
+
{
|
1052 |
if (!isset($dataColumnIndex)
|
1053 |
|| !isset($rowKey)
|
1054 |
) {
|
1065 |
return $this->_dataRows[$rowKey][$dataColumnIndex];
|
1066 |
}
|
1067 |
|
1068 |
+
public function returnCellValue($cellContent, $wdtColumnIndex)
|
1069 |
+
{
|
1070 |
if (!isset($wdtColumnIndex)) {
|
1071 |
throw new WDTException('Column index not provided!');
|
1072 |
}
|
1076 |
return $this->_wdtNamedColumns[$wdtColumnIndex]->returnCellValue($cellContent);
|
1077 |
}
|
1078 |
|
1079 |
+
public function getDataRows()
|
1080 |
+
{
|
1081 |
return $this->_dataRows;
|
1082 |
}
|
1083 |
|
1084 |
+
public function getDataRowsFormatted()
|
1085 |
+
{
|
1086 |
$dataRowsFormatted = array();
|
1087 |
foreach ($this->_dataRows as $dataRow) {
|
1088 |
$formattedRow = array();
|
1094 |
return $dataRowsFormatted;
|
1095 |
}
|
1096 |
|
1097 |
+
public function getRow($index)
|
1098 |
+
{
|
1099 |
if (!isset($index) || !isset($this->_dataRows[$index])) {
|
1100 |
throw new WDTException('Invalid row index!');
|
1101 |
}
|
1104 |
return $rowArray;
|
1105 |
}
|
1106 |
|
1107 |
+
public function addDataColumn(&$dataColumn)
|
1108 |
+
{
|
1109 |
if (!($dataColumn instanceof WDTColumn)) {
|
1110 |
throw new WDTException('Please provide a wpDataTable column.');
|
1111 |
}
|
1114 |
return true;
|
1115 |
}
|
1116 |
|
1117 |
+
public function addColumns(&$dataColumns)
|
1118 |
+
{
|
1119 |
if (!is_array($dataColumns)) {
|
1120 |
throw new WDTException('Please provide an array of wpDataTable column objects.');
|
1121 |
}
|
1132 |
* @param $function
|
1133 |
* @return float|int
|
1134 |
*/
|
1135 |
+
public function calcColumnFunction($columnKey, $function)
|
1136 |
+
{
|
1137 |
$result = null;
|
1138 |
if ($function == 'sum' || $function == 'avg') {
|
1139 |
foreach ($this->getDataRows() as $wdtRowDataArr) {
|
1170 |
/**
|
1171 |
* Helper method to generate values for SUM, MIN, MAX, AVG
|
1172 |
*/
|
1173 |
+
private function calcColumnsAggregateFuncs()
|
1174 |
+
{
|
1175 |
if (empty($this->_aggregateFuncsRes)) {
|
1176 |
$this->_aggregateFuncsRes = array(
|
1177 |
'sum' => array(),
|
1255 |
* @param $function
|
1256 |
* @return mixed
|
1257 |
*/
|
1258 |
+
public function getColumnsAggregateFuncsResult($columnKey, $function)
|
1259 |
+
{
|
1260 |
if (!isset($this->_aggregateFuncsRes[$function][$columnKey])) {
|
1261 |
$this->calcColumnsAggregateFuncs();
|
1262 |
}
|
1263 |
return $this->_aggregateFuncsRes[$function][$columnKey];
|
1264 |
}
|
1265 |
|
|
|
1266 |
|
1267 |
/**
|
1268 |
* Formatting row data structure for ajax display table
|
1269 |
* @param $row - key => value pairs as column name and cell value of a row
|
1270 |
* @return array
|
1271 |
*/
|
1272 |
+
protected function formatAjaxQueryResultRow($row)
|
1273 |
+
{
|
1274 |
return array_values($row);
|
1275 |
}
|
1276 |
|
1277 |
|
1278 |
+
public function jsonBasedConstruct($json, $wdtParameters = array())
|
1279 |
+
{
|
1280 |
$json = WDTTools::applyPlaceholders($json);
|
1281 |
$json = WDTTools::curlGetData($json);
|
1282 |
$json = apply_filters('wpdatatables_filter_json', $json, $this->getWpId());
|
1283 |
return $this->arrayBasedConstruct(json_decode($json, true), $wdtParameters);
|
1284 |
}
|
1285 |
|
1286 |
+
public function XMLBasedConstruct($xml, $wdtParameters = array())
|
1287 |
+
{
|
1288 |
if (!$xml) {
|
1289 |
throw new WDTException('File you provided cannot be found.');
|
1290 |
}
|
1303 |
return $this->arrayBasedConstruct($XMLArray, $wdtParameters);
|
1304 |
}
|
1305 |
|
1306 |
+
public function excelBasedConstruct($xls_url, $wdtParameters = array())
|
1307 |
+
{
|
1308 |
ini_set('memory_limit', '2048M');
|
1309 |
if (!$xls_url) {
|
1310 |
throw new WDTException('Excel file not found!');
|
1374 |
/**
|
1375 |
* Helper method that renders the modal
|
1376 |
*/
|
1377 |
+
public static function renderModal()
|
1378 |
+
{
|
1379 |
include_once WDT_TEMPLATE_PATH . 'frontend/modal.inc.php';
|
1380 |
include_once WDT_TEMPLATE_PATH . 'common/delete_modal.inc.php';
|
1381 |
}
|
1384 |
* Generates table HTML
|
1385 |
* @return string
|
1386 |
*/
|
1387 |
+
public function generateTable()
|
1388 |
+
{
|
1389 |
/** @noinspection PhpUnusedLocalVariableInspection */
|
1390 |
$tableContent = $this->renderWithJSAndStyles();
|
1391 |
|
1419 |
}
|
1420 |
$returnData .= "</style>\n";
|
1421 |
|
|
|
1422 |
|
1423 |
return $returnData;
|
1424 |
}
|
1428 |
* enqueue all necessary JS and CSS files
|
1429 |
* @return string
|
1430 |
*/
|
1431 |
+
protected function renderWithJSAndStyles()
|
1432 |
+
{
|
1433 |
|
1434 |
$this->enqueueJSAndStyles();
|
1435 |
|
1457 |
/**
|
1458 |
* Function that enqueue all necessary JS and CSS files for wpDataTable
|
1459 |
*/
|
1460 |
+
protected function enqueueJSAndStyles()
|
1461 |
+
{
|
1462 |
|
1463 |
WDTTools::wdtUIKitEnqueue();
|
1464 |
|
1471 |
wp_enqueue_style('wdt-wpdatatables', WDT_CSS_PATH . 'wpdatatables.min.css');
|
1472 |
wp_enqueue_style('wdt-table-tools', WDT_CSS_PATH . 'TableTools.css');
|
1473 |
|
|
|
1474 |
|
1475 |
if (WDT_INCLUDE_DATATABLES_CORE) {
|
1476 |
wp_enqueue_script('wdt-datatables', WDT_JS_PATH . 'jquery-datatables/jquery.dataTables.min.js', array(), false, true);
|
1477 |
}
|
1478 |
|
|
|
1479 |
|
1480 |
if ($this->groupingEnabled()) {
|
1481 |
wp_enqueue_script('wdt-row-grouping', WDT_JS_PATH . 'jquery-datatables/jquery.dataTables.rowGrouping.js', array('jquery', 'wdt-datatables'), false, true);
|
1482 |
}
|
1483 |
|
|
|
1484 |
|
1485 |
wp_enqueue_script('wdt-funcs-js', WDT_JS_PATH . 'wpdatatables/wdt.funcs.js', array('jquery', 'wdt-datatables', 'wdt-common'), false, true);
|
1486 |
wp_enqueue_script('wdt-wpdatatables', WDT_JS_PATH . 'wpdatatables/wpdatatables.js', array('jquery', 'wdt-datatables'), false, true);
|
1521 |
!empty($this->_tableToolsConfig['pdf']) ? wp_enqueue_script('wdt-pdf-make', WDT_JS_PATH . 'export-tools/pdfmake.min.js', array('jquery'), false, true) : null;
|
1522 |
!empty($this->_tableToolsConfig['pdf']) ? wp_enqueue_script('wdt-vfs-fonts', WDT_JS_PATH . 'export-tools/vfs_fonts.js', array('jquery'), false, true) : null;
|
1523 |
|
|
|
1524 |
|
1525 |
wp_localize_script('wdt-common', 'wpdatatables_edit_strings', WDTTools::getTranslationStrings());
|
1526 |
wp_localize_script('wdt-wpdatatables', 'wpdatatables_settings', WDTTools::getDateTimeSettings());
|
1533 |
* @param $tableData
|
1534 |
* @return array
|
1535 |
*/
|
1536 |
+
public function prepareColumnData($tableData)
|
1537 |
+
{
|
1538 |
|
1539 |
$returnArray = array(
|
1540 |
'dateInputFormat' => array(),
|
1592 |
$returnArray['possibleValuesAddEmpty'][$column->orig_header] = isset($column->possibleValuesAddEmpty) ? $column->possibleValuesAddEmpty : null;
|
1593 |
$returnArray['possibleValuesType'][$column->orig_header] = isset($column->possibleValuesType) ? $column->possibleValuesType : null;
|
1594 |
$returnArray['sorting'][$column->orig_header] = isset($column->sorting) ? $column->sorting : null;
|
1595 |
+
$returnArray['linkTargetAttribute'][$column->orig_header] = isset($column->linkTargetAttribute) ? $column->linkTargetAttribute : null;
|
1596 |
+
$returnArray['linkButtonAttribute'][$column->orig_header] = isset($column->linkButtonAttribute) ? $column->linkButtonAttribute : null;
|
1597 |
+
$returnArray['linkButtonLabel'][$column->orig_header] = isset($column->linkButtonLabel) ? $column->linkButtonLabel : null;
|
1598 |
+
$returnArray['linkButtonClass'][$column->orig_header] = isset($column->linkButtonClass) ? $column->linkButtonClass : null;
|
1599 |
|
1600 |
}
|
1601 |
}
|
1602 |
return $returnArray;
|
1603 |
}
|
1604 |
|
|
|
1605 |
|
1606 |
/**
|
1607 |
* Helper method which populates the wpdatatables object with passed in parameters and data (stored in DB)
|
1609 |
* @param $tableData
|
1610 |
* @param $columnData
|
1611 |
*/
|
1612 |
+
public function fillFromData($tableData, $columnData)
|
1613 |
+
{
|
1614 |
if (empty($tableData->table_type)) {
|
1615 |
return;
|
1616 |
}
|
1668 |
if (isset($columnData['dateInputFormat'])) {
|
1669 |
$params['dateInputFormat'] = $columnData['dateInputFormat'];
|
1670 |
}
|
1671 |
+
if (isset($columnData['linkTargetAttribute'])) {
|
1672 |
$params['linkTargetAttribute'] = $columnData['linkTargetAttribute'];
|
1673 |
}
|
1674 |
+
if (isset($columnData['linkButtonAttribute'])) {
|
1675 |
$params['linkButtonAttribute'] = $columnData['linkButtonAttribute'];
|
1676 |
}
|
1677 |
+
if (isset($columnData['linkButtonLabel'])) {
|
1678 |
$params['linkButtonLabel'] = $columnData['linkButtonLabel'];
|
1679 |
}
|
1680 |
+
if (isset($columnData['linkButtonClass'])) {
|
1681 |
$params['linkButtonClass'] = $columnData['linkButtonClass'];
|
1682 |
}
|
1683 |
|
1684 |
switch ($tableData->table_type) {
|
1685 |
+
|
1686 |
case 'xls':
|
1687 |
case 'csv':
|
1688 |
$this->excelBasedConstruct(
|
1711 |
);
|
1712 |
break;
|
1713 |
|
|
|
1714 |
|
1715 |
default:
|
1716 |
// Solution for addons
|
1747 |
$this->setWordWrap(true);
|
1748 |
}
|
1749 |
|
|
|
1750 |
|
1751 |
if (!empty($tableData->scrollable)) {
|
1752 |
$this->setScrollable(true);
|
1808 |
* Helper method that prepares the rendering rules
|
1809 |
* @param array $columnData
|
1810 |
*/
|
1811 |
+
public function prepareRenderingRules($columnData)
|
1812 |
+
{
|
1813 |
$columnIndex = 1;
|
1814 |
// Check the search values passed from URL
|
1815 |
if (isset($_GET['wdt_search'])) {
|
1817 |
}
|
1818 |
|
1819 |
// Define all column-dependent rendering rules
|
1820 |
+
foreach ($columnData as $key => $column) {
|
1821 |
|
1822 |
$this->column_id = $key;
|
1823 |
// Set filter types
|
1829 |
$this->getColumn($column->orig_header)->setIsVisible(false);
|
1830 |
}
|
1831 |
|
|
|
1832 |
|
1833 |
// if grouping enabled for this column, passing it to table class
|
1834 |
if ($column->groupColumn) {
|
1868 |
if (sanitize_html_class(strtolower(str_replace(' ', '-', $column->orig_header))) === '') {
|
1869 |
$cssColumnHeader = 'column-' . $this->column_id;
|
1870 |
} else {
|
1871 |
+
$cssColumnHeader = 'column-' . sanitize_html_class(strtolower(str_replace(' ', '-', $column->orig_header)));
|
1872 |
}
|
1873 |
if ($column->text_before != '') {
|
1874 |
$this->_columnsCSS .= "\n#{$this->getId()} > tbody > tr > td.{$cssColumnHeader}:not(:empty):before,
|
1903 |
/**
|
1904 |
* Returns JSON object for table description
|
1905 |
*/
|
1906 |
+
public function getJsonDescription()
|
1907 |
+
{
|
1908 |
+
|
1909 |
global $wdtExportFileName;
|
1910 |
|
1911 |
$obj = new stdClass();
|
1914 |
$obj->infoBlock = $this->isInfoBlock();
|
1915 |
$obj->globalSearch = $this->isGlobalSearch();
|
1916 |
$obj->showRowsPerPage = $this->isShowRowsPerPage();
|
1917 |
+
|
1918 |
$obj->hideBeforeLoad = $this->doHideBeforeLoad();
|
1919 |
$obj->number_format = (int)(get_option('wdtNumberFormat') ? get_option('wdtNumberFormat') : 1);
|
1920 |
$obj->decimalPlaces = (int)(get_option('wdtDecimalPlaces') ? get_option('wdtDecimalPlaces') : 2);
|
1921 |
+
|
1922 |
$obj->spinnerSrc = WDT_ASSETS_PATH . '/img/spinner.gif';
|
1923 |
$obj->groupingEnabled = $this->groupingEnabled();
|
1924 |
if ($this->groupingEnabled()) {
|
1934 |
$obj->dataTableParams->sDom = "BT<'clear'>{$showRowsPerPage}{$globalSearch}{$scrollable}{$infoBlock}p";
|
1935 |
|
1936 |
$obj->dataTableParams->bSortCellsTop = false;
|
1937 |
+
|
1938 |
if ($this->paginationEnabled()) {
|
1939 |
$obj->dataTableParams->bPaginate = true;
|
1940 |
$obj->dataTableParams->aLengthMenu = json_decode('[[1,5,10,25,50,100,-1],[1,5,10,25,50,100,"' . __('All', 'wpdatatables') . '"]]');
|
1986 |
}
|
1987 |
|
1988 |
$currentSkin = get_option('wdtBaseSkin');
|
1989 |
+
$skinsWithNewTableToolsButtons = ['aqua', 'purple', 'dark'];
|
1990 |
|
1991 |
if ($this->TTEnabled()) {
|
1992 |
(!isset($obj->dataTableParams->buttons)) ? $obj->dataTableParams->buttons = array() : '';
|
1993 |
+
if (in_array($currentSkin, $skinsWithNewTableToolsButtons)) {
|
1994 |
|
1995 |
if (!empty($this->_tableToolsConfig['columns'])) {
|
1996 |
$obj->dataTableParams->buttons[] =
|
2134 |
$obj->dataTableParams->oLanguage->sLengthMenu = __('Showing _MENU_ Entries', 'wpdatatables');
|
2135 |
}
|
2136 |
|
|
|
2137 |
|
2138 |
if (!isset($obj->dataTableParams->buttons)) {
|
2139 |
$obj->dataTableParams->buttons = array();
|
2140 |
}
|
2141 |
|
|
|
2142 |
|
2143 |
$obj->dataTableParams->sPaginationType = 'full_numbers';
|
2144 |
$obj->columnsFixed = 0;
|
2145 |
|
|
|
2146 |
|
2147 |
$init_format = get_option('wdtDateFormat');
|
2148 |
$datepick_format = str_replace('d', 'dd', $init_format);
|
2166 |
* @param $dataRows
|
2167 |
* @return mixed
|
2168 |
*/
|
2169 |
+
public function joinWithForeignWpDataTable($columnKey, $foreignKeyRule, $dataRows)
|
2170 |
+
{
|
2171 |
$joinedTable = WPDataTable::loadWpDataTable($foreignKeyRule->tableId);
|
2172 |
$distinctValues = $joinedTable->getDistinctValuesForColumns($foreignKeyRule);
|
2173 |
foreach ($dataRows as &$dataRow) {
|
2188 |
* storeColumnId and storeColumnName
|
2189 |
* @return array
|
2190 |
*/
|
2191 |
+
public function getDistinctValuesForColumns($foreignKeyRule)
|
2192 |
+
{
|
2193 |
$distinctValues = array();
|
2194 |
$storeColumnName = $foreignKeyRule->storeColumnName;
|
2195 |
$displayColumnName = $foreignKeyRule->displayColumnName;
|
2230 |
* @param $tableId
|
2231 |
* @return bool
|
2232 |
*/
|
2233 |
+
public static function deleteTable($tableId)
|
2234 |
+
{
|
2235 |
global $wpdb;
|
2236 |
|
2237 |
if (!isset($_REQUEST['wdtNonce']) || empty($tableId) || !current_user_can('manage_options') || !wp_verify_nonce($_REQUEST['wdtNonce'], 'wdtDeleteTableNonce')) {
|
2266 |
* Get all tables
|
2267 |
* @return array|null|object
|
2268 |
*/
|
2269 |
+
public static function getAllTables()
|
2270 |
+
{
|
2271 |
global $wpdb;
|
2272 |
$query = "SELECT id, title, table_type, server_side FROM {$wpdb->prefix}wpdatatables ORDER BY id";
|
2273 |
$allTables = $wpdb->get_results($query, ARRAY_A);
|
2282 |
* @param bool $disableLimit
|
2283 |
* @return WPDataTable|WPExcelDataTable|bool
|
2284 |
*/
|
2285 |
+
public static function loadWpDataTable($tableId, $tableView = null, $disableLimit = false)
|
2286 |
+
{
|
2287 |
$tableData = WDTConfigController::loadTableFromDB($tableId);
|
2288 |
|
2289 |
if ($tableData) {
|
templates/admin/browse/chart/browse.inc.php
CHANGED
@@ -31,10 +31,10 @@
|
|
31 |
<i class="zmdi zmdi-plus"></i>
|
32 |
<?php _e('Add New', 'wpdatatables'); ?>
|
33 |
</button>
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
</li>
|
39 |
</ul>
|
40 |
</div>
|
@@ -42,6 +42,12 @@
|
|
42 |
|
43 |
<form method="post" action="<?php echo admin_url('admin.php?page=wpdatatables-charts'); ?>"
|
44 |
id="wdt-datatables-browse-table">
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<?php echo $tableHTML; ?>
|
46 |
<?php wp_nonce_field('wdtDeleteChartNonce', 'wdtNonce'); ?>
|
47 |
</form>
|
@@ -54,6 +60,10 @@
|
|
54 |
</div>
|
55 |
<!-- .container -->
|
56 |
|
|
|
|
|
|
|
|
|
57 |
<!-- Delete modal -->
|
58 |
<?php include WDT_TEMPLATE_PATH . 'common/delete_modal.inc.php'; ?>
|
59 |
<!-- /Delete modal -->
|
31 |
<i class="zmdi zmdi-plus"></i>
|
32 |
<?php _e('Add New', 'wpdatatables'); ?>
|
33 |
</button>
|
34 |
+
<button class="btn bgm-green waves-effect tms-store-checkout-wpdatatables">
|
35 |
+
<i class="zmdi zmdi-shopping-cart"></i>
|
36 |
+
<?php _e('Buy Full Version', 'wpdatatables'); ?>
|
37 |
+
</button>
|
38 |
</li>
|
39 |
</ul>
|
40 |
</div>
|
42 |
|
43 |
<form method="post" action="<?php echo admin_url('admin.php?page=wpdatatables-charts'); ?>"
|
44 |
id="wdt-datatables-browse-table">
|
45 |
+
<div class="alert alert-info alert-dismissible" role="alert">
|
46 |
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
|
47 |
+
aria-hidden="true">×</span></button>
|
48 |
+
<?php _e('NEW awesome features!!! From version wpDataTables Lite 2.1 you can create Google charts: Line, Column and Pie. All other chart types are available in the', 'wpdatatables'); ?>
|
49 |
+
<a class="tms-store-checkout-wpdatatables dark"><?php _e('full version of wpDataTables.', 'wpdatatables'); ?></a>
|
50 |
+
</div>
|
51 |
<?php echo $tableHTML; ?>
|
52 |
<?php wp_nonce_field('wdtDeleteChartNonce', 'wdtNonce'); ?>
|
53 |
</form>
|
60 |
</div>
|
61 |
<!-- .container -->
|
62 |
|
63 |
+
<!-- Duplicate chart modal -->
|
64 |
+
<?php include WDT_TEMPLATE_PATH . 'admin/browse/chart/duplicate_chart_modal.inc.php'; ?>
|
65 |
+
<!-- /Duplicate chart modal -->
|
66 |
+
|
67 |
<!-- Delete modal -->
|
68 |
<?php include WDT_TEMPLATE_PATH . 'common/delete_modal.inc.php'; ?>
|
69 |
<!-- /Delete modal -->
|
templates/admin/browse/chart/duplicate_chart_modal.inc.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('Access denied.'); ?>
|
2 |
+
|
3 |
+
<!-- #wdt-duplicate-chart-modal -->
|
4 |
+
<div class="modal fade" id="wdt-duplicate-chart-modal" data-backdrop="static" data-keyboard="false" tabindex="-1"
|
5 |
+
role="dialog" aria-hidden="true">
|
6 |
+
<?php wp_nonce_field('wdtDuplicateChartNonce', 'wdtNonce'); ?>
|
7 |
+
|
8 |
+
<!-- .modal-dialog -->
|
9 |
+
<div class="modal-dialog">
|
10 |
+
|
11 |
+
<!-- .modal-content -->
|
12 |
+
<div class="modal-content">
|
13 |
+
|
14 |
+
<!-- .modal-header -->
|
15 |
+
<div class="modal-header">
|
16 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
|
17 |
+
</button>
|
18 |
+
<h4 class="modal-title"><?php _e('Duplicate chart', 'wpdatatables') ?></h4>
|
19 |
+
</div>
|
20 |
+
<!--/ .modal-header -->
|
21 |
+
|
22 |
+
<!-- .modal-body -->
|
23 |
+
<div class="modal-body">
|
24 |
+
<!-- .row -->
|
25 |
+
<div class="row">
|
26 |
+
<div class="col-sm-5">
|
27 |
+
<label class="duplicate-chart-label"><?php _e('New chart title', 'wpdatatables'); ?></label>
|
28 |
+
</div>
|
29 |
+
<div class="col-sm-7">
|
30 |
+
<input type="text" value="" class="wdt-duplicate-chart-name form-control input-sm" title=""/>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<!--/ .row -->
|
34 |
+
</div>
|
35 |
+
<!--/ .modal-body -->
|
36 |
+
|
37 |
+
<!-- .modal-footer -->
|
38 |
+
<div class="modal-footer">
|
39 |
+
<button type="button" class="btn btn-danger btn-icon-text waves-effect" data-dismiss="modal"><i
|
40 |
+
class="zmdi zmdi-close"></i> <?php _e('Cancel', 'wpdatatables'); ?></button>
|
41 |
+
<button type="button"
|
42 |
+
class="btn btn-success btn-icon-text waves-effect wdt-apply duplicate-chart-button"><i
|
43 |
+
class="zmdi zmdi-copy"></i> <?php _e('Duplicate', 'wpdatatables'); ?></button>
|
44 |
+
</div>
|
45 |
+
<!--/ .modal-footer -->
|
46 |
+
</div>
|
47 |
+
<!--/ .modal-content -->
|
48 |
+
</div>
|
49 |
+
<!--/ .modal-dialog -->
|
50 |
+
</div>
|
51 |
+
<!--/ #wdt-duplicate-chart-modal -->
|
templates/admin/chart_wizard/chart_wizard.inc.php
CHANGED
@@ -3,15 +3,12 @@
|
|
3 |
<?php if (isset($chartObj)) { ?>
|
4 |
<script type='text/javascript'>var editing_chart_data = {
|
5 |
render_data: <?php echo json_encode($chartObj->getRenderData()); ?>,
|
6 |
-
highcharts_render_data: <?php echo json_encode($chartObj->getHighchartsRenderData()); ?>,
|
7 |
-
chartjs_render_data: <?php echo json_encode($chartObj->getChartJSRenderData()); ?>,
|
8 |
engine: "<?php echo $chartObj->getEngine();?>",
|
9 |
type: "<?php echo $chartObj->getType(); ?>",
|
10 |
selected_columns: <?php echo json_encode($chartObj->getSelectedColumns()) ?>,
|
11 |
range_type: "<?php echo $chartObj->getRangeType() ?>"<?php if( $chartObj->getRangeType() == 'picked_range' ){ ?>,
|
12 |
row_range: <?php echo json_encode($chartObj->getRowRange()); } ?>,
|
13 |
title: "<?php echo $chartObj->getTitle(); ?>",
|
14 |
-
follow_filtering: <?php echo (int)$chartObj->getFollowFiltering(); ?>,
|
15 |
wpdatatable_id: <?php echo $chartObj->getwpDataTableId(); ?> };</script>
|
16 |
<?php } ?>
|
17 |
|
@@ -73,6 +70,30 @@
|
|
73 |
|
74 |
</div>
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
<?php ?>
|
77 |
|
78 |
</div>
|
@@ -99,8 +120,46 @@
|
|
99 |
</div>
|
100 |
<!-- /.container -->
|
101 |
|
102 |
-
<?php ?>
|
103 |
-
|
104 |
</div>
|
105 |
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<?php if (isset($chartObj)) { ?>
|
4 |
<script type='text/javascript'>var editing_chart_data = {
|
5 |
render_data: <?php echo json_encode($chartObj->getRenderData()); ?>,
|
|
|
|
|
6 |
engine: "<?php echo $chartObj->getEngine();?>",
|
7 |
type: "<?php echo $chartObj->getType(); ?>",
|
8 |
selected_columns: <?php echo json_encode($chartObj->getSelectedColumns()) ?>,
|
9 |
range_type: "<?php echo $chartObj->getRangeType() ?>"<?php if( $chartObj->getRangeType() == 'picked_range' ){ ?>,
|
10 |
row_range: <?php echo json_encode($chartObj->getRowRange()); } ?>,
|
11 |
title: "<?php echo $chartObj->getTitle(); ?>",
|
|
|
12 |
wpdatatable_id: <?php echo $chartObj->getwpDataTableId(); ?> };</script>
|
13 |
<?php } ?>
|
14 |
|
70 |
|
71 |
</div>
|
72 |
|
73 |
+
<div class="chart-wizard-step step2" data-step="step2" style="display: none">
|
74 |
+
|
75 |
+
<?php include WDT_TEMPLATE_PATH . 'admin/chart_wizard/steps/step2.inc.php'; ?>
|
76 |
+
|
77 |
+
</div>
|
78 |
+
|
79 |
+
<div class="chart-wizard-step step3" data-step="step3" style="display: none">
|
80 |
+
|
81 |
+
<?php include WDT_TEMPLATE_PATH . 'admin/chart_wizard/steps/step3.inc.php'; ?>
|
82 |
+
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div class="chart-wizard-step step4" data-step="step4" style="display: none">
|
86 |
+
|
87 |
+
<?php include WDT_TEMPLATE_PATH . 'admin/chart_wizard/steps/step4.inc.php'; ?>
|
88 |
+
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<div class="chart-wizard-step step5" data-step="step5" style="display: none">
|
92 |
+
|
93 |
+
<?php include WDT_TEMPLATE_PATH . 'admin/chart_wizard/steps/step5.inc.php'; ?>
|
94 |
+
|
95 |
+
</div>
|
96 |
+
|
97 |
<?php ?>
|
98 |
|
99 |
</div>
|
120 |
</div>
|
121 |
<!-- /.container -->
|
122 |
|
|
|
|
|
123 |
</div>
|
124 |
|
125 |
+
<script id="wdt-chart-series-setting-block" type="text/x-jsrender">
|
126 |
+
{{for series}}
|
127 |
+
<div class="chart-series-block" data-orig_header="{{>orig_header}}">
|
128 |
+
<h4 class="c-black m-b-20 title">
|
129 |
+
<?php _e('Serie', 'wpdatatables'); ?>: {{>label}}
|
130 |
+
</h4>
|
131 |
+
<div class="chart-series-label">
|
132 |
+
<h4 class="c-black m-b-20">
|
133 |
+
<?php _e('Label', 'wpdatatables'); ?>
|
134 |
+
</h4>
|
135 |
+
<div class="form-group">
|
136 |
+
<div class="fg-line">
|
137 |
+
<div class="row">
|
138 |
+
<div class="col-sm-12">
|
139 |
+
<input type="text" name="font-name" id="series-label" value="{{>label}}" class="form-control input-sm series-label" />
|
140 |
+
</div>
|
141 |
+
</div>
|
142 |
+
</div>
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
<div class="chart-series-color" id="chart-series-color">
|
146 |
+
<h4 class="c-black m-b-20">
|
147 |
+
<?php _e('Color', 'wpdatatables'); ?>
|
148 |
+
</h4>
|
149 |
+
<div class="cp-container">
|
150 |
+
<div class="form-group">
|
151 |
+
<div class="fg-line dropdown">
|
152 |
+
<div id="cp" class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker"">
|
153 |
+
<input type="text" id="series-color" value="" class="form-control cp-value series-color" />
|
154 |
+
<span class="input-group-addon wpcolorpicker-icon"><i></i></span>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
{{/for}}
|
162 |
+
|
163 |
+
</script>
|
164 |
+
|
165 |
+
|
templates/admin/chart_wizard/steps/charts_pick/chartjs.inc.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
<div class="row">
|
4 |
|
5 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
6 |
<div class="card" data-type="chartjs_line_chart" data-min_columns="2" data-max_columns="0">
|
7 |
<div class="card-header">
|
8 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -14,7 +14,7 @@
|
|
14 |
</div>
|
15 |
</div>
|
16 |
|
17 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
18 |
<div class="card" data-type="chartjs_area_chart" data-min_columns="2" data-max_columns="0">
|
19 |
<div class="card-header">
|
20 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -26,7 +26,7 @@
|
|
26 |
</div>
|
27 |
</div>
|
28 |
|
29 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
30 |
<div class="card" data-type="chartjs_stacked_area_chart" data-min_columns="2" data-max_columns="0">
|
31 |
<div class="card-header">
|
32 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -39,7 +39,7 @@
|
|
39 |
</div>
|
40 |
</div>
|
41 |
|
42 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
43 |
<div class="card" data-type="chartjs_column_chart" data-min_columns="2" data-max_columns="0">
|
44 |
<div class="card-header">
|
45 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -52,7 +52,7 @@
|
|
52 |
</div>
|
53 |
</div>
|
54 |
|
55 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
56 |
<div class="card" data-type="chartjs_radar_chart" data-min_columns="2" data-max_columns="0">
|
57 |
<div class="card-header">
|
58 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -64,7 +64,7 @@
|
|
64 |
</div>
|
65 |
</div>
|
66 |
|
67 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
68 |
<div class="card" data-type="chartjs_polar_area_chart" data-min_columns="2" data-max_columns="2">
|
69 |
<div class="card-header">
|
70 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -81,7 +81,7 @@
|
|
81 |
|
82 |
<div class="row">
|
83 |
|
84 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
85 |
<div class="card" data-type="chartjs_pie_chart" data-min_columns="2" data-max_columns="2">
|
86 |
<div class="card-header">
|
87 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -93,7 +93,7 @@
|
|
93 |
</div>
|
94 |
</div>
|
95 |
|
96 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
97 |
<div class="card" data-type="chartjs_doughnut_chart" data-min_columns="2" data-max_columns="2">
|
98 |
<div class="card-header">
|
99 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -106,7 +106,7 @@
|
|
106 |
</div>
|
107 |
</div>
|
108 |
|
109 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
110 |
<div class="card" data-type="chartjs_bubble_chart" data-min_columns="4" data-max_columns="4">
|
111 |
<div class="card-header">
|
112 |
<div class="wdt-chart-wizard-overlay"></div>
|
2 |
|
3 |
<div class="row">
|
4 |
|
5 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
6 |
<div class="card" data-type="chartjs_line_chart" data-min_columns="2" data-max_columns="0">
|
7 |
<div class="card-header">
|
8 |
<div class="wdt-chart-wizard-overlay"></div>
|
14 |
</div>
|
15 |
</div>
|
16 |
|
17 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
18 |
<div class="card" data-type="chartjs_area_chart" data-min_columns="2" data-max_columns="0">
|
19 |
<div class="card-header">
|
20 |
<div class="wdt-chart-wizard-overlay"></div>
|
26 |
</div>
|
27 |
</div>
|
28 |
|
29 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
30 |
<div class="card" data-type="chartjs_stacked_area_chart" data-min_columns="2" data-max_columns="0">
|
31 |
<div class="card-header">
|
32 |
<div class="wdt-chart-wizard-overlay"></div>
|
39 |
</div>
|
40 |
</div>
|
41 |
|
42 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
43 |
<div class="card" data-type="chartjs_column_chart" data-min_columns="2" data-max_columns="0">
|
44 |
<div class="card-header">
|
45 |
<div class="wdt-chart-wizard-overlay"></div>
|
52 |
</div>
|
53 |
</div>
|
54 |
|
55 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
56 |
<div class="card" data-type="chartjs_radar_chart" data-min_columns="2" data-max_columns="0">
|
57 |
<div class="card-header">
|
58 |
<div class="wdt-chart-wizard-overlay"></div>
|
64 |
</div>
|
65 |
</div>
|
66 |
|
67 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
68 |
<div class="card" data-type="chartjs_polar_area_chart" data-min_columns="2" data-max_columns="2">
|
69 |
<div class="card-header">
|
70 |
<div class="wdt-chart-wizard-overlay"></div>
|
81 |
|
82 |
<div class="row">
|
83 |
|
84 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
85 |
<div class="card" data-type="chartjs_pie_chart" data-min_columns="2" data-max_columns="2">
|
86 |
<div class="card-header">
|
87 |
<div class="wdt-chart-wizard-overlay"></div>
|
93 |
</div>
|
94 |
</div>
|
95 |
|
96 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
97 |
<div class="card" data-type="chartjs_doughnut_chart" data-min_columns="2" data-max_columns="2">
|
98 |
<div class="card-header">
|
99 |
<div class="wdt-chart-wizard-overlay"></div>
|
106 |
</div>
|
107 |
</div>
|
108 |
|
109 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
110 |
<div class="card" data-type="chartjs_bubble_chart" data-min_columns="4" data-max_columns="4">
|
111 |
<div class="card-header">
|
112 |
<div class="wdt-chart-wizard-overlay"></div>
|
templates/admin/chart_wizard/steps/charts_pick/google_charts.inc.php
CHANGED
@@ -15,62 +15,62 @@
|
|
15 |
</div>
|
16 |
|
17 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
18 |
-
<div class="card" data-type="
|
19 |
<div class="card-header">
|
20 |
<div class="wdt-chart-wizard-overlay"></div>
|
21 |
-
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/
|
22 |
</div>
|
23 |
<div class="card-body">
|
24 |
-
<h4 class="f-14"><?php _e('
|
25 |
</div>
|
26 |
</div>
|
27 |
</div>
|
28 |
|
29 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
30 |
-
<div class="card" data-type="
|
31 |
<div class="card-header">
|
32 |
<div class="wdt-chart-wizard-overlay"></div>
|
33 |
-
<img class="img-responsive"
|
34 |
-
src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_stepped_area_chart.jpg">
|
35 |
</div>
|
36 |
<div class="card-body">
|
37 |
-
<h4 class="f-14"><?php _e('
|
38 |
</div>
|
39 |
</div>
|
40 |
</div>
|
41 |
|
42 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
43 |
-
<div class="card" data-type="
|
44 |
<div class="card-header">
|
45 |
<div class="wdt-chart-wizard-overlay"></div>
|
46 |
-
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/
|
47 |
</div>
|
48 |
<div class="card-body">
|
49 |
-
<h4 class="f-14"><?php _e('
|
50 |
</div>
|
51 |
</div>
|
52 |
</div>
|
53 |
|
54 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
55 |
-
<div class="card" data-type="
|
56 |
<div class="card-header">
|
57 |
<div class="wdt-chart-wizard-overlay"></div>
|
58 |
-
<img class="img-responsive"
|
|
|
59 |
</div>
|
60 |
<div class="card-body">
|
61 |
-
<h4 class="f-14"><?php _e('
|
62 |
</div>
|
63 |
</div>
|
64 |
</div>
|
65 |
|
66 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
67 |
-
<div class="card" data-type="
|
68 |
<div class="card-header">
|
69 |
<div class="wdt-chart-wizard-overlay"></div>
|
70 |
-
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/
|
71 |
</div>
|
72 |
<div class="card-body">
|
73 |
-
<h4 class="f-14"><?php _e('
|
74 |
</div>
|
75 |
</div>
|
76 |
</div>
|
@@ -80,31 +80,31 @@
|
|
80 |
<div class="row">
|
81 |
|
82 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
83 |
-
<div class="card" data-type="
|
84 |
<div class="card-header">
|
85 |
<div class="wdt-chart-wizard-overlay"></div>
|
86 |
-
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/
|
87 |
</div>
|
88 |
<div class="card-body">
|
89 |
-
<h4 class="f-14"><?php _e('
|
90 |
</div>
|
91 |
</div>
|
92 |
</div>
|
93 |
|
94 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
95 |
-
<div class="card" data-type="
|
96 |
<div class="card-header">
|
97 |
<div class="wdt-chart-wizard-overlay"></div>
|
98 |
-
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/
|
99 |
</div>
|
100 |
<div class="card-body">
|
101 |
-
<h4 class="f-14"><?php _e('
|
102 |
</div>
|
103 |
</div>
|
104 |
</div>
|
105 |
|
106 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
107 |
-
<div class="card" data-type="google_bubble_chart" data-min_columns="2" data-max_columns="0">
|
108 |
<div class="card-header">
|
109 |
<div class="wdt-chart-wizard-overlay"></div>
|
110 |
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_bubble_chart.jpg">
|
@@ -116,7 +116,7 @@
|
|
116 |
</div>
|
117 |
|
118 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
119 |
-
<div class="card" data-type="google_donut_chart" data-min_columns="2" data-max_columns="0">
|
120 |
<div class="card-header">
|
121 |
<div class="wdt-chart-wizard-overlay"></div>
|
122 |
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_donut_chart.jpg">
|
@@ -128,7 +128,7 @@
|
|
128 |
</div>
|
129 |
|
130 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
131 |
-
<div class="card" data-type="google_gauge_chart" data-min_columns="1" data-max_columns="2">
|
132 |
<div class="card-header">
|
133 |
<div class="wdt-chart-wizard-overlay"></div>
|
134 |
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_gauge_chart.jpg">
|
@@ -140,7 +140,7 @@
|
|
140 |
</div>
|
141 |
|
142 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
143 |
-
<div class="card" data-type="google_scatter_chart" data-min_columns="2" data-max_columns="0">
|
144 |
<div class="card-header">
|
145 |
<div class="wdt-chart-wizard-overlay"></div>
|
146 |
<img class="img-responsive"
|
@@ -157,7 +157,7 @@
|
|
157 |
<div class="row">
|
158 |
|
159 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
160 |
-
<div class="card" data-type="google_candlestick_chart" data-min_columns="5" data-max_columns="5">
|
161 |
<div class="card-header">
|
162 |
<div class="wdt-chart-wizard-overlay"></div>
|
163 |
<img class="img-responsive"
|
@@ -170,7 +170,7 @@
|
|
170 |
</div>
|
171 |
|
172 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
173 |
-
<div class="card" data-type="google_waterfall_chart" data-min_columns="5" data-max_columns="5">
|
174 |
<div class="card-header">
|
175 |
<div class="wdt-chart-wizard-overlay"></div>
|
176 |
<img class="img-responsive"
|
15 |
</div>
|
16 |
|
17 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
18 |
+
<div class="card" data-type="google_column_chart" data-min_columns="2" data-max_columns="0">
|
19 |
<div class="card-header">
|
20 |
<div class="wdt-chart-wizard-overlay"></div>
|
21 |
+
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_column_chart.jpg">
|
22 |
</div>
|
23 |
<div class="card-body">
|
24 |
+
<h4 class="f-14"><?php _e('Column chart', 'wpdatatables'); ?></h4>
|
25 |
</div>
|
26 |
</div>
|
27 |
</div>
|
28 |
|
29 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
30 |
+
<div class="card" data-type="google_pie_chart" data-min_columns="2" data-max_columns="2">
|
31 |
<div class="card-header">
|
32 |
<div class="wdt-chart-wizard-overlay"></div>
|
33 |
+
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_pie_chart.jpg">
|
|
|
34 |
</div>
|
35 |
<div class="card-body">
|
36 |
+
<h4 class="f-14"><?php _e('Pie chart', 'wpdatatables'); ?></h4>
|
37 |
</div>
|
38 |
</div>
|
39 |
</div>
|
40 |
|
41 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
42 |
+
<div class="card disabled" data-type="google_area_chart" data-min_columns="2" data-max_columns="0">
|
43 |
<div class="card-header">
|
44 |
<div class="wdt-chart-wizard-overlay"></div>
|
45 |
+
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_area_chart.jpg">
|
46 |
</div>
|
47 |
<div class="card-body">
|
48 |
+
<h4 class="f-14"><?php _e('Area chart', 'wpdatatables'); ?></h4>
|
49 |
</div>
|
50 |
</div>
|
51 |
</div>
|
52 |
|
53 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
54 |
+
<div class="card disabled" data-type="google_stepped_area_chart" data-min_columns="2" data-max_columns="0">
|
55 |
<div class="card-header">
|
56 |
<div class="wdt-chart-wizard-overlay"></div>
|
57 |
+
<img class="img-responsive"
|
58 |
+
src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_stepped_area_chart.jpg">
|
59 |
</div>
|
60 |
<div class="card-body">
|
61 |
+
<h4 class="f-14"><?php _e('Stepped area chart', 'wpdatatables'); ?></h4>
|
62 |
</div>
|
63 |
</div>
|
64 |
</div>
|
65 |
|
66 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
67 |
+
<div class="card disabled" data-type="google_histogram" data-min_columns="2" data-max_columns="0">
|
68 |
<div class="card-header">
|
69 |
<div class="wdt-chart-wizard-overlay"></div>
|
70 |
+
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_histogram.jpg">
|
71 |
</div>
|
72 |
<div class="card-body">
|
73 |
+
<h4 class="f-14"><?php _e('Histogram', 'wpdatatables'); ?></h4>
|
74 |
</div>
|
75 |
</div>
|
76 |
</div>
|
80 |
<div class="row">
|
81 |
|
82 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
83 |
+
<div class="card disabled" data-type="google_bar_chart" data-min_columns="2" data-max_columns="0">
|
84 |
<div class="card-header">
|
85 |
<div class="wdt-chart-wizard-overlay"></div>
|
86 |
+
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_bar_chart.jpg">
|
87 |
</div>
|
88 |
<div class="card-body">
|
89 |
+
<h4 class="f-14"><?php _e('Bar chart', 'wpdatatables'); ?></h4>
|
90 |
</div>
|
91 |
</div>
|
92 |
</div>
|
93 |
|
94 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
95 |
+
<div class="card disabled" data-type="google_stacked_bar_chart" data-min_columns="2" data-max_columns="0">
|
96 |
<div class="card-header">
|
97 |
<div class="wdt-chart-wizard-overlay"></div>
|
98 |
+
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_stacked_bar_chart.jpg">
|
99 |
</div>
|
100 |
<div class="card-body">
|
101 |
+
<h4 class="f-14"><?php _e('Stacked bar chart', 'wpdatatables'); ?></h4>
|
102 |
</div>
|
103 |
</div>
|
104 |
</div>
|
105 |
|
106 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
107 |
+
<div class="card disabled" data-type="google_bubble_chart" data-min_columns="2" data-max_columns="0">
|
108 |
<div class="card-header">
|
109 |
<div class="wdt-chart-wizard-overlay"></div>
|
110 |
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_bubble_chart.jpg">
|
116 |
</div>
|
117 |
|
118 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
119 |
+
<div class="card disabled" data-type="google_donut_chart" data-min_columns="2" data-max_columns="0">
|
120 |
<div class="card-header">
|
121 |
<div class="wdt-chart-wizard-overlay"></div>
|
122 |
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_donut_chart.jpg">
|
128 |
</div>
|
129 |
|
130 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
131 |
+
<div class="card disabled" data-type="google_gauge_chart" data-min_columns="1" data-max_columns="2">
|
132 |
<div class="card-header">
|
133 |
<div class="wdt-chart-wizard-overlay"></div>
|
134 |
<img class="img-responsive" src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/google_gauge_chart.jpg">
|
140 |
</div>
|
141 |
|
142 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
143 |
+
<div class="card disabled" data-type="google_scatter_chart" data-min_columns="2" data-max_columns="0">
|
144 |
<div class="card-header">
|
145 |
<div class="wdt-chart-wizard-overlay"></div>
|
146 |
<img class="img-responsive"
|
157 |
<div class="row">
|
158 |
|
159 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
160 |
+
<div class="card disabled" data-type="google_candlestick_chart" data-min_columns="5" data-max_columns="5">
|
161 |
<div class="card-header">
|
162 |
<div class="wdt-chart-wizard-overlay"></div>
|
163 |
<img class="img-responsive"
|
170 |
</div>
|
171 |
|
172 |
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
173 |
+
<div class="card disabled" data-type="google_waterfall_chart" data-min_columns="5" data-max_columns="5">
|
174 |
<div class="card-header">
|
175 |
<div class="wdt-chart-wizard-overlay"></div>
|
176 |
<img class="img-responsive"
|
templates/admin/chart_wizard/steps/charts_pick/highcharts.inc.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
<div class="row">
|
4 |
|
5 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
6 |
<div class="card" data-type="highcharts_line_chart" data-min_columns="2" data-max_columns="0">
|
7 |
<div class="card-header">
|
8 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -15,7 +15,7 @@
|
|
15 |
</div>
|
16 |
</div>
|
17 |
|
18 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
19 |
<div class="card" data-type="highcharts_spline_chart" data-min_columns="2" data-max_columns="0">
|
20 |
<div class="card-header">
|
21 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -28,7 +28,7 @@
|
|
28 |
</div>
|
29 |
</div>
|
30 |
|
31 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
32 |
<div class="card" data-type="highcharts_basic_area_chart" data-min_columns="2" data-max_columns="0">
|
33 |
<div class="card-header">
|
34 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -41,7 +41,7 @@
|
|
41 |
</div>
|
42 |
</div>
|
43 |
|
44 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
45 |
<div class="card" data-type="highcharts_stacked_area_chart" data-min_columns="2" data-max_columns="0">
|
46 |
<div class="card-header">
|
47 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -54,7 +54,7 @@
|
|
54 |
</div>
|
55 |
</div>
|
56 |
|
57 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
58 |
<div class="card" data-type="highcharts_basic_bar_chart" data-min_columns="2" data-max_columns="0">
|
59 |
<div class="card-header">
|
60 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -67,7 +67,7 @@
|
|
67 |
</div>
|
68 |
</div>
|
69 |
|
70 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
71 |
<div class="card" data-type="highcharts_stacked_bar_chart" data-min_columns="2" data-max_columns="0">
|
72 |
<div class="card-header">
|
73 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -84,7 +84,7 @@
|
|
84 |
|
85 |
<div class="row">
|
86 |
|
87 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
88 |
<div class="card" data-type="highcharts_basic_column_chart" data-min_columns="2" data-max_columns="0">
|
89 |
<div class="card-header">
|
90 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -97,7 +97,7 @@
|
|
97 |
</div>
|
98 |
</div>
|
99 |
|
100 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
101 |
<div class="card" data-type="highcharts_stacked_column_chart" data-min_columns="2" data-max_columns="0">
|
102 |
<div class="card-header">
|
103 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -110,7 +110,7 @@
|
|
110 |
</div>
|
111 |
</div>
|
112 |
|
113 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
114 |
<div class="card" data-type="highcharts_pie_chart" data-min_columns="2" data-max_columns="2">
|
115 |
<div class="card-header">
|
116 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -123,7 +123,7 @@
|
|
123 |
</div>
|
124 |
</div>
|
125 |
|
126 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
127 |
<div class="card" data-type="highcharts_pie_with_gradient_chart" data-min_columns="2" data-max_columns="2">
|
128 |
<div class="card-header">
|
129 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -136,7 +136,7 @@
|
|
136 |
</div>
|
137 |
</div>
|
138 |
|
139 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
140 |
<div class="card" data-type="highcharts_donut_chart" data-min_columns="2" data-max_columns="2">
|
141 |
<div class="card-header">
|
142 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -149,7 +149,7 @@
|
|
149 |
</div>
|
150 |
</div>
|
151 |
|
152 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
153 |
<div class="card" data-type="highcharts_scatter_plot" data-min_columns="2" data-max_columns="0">
|
154 |
<div class="card-header">
|
155 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -166,7 +166,7 @@
|
|
166 |
|
167 |
<div class="row">
|
168 |
|
169 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
170 |
<div class="card" data-type="highcharts_3d_column_chart" data-min_columns="2" data-max_columns="0">
|
171 |
<div class="card-header">
|
172 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -179,7 +179,7 @@
|
|
179 |
</div>
|
180 |
</div>
|
181 |
|
182 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
183 |
<div class="card" data-type="highcharts_3d_pie_chart" data-min_columns="2" data-max_columns="2">
|
184 |
<div class="card-header">
|
185 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -192,7 +192,7 @@
|
|
192 |
</div>
|
193 |
</div>
|
194 |
|
195 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
196 |
<div class="card" data-type="highcharts_3d_donut_chart" data-min_columns="2" data-max_columns="2">
|
197 |
<div class="card-header">
|
198 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -204,7 +204,7 @@
|
|
204 |
</div>
|
205 |
</div>
|
206 |
</div>
|
207 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
208 |
<div class="card" data-type="highcharts_treemap_chart" data-min_columns="2" data-max_columns="2">
|
209 |
<div class="card-header">
|
210 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -216,7 +216,7 @@
|
|
216 |
</div>
|
217 |
</div>
|
218 |
</div>
|
219 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
220 |
<div class="card" data-type="highcharts_treemap_level_chart" data-min_columns="3" data-max_columns="0">
|
221 |
<div class="card-header">
|
222 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -228,7 +228,7 @@
|
|
228 |
</div>
|
229 |
</div>
|
230 |
</div>
|
231 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
232 |
<div class="card" data-type="highcharts_polar_chart" data-min_columns="2" data-max_columns="0">
|
233 |
<div class="card-header">
|
234 |
<div class="wdt-chart-wizard-overlay"></div>
|
@@ -244,7 +244,7 @@
|
|
244 |
|
245 |
<div class="row">
|
246 |
|
247 |
-
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
|
248 |
<div class="card" data-type="highcharts_spiderweb_chart" data-min_columns="2" data-max_columns="0">
|
249 |
<div class="card-header">
|
250 |
<div class="wdt-chart-wizard-overlay"></div>
|
2 |
|
3 |
<div class="row">
|
4 |
|
5 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
6 |
<div class="card" data-type="highcharts_line_chart" data-min_columns="2" data-max_columns="0">
|
7 |
<div class="card-header">
|
8 |
<div class="wdt-chart-wizard-overlay"></div>
|
15 |
</div>
|
16 |
</div>
|
17 |
|
18 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
19 |
<div class="card" data-type="highcharts_spline_chart" data-min_columns="2" data-max_columns="0">
|
20 |
<div class="card-header">
|
21 |
<div class="wdt-chart-wizard-overlay"></div>
|
28 |
</div>
|
29 |
</div>
|
30 |
|
31 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
32 |
<div class="card" data-type="highcharts_basic_area_chart" data-min_columns="2" data-max_columns="0">
|
33 |
<div class="card-header">
|
34 |
<div class="wdt-chart-wizard-overlay"></div>
|
41 |
</div>
|
42 |
</div>
|
43 |
|
44 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
45 |
<div class="card" data-type="highcharts_stacked_area_chart" data-min_columns="2" data-max_columns="0">
|
46 |
<div class="card-header">
|
47 |
<div class="wdt-chart-wizard-overlay"></div>
|
54 |
</div>
|
55 |
</div>
|
56 |
|
57 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
58 |
<div class="card" data-type="highcharts_basic_bar_chart" data-min_columns="2" data-max_columns="0">
|
59 |
<div class="card-header">
|
60 |
<div class="wdt-chart-wizard-overlay"></div>
|
67 |
</div>
|
68 |
</div>
|
69 |
|
70 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
71 |
<div class="card" data-type="highcharts_stacked_bar_chart" data-min_columns="2" data-max_columns="0">
|
72 |
<div class="card-header">
|
73 |
<div class="wdt-chart-wizard-overlay"></div>
|
84 |
|
85 |
<div class="row">
|
86 |
|
87 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
88 |
<div class="card" data-type="highcharts_basic_column_chart" data-min_columns="2" data-max_columns="0">
|
89 |
<div class="card-header">
|
90 |
<div class="wdt-chart-wizard-overlay"></div>
|
97 |
</div>
|
98 |
</div>
|
99 |
|
100 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
101 |
<div class="card" data-type="highcharts_stacked_column_chart" data-min_columns="2" data-max_columns="0">
|
102 |
<div class="card-header">
|
103 |
<div class="wdt-chart-wizard-overlay"></div>
|
110 |
</div>
|
111 |
</div>
|
112 |
|
113 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
114 |
<div class="card" data-type="highcharts_pie_chart" data-min_columns="2" data-max_columns="2">
|
115 |
<div class="card-header">
|
116 |
<div class="wdt-chart-wizard-overlay"></div>
|
123 |
</div>
|
124 |
</div>
|
125 |
|
126 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
127 |
<div class="card" data-type="highcharts_pie_with_gradient_chart" data-min_columns="2" data-max_columns="2">
|
128 |
<div class="card-header">
|
129 |
<div class="wdt-chart-wizard-overlay"></div>
|
136 |
</div>
|
137 |
</div>
|
138 |
|
139 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
140 |
<div class="card" data-type="highcharts_donut_chart" data-min_columns="2" data-max_columns="2">
|
141 |
<div class="card-header">
|
142 |
<div class="wdt-chart-wizard-overlay"></div>
|
149 |
</div>
|
150 |
</div>
|
151 |
|
152 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
153 |
<div class="card" data-type="highcharts_scatter_plot" data-min_columns="2" data-max_columns="0">
|
154 |
<div class="card-header">
|
155 |
<div class="wdt-chart-wizard-overlay"></div>
|
166 |
|
167 |
<div class="row">
|
168 |
|
169 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
170 |
<div class="card" data-type="highcharts_3d_column_chart" data-min_columns="2" data-max_columns="0">
|
171 |
<div class="card-header">
|
172 |
<div class="wdt-chart-wizard-overlay"></div>
|
179 |
</div>
|
180 |
</div>
|
181 |
|
182 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
183 |
<div class="card" data-type="highcharts_3d_pie_chart" data-min_columns="2" data-max_columns="2">
|
184 |
<div class="card-header">
|
185 |
<div class="wdt-chart-wizard-overlay"></div>
|
192 |
</div>
|
193 |
</div>
|
194 |
|
195 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
196 |
<div class="card" data-type="highcharts_3d_donut_chart" data-min_columns="2" data-max_columns="2">
|
197 |
<div class="card-header">
|
198 |
<div class="wdt-chart-wizard-overlay"></div>
|
204 |
</div>
|
205 |
</div>
|
206 |
</div>
|
207 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
208 |
<div class="card" data-type="highcharts_treemap_chart" data-min_columns="2" data-max_columns="2">
|
209 |
<div class="card-header">
|
210 |
<div class="wdt-chart-wizard-overlay"></div>
|
216 |
</div>
|
217 |
</div>
|
218 |
</div>
|
219 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
220 |
<div class="card" data-type="highcharts_treemap_level_chart" data-min_columns="3" data-max_columns="0">
|
221 |
<div class="card-header">
|
222 |
<div class="wdt-chart-wizard-overlay"></div>
|
228 |
</div>
|
229 |
</div>
|
230 |
</div>
|
231 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
232 |
<div class="card" data-type="highcharts_polar_chart" data-min_columns="2" data-max_columns="0">
|
233 |
<div class="card-header">
|
234 |
<div class="wdt-chart-wizard-overlay"></div>
|
244 |
|
245 |
<div class="row">
|
246 |
|
247 |
+
<div class="wdt-chart-wizard-chart-selecter-block col-sm-2 disabled">
|
248 |
<div class="card" data-type="highcharts_spiderweb_chart" data-min_columns="2" data-max_columns="0">
|
249 |
<div class="card-header">
|
250 |
<div class="wdt-chart-wizard-overlay"></div>
|
templates/admin/chart_wizard/steps/step1.inc.php
CHANGED
@@ -2,10 +2,15 @@
|
|
2 |
|
3 |
<div class="row">
|
4 |
|
5 |
-
|
6 |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
<!-- .col-sm-4 -->
|
11 |
<div class="col-sm-6 col-md-6 chart-name">
|
2 |
|
3 |
<div class="row">
|
4 |
|
5 |
+
<div class="alert alert-warning alert-dismissible" role="alert" hidden>
|
6 |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
7 |
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
8 |
+
<?php _e('This feature is available in the ', 'wpdatatables'); ?><a class="tms-store-checkout-wpdatatables"><?php _e('full version of wpDataTables.', 'wpdatatables'); ?></a>
|
9 |
+
</div>
|
10 |
+
<div class="alert alert-info alert-dismissible" role="alert" hidden>
|
11 |
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
12 |
+
<?php _e('NEW awesome features!!! From version wpDataTables Lite 2.1 you can create Google charts: Line, Column and Pie. All other chart types are available in the', 'wpdatatables'); ?> <a class="tms-store-checkout-wpdatatables dark"><?php _e('full version of wpDataTables.', 'wpdatatables'); ?></a>
|
13 |
+
</div>
|
14 |
|
15 |
<!-- .col-sm-4 -->
|
16 |
<div class="col-sm-6 col-md-6 chart-name">
|
templates/admin/chart_wizard/steps/step2.inc.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('Access denied.'); ?>
|
2 |
+
|
3 |
+
<div class="row">
|
4 |
+
<div class="col-sm-6 col-md-6 data-source">
|
5 |
+
<h4 class="c-black m-b-20">
|
6 |
+
<?php _e('wpDataTable Data Source', 'wpdatatables'); ?>
|
7 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
8 |
+
title="<?php _e('Please pick a wpDataTable which will be used as a data source for this chart.', 'wpdatatables'); ?>"></i>
|
9 |
+
</h4>
|
10 |
+
<div class="form-group">
|
11 |
+
<div class="fg-line">
|
12 |
+
<div class="select">
|
13 |
+
<select class="selectpicker" name="wpdatatables-chart-source" id="wpdatatables-chart-source"
|
14 |
+
data-live-search="true">
|
15 |
+
<option value=""><?php _e('Pick a wpDataTable', 'wpdatatables'); ?></option>
|
16 |
+
<?php foreach (WPDataTable::getAllTables() as $table) { ?>
|
17 |
+
<option value="<?php echo $table['id'] ?>">
|
18 |
+
<?php echo "{$table['title']} (id: {$table['id']})";?>
|
19 |
+
</option>
|
20 |
+
<?php } ?>
|
21 |
+
</select>
|
22 |
+
</select>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
</div>
|
templates/admin/chart_wizard/steps/step3.inc.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('Access denied.'); ?>
|
2 |
+
|
3 |
+
<div class="col-sm-12 p-0 wdt-chart-column-picker-container">
|
4 |
+
|
5 |
+
<div class="alert alert-warning alert-dismissible" role="alert">
|
6 |
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
7 |
+
<?php _e('Charts data filtering and Row range are available in the','wpdatatables')?> <a class="tms-store-checkout-wpdatatables dark"><?php _e('full version of wpDataTables.','wpdatatables')?></a>
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<div class="existing-columns card col-sm-5-5">
|
11 |
+
<div class="card-header ch-alt">
|
12 |
+
<h2><?php _e('Columns in the data source', 'wpdatatables'); ?>
|
13 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
14 |
+
title="<?php _e('Choose table columns that you would like to use in the chart. You can either drag the column blocks, or click to select them and use controls in the middle to add or remove from the chart.', 'wpdatatables'); ?>"></i>
|
15 |
+
<button class="btn btn-xs bgm-gray waves-effect select-all-columns pull-right"><?php _e('Select All', 'wpdatatables'); ?></button>
|
16 |
+
</h2>
|
17 |
+
</div>
|
18 |
+
<div class="wdt-chart-wizart-existing-columns-container card-body card-padding">
|
19 |
+
|
20 |
+
</div>
|
21 |
+
</div>
|
22 |
+
|
23 |
+
<div class="picker_column col-sm-1">
|
24 |
+
<button class="btn bgm-gray waves-effect" id="wdt-add-all-chart-columns" data-toggle="tooltip"
|
25 |
+
data-original-title="<?php _e('Add all', 'wpdatatables'); ?>"></button>
|
26 |
+
<button class="btn bgm-gray waves-effect" id="wdt-add-chart-columns" data-toggle="tooltip"
|
27 |
+
data-original-title="<?php _e('Add', 'wpdatatables'); ?>"></button>
|
28 |
+
<button class="btn bgm-gray waves-effect" id="wdt-remove-chart-columns" data-toggle="tooltip"
|
29 |
+
data-original-title="<?php _e('Remove', 'wpdatatables'); ?>"></button>
|
30 |
+
<button class="btn bgm-gray waves-effect" id="wdt-remove-all-chart-columns" data-toggle="tooltip"
|
31 |
+
data-original-title="<?php _e('Remove all', 'wpdatatables'); ?>"></button>
|
32 |
+
</div>
|
33 |
+
|
34 |
+
<div class="chosen_columns card col-sm-5-5">
|
35 |
+
<div class="card-header ch-alt">
|
36 |
+
<h2><?php _e('Columns used in the chart', 'wpdatatables'); ?>
|
37 |
+
<button class="btn btn-xs bgm-gray waves-effect select-all-columns pull-right"><?php _e('Select All', 'wpdatatables'); ?></button>
|
38 |
+
</h2>
|
39 |
+
</div>
|
40 |
+
<div class="wdt-chart-wizard-chosen-columns-container card-body card-padding">
|
41 |
+
<div class="strings-error alert alert-danger m-b-10"
|
42 |
+
style="display:none"><?php _e('Please do not add more then one string-type (date/time, image, email, URL) column since only one can be used as a label', 'wpdatatables'); ?></div>
|
43 |
+
<div class="min-columns-error alert alert-danger m-b-10"
|
44 |
+
style="display:none"><?php _e('Minimum count of columns for this chart type is ', 'wpdatatables'); ?>
|
45 |
+
<span class="columns"></span></div>
|
46 |
+
<div class="max-columns-error alert alert-danger m-b-10"
|
47 |
+
style="display:none"><?php _e('Maximum count of columns for this chart type is ', 'wpdatatables'); ?>
|
48 |
+
<span class="columns"></span></div>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<div class="col-sm-12 p-0">
|
55 |
+
|
56 |
+
<div class="col-sm-5-5 p-l-0 data-filtering disabled">
|
57 |
+
<h4 class="c-black m-b-20">
|
58 |
+
<?php _e('Charts data filtering', 'wpdatatables'); ?>
|
59 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
60 |
+
title="<?php _e('If you enable this, chart will automatically re-render with actual data every time you sort, filter, or switch pages in the table (chart must be in the same page with the table).', 'wpdatatables'); ?>"></i>
|
61 |
+
</h4>
|
62 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
63 |
+
<label for="follow-table-filtering"><?php _e('Follow table filtering', 'wpdatatables'); ?></label>
|
64 |
+
<input id="follow-table-filtering" type="checkbox" hidden="hidden">
|
65 |
+
<label for="follow-table-filtering" class="ts-helper"></label>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
|
69 |
+
<div class="col-sm-5-5 pull-right p-r-0 disabled">
|
70 |
+
<h4 class="c-black m-b-20">
|
71 |
+
<?php _e('Row range', 'wpdatatables'); ?>
|
72 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
73 |
+
title="<?php _e('Please choose the row range.', 'wpdatatables'); ?> <?php _e('If you do not want data from all the table rows to be in the chart, you can pick the row range manually. Please note that if the data set is large the range picker can load slowly or even cause an out of memory error.', 'wpdatatables'); ?>"></i>
|
74 |
+
</h4>
|
75 |
+
<div class="form-group m-0">
|
76 |
+
<div class="fg-line">
|
77 |
+
<div class="select">
|
78 |
+
<select class="selectpicker" name="wdt-chart-row-range-type" id="wdt-chart-row-range-type">
|
79 |
+
<option value="all_rows"><?php _e('All rows (default)', 'wpdatatables'); ?></option>
|
80 |
+
<option value="pick_rows"><?php _e('Pick range (slow on large datasets)', 'wpdatatables'); ?></option>
|
81 |
+
</select>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
<div id="range_picked_info"><?php _e('Rows picked', 'wpdatatables'); ?>: <span
|
86 |
+
class="rowspicked"><?php _e('All', 'wpdatatables'); ?></span></div>
|
87 |
+
<button class="btn bgm-gray btn-icon-text waves-effect" id="open-range-picker-btn"
|
88 |
+
style="display:none"><?php _e('Range picker...', 'wpdatatables'); ?></button>
|
89 |
+
<br/>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
</div>
|
93 |
+
|
94 |
+
<script id="wdt-chart-column-block" type="text/x-jsrender">
|
95 |
+
{{for columns}}
|
96 |
+
<div class="btn btn-default btn-block chart-column-block {{:column_type}} m-t-5" data-column_id="{{:id}}" data-orig_header="{{:orig_header}}"><strong>{{:display_header}}</strong> ({{:column_type}})</div>
|
97 |
+
{{/for}}
|
98 |
+
|
99 |
+
</script>
|
templates/admin/chart_wizard/steps/step4.inc.php
ADDED
@@ -0,0 +1,546 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('Access denied.'); ?>
|
2 |
+
|
3 |
+
<div class="row">
|
4 |
+
<div class="alert alert-warning alert-dismissible" role="alert">
|
5 |
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
6 |
+
<?php _e('All options that are disabled are available in the','wpdatatables')?> <a class="tms-store-checkout-wpdatatables"><?php _e('full version of wpDataTables.','wpdatatables')?></a>
|
7 |
+
</div>
|
8 |
+
|
9 |
+
<div class="col-sm-5 col-md-5 col-lg-5 m-b-20">
|
10 |
+
<div id="chart-container-tabs" class=" settings">
|
11 |
+
|
12 |
+
<div class="col-sm-3 col-md-3 col-lg-4">
|
13 |
+
<ul class="tab-nav settings">
|
14 |
+
<li class="chart-container active"><a href="#chart-container-tabs-1"
|
15 |
+
data-toggle="tab"><?php _e('Chart', 'wpdatatables'); ?></a>
|
16 |
+
</li>
|
17 |
+
<li class="chart-container series"><a href="#chart-container-tabs-2" data-toggle="tab"
|
18 |
+
class=""><?php _e('Series', 'wpdatatables'); ?></a></li>
|
19 |
+
<li class="chart-container axes"><a href="#chart-container-tabs-3" data-toggle="tab"
|
20 |
+
class=""><?php _e('Axes', 'wpdatatables'); ?></a></li>
|
21 |
+
<li class="chart-container title"><a href="#chart-container-tabs-4" data-toggle="tab"
|
22 |
+
class=""><?php _e('Title', 'wpdatatables'); ?></a></li>
|
23 |
+
<li class="chart-container tooltips"><a href="#chart-container-tabs-5" data-toggle="tab"
|
24 |
+
class=""><?php _e('Tooltip', 'wpdatatables'); ?></a></li>
|
25 |
+
<li class="chart-container legend"><a href="#chart-container-tabs-6" data-toggle="tab"
|
26 |
+
class=""><?php _e('Legend', 'wpdatatables'); ?></a></li>
|
27 |
+
<li class="chart-container highcharts"><a href="#chart-container-tabs-7" data-toggle="tab"
|
28 |
+
class=""><?php _e('Exporting', 'wpdatatables'); ?></a>
|
29 |
+
</li>
|
30 |
+
<li class="chart-container highcharts"><a href="#chart-container-tabs-8" data-toggle="tab"
|
31 |
+
class=""><?php _e('Credits', 'wpdatatables'); ?></a></li>
|
32 |
+
</ul>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<div class="tab-content p-0">
|
36 |
+
<div id="chart-container-tabs-2"
|
37 |
+
class="col-sm-9 col-md-9 col-lg-8 chart-container chart-options-container tab-pane">
|
38 |
+
<div>
|
39 |
+
<h4 class="c-black m-b-20">
|
40 |
+
<?php _e('Series settings', 'wpdatatables'); ?>
|
41 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
42 |
+
title="<?php _e('If you want to redefine the series labels and colors you can do it here.', 'wpdatatables'); ?>"></i>
|
43 |
+
</h4>
|
44 |
+
</div>
|
45 |
+
<div>
|
46 |
+
<div id="series-settings-container">
|
47 |
+
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
<div class="chartjs google disabled" id="curve-type-row">
|
51 |
+
<h4 class="c-black m-b-20">
|
52 |
+
<?php _e('Curve type', 'wpdatatables'); ?>
|
53 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
54 |
+
title="<?php _e('Controls the curve of the lines', 'wpdatatables'); ?>"></i>
|
55 |
+
</h4>
|
56 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
57 |
+
<label for="curve-type"><?php _e('Check for smoothed lines', 'wpdatatables'); ?></label>
|
58 |
+
<input id="curve-type" type="checkbox" hidden="hidden">
|
59 |
+
<label for="curve-type" class="ts-helper"></label>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
<div id="chart-container-tabs-1"
|
64 |
+
class="col-sm-9 col-md-9 col-lg-8 chart-container chart-options-container tab-pane active">
|
65 |
+
<div class="chart-width">
|
66 |
+
<h4 class="c-black m-b-20">
|
67 |
+
<?php _e('Chart width', 'wpdatatables'); ?>
|
68 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
69 |
+
title="<?php _e('The width of the chart.', 'wpdatatables'); ?>"></i>
|
70 |
+
</h4>
|
71 |
+
<div class="form-group">
|
72 |
+
<div class="fg-line">
|
73 |
+
<div class="row">
|
74 |
+
<div class="col-sm-12">
|
75 |
+
<input type="number" name="chart-width" id="chart-width"
|
76 |
+
class="form-control input-sm" value="400"/>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
<div class="responsive-width disabled">
|
83 |
+
<h4 class="c-black m-b-20">
|
84 |
+
<?php _e('Responsive width', 'wpdatatables'); ?>
|
85 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
86 |
+
title="<?php _e('If you tick this chart width will always adjust to 100% width of the container', 'wpdatatables'); ?>"></i>
|
87 |
+
</h4>
|
88 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
89 |
+
<label for="chart-responsive-width"><?php _e('Responsive chart width', 'wpdatatables'); ?></label>
|
90 |
+
<input id="chart-responsive-width" type="checkbox" hidden="hidden">
|
91 |
+
<label for="chart-responsive-width" class="ts-helper"></label>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
<div class="chart-height">
|
95 |
+
<h4 class="c-black m-b-20">
|
96 |
+
<?php _e('Chart height', 'wpdatatables'); ?>
|
97 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
98 |
+
title="<?php _e('The height of the chart.', 'wpdatatables'); ?>"></i>
|
99 |
+
</h4>
|
100 |
+
<div class="form-group">
|
101 |
+
<div class="fg-line">
|
102 |
+
<div class="row">
|
103 |
+
<div class="col-sm-12">
|
104 |
+
<input type="number" name="chart-height" id="chart-height"
|
105 |
+
class="form-control input-sm" value="400"/>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
<div class="group-chart disabled">
|
112 |
+
<h4 class="c-black m-b-20">
|
113 |
+
<?php _e('Group chart', 'wpdatatables'); ?>
|
114 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
115 |
+
title="<?php _e('If you tick this checkbox, the values of the rows with same label will be summed up and rendered as a single series. If you leave it unticked all rows will be rendered as separate series.', 'wpdatatables'); ?>"></i>
|
116 |
+
</h4>
|
117 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
118 |
+
<label for="group-chart"><?php _e('Enable grouping', 'wpdatatables'); ?></label>
|
119 |
+
<input id="group-chart" type="checkbox" hidden="hidden">
|
120 |
+
<label for="group-chart" class="ts-helper"></label>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
<div class="background-color-container" id="background-color-container">
|
124 |
+
<h4 class="c-black m-b-20">
|
125 |
+
<?php _e('Background color', 'wpdatatables'); ?>
|
126 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
127 |
+
title="<?php _e('The background color for the outer chart area.', 'wpdatatables'); ?>"></i>
|
128 |
+
</h4>
|
129 |
+
<div class="cp-container">
|
130 |
+
<div class="form-group">
|
131 |
+
<div class="fg-line dropdown">
|
132 |
+
<div id="cp"
|
133 |
+
class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
|
134 |
+
<input type="text" id="background-color" value=""
|
135 |
+
class="form-control cp-value background-color"/>
|
136 |
+
<span class="input-group-addon wpcolorpicker-icon"><i></i></span>
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
</div>
|
140 |
+
</div>
|
141 |
+
</div>
|
142 |
+
<div class="border-width">
|
143 |
+
<h4 class="c-black m-b-20">
|
144 |
+
<?php _e('Border width', 'wpdatatables'); ?>
|
145 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
146 |
+
title="<?php _e('The pixel width of the outer chart border.', 'wpdatatables'); ?>"></i>
|
147 |
+
</h4>
|
148 |
+
<div class="form-group">
|
149 |
+
<div class="fg-line">
|
150 |
+
<div class="row">
|
151 |
+
<div class="col-sm-12">
|
152 |
+
<input type="number" name="border-width" id="border-width"
|
153 |
+
class="form-control input-sm" value="0"/>
|
154 |
+
</div>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
<div class="border-color-container" id="border-color-container">
|
160 |
+
<h4 class="c-black m-b-20">
|
161 |
+
<?php _e('Border color', 'wpdatatables'); ?>
|
162 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
163 |
+
title="<?php _e('The color of the outer chart border.', 'wpdatatables'); ?>"></i>
|
164 |
+
</h4>
|
165 |
+
<div class="cp-container">
|
166 |
+
<div class="form-group">
|
167 |
+
<div class="fg-line dropdown">
|
168 |
+
<div id="cp"
|
169 |
+
class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
|
170 |
+
<input type="text" id="border_color" value=""
|
171 |
+
class="form-control cp-value plot border_color"/>
|
172 |
+
<span class="input-group-addon wpcolorpicker-icon"><i></i></span>
|
173 |
+
</div>
|
174 |
+
</div>
|
175 |
+
</div>
|
176 |
+
</div>
|
177 |
+
</div>
|
178 |
+
|
179 |
+
<div class="border-radius">
|
180 |
+
<h4 class="c-black m-b-20">
|
181 |
+
<?php _e('Border radius', 'wpdatatables'); ?>
|
182 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
183 |
+
title="<?php _e('The corner radius of the outer chart border.', 'wpdatatables'); ?>"></i>
|
184 |
+
</h4>
|
185 |
+
<div class="form-group">
|
186 |
+
<div class="fg-line">
|
187 |
+
<div class="row">
|
188 |
+
<div class="col-sm-12">
|
189 |
+
<input type="number" name="border-radius" id="border-radius"
|
190 |
+
class="form-control input-sm" value="0"/>
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
|
197 |
+
<div class="google highcharts" id="plot-background-color-container">
|
198 |
+
<h4 class="c-black m-b-20">
|
199 |
+
<?php _e('Plot background color', 'wpdatatables'); ?>
|
200 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
201 |
+
title="<?php _e('The background color or gradient for the plot area.', 'wpdatatables'); ?>"></i>
|
202 |
+
</h4>
|
203 |
+
<div class="cp-container">
|
204 |
+
<div class="form-group">
|
205 |
+
<div class="fg-line dropdown">
|
206 |
+
<div id="cp"
|
207 |
+
class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
|
208 |
+
<input type="text" id="plot-background-color" value=""
|
209 |
+
class="form-control cp-value plot-background-color"/>
|
210 |
+
<span class="input-group-addon wpcolorpicker-icon"><i></i></span>
|
211 |
+
</div>
|
212 |
+
</div>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
</div>
|
216 |
+
<div class="google highcharts" id="plot-border-width-row">
|
217 |
+
<h4 class="c-black m-b-20">
|
218 |
+
<?php _e('Plot border width', 'wpdatatables'); ?>
|
219 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
220 |
+
title="<?php _e('The corner radius of the outer chart border.', 'wpdatatables'); ?>"></i>
|
221 |
+
</h4>
|
222 |
+
<div class="form-group">
|
223 |
+
<div class="fg-line">
|
224 |
+
<div class="row">
|
225 |
+
<div class="col-sm-12">
|
226 |
+
<input type="number" name="plot-border-width" id="plot-border-width"
|
227 |
+
class="form-control input-sm plot-border-width" value=""/>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
</div>
|
231 |
+
</div>
|
232 |
+
</div>
|
233 |
+
<div class="google highcharts" id="plot-border-color-container">
|
234 |
+
<h4 class="c-black m-b-20">
|
235 |
+
<?php _e('Plot border color', 'wpdatatables'); ?>
|
236 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
237 |
+
title="<?php _e('The color of the inner chart or plot area border.', 'wpdatatables'); ?>"></i>
|
238 |
+
</h4>
|
239 |
+
<div class="cp-container">
|
240 |
+
<div class="form-group">
|
241 |
+
<div class="fg-line dropdown">
|
242 |
+
<div id="cp"
|
243 |
+
class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
|
244 |
+
<input type="text" id="plot-border-color" value=""
|
245 |
+
class="form-control cp-value plot-border-color"/>
|
246 |
+
<span class="input-group-addon wpcolorpicker-icon"><i></i></span>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
</div>
|
250 |
+
</div>
|
251 |
+
</div>
|
252 |
+
<div class="google chartjs disabled" id="font-size-row">
|
253 |
+
<h4 class="c-black m-b-20">
|
254 |
+
<?php _e('Font size', 'wpdatatables'); ?>
|
255 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
256 |
+
title="<?php _e('The default font size, in pixels, of all text in the chart.', 'wpdatatables'); ?>"></i>
|
257 |
+
</h4>
|
258 |
+
<div class="form-group">
|
259 |
+
<div class="fg-line">
|
260 |
+
<div class="row">
|
261 |
+
<div class="col-sm-12">
|
262 |
+
<input type="number" min="0" name="font-size" id="font-size"
|
263 |
+
class="form-control input-sm" value=""/>
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
</div>
|
267 |
+
</div>
|
268 |
+
</div>
|
269 |
+
<div class="google chartjs disabled" id="font-name-row">
|
270 |
+
<h4 class="c-black m-b-20">
|
271 |
+
<?php _e('Font name', 'wpdatatables'); ?>
|
272 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
273 |
+
title="<?php _e('The default font face for all text in the chart.', 'wpdatatables'); ?>"></i>
|
274 |
+
</h4>
|
275 |
+
<div class="form-group">
|
276 |
+
<div class="fg-line">
|
277 |
+
<div class="row">
|
278 |
+
<div class="col-sm-12">
|
279 |
+
<input type="text" name="font-name" id="font-name" value="Arial"
|
280 |
+
class="form-control input-sm"/>
|
281 |
+
</div>
|
282 |
+
</div>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
+
</div>
|
286 |
+
</div>
|
287 |
+
<div id="chart-container-tabs-3"
|
288 |
+
class="col-sm-9 col-md-9 col-lg-8 chart-container chart-options-container tab-pane">
|
289 |
+
<div class="inside">
|
290 |
+
<div id="show-grid-row">
|
291 |
+
<h4 class="c-black m-b-20">
|
292 |
+
<?php _e('Grid', 'wpdatatables'); ?>
|
293 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
294 |
+
title="<?php _e('Controls the curve of the lines', 'wpdatatables'); ?>"></i>
|
295 |
+
</h4>
|
296 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
297 |
+
<label for="show-grid"><?php _e('Do you want to show grid on the chart', 'wpdatatables'); ?></label>
|
298 |
+
<input id="show-grid" type="checkbox" hidden="hidden" checked>
|
299 |
+
<label for="show-grid" class="ts-helper"></label>
|
300 |
+
</div>
|
301 |
+
</div>
|
302 |
+
<div id="horizontal-axis-label-row">
|
303 |
+
<h4 class="c-black m-b-20">
|
304 |
+
<?php _e('Horizontal axis label', 'wpdatatables'); ?>
|
305 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
306 |
+
title="<?php _e('Name of the horizontal axis.', 'wpdatatables'); ?>"></i>
|
307 |
+
</h4>
|
308 |
+
<div class="form-group">
|
309 |
+
<div class="fg-line">
|
310 |
+
<div class="row">
|
311 |
+
<div class="col-sm-12">
|
312 |
+
<input type="text" id="horizontal-axis-label" value=""
|
313 |
+
class="form-control input-sm"/>
|
314 |
+
</div>
|
315 |
+
</div>
|
316 |
+
</div>
|
317 |
+
</div>
|
318 |
+
</div>
|
319 |
+
<div class="google highcharts disabled" id="horizontal-axis-crosshair-row">
|
320 |
+
<h4 class="c-black m-b-20">
|
321 |
+
<?php _e('Horizontal crosshair', 'wpdatatables'); ?>
|
322 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
323 |
+
title="<?php _e('Configure a horizontal crosshair that follows either the mouse pointer or the hovered point lines', 'wpdatatables'); ?>"></i>
|
324 |
+
</h4>
|
325 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
326 |
+
<label for="horizontal-axis-crosshair"><?php _e('Show x-Axis crosshair', 'wpdatatables'); ?></label>
|
327 |
+
<input id="horizontal-axis-crosshair" type="checkbox" hidden="hidden">
|
328 |
+
<label for="horizontal-axis-crosshair" class="ts-helper"></label>
|
329 |
+
</div>
|
330 |
+
</div>
|
331 |
+
<div class="google disabled" id="horizontal-axis-direction-row">
|
332 |
+
<h4 class="c-black m-b-20">
|
333 |
+
<?php _e('Horizontal axis direction', 'wpdatatables'); ?>
|
334 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
335 |
+
title="<?php _e('The direction in which the values along the horizontal axis grow. Specify -1 to reverse the order of the values', 'wpdatatables'); ?>"></i>
|
336 |
+
</h4>
|
337 |
+
<div class="form-group">
|
338 |
+
<div class="fg-line">
|
339 |
+
<div class="select">
|
340 |
+
<select class="selectpicker" name="horizontal-axis-direction"
|
341 |
+
id="horizontal-axis-direction">
|
342 |
+
<option selected="selected" value="1">1</option>
|
343 |
+
<option value="-1">-1</option>
|
344 |
+
</select>
|
345 |
+
</div>
|
346 |
+
</div>
|
347 |
+
</div>
|
348 |
+
</div>
|
349 |
+
<div id="vertical-axis-label-row">
|
350 |
+
<h4 class="c-black m-b-20">
|
351 |
+
<?php _e('Vertical axis label', 'wpdatatables'); ?>
|
352 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
353 |
+
title="<?php _e('Name of the vertical axis.', 'wpdatatables'); ?>"></i>
|
354 |
+
</h4>
|
355 |
+
<div class="form-group">
|
356 |
+
<div class="fg-line">
|
357 |
+
<div class="row">
|
358 |
+
<div class="col-sm-12">
|
359 |
+
<input type="text" id="vertical-axis-label" value=""
|
360 |
+
class="form-control input-sm"/>
|
361 |
+
</div>
|
362 |
+
</div>
|
363 |
+
</div>
|
364 |
+
</div>
|
365 |
+
</div>
|
366 |
+
<div class="google highcharts disabled" id="vertical-axis-crosshair-row">
|
367 |
+
<h4 class="c-black m-b-20">
|
368 |
+
<?php _e('Vertical crosshair', 'wpdatatables'); ?>
|
369 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
370 |
+
title="<?php _e('Configure a vertical crosshair that follows either the mouse pointer or the hovered point lines', 'wpdatatables'); ?>"></i>
|
371 |
+
</h4>
|
372 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
373 |
+
<label for="vertical-axis-crosshair"><?php _e('Show y-Axis crosshair', 'wpdatatables'); ?></label>
|
374 |
+
<input id="vertical-axis-crosshair" type="checkbox" hidden="hidden">
|
375 |
+
<label for="vertical-axis-crosshair" class="ts-helper"></label>
|
376 |
+
</div>
|
377 |
+
</div>
|
378 |
+
<div class="google disabled" id="vertical-axis-direction-row">
|
379 |
+
<h4 class="c-black m-b-20">
|
380 |
+
<?php _e('Vertical axis direction', 'wpdatatables'); ?>
|
381 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
382 |
+
title="<?php _e('The direction in which the values along the vertical axis grow. Specify -1 to reverse the order of the values', 'wpdatatables'); ?>"></i>
|
383 |
+
</h4>
|
384 |
+
<div class="form-group">
|
385 |
+
<div class="fg-line">
|
386 |
+
<div class="select">
|
387 |
+
<select class="selectpicker" name="vertical-axis-direction"
|
388 |
+
id="vertical-axis-direction">
|
389 |
+
<option selected="selected" value="1">1</option>
|
390 |
+
<option value="-1">-1</option>
|
391 |
+
</select>
|
392 |
+
</div>
|
393 |
+
</div>
|
394 |
+
</div>
|
395 |
+
</div>
|
396 |
+
<div class="disabled" id="vertical-axis-min-row">
|
397 |
+
<h4 class="c-black m-b-20">
|
398 |
+
<?php _e('Vertical axis min value', 'wpdatatables'); ?>
|
399 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
400 |
+
title="<?php _e('The minimum value of the axis.', 'wpdatatables'); ?>"></i>
|
401 |
+
</h4>
|
402 |
+
<div class="form-group">
|
403 |
+
<div class="fg-line">
|
404 |
+
<div class="row">
|
405 |
+
<div class="col-sm-12">
|
406 |
+
<input type="number" min="0" id="vertical-axis-min" value=""
|
407 |
+
class="form-control input-sm"/>
|
408 |
+
</div>
|
409 |
+
</div>
|
410 |
+
</div>
|
411 |
+
</div>
|
412 |
+
</div>
|
413 |
+
<div class="disabled" id="vertical-axis-max-row">
|
414 |
+
<h4 class="c-black m-b-20">
|
415 |
+
<?php _e('Vertical axis max value', 'wpdatatables'); ?>
|
416 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
417 |
+
title="<?php _e('The maximum value of the axis.', 'wpdatatables'); ?>"></i>
|
418 |
+
</h4>
|
419 |
+
<div class="form-group">
|
420 |
+
<div class="fg-line">
|
421 |
+
<div class="row">
|
422 |
+
<div class="col-sm-12">
|
423 |
+
<input type="number" min="0" id="vertical-axis-max" value=""
|
424 |
+
class="form-control input-sm"/>
|
425 |
+
</div>
|
426 |
+
</div>
|
427 |
+
</div>
|
428 |
+
</div>
|
429 |
+
</div>
|
430 |
+
<div class="google highcharts disabled" id="inverted-row">
|
431 |
+
<h4 class="c-black m-b-20">
|
432 |
+
<?php _e('Invert', 'wpdatatables'); ?>
|
433 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
434 |
+
title="<?php _e('Whether to invert the axes so that the x axis is vertical and y axis is horizontal', 'wpdatatables'); ?>"></i>
|
435 |
+
</h4>
|
436 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
437 |
+
<label for="inverted"><?php _e('Invert chart axes', 'wpdatatables'); ?></label>
|
438 |
+
<input id="inverted" type="checkbox" hidden="hidden">
|
439 |
+
<label for="inverted" class="ts-helper"></label>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
</div>
|
443 |
+
</div>
|
444 |
+
<div id="chart-container-tabs-4"
|
445 |
+
class="col-sm-9 col-md-9 col-lg-8 chart-container chart-options-container tab-pane">
|
446 |
+
<div class="inside">
|
447 |
+
<div id="show-chart-title-row">
|
448 |
+
<h4 class="c-black m-b-20">
|
449 |
+
<?php _e('Chart title', 'wpdatatables'); ?>
|
450 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
451 |
+
title="<?php _e('Do you want to show the chart title on the page', 'wpdatatables'); ?>"></i>
|
452 |
+
</h4>
|
453 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
454 |
+
<label for="show-chart-title"><?php _e('Show title', 'wpdatatables'); ?></label>
|
455 |
+
<input id="show-chart-title" type="checkbox" hidden="hidden" checked>
|
456 |
+
<label for="show-chart-title" class="ts-helper"></label>
|
457 |
+
</div>
|
458 |
+
</div>
|
459 |
+
<div class="google highcharts" id="title-floating-row">
|
460 |
+
<h4 class="c-black m-b-20">
|
461 |
+
<?php _e('Title floating', 'wpdatatables'); ?>
|
462 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
463 |
+
title="<?php _e('When the title is floating, the plot area will not move to make space for it', 'wpdatatables'); ?>"></i>
|
464 |
+
</h4>
|
465 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
466 |
+
<label for="title-floating"><?php _e('Enable floating', 'wpdatatables'); ?></label>
|
467 |
+
<input id="title-floating" type="checkbox" hidden="hidden">
|
468 |
+
<label for="title-floating" class="ts-helper"></label>
|
469 |
+
</div>
|
470 |
+
</div>
|
471 |
+
</div>
|
472 |
+
</div>
|
473 |
+
<div id="chart-container-tabs-5"
|
474 |
+
class="col-sm-9 col-md-9 col-lg-8 chart-container chart-options-container tab-pane">
|
475 |
+
<div class="inside">
|
476 |
+
<div class="disabled" id="tooltip-enabled-row">
|
477 |
+
<h4 class="c-black m-b-20">
|
478 |
+
<?php _e('Tooltip', 'wpdatatables'); ?>
|
479 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
480 |
+
title="<?php _e('Enable or disable the tooltip', 'wpdatatables'); ?>"></i>
|
481 |
+
</h4>
|
482 |
+
<div class="toggle-switch p-b-20 p-t-5" data-ts-color="blue">
|
483 |
+
<label for="tooltip-enabled"><?php _e('Show tooltip', 'wpdatatables'); ?></label>
|
484 |
+
<input id="tooltip-enabled" type="checkbox" hidden="hidden">
|
485 |
+
<label for="tooltip-enabled" class="ts-helper"></label>
|
486 |
+
</div>
|
487 |
+
</div>
|
488 |
+
</div>
|
489 |
+
</div>
|
490 |
+
<div id="chart-container-tabs-6"
|
491 |
+
class="col-sm-9 col-md-9 col-lg-8 chart-container chart-options-container tab-pane">
|
492 |
+
<div class="inside">
|
493 |
+
|
494 |
+
<div class="google" id="legend-position-row">
|
495 |
+
<h4 class="c-black m-b-20">
|
496 |
+
<?php _e('Position', 'wpdatatables'); ?>
|
497 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
498 |
+
title="<?php _e('Position of the legend', 'wpdatatables'); ?>"></i>
|
499 |
+
</h4>
|
500 |
+
<div class="form-group">
|
501 |
+
<div class="fg-line">
|
502 |
+
<div class="select">
|
503 |
+
<select class="selectpicker" name="legend_position" id="legend_position">
|
504 |
+
<option value="right">Right</option>
|
505 |
+
<option selected="selected" value="bottom">Bottom</option>
|
506 |
+
<option value="top">Top</option>
|
507 |
+
<option value="in">In</option>
|
508 |
+
<option value="none">None</option>
|
509 |
+
</select>
|
510 |
+
</div>
|
511 |
+
</div>
|
512 |
+
</div>
|
513 |
+
</div>
|
514 |
+
<div class="google highcharts" id="legend_vertical_align_row">
|
515 |
+
<h4 class="c-black m-b-20">
|
516 |
+
<?php _e('Vertical align', 'wpdatatables'); ?>
|
517 |
+
<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
|
518 |
+
title="<?php _e('The vertical alignment of the legend box', 'wpdatatables'); ?>"></i>
|
519 |
+
</h4>
|
520 |
+
<div class="form-group">
|
521 |
+
<div class="fg-line">
|
522 |
+
<div class="select">
|
523 |
+
<select class="selectpicker" name="legend_vertical_align"
|
524 |
+
id="legend_vertical_align">
|
525 |
+
<option selected="selected" value="bottom">Bottom</option>
|
526 |
+
<option value="middle">Middle</option>
|
527 |
+
<option value="top">Top</option>
|
528 |
+
</select>
|
529 |
+
</div>
|
530 |
+
</div>
|
531 |
+
</div>
|
532 |
+
</div>
|
533 |
+
</div>
|
534 |
+
</div>
|
535 |
+
</div>
|
536 |
+
|
537 |
+
</div>
|
538 |
+
</div>
|
539 |
+
|
540 |
+
<div class="col-sm-7 col-md-7 col-lg-7">
|
541 |
+
<div class="chart-preview-container">
|
542 |
+
<div id="google-chart-container"></div>
|
543 |
+
</div>
|
544 |
+
</div>
|
545 |
+
|
546 |
+
</div>
|
templates/admin/chart_wizard/steps/step5.inc.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('Access denied.'); ?>
|
2 |
+
|
3 |
+
<div class="m-b-20">
|
4 |
+
<label class="m-b-10"><?php _e('Paste this shortcode to render this chart', 'wpdatatables'); ?></label>
|
5 |
+
<button class="btn btn-primary bgm-gray wdt-copy-shortcode" id="wdt-chart-shortcode-container" data-toggle="tooltip"
|
6 |
+
data-placement="top"
|
7 |
+
title="<?php _e('Click to copy shortcode', 'wpdatatables'); ?>">
|
8 |
+
</button>
|
9 |
+
</div>
|
templates/browse_charts.inc.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php defined('ABSPATH') or die("Cannot access pages directly."); ?>
|
2 |
-
|
3 |
-
<div id="wdtPreloadLayer" class="overlayed">
|
4 |
-
</div>
|
5 |
-
|
6 |
-
<div class="wrap">
|
7 |
-
<img src="<?php echo dirname(plugin_dir_url(__FILE__)); ?>/assets/img/wpdatatables-logo.png" class="wpdatatables_logo" style="margin: 10px" />
|
8 |
-
<p><i><?php _e('Please refer to','wpdatatables');?> <a href="http://wpdatatables.com/documentation/wpdatacharts/"><?php _e('wpDataTables documentation on Charts','wpdatatables');?></a> <?php _e('if you have some questions or problems with the plugin.','wpdatatables'); ?></i></p>
|
9 |
-
<h2><?php _e('wpDataCharts','wpdatatables');?><a href="admin.php?page=wpdatatables-chart-wizard" class="add-new-h2"><?php _e('Add new chart','wpdatatables');?></a></h2>
|
10 |
-
|
11 |
-
<form method="post" action="<?php echo admin_url('admin.php?page=wpdatatables-charts'); ?>" id="wpDataChartsBrowseForm">
|
12 |
-
<?php echo $tableHTML; ?>
|
13 |
-
</form>
|
14 |
-
|
15 |
-
</div>
|
16 |
-
|
17 |
-
<script type="text/javascript">
|
18 |
-
var duplicate_table_id = '';
|
19 |
-
|
20 |
-
jQuery(document).ready(function(){
|
21 |
-
|
22 |
-
jQuery('#doaction').click(function(e){
|
23 |
-
e.preventDefault();
|
24 |
-
|
25 |
-
if(jQuery('#bulk-action-selector-top').val() == ''){ return; }
|
26 |
-
if(jQuery('#wpDataChartsBrowseForm table.widefat input[type="checkbox"]:checked').length == 0){ return; }
|
27 |
-
|
28 |
-
if(confirm("<?php _e('Are you sure','wpdatatables'); ?>?")){
|
29 |
-
jQuery('#wpDataChartsBrowseForm').submit();
|
30 |
-
}
|
31 |
-
});
|
32 |
-
|
33 |
-
});
|
34 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/chart_js_template.inc.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php defined('ABSPATH') or die("Cannot access pages directly."); ?>
|
2 |
-
|
3 |
-
<script type="text/javascript">
|
4 |
-
if(typeof wpDataTablesCharts == 'undefined'){
|
5 |
-
var wpDataTablesCharts = [];
|
6 |
-
}
|
7 |
-
wpDataTablesCharts['<?php echo $tableId?>'] = <?php echo $chartProperties ?>;
|
8 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/wpdatachart.inc.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('Access denied.'); ?>
|
2 |
+
|
3 |
+
<script type="text/javascript">if (typeof (wpDataCharts) == 'undefined') {
|
4 |
+
wpDataCharts = {};
|
5 |
+
}
|
6 |
+
wpDataCharts[<?php echo $chart_id; ?>] = {
|
7 |
+
render_data: <?php echo $json_chart_render_data; ?>,
|
8 |
+
engine: "google",
|
9 |
+
type: "<?php echo $this->_type; ?>",
|
10 |
+
title: "<?php echo $this->_title; ?>",
|
11 |
+
container: "wpDataChart_<?php echo $chart_id?>",
|
12 |
+
wpdatatable_id: <?php echo $this->_wpdatatable_id ?>}</script>
|
13 |
+
|
14 |
+
<div id="wpDataChart_<?php echo $chart_id ?>" class="<?php echo $this->_type ?>" style="width: 100%"></div>
|
wpdatatables.php
CHANGED
@@ -2,12 +2,12 @@
|
|
2 |
|
3 |
|
4 |
/*
|
5 |
-
Plugin Name: wpDataTables
|
6 |
-
Plugin URI:
|
7 |
-
Description:
|
8 |
-
Version: 2.
|
9 |
Author: TMS-Plugins
|
10 |
-
Author URI:
|
11 |
Text Domain: wpdatatables
|
12 |
Domain Path: /languages
|
13 |
*/
|
@@ -30,11 +30,11 @@ if (!defined('WDT_BASENAME')) {
|
|
30 |
require_once(WDT_ROOT_PATH . '/config/config.inc.php');
|
31 |
|
32 |
|
33 |
-
|
34 |
// Plugin functions
|
35 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_functions.php');
|
36 |
|
37 |
-
function wpdatatables_load()
|
|
|
38 |
if (is_admin()) {
|
39 |
// Admin panel controller
|
40 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_admin.php');
|
@@ -49,16 +49,17 @@ function wpdatatables_load() {
|
|
49 |
require_once(WDT_ROOT_PATH . 'source/class.sql.php');
|
50 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatatable.php');
|
51 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatacolumn.php');
|
52 |
-
|
53 |
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsetable.php');
|
54 |
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsechartstable.php');
|
|
|
55 |
require_once(WDT_ROOT_PATH . 'source/WpDataTablesGutenbergBlock.php');
|
|
|
56 |
|
57 |
add_action('plugins_loaded', 'wdtLoadTextdomain');
|
58 |
}
|
59 |
|
60 |
|
61 |
-
|
62 |
/********
|
63 |
* Hooks *
|
64 |
********/
|
@@ -74,7 +75,5 @@ add_shortcode('wpdatatable_min', 'wdtFuncsShortcodeHandler');
|
|
74 |
add_shortcode('wpdatatable_max', 'wdtFuncsShortcodeHandler');
|
75 |
|
76 |
|
77 |
-
|
78 |
wpdatatables_load();
|
79 |
-
|
80 |
?>
|
2 |
|
3 |
|
4 |
/*
|
5 |
+
Plugin Name: wpDataTables - Tables & Table Charts
|
6 |
+
Plugin URI: https://tms-outsource.com
|
7 |
+
Description: Create responsive, sortable tables & charts from Excel, CSV or PHP. Add tables & charts to any post in minutes with DataTables.
|
8 |
+
Version: 2.013
|
9 |
Author: TMS-Plugins
|
10 |
+
Author URI: https://tms-outsource.com
|
11 |
Text Domain: wpdatatables
|
12 |
Domain Path: /languages
|
13 |
*/
|
30 |
require_once(WDT_ROOT_PATH . '/config/config.inc.php');
|
31 |
|
32 |
|
|
|
33 |
// Plugin functions
|
34 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_functions.php');
|
35 |
|
36 |
+
function wpdatatables_load()
|
37 |
+
{
|
38 |
if (is_admin()) {
|
39 |
// Admin panel controller
|
40 |
require_once(WDT_ROOT_PATH . 'controllers/wdt_admin.php');
|
49 |
require_once(WDT_ROOT_PATH . 'source/class.sql.php');
|
50 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatatable.php');
|
51 |
require_once(WDT_ROOT_PATH . 'source/class.wpdatacolumn.php');
|
52 |
+
require_once(WDT_ROOT_PATH . 'source/class.wpdatachart.php');
|
53 |
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsetable.php');
|
54 |
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsechartstable.php');
|
55 |
+
require_once(WDT_ROOT_PATH . 'source/GutenbergBlock.php');
|
56 |
require_once(WDT_ROOT_PATH . 'source/WpDataTablesGutenbergBlock.php');
|
57 |
+
require_once(WDT_ROOT_PATH . 'source/WpDataChartsGutenbergBlock.php');
|
58 |
|
59 |
add_action('plugins_loaded', 'wdtLoadTextdomain');
|
60 |
}
|
61 |
|
62 |
|
|
|
63 |
/********
|
64 |
* Hooks *
|
65 |
********/
|
75 |
add_shortcode('wpdatatable_max', 'wdtFuncsShortcodeHandler');
|
76 |
|
77 |
|
|
|
78 |
wpdatatables_load();
|
|
|
79 |
?>
|