source: trunk/statistic.php@ 449

Last change on this file since 449 was 449, checked in by george, 15 years ago
  • Upraveno: Informaci o dostupných verzích vyčítat přímo z tabulky ClientVersion sloupce Imported namísto složitých detekcí.
File size: 3.9 KB
Line 
1<?php
2
3include('includes/global.php');
4
5if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
6if(!array_key_exists('StatVersion', $_SESSION)) $_SESSION['StatVersion'] = $Config['Web']['GameVersion'];
7
8function ShowStatTable()
9{
10 global $Database, $Config;
11
12 $LanguageId = LoadLanguageIdParameter();
13 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']);
14
15 $GroupListQuery = 'SELECT `Group`.* FROM `Group`';
16 $Query = '';
17 $DbResult = $Database->SQLCommand($GroupListQuery);
18 while($DbRow = mysql_fetch_assoc($DbResult))
19 {
20 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
21 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'.
22 ' WHERE (`Complete` = 1) AND (`Language`='.$LanguageId.') AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
23 ') AS `C1`) AS `Translated`, '.
24 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
25 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'.
26 ' WHERE (`Language` = 0) AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
27 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';
28 }
29 $Query = substr($Query, 0, - 6);
30
31 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
32 $DbRow = mysql_fetch_row($DbResult);
33 $PageList = GetPageList($DbRow[0]);
34 echo($PageList['Output']);
35
36 echo('<table class="BaseTable">');
37 $TableColumns = array(
38 array('Name' => 'Name', 'Title' => 'Jméno'),
39 array('Name' => 'Translated', 'Title' => 'Přeložených'),
40 array('Name' => 'Total', 'Title' => 'Anglických'),
41 array('Name' => 'Percent', 'Title' => 'Procenta'),
42 );
43
44 $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
45 echo($Order['Output']);
46
47 $Translated = 0;
48 $Total = 0;
49 $ID = $Database->SQLCommand('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
50 while($Group = mysql_fetch_assoc($ID))
51 {
52 echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>');
53 $Translated += $Group['Translated'];
54 $Total += $Group['Total'];
55 }
56 if($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);
57 else $Total = 0;
58 echo('<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $Total).'</strong></td></tr>');
59 echo('</table>');
60}
61
62ShowPage();
63
64// Show client version selection
65echo('Zobrazit statistiku pro verzi: ');
66$DbResult = $System->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');
67while($DbRow = $DbResult->fetch_assoc())
68{
69 echo('<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> ');
70}
71
72// Show language selection
73echo('<br /><br /><h3>Statistika dokončení překladů pro verzi '.$_SESSION['StatVersion'].'</h3><br/>');
74echo('Jazyk: <a href="statistic.php">Dohromady</a>');
75foreach($LanguageList as $Language)
76 if($Language['Enabled'] == 1) echo(' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>');
77
78echo('<br/><br/>');
79
80ShowStatTable();
81
82echo('<br/><p><strong>Celková statistika v závislosti na čase: </strong><a href="http://stat.zdechov.net/game/?Measure=18">Počet přeložených textů</a></p>
83<div>Počet stáhnutí přeložených textů v SQL souboru: <strong>');
84
85$ID = $Database->SQLCommand('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 2');
86$Line = mysql_fetch_row($ID);
87echo($Line[0]);
88
89echo('</strong></div>
90<div>Počet stáhnutí: <strong>');
91
92$ID = $Database->SQLCommand('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 0');
93$Line = mysql_fetch_row($ID);
94echo($Line[0]);
95
96echo('</strong></div>');
97
98ShowFooter();
99
100?>
Note: See TracBrowser for help on using the repository browser.