-
Notifications
You must be signed in to change notification settings - Fork 0
/
history.php
173 lines (163 loc) · 7.29 KB
/
history.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
<?php include("login.php"); ?>
<head>
<meta charset="utf-8">
<title>plexWatch</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="css/plexwatch.css" rel="stylesheet">
<link href="css/plexwatch-tables.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet" >
<link href="css/xcharts.css" rel="stylesheet" >
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 30px;
margin-left: -125px;
margin-top: -15px;
padding: 14px 0 2px 0;
border: 1px solid #ddd;
text-align: center;
color: black;
font-size: 14px;
background-color: white;
}
</style>
<!-- touch icons -->
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/icon_iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/icon_ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/icon_iphone@2x.png">
<link rel="apple-touch-icon" sizes="144x144" href="images/icon_ipad@2x.png">
</head>
<?php include "serverdatapdo.php"; ?>
<body>
<div class="container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<a href="index.php"><div class="logo hidden-phone"></div></a>
<ul class="nav">
<li><a href="index.php"><i class="icon-2x icon-home icon-white" data-toggle="tooltip" data-placement="bottom" title="Home" id="home"></i></a></li>
<li class="active"><a href="history.php"><i class="icon-2x icon-calendar icon-white" data-toggle="tooltip" data-placement="bottom" title="History" id="history"></i></a></li>
<li><a href="stats.php"><i class="icon-2x icon-tasks icon-white" data-toggle="tooltip" data-placement="bottom" title="PLEX Stats" id="stats"></i></a></li>
<li><a href="users.php"><i class="icon-2x icon-group icon-white" data-toggle="tooltip" data-placement="bottom" title="Users" id="users"></i></a></li>
<li><a href="charts.php"><i class="icon-2x icon-bar-chart icon-white" data-toggle="tooltip" data-placement="bottom" title="Charts" id="charts"></i></a></li>
<li><a href="sysinfo.php"><i class="icon-2x icon-hdd icon-white" data-toggle="tooltip" data-placement="bottom" title="System Info" id="sysinfo"></i></a></li>
<li><a href="edit.php"><i class="icon-2x icon-bug icon-white" data-toggle="tooltip" data-placement="bottom" title="Debug SQL" id="editsql"></i></a></li>
<li><a href="settings.php"><i class="icon-2x icon-wrench icon-white" data-toggle="tooltip" data-placement="bottom" title="PlexWatch Settings" id="settings"></i></a></li>
<li><a href="index.php?logout=1"><i class="icon-2x icon-power-off icon-white" data-toggle="tooltip" data-placement="bottom" title="Logout" id="logout"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="clear"></div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class='wellheader'>
<div class="dashboard-wellheader-no-chevron">
<h2><i class="icon-large icon-calendar icon-white"></i> History</h2>
</div>
</div>
</div>
</div>
</div>
<div class='container-fluid'>
<div class='row-fluid'>
<div class='span12'>
<div class='wellbg'>
<?php
//now generate the HTML databable structure from SQL here:
$cols= "id,Date,User,Platform,IP Address,Title,Started,Paused,Stopped,xml,Duration,Completed"; //Column names for datatable headings (typically same as sql)
$html = ServerDataPDO::build_html_datatable($cols,'history_datatable');
echo $html;
?>
<div id="info-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="info-modal" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-remove"></i></button>
<h3 id="myModalLabel"><i class="icon-info-sign icon-white"></i> Stream Info: <strong><span id="modal-stream-info"></span></strong></h3>
</div>
<div class="modal-body" id="modal-text">
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="js/jquery-2.0.3.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery.dataTables.js"></script>
<script src="js/jquery.dataTables.plugin.bootstrap_pagination.js"></script>
<script src="js/d3.v3.js"></script>
<script src="js/moment-with-locale.js"></script>
<script>
function loadXMLString(txt) {
if (window.DOMParser) {
parser=new DOMParser();
xmlDoc=parser.parseFromString(txt,"text/xml");
} else { // code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(txt);
}
return xmlDoc;
}
</script>
<?php
$plexWatchDbTable = "";
if ($plexWatch['globalHistoryGrouping'] == "yes") {
$plexWatchDbTable = "grouped";
} else if ($plexWatch['globalHistoryGrouping'] == "no") {
$plexWatchDbTable = "processed";
}
$db_array=array(
"sql"=>"SELECT id|time|user|platform|ip_address|title|time|paused_counter|stopped|xml|round((julianday(datetime(stopped,'unixepoch', 'localtime')) - julianday(datetime(time,'unixepoch', 'localtime')))*86400)-(case when paused_counter is null then 0 else paused_counter end) from ".$plexWatchDbTable, /* Use | as delimiter. Spell out columns names no SELECT * Table */
"table"=>$plexWatchDbTable, /* DB table to use assigned by constructor*/
"idxcol"=>"id" /* Indexed column (used for fast and accurate table cardinality) */
);
$javascript = ServerDataPDO::build_jquery_datatable($db_array,'history_datatable','datafactory/get-info-modal.php');
echo $javascript;
?>
<script>
$(document).ready(function() {
$('#home').tooltip();
});
$(document).ready(function() {
$('#history').tooltip();
});
$(document).ready(function() {
$('#users').tooltip();
});
$(document).ready(function() {
$('#charts').tooltip();
});
$(document).ready(function() {
$('#editsql').tooltip();
});
$(document).ready(function() {
$('#settings').tooltip();
});
$(document).ready(function() {
$('#sysinfo').tooltip();
});
$(document).ready(function() {
$('#stats').tooltip();
});
$(document).ready(function() {
$('#logout').tooltip();
});
</script>