1
|
<!DOCTYPE html
|
2
|
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
<html>
|
5
|
<?php
|
6
|
//session_start();
|
7
|
require_once('controller.php');
|
8
|
$controller = new Controller(false);
|
9
|
|
10
|
if(isset($_GET['com'])) {
|
11
|
//analoga me to command kalei tin katallili synanrtisi
|
12
|
if($_GET['com'] == "query") {
|
13
|
$selectedData = json_encode($_GET['data'],JSON_NUMERIC_CHECK);
|
14
|
// $resp = $controller->makeQuery('table');
|
15
|
|
16
|
|
17
|
//make the query
|
18
|
if(!isset($_GET['persistent'])){
|
19
|
|
20
|
$persistent="true";
|
21
|
}
|
22
|
else
|
23
|
{
|
24
|
$persistent="false";
|
25
|
}
|
26
|
|
27
|
|
28
|
$resp = $controller->makeQuery('table',$persistent);
|
29
|
|
30
|
|
31
|
|
32
|
|
33
|
}
|
34
|
else{
|
35
|
echo "unknown command code";
|
36
|
}
|
37
|
}
|
38
|
else {
|
39
|
//oops error
|
40
|
echo "no command given";
|
41
|
}
|
42
|
|
43
|
?>
|
44
|
<head>
|
45
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
46
|
<title>table</title>
|
47
|
|
48
|
<!-- Include JQuery Core-->
|
49
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
50
|
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
|
51
|
|
52
|
<!-- HighCharts -->
|
53
|
<script src="./js/Highcharts-4.0.1/js/highcharts.js" type="text/javascript"></script>
|
54
|
|
55
|
<!-- scripts to create the menu and charts-->
|
56
|
<!--script src="./js/renderSchema9.js" type="text/javascript"></script-->
|
57
|
|
58
|
<script src="./js/themes9.js" type="text/javascript"></script>
|
59
|
<style>
|
60
|
body{
|
61
|
color: #323232;
|
62
|
text-align: justify;
|
63
|
font-family: Verdana,Geneva,Kalimati,sans-serif;
|
64
|
font-size: 12px;
|
65
|
line-height: 150%;
|
66
|
}
|
67
|
table th, table td{
|
68
|
border-bottom: 1px solid #E0E0E1;
|
69
|
padding: 9px;
|
70
|
}
|
71
|
|
72
|
table tbody tr:nth-of-type(2n+1) {
|
73
|
background: none repeat scroll 0 0 #F0F1F2;
|
74
|
}
|
75
|
|
76
|
table tbody tr:nth-of-type(2n) {
|
77
|
background: none repeat scroll 0 0 #FEFEFF;
|
78
|
}
|
79
|
|
80
|
</style>
|
81
|
|
82
|
<script type='text/javascript'>
|
83
|
var chart;
|
84
|
var tableData;
|
85
|
var selectedData;
|
86
|
var headers;
|
87
|
$(document).ready(function(){
|
88
|
$('document').css('cursor','wait');
|
89
|
headers = $.parseJSON(<?php if(isset($_GET['headers'])) echo json_encode($_GET['headers']);?>);
|
90
|
|
91
|
tableData = <?php echo $resp ?>;
|
92
|
|
93
|
///////!!!!!!!!!!!!!!!!!/////////
|
94
|
tableData['data'].sort(function(a,b) {
|
95
|
return parseInt(b[1],10)-parseInt(a[1],10);
|
96
|
});
|
97
|
|
98
|
////////////////////////////////
|
99
|
selectedData = $.parseJSON(<?php echo $selectedData;?>);
|
100
|
|
101
|
if(headers != null){
|
102
|
for(var i in headers){
|
103
|
$('thead tr').append("<th>"+headers[i]+"</th>");
|
104
|
}
|
105
|
}
|
106
|
else{
|
107
|
var fld = selectedData['xaxis']['name'].split('-');
|
108
|
if(selectedData['xaxis']['agg']!='')
|
109
|
$('thead tr').append("<th>"+selectedData['xaxis']['agg']+" of "+fld[fld.length-1]+"</th>");
|
110
|
else
|
111
|
$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
|
112
|
for(var i in selectedData['fields']){
|
113
|
fld = selectedData['fields'][i]['fld'].split('-');
|
114
|
if(selectedData['fields'][i]['agg']!='')
|
115
|
$('thead tr').append("<th>"+selectedData['fields'][i]['agg']+" of "+fld[fld.length-1]+"</th>");
|
116
|
else
|
117
|
$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
|
118
|
}
|
119
|
if(selectedData['group'] != '' && selectedData['group'] != 'no'){
|
120
|
fld = selectedData['group'].split('-');
|
121
|
$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
|
122
|
}
|
123
|
else if(selectedData['color'] != '' && selectedData['color'] != 'no'){
|
124
|
fld = selectedData['color'].split('-');
|
125
|
$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
|
126
|
}
|
127
|
}
|
128
|
|
129
|
|
130
|
for(var i in tableData['data']){
|
131
|
var str = "<tr>";
|
132
|
for(var j in tableData['data'][i]){
|
133
|
str += "<td>"+tableData['data'][i][j]+"</td>";
|
134
|
}
|
135
|
str += "</tr>"
|
136
|
$('tbody').append(str);
|
137
|
}
|
138
|
});
|
139
|
</script>
|
140
|
</head>
|
141
|
<body>
|
142
|
<div id="table"><table><thead><tr></tr></thead><tbody></tbody><!-- SECTION FOR THE TABLE --></table></div>
|
143
|
</body>
|
144
|
</html>
|