Repository navigation
Expand file tree
/
Copy pathstatistics.php
More file actions
199 lines (175 loc) · 18 KB
/
Copy pathstatistics.php
File metadata and controls
199 lines (175 loc) · 18 KB
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
<?php
/**************************************************************
"Learning with Texts" (LWT) is released into the Public Domain.
This applies worldwide.
In case this is not legally possible, any entity is granted the
right to use this work for any purpose, without any conditions,
unless such conditions are required by law.
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: statistics.php
Display statistics
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
pagestart('My Statistics',true);
?>
<h4>Breakdown by Language and Term Status<br />(Click on numbers to see the list of terms)</h4>
<table class="tab3" cellspacing="0" cellpadding="5">
<tr>
<th class="th1">Language</th>
<th class="th1">Total<br /></th>
<th class="th1">Active<br />(1..5)</th>
<th class="th1">Learning<br />(1..4)</th>
<th class="th1">Unknown<br />(1)</th>
<th class="th1">Learning<br />(2)</th>
<th class="th1">Learning<br />(3)</th>
<th class="th1">Learning<br />(4)</th>
<th class="th1">Learned<br />(5)</th>
<th class="th1">Well<br />Known<br />(99)</th>
<th class="th1">Known<br />(5+99)</th>
<th class="th1">Ign.<br />(98)</th>
</tr>
<?php
$sql = 'SELECT LgID, LgName FROM languages ORDER BY LgName';
$res = mysql_query($sql);
if ($res == FALSE) die("Invalid Query: $sql");
while ($dsatz = mysql_fetch_assoc($res)) {
$lang = $dsatz['LgID'];
$s1 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 1');
$s2 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 2');
$s3 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 3');
$s4 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 4');
$s5 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 5');
$s98 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 98');
$s99 = get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus = 99');
$all = $s1 + $s2 + $s3 + $s4 + $s5 + $s98 + $s99;
echo '<tr>';
echo '<td class="td1">' . tohtml($dsatz['LgName']) . '</td>';
echo '<td class="td1 center"><a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=&tag12=0&tag2=&tag1="><b>' . $all . '</b></a></td>';
echo '<td class="td1 center"><a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=15&tag12=0&tag2=&tag1="><b>' . ($s1+$s2+$s3+$s4+$s5) . '</b></a></td>';
echo '<td class="td1 center"><a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=14&tag12=0&tag2=&tag1="><b>' . ($s1+$s2+$s3+$s4) . '</b></a></td>';
echo '<td class="td1 center"><span class="status1"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=1&tag12=0&tag2=&tag1=">' . $s1 . '</a> </span></td>';
echo '<td class="td1 center"><span class="status2"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=2&tag12=0&tag2=&tag1=">' . $s2 . '</a> </span></td>';
echo '<td class="td1 center"><span class="status3"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=3&tag12=0&tag2=&tag1=">' . $s3 . '</a> </span></td>';
echo '<td class="td1 center"><span class="status4"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=4&tag12=0&tag2=&tag1=">' . $s4 . '</a> </span></td>';
echo '<td class="td1 center"><span class="status5"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=5&tag12=0&tag2=&tag1=">' . $s5 . '</a> </span></td>';
echo '<td class="td1 center"><span class="status99"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=99&tag12=0&tag2=&tag1=">' . $s99 . '</a> </span></td>';
echo '<td class="td1 center"><span class="status5stat"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=599&tag12=0&tag2=&tag1="><b>' . ($s5 + $s99) . '</b></a> </span></td>';
echo '<td class="td1 center"><span class="status98"> <a href="edit_words.php?page=1&text=&query=&filterlang=' . $lang . '&status=98&tag12=0&tag2=&tag1="><b>' . $s98 . '</b></a> </span></td>';
echo '</tr>';
}
mysql_free_result($res);
$s1 = get_first_value('select count(WoID) as value from words where WoStatus = 1');
$s2 = get_first_value('select count(WoID) as value from words where WoStatus = 2');
$s3 = get_first_value('select count(WoID) as value from words where WoStatus = 3');
$s4 = get_first_value('select count(WoID) as value from words where WoStatus = 4');
$s5 = get_first_value('select count(WoID) as value from words where WoStatus = 5');
$s98 = get_first_value('select count(WoID) as value from words where WoStatus = 98');
$s99 = get_first_value('select count(WoID) as value from words where WoStatus = 99');
$all = $s1 + $s2 + $s3 + $s4 + $s5 + $s98 + $s99;
echo '<tr>';
echo '<th class="th1"><b>TOTAL</b></th>';
echo '<th class="th1 center"><a href="edit_words.php?page=1&text=&query=&filterlang=&status=&tag12=0&tag2=&tag1="><b>' . $all . '</b></a></th>';
echo '<th class="th1 center"><a href="edit_words.php?page=1&text=&query=&filterlang=&status=15&tag12=0&tag2=&tag1="><b>' . ($s1+$s2+$s3+$s4+$s5) . '</b></a></th>';
echo '<th class="th1 center"><a href="edit_words.php?page=1&text=&query=&filterlang=&status=14&tag12=0&tag2=&tag1="><b>' . ($s1+$s2+$s3+$s4) . '</b></a></th>';
echo '<th class="th1 center"><span class="status1"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=1&tag12=0&tag2=&tag1="><b>' . $s1 . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status2"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=2&tag12=0&tag2=&tag1="><b>' . $s2 . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status3"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=3&tag12=0&tag2=&tag1="><b>' . $s3 . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status4"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=4&tag12=0&tag2=&tag1="><b>' . $s4 . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status5"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=5&tag12=0&tag2=&tag1="><b>' . $s5 . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status99"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=99&tag12=0&tag2=&tag1="><b>' . $s99 . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status5stat"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=599&tag12=0&tag2=&tag1="><b>' . ($s5 + $s99) . '</b></a> </span></th>';
echo '<th class="th1 center"><span class="status98"> <a href="edit_words.php?page=1&text=&query=&filterlang=&status=98&tag12=0&tag2=&tag1="><b>' . $s98 . '</b></a> </span></th>';
echo '</tr>';
?>
</table>
<h4>Breakdown by Language and Time Range<br />(Terms created (C), Terms changed status = Activity (A), Terms set to "Known" (K))</h4>
<table class="tab3" cellspacing="0" cellpadding="5">
<tr>
<th class="th1" rowspan="2">Language</th>
<th class="th1" colspan="3">Today</th>
<th class="th1" colspan="3">Yesterday</th>
<th class="th1" colspan="3">Last 7 d</th>
<th class="th1" colspan="3">Last 30 d</th>
<th class="th1" colspan="3">Last 365 d</th>
<th class="th1" colspan="3">All Time</th>
</tr>
<tr>
<th class="th1">C</th>
<th class="th1">A</th>
<th class="th1">K</th>
<th class="th1">C</th>
<th class="th1">A</th>
<th class="th1">K</th>
<th class="th1">C</th>
<th class="th1">A</th>
<th class="th1">K</th>
<th class="th1">C</th>
<th class="th1">A</th>
<th class="th1">K</th>
<th class="th1">C</th>
<th class="th1">A</th>
<th class="th1">K</th>
<th class="th1">C</th>
<th class="th1">A</th>
<th class="th1">K</th>
</tr>
<?php
$sql = 'SELECT LgID, LgName FROM languages ORDER BY LgName';
$res = mysql_query($sql);
if ($res == FALSE) die("Invalid Query: $sql");
while ($dsatz = mysql_fetch_assoc($res)) {
$lang = $dsatz['LgID'];
echo '<tr>';
echo '<td class="td1">' . tohtml($dsatz['LgName']) . '</td>';
echo '<td class="td1 center"><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoCreated as date) = curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoStatusChanged as date) = curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus in (5, 99) and cast(WoStatusChanged as date) = curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoCreated as date) = subdate(curdate(), \'1 day\')') . ' </span></td>';
echo '<td class="td1 center"><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoStatusChanged as date) = subdate(curdate(), \'1 day\')') . ' </span></td>';
echo '<td class="td1 center"><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus in (5, 99) and cast(WoStatusChanged as date) = subdate(curdate(), \'1 day\')') . ' </span></td>';
echo '<td class="td1 center"><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoCreated as date) between subdate(curdate(), \'6 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoStatusChanged as date) between subdate(curdate(), \'6 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus in (5, 99) and cast(WoStatusChanged as date) between subdate(curdate(), \'6 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoCreated as date) between subdate(curdate(), \'29 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoStatusChanged as date) between subdate(curdate(), \'29 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus in (5, 99) and cast(WoStatusChanged as date) between subdate(curdate(), \'29 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoCreated as date) between subdate(curdate(), \'364 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5 and cast(WoStatusChanged as date) between subdate(curdate(), \'364 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus in (5, 99) and cast(WoStatusChanged as date) between subdate(curdate(), \'364 day\') and curdate()') . ' </span></td>';
echo '<td class="td1 center"><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5') . ' </span></td>';
echo '<td class="td1 center"><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus between 1 and 5') . ' </span></td>';
echo '<td class="td1 center"><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoLgID = ' . $lang . ' and WoStatus in (5, 99)') . ' </span></td>';
echo '</tr>';
}
mysql_free_result($res);
echo '<tr>';
echo '<th class="th1"><b>TOTAL</b></th>';
echo '<th class="th1 center"><b><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoStatus between 1 and 5 and cast(WoCreated as date) = curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) = curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (5, 99) and cast(WoStatusChanged as date) = curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoStatus between 1 and 5 and cast(WoCreated as date) = subdate(curdate(), \'1 day\')') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) = subdate(curdate(), \'1 day\')') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (5, 99) and cast(WoStatusChanged as date) = subdate(curdate(), \'1 day\')') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoStatus between 1 and 5 and cast(WoCreated as date) between subdate(curdate(), \'6 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'6 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (5, 99) and cast(WoStatusChanged as date) between subdate(curdate(), \'6 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoStatus between 1 and 5 and cast(WoCreated as date) between subdate(curdate(), \'29 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'29 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (5, 99) and cast(WoStatusChanged as date) between subdate(curdate(), \'29 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoStatus between 1 and 5 and cast(WoCreated as date) between subdate(curdate(), \'364 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (1,2,3,4,5,99) and cast(WoStatusChanged as date) between subdate(curdate(), \'364 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (5, 99) and cast(WoStatusChanged as date) between subdate(curdate(), \'364 day\') and curdate()') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status1"> ' . get_first_value('select count(WoID) as value from words where WoStatus between 1 and 5') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status3"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (1,2,3,4,5,99)') . ' </span></b></th>';
echo '<th class="th1 center"><b><span class="status5stat"> ' . get_first_value('select count(WoID) as value from words where WoStatus in (5, 99)') . ' </span></b></th>';
echo '</tr>';
?>
</table>
<p><input type="button" value="<< Back" onclick="location.href='index.php';" /></p>
<?php
pageend();
?>