Changeset 584 for trunk/Modules/Translation/Progress.php
- Timestamp:
- Sep 13, 2013, 8:58:04 PM (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Progress.php
r578 r584 1 1 <?php 2 2 3 $InitSystem = true; 4 include_once('includes/global.php'); 3 class PageProgress extends Page 4 { 5 function ShowStatTable() 6 { 7 $Output = ''; 8 9 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']); 10 if(is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')'; 11 else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')'; 12 13 $GroupListQuery = 'SELECT `Id`, `TablePrefix`, `Name` FROM `Group`'; 14 $Query = ''; 15 $DbResult = $this->Database->query($GroupListQuery); 16 if($DbResult->num_rows > 0) 17 { 18 while($DbRow = $DbResult->fetch_assoc()) 19 { 20 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 21 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 22 'WHERE (`Complete` = 1) '.$LanguageFilter.' '. 23 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 24 ') AS `C1`) AS `Translated`, '. 25 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 26 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 27 'WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') '. 28 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 29 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 30 } 31 $Query = substr($Query, 0, - 6); 32 33 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 34 $DbRow = $DbResult->fetch_row(); 35 $PageList = GetPageList($DbRow[0]); 36 $Output .= $PageList['Output']; 37 38 $Output .= '<table class="BaseTable">'; 39 $TableColumns = array( 40 array('Name' => 'Name', 'Title' => 'Jméno'), 41 array('Name' => 'Translated', 'Title' => 'Přeložených'), 42 array('Name' => 'Total', 'Title' => 'Anglických'), 43 array('Name' => 'Percent', 'Title' => 'Procenta'), 44 ); 45 46 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 47 $Output .= $Order['Output']; 48 49 $Translated = 0; 50 $Total = 0; 51 $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 52 while($Group = $DbResult->fetch_assoc()) 53 { 54 $Output .= '<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; 55 $Translated += $Group['Translated']; 56 $Total += $Group['Total']; 57 } 58 if($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2); 59 else $TotalCount = 0; 60 $Output .= '<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $TotalCount).'</strong></td></tr>'. 61 '</table>'; 62 } 63 return($Output); 64 } 5 65 66 function Show() 67 { 6 68 $LanguageList = GetLanguageList(); 7 69 8 70 if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version']; 9 if(!array_key_exists('StatVersion', $_SESSION)) $_SESSION['StatVersion'] = $ Config['Web']['GameVersion'];71 if(!array_key_exists('StatVersion', $_SESSION)) $_SESSION['StatVersion'] = $this->System->Config['Web']['GameVersion']; 10 72 11 73 if(!isset($_SESSION['language'])) 12 74 { 13 if($ User->Licence(LICENCE_USER))75 if($this->System->User->Licence(LICENCE_USER)) 14 76 { 15 $_SESSION['language'] = $ User->Language;77 $_SESSION['language'] = $this->System->User->Language; 16 78 } else $_SESSION['language'] = ''; 17 79 } … … 24 86 if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = ''; 25 87 26 27 function ShowStatTable()28 {29 global $System, $User, $Config;30 31 $Output = '';32 33 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']);34 if(is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';35 else $LanguageFilter = ' AND (`Language`!='.$Config['OriginalLanguage'].')';36 37 $GroupListQuery = 'SELECT `Id`, `TablePrefix`, `Name` FROM `Group`';38 $Query = '';39 $DbResult = $System->Database->query($GroupListQuery);40 if($DbResult->num_rows > 0)41 {42 while($DbRow = $DbResult->fetch_assoc())43 {44 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.45 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.46 'WHERE (`Complete` = 1) '.$LanguageFilter.' '.47 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.48 ') AS `C1`) AS `Translated`, '.49 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.50 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.51 'WHERE (`Language` = '.$Config['OriginalLanguage'].') '.52 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.53 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';54 }55 $Query = substr($Query, 0, - 6);56 57 $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');58 $DbRow = $DbResult->fetch_row();59 $PageList = GetPageList($DbRow[0]);60 $Output .= $PageList['Output'];61 62 $Output .= '<table class="BaseTable">';63 $TableColumns = array(64 array('Name' => 'Name', 'Title' => 'Jméno'),65 array('Name' => 'Translated', 'Title' => 'Přeložených'),66 array('Name' => 'Total', 'Title' => 'Anglických'),67 array('Name' => 'Percent', 'Title' => 'Procenta'),68 );69 70 $Order = GetOrderTableHeader($TableColumns, 'Name', 0);71 $Output .= $Order['Output'];72 73 $Translated = 0;74 $Total = 0;75 $DbResult = $System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);76 while($Group = $DbResult->fetch_assoc())77 {78 $Output .= '<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';79 $Translated += $Group['Translated'];80 $Total += $Group['Total'];81 }82 if($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);83 else $TotalCount = 0;84 $Output .= '<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $TotalCount).'</strong></td></tr>'.85 '</table>';86 }87 return($Output);88 }89 90 88 // Show client version selection 91 89 $Output = 'Verze klienta: '; 92 $DbResult = $ System->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');90 $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`'); 93 91 while($DbRow = $DbResult->fetch_assoc()) 94 92 $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> '; … … 111 109 else $LanguageName = 'Všechny'; 112 110 $Output .= '<br/><br /><h3>Statistika dokončení překladů jazyka '.$LanguageName.' pro verzi '.$_SESSION['StatVersion'].'</h3><br/>'; 113 $Output .= ShowStatTable();111 $Output .= $this->ShowStatTable(); 114 112 115 113 $Output .= '<div>Počet stáhnutí přeložených textů v SQL souboru: <strong>'; 116 $ID = $ System->Database->query('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 2');114 $ID = $this->Database->query('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 2'); 117 115 $Line = $ID->fetch_row(); 118 116 $Output .= $Line[0]; … … 120 118 121 119 $Output .= '<div>Počet stáhnutí: <strong>'; 122 $ID = $ System->Database->query('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 0');120 $ID = $this->Database->query('SELECT count(distinct(`IP`)) FROM `Log` WHERE `Type` = 0'); 123 121 $Line = $ID->fetch_row(); 124 122 $Output .= $Line[0]; 125 123 $Output .= '</strong></div>'; 126 127 ShowPage($Output); 124 return($Output); 125 } 126 }
Note:
See TracChangeset
for help on using the changeset viewer.