-
Notifications
You must be signed in to change notification settings - Fork 0
/
more_statistics_details.php
315 lines (220 loc) · 12.1 KB
/
more_statistics_details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?php
/*************************************************************************************
Created by G. Papaioannou
You can contact with me at [email protected]
Paradox Interactive (c) 2011,Greece
http://www.paradoxinteractive.gr
**************************************************************************************/
session_start();
include_once 'includes/config.php';
include_once 'includes/functions.php';
include_once 'translations/'.$g_language;
include_once 'includes/login.php';
OpenDB();
if (!check_login() ) {
header( 'Location: index.php' ) ;
}
CloseDB();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Statistics</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="build/datatable/assets/skins/sam/datatable.css" />
<link rel="stylesheet" type="text/css" href="build/paginator/assets/skins/sam/paginator.css" />
<link rel="stylesheet" type="text/css" href="build/button/assets/skins/sam/button.css" />
<script type="text/javascript" src="build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="build/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="build/element/element-min.js"></script>
<script type="text/javascript" src="build/button/button-min.js"></script>
<script type="text/javascript" src="build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="build/datatable/datatable-min.js"></script>
<script type="text/javascript" src="build/connection/connection-min.js"></script>
<script type="text/javascript" src="build/paginator/paginator-min.js"></script>
<script type="text/javascript" src="build/json/json-min.js"></script>
<script type="text/javascript" src="javascript/dateformat.js"></script>
<style type="text/css">
/* custom styles for this example */
.yui-skin-sam .yui-dt-liner { white-space:nowrap; }
.yui-skin-sam .yui-dt tr.yui-dt-last td,
.yui-skin-sam .yui-dt th,
.yui-skin-sam .yui-dt td {
border-bottom: 1px solid #7f7f7f;
text-align: center;
height: 30px;
}
/* custom styles for this example */
.yui-skin-sam .yui-dt-body { cursor:pointer; } /* when cells are selectable */
#cellrange, #singlecell { margin-top:2em; }
/* custom styles for this example */
.modform {margin-bottom: 1em;}
.index {width:5em;}
.myHighlightClassName {
background-color: #FFCA95;
Color:black;
}
.yui-skin-sam .yui-checkbox-button button {
width: 4em;
}
.more-button {
cursor:pointer;
background: #FFFFCC url(images/edit.png) no-repeat center center;
width:16px;height:16px;
}
</style>
</head>
<body class="yui-skin-sam">
<?php include 'includes/navigation.php' ?>
<?php include 'includes/header.php' ?>
<div id="content">
<div id="content-wrap">
<div class="welcome">
<h3><?php getTranslation('Statistics') ?></h3>
<p><?php getTranslation('StatisticsList') ?> </p>
<br />
<hr width=100% />
<br />
</div>
<div class="tablereport">
<div id="report" align="center"></div>
<script type="text/javascript">
parseSQLDate = function(ISOdate,output)
{
var time = '';
var pos = ISOdate.indexOf('-');
var year = ISOdate.substr(0,pos);
var pos2 = ISOdate.indexOf('-',pos+1);
var month = ISOdate.substr(pos+1,(pos2-pos-1));
pos = ISOdate.indexOf(' ');
if (pos != -1) {
var day = ISOdate.substr(pos2+1,(pos-pos2-1));
time = ISOdate.substr(pos+1);
}
else
var day = ISOdate.substr(pos2+1);
if (pos != -1) {
var jsdate = new Date (month+"/"+day+"/"+year+' '+ time);
var formatedDateTime = dateFormat(jsdate,"dd/mm/yyyy HH:MM");
}
else {
var jsdate = new Date (month+"/"+day+"/"+year);
var formatedDateTime = dateFormat(jsdate,"dd/mm/yyyy");
}
if (output==1)
return jsdate;
else
return formatedDateTime;
};
var myRequestBuilder = function(oState, oSelf) {
// Get states or use defaults
oState = oState || { pagination: null, sortedBy: null };
var sort = (oState.sortedBy) ? oState.sortedBy.key : "sDate";
var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0;
var results = (oState.pagination) ? oState.pagination.rowsPerPage : 100;
// Build custom request
return "query=statistics_details" +
"&type=select" +
"&BannerID=<?php echo $_GET['BannerID'] ?>" +
"&column=" + sort +
"&dir=" + dir +
"&pageStart=" + startIndex +
"&Recs=" + results;
};
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.report = function() {
var DataSource = new YAHOO.util.DataSource("includes/data.php?");
DataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
DataSource.connXhrMode = "queueRequests";
var ColumnDefs = [
{key:"sID", label:"StatisticsID",hidden:true, isPrimaryKey:true},
{key:"sBannerID", label:"BannerID",hidden:true,},
{key:"cID", label:"CategoryID",hidden:true},
{key:"bDescription",label:"Περιγραφή διαφήμισης", width:150, sortable:true, resizeable:true},
{key:"sDate",label:"Ημερομηνία", formatter:"date", width:120, sortable:true, resizeable:true},
{key:"sIP",label:"Διεύθυνση IP", width:200, sortable:true, resizeable:true},
{key:"sClicksSUM",label:"Clicks", width:50, sortable:true, resizeable:true},
{key:"sImpressionsSUM",label:"Εμφανίσεις", width:60, sortable:true, resizeable:true}
];
DataSource.responseSchema = {
resultsList: "DataSet.items",
// Use the parse methods to populate the RecordSet with the right data types
fields: [
{key:"sID", parser:"number"},
{key:"sBannerID", parser:"number"},
{key:"cID", parser:"number"},
{key:"bDescription", parser:"string"},
{key:"sDate",parser:function (oDate){return parseSQLDate(oDate,2);}},
{key:"sIP", parser:"string"},
{key:"sClicksSUM", parser:"number"},
{key:"sImpressionsSUM", parser:"number"}
],
metaFields: {totalRecords: "DataSet.totalRecords"}
};
var oConfigs = {
dateOptions:{format:"%d/%m/%Y"},
selectionMode:"single",
numberOptions:{decimalPlaces:2, thousandsSeparator:","},
MSG_EMPTY:'<?php getTranslation("no records") ?>',
draggableColumns:false,
initialRequest:"query=statistics_details&type=select&BannerID=<?php echo $_GET['BannerID'] ?>&column=sDate&dir=desc&pageStart=0&Recs=25",
paginator: new YAHOO.widget.Paginator(
{ rowsPerPage:25,
rowsPerPageOptions: [25, 50, 100],
previousPageLinkLabel : "προηγούμενη",
nextPageLinkLabel : "επόμενη",
firstPageLinkLabel : "πρώτη",
lastPageLinkLabel : "τελευταία"
}),
dynamicData : true,
generateRequest: myRequestBuilder
};
DataTable = new YAHOO.widget.DataTable("report", ColumnDefs, DataSource, oConfigs );
// Update totalRecords on the fly with value from server
DataTable.handleDataReturnPayload = function (oRequest, oResponse, oPayload) {
oPayload.totalRecords = oResponse.meta.totalRecords;
return oPayload;
}
var i=1,bReverseSorted = false;
// Track when Column is reverse-sorted, since new data will come in out of order
var trackReverseSorts = function(oArg) {
bReverseSorted = (oArg.dir === YAHOO.widget.DataTable.CLASS_DESC);
};
// Set up editing flow
var highlightEditableCell = function(oArgs) {
var elCell = oArgs.target;
if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
this.highlightCell(elCell);
}
};
DataTable.subscribe("cellMouseoverEvent", highlightEditableCell);
DataTable.subscribe("cellMouseoutEvent", DataTable.onEventUnhighlightCell);
DataTable.subscribe("cellClickEvent", DataTable.onEventShowCellEditor);
var myBuildUrl = function(datatable,record) {
var url = '';
var cols = datatable.getColumnSet().keys;
for (var i = 0; i < cols.length; i++) {
if (cols[i].isPrimaryKey) {
url += '&id=' + escape(record.getData(cols[i].key));
url += '&primaryKey=' + cols[i].key;
}
}
return url;
};
return {
oDS: DataSource,
oDT: DataTable
};
}();
});
</script>
</div>
<div class="clear"></div>
</div>
</div>
<?php include 'includes/footer.php' ?>
</body>
</html>