Changeset 584 for trunk/Modules/Translation
- Timestamp:
- Sep 13, 2013, 8:58:04 PM (11 years ago)
- Location:
- trunk/Modules/Translation
- Files:
-
- 2 edited
- 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 } -
trunk/Modules/Translation/Save.php
r582 r584 79 79 } 80 80 } 81 if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 81 if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and 82 ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 82 83 } 83 84 } … … 100 101 $this->Database->query('UPDATE `'.$Table.'` SET '.$Values.' WHERE `ID` = '.$ExistedText['ID']); 101 102 102 $Output .= 'Změny v překladu <a href="'.$this->System->Link('/form.php?group='.$GroupId.'&ID='.$ExistedText['ID']).'">'.$ExistedText['ID'].'</a> ('.$ExistedText['Entry'].') uloženy jako '.$CompleteText[$NewComplete].'.<br />'; 103 $this->System->ModuleManager->Modules['Log']->WriteLog('Změny v překladu <a href="'.$this->System->Link('/form.php?group='.$GroupId.'&ID='.$ExistedText['ID']).'">'.$ExistedText['ID'].'</a> ('.$ExistedText['Entry'].') uloženy jako '.$CompleteText[$NewComplete].'.', LOG_TYPE_TRANSLATION); 103 $Output .= 'Změny v překladu <a href="'.$this->System->Link('/form.php?group='. 104 $GroupId.'&ID='.$ExistedText['ID']).'">'.$ExistedText['ID'].'</a> ('. 105 $ExistedText['Entry'].') uloženy jako '.$CompleteText[$NewComplete].'.<br />'; 106 $this->System->ModuleManager->Modules['Log']->WriteLog('Změny v překladu <a href="'. 107 $this->System->Link('/form.php?group='.$GroupId.'&ID='.$ExistedText['ID']).'">'. 108 $ExistedText['ID'].'</a> ('.$ExistedText['Entry'].') uloženy jako '.$CompleteText[$NewComplete].'.', LOG_TYPE_TRANSLATION); 104 109 } else 105 110 { 106 111 // Insert new user translation 107 112 $Columns = '`Entry`, `VersionStart`, `VersionEnd`, `Language`, `User`, `Take`, `ModifyTime`'; 108 $Values = $EnglishFound['Entry'].', '.$EnglishFound['VersionStart'].', '.$EnglishFound['VersionEnd'].', '.$Language.', '.$this->System->User->Id.', '.$SourceText['ID'].', NOW()'; 113 $Values = $EnglishFound['Entry'].', '.$EnglishFound['VersionStart'].', '. 114 $EnglishFound['VersionEnd'].', '.$Language.', '.$this->System->User->Id.', '.$SourceText['ID'].', NOW()'; 109 115 110 116 $CompleteParts = 0; … … 148 154 $LastID = $this->Database->insert_id; 149 155 150 $Output .= 'Text <a href="'.$this->System->Link('/form.php?group='.$GroupId.'&ID='.$LastID).'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='.$GroupId.'&user=0&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen jako '.$CompleteText[$NewComplete].'. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.<br/>'; 151 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="'.$this->System->Link('/form.php?group='.$GroupId.'&ID='.$LastID).'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='.$GroupId.'&user=0&text=&entry=&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen jako '.$CompleteText[$NewComplete].'. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', LOG_TYPE_TRANSLATION); 156 $Output .= 'Text <a href="'.$this->System->Link('/form.php?group='. 157 $GroupId.'&ID='.$LastID).'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 158 $GroupId.'&user=0&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen jako '. 159 $CompleteText[$NewComplete].'. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.<br/>'; 160 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="'. 161 $this->System->Link('/form.php?group='.$GroupId.'&ID='.$LastID).'">'. 162 $LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 163 $GroupId.'&user=0&text=&entry=&action=filter">'. 164 $TranslationTree[$GroupId]['Name'].'</a> uložen jako '.$CompleteText[$NewComplete]. 165 '. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', LOG_TYPE_TRANSLATION); 152 166 } 153 167 } … … 186 200 } 187 201 188 $Output .= 'Z této stránky můžete být automaticky přesměrování. Nastavit kam chcete být přesměrování si můžete v <a href="'.$this->System->Link('/Options.php').'" title="Nastavení uživatele">Nastavení</a>'; 202 $Output .= 'Z této stránky můžete být automaticky přesměrování. Nastavit kam chcete být přesměrování si můžete v <a href="'. 203 $this->System->Link('/Options.php').'" title="Nastavení uživatele">Nastavení</a>'; 189 204 190 205 // Update flag for experience info load -
trunk/Modules/Translation/Translation.php
r581 r584 5 5 include_once(dirname(__FILE__).'/Save.php'); 6 6 include_once(dirname(__FILE__).'/TranslationList.php'); 7 include_once(dirname(__FILE__).'/Progress.php'); 7 8 8 9 class ModuleTranslation extends AppModule … … 24 25 $this->System->RegisterPage('form.php', 'PageTranslationForm'); 25 26 $this->System->RegisterPage('save.php', 'PageTranslationSave'); 27 $this->System->RegisterPage('progress', 'PageProgress'); 26 28 $this->System->RegisterPage('TranslationList.php', 'PageTranslationList'); 27 29 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => 'Poslední překlady', 28 30 'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS)); 31 $this->System->RegisterMenuItem(array( 32 'Title' => 'Stav dokončení', 33 'Hint' => 'Stav dokončení překládů', 34 'Link' => $this->System->Link('/progress/'), 35 'Permission' => LICENCE_ANONYMOUS, 36 'Icon' => '', 37 ), 1); 29 38 } 30 39
Note:
See TracChangeset
for help on using the changeset viewer.