Project

General

Profile

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
	else{
17
		echo "unknown command code";
18
	}
19
}
20
else {
21
	//oops error
22
	echo "no command given";
23
}
24

    
25
?>
26
<head>
27
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
28
<title>table</title>
29

    
30
<!-- Include JQuery Core-->
31
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
32
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
33

    
34
<!-- HighCharts -->
35
<script src="./js/Highcharts-4.0.1/js/highcharts.js" type="text/javascript"></script>
36

    
37
<!-- scripts to create the menu and charts-->
38
<!--script src="./js/renderSchema9.js" type="text/javascript"></script--> 
39

    
40
<script src="./js/themes9.js" type="text/javascript"></script> 
41
<style>
42
body{
43
	color: #323232;
44
	text-align: justify;
45
	font-family: Verdana,Geneva,Kalimati,sans-serif;
46
	font-size: 12px;
47
	line-height: 150%;
48
}
49
table th, table td{
50
	border-bottom: 1px solid #E0E0E1;
51
	padding: 9px;
52
}
53

    
54
table tbody tr:nth-of-type(2n+1) {
55
	background: none repeat scroll 0 0 #F0F1F2;
56
}
57

    
58
table tbody tr:nth-of-type(2n) {
59
	background: none repeat scroll 0 0 #FEFEFF;
60
}
61

    
62
</style>
63

    
64
<script type='text/javascript'>
65
var chart;
66
var tableData;
67
var selectedData;
68
var headers;
69
$(document).ready(function(){
70
	$('document').css('cursor','wait');
71
	headers = $.parseJSON(<?php if(isset($_GET['headers'])) echo json_encode($_GET['headers']);?>);
72
	
73
	tableData = <?php echo $resp ?>;
74
	
75
	///////!!!!!!!!!!!!!!!!!/////////
76
	tableData['data'].sort(function(a,b) {
77
		return parseInt(b[1],10)-parseInt(a[1],10);
78
	});
79
	
80
	////////////////////////////////
81
	selectedData = $.parseJSON(<?php echo $selectedData;?>);
82
	
83
	if(headers != null){
84
		for(var i in headers){
85
			$('thead tr').append("<th>"+headers[i]+"</th>");
86
		}
87
	}
88
	else{
89
		var fld = selectedData['xaxis']['name'].split('-');
90
		if(selectedData['xaxis']['agg']!='')
91
			$('thead tr').append("<th>"+selectedData['xaxis']['agg']+" of "+fld[fld.length-1]+"</th>");
92
		else
93
			$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
94
		for(var i in selectedData['fields']){
95
			fld = selectedData['fields'][i]['fld'].split('-');
96
			if(selectedData['fields'][i]['agg']!='')
97
				$('thead tr').append("<th>"+selectedData['fields'][i]['agg']+" of "+fld[fld.length-1]+"</th>");
98
			else
99
				$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
100
		}
101
		if(selectedData['group'] != '' && selectedData['group'] != 'no'){
102
			fld = selectedData['group'].split('-');
103
			$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
104
		}
105
		else if(selectedData['color'] != '' && selectedData['color'] != 'no'){
106
			fld = selectedData['color'].split('-');
107
			$('thead tr').append("<th>"+fld[fld.length-1]+"</th>");
108
		}
109
	}
110
	
111
	
112
	for(var i in tableData['data']){
113
		var str = "<tr>";
114
		for(var j in tableData['data'][i]){
115
			str += "<td>"+tableData['data'][i][j]+"</td>";
116
		}
117
		str += "</tr>"
118
		$('tbody').append(str);
119
	}
120
});
121
</script>
122
</head>
123
<body>
124
<div id="table"><table><thead><tr></tr></thead><tbody></tbody><!-- SECTION FOR THE TABLE --></table></div>
125
</body>
126
</html>
(18-18/19)