Changeset 410
- Timestamp:
- Mar 31, 2010, 9:11:05 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/index.php
r398 r410 567 567 } 568 568 569 function ExportViewStat() 570 { 571 global $Database, $System; 572 573 $Export = new Export($System); 574 $Export->Id = $_GET['ExportId']; 575 $Export->Init(); 576 $Export->LoadFilters(); 577 578 $GroupListQuery = 'SELECT `Group`.* FROM `Group` '. 579 ' JOIN `ExportGroup` ON (`ExportGroup`.`Export`='.$Export->Id.') AND (`ExportGroup`.`Group`=`Group`.`Id`)'; 580 $Query = ''; 581 $DbResult = $Database->SQLCommand($GroupListQuery); 582 while($DbRow = mysql_fetch_assoc($DbResult)) 583 { 584 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 585 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 586 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$Export->Id.') '. 587 ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$Export->Id.')'. 588 ' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 589 ') AS `C1`) AS `Translated`, '. 590 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 591 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 592 ' WHERE (`Language` = 0) AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 593 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 594 } 595 $Query = substr($Query, 0, - 6); 596 597 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 598 $DbRow = mysql_fetch_row($DbResult); 599 $PageList = GetPageList($DbRow[0]); 600 echo('<h3>Statistika dokončení vybraných skupin</h3>'); 601 echo($PageList['Output']); 602 603 echo('<table class="BaseTable">'); 604 $TableColumns = array( 605 array('Name' => 'Name', 'Title' => 'Jméno'), 606 array('Name' => 'Translated', 'Title' => 'Přeložených'), 607 array('Name' => 'Total', 'Title' => 'Anglických'), 608 array('Name' => 'Percent', 'Title' => 'Procenta'), 609 ); 610 611 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 612 echo($Order['Output']); 613 614 $Translated = 0; 615 $Total = 0; 616 $ID = $Database->SQLCommand('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 617 while($Group = mysql_fetch_assoc($ID)) 618 { 619 echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'); 620 $Translated += $Group['Translated']; 621 $Total += $Group['Total']; 622 } 623 echo('<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Translated / $Total * 100, 2)).'</strong></td></tr>'); 624 echo('</table>'); 625 } 626 569 627 function ExportView() 570 628 { … … 576 634 $UserLine = mysql_fetch_assoc($DbResult); 577 635 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>'); 578 ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', ' Výstup'));636 ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup')); 579 637 echo('<div id="content">'); 580 638 if($_SESSION['Tab'] == 0) ExportViewGeneral(); … … 584 642 else if($_SESSION['Tab'] == 4) ExportViewOutputFormat(); 585 643 else if($_SESSION['Tab'] == 5) ExportViewVersion(); 586 else if($_SESSION['Tab'] == 6) ExportViewOutput(); 644 else if($_SESSION['Tab'] == 6) ExportViewStat(); 645 else if($_SESSION['Tab'] == 7) ExportViewOutput(); 587 646 588 647 echo('</div>'); -
trunk/includes/global_function.php
r399 r410 502 502 { 503 503 if (strpos($ArrStr[$i],"'s") > 0) 504 504 $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-2); 505 505 if (strpos($ArrStr[$i],',') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1); 506 506 if (strpos($ArrStr[$i],'.') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1); … … 511 511 $where .= '(`O`.`'.$Column.'` LIKE "%'.addslashes($ArrStr[$i]).'%") OR '; 512 512 $SqlOK = true; 513 513 } 514 514 } 515 515 $where = substr($where,0,strlen($where)-4); … … 519 519 // echo ($sql.'|'.$where.'|'.$groupby); 520 520 while($Line = mysql_fetch_assoc($ID)) { 521 521 $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 522 522 } 523 523 } 524 524 } 525 525 } 526 526 return $buff; 527 527 } 528 529 function ProgressBar($Width, $Percent, $Text = '') 530 { 531 $Pixels = $Width * ($Percent / 100); 532 if($Pixels > $Width) $Pixels = $Width; 533 if($Text == '') $Text = $Percent; 534 535 return('<div class="progressbar" style="width: '.$Width.'px">'. 536 '<div class="bar" style="width: '.$Pixels.'px;"></div>'. 537 '<div class="text" style="width: '.$Width.'px">'.$Text.'</div>'. 538 '</div>'); 539 } 540 541 function GetLevelMinMax($XP) 542 { 543 $IndexLevel = 100; 544 545 if($XP > 0) $Level = floor(sqrt($XP / $IndexLevel)); 546 else $Level = 0; 547 $MinXP = $Level * $Level * $IndexLevel; 548 $MaxXP = ($Level + 1) * ($Level + 1) * $IndexLevel; 549 $MaxXP = $MaxXP - $MinXP; 550 $XP = $XP - $MinXP; 551 return(array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP)); 552 } 553 528 554 ?> -
trunk/statistic.php
r402 r410 3 3 include('includes/global.php'); 4 4 5 function ShowStatTable() 6 { 7 global $Database, $Config; 8 9 $LanguageId = LoadLanguageIdParameter(); 10 $BuildNumber = GetBuildNumber($Config['Web']['GameVersion']); 11 12 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; 13 $Query = ''; 14 $DbResult = $Database->SQLCommand($GroupListQuery); 15 while($DbRow = mysql_fetch_assoc($DbResult)) 16 { 17 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 18 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 19 ' WHERE (`Complete` = 1) AND (`Language`='.$LanguageId.') AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 20 ') AS `C1`) AS `Translated`, '. 21 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 22 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 23 ' WHERE (`Language` = 0) AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 24 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 25 } 26 $Query = substr($Query, 0, - 6); 27 28 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 29 $DbRow = mysql_fetch_row($DbResult); 30 $PageList = GetPageList($DbRow[0]); 31 echo($PageList['Output']); 32 33 echo('<table class="BaseTable">'); 34 $TableColumns = array( 35 array('Name' => 'Name', 'Title' => 'Jméno'), 36 array('Name' => 'Translated', 'Title' => 'Přeložených'), 37 array('Name' => 'Total', 'Title' => 'Anglických'), 38 array('Name' => 'Percent', 'Title' => 'Procenta'), 39 ); 40 41 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 42 echo($Order['Output']); 43 44 $Translated = 0; 45 $Total = 0; 46 $ID = $Database->SQLCommand('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 47 while($Group = mysql_fetch_assoc($ID)) 48 { 49 echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'); 50 $Translated += $Group['Translated']; 51 $Total += $Group['Total']; 52 } 53 echo('<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Translated / $Total * 100, 2)).'</strong></td></tr>'); 54 echo('</table>'); 55 } 56 5 57 ShowPage(); 6 58 7 $LanguageId = LoadLanguageIdParameter(); 8 if($LanguageId > 0) $language = '&language='.$LanguageId; 9 else $language = ''; 10 11 echo('<strong>Statistika:</strong> <a href="statistic.php">Všechny</a>'); 59 echo('<h3>Statistika dokončení překladů pro verzi '.$Config['Web']['GameVersion'].'</h3><br/>Jazyk: <a href="statistic.php">Dohromady</a>'); 12 60 foreach($LanguageList as $Language) 13 61 if($Language['Enabled'] == 1) echo(' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>'); 14 62 63 echo('<br/><br/>'); 15 64 16 foreach($TranslationTree as $Group) 17 if($Group['TablePrefix'] != '') 18 echo('<div class="state-image"><img alt="'.$Group['TablePrefix'].'" src="img_statistic.php?group='.$Group['Id'].$language.'" title="Statistika překladů '.$Group['Name'].'"/></div>'); 65 ShowStatTable(); 19 66 20 echo('< 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>67 echo('<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> 21 68 <div>Počet stáhnutí přeložených textů v SQL souboru: <strong>'); 22 69 -
trunk/style/style.css
r296 r410 433 433 } 434 434 435 .progressbar 436 { 437 position: relative; 438 border: 0px solid black; 439 background-color: #e0e0e0; 440 } 441 442 .progressbar .bar 443 { 444 position: absolute; 445 top: 0; 446 left: 0; 447 height: 100%; 448 background-color: #ff8080; 449 } 450 451 .progressbar .text 452 { 453 text-align: center; 454 position: relative; 455 } -
trunk/userlist.php
r378 r410 37 37 array('Name' => 'TranslatedCount', 'Title' => 'Přeložených'), 38 38 array('Name' => 'XP', 'Title' => 'Úroveň'), 39 array('Name' => 'GM', 'Title' => 'Oprávnění'), 39 array('Name' => 'XP', 'Title' => 'Zkušenost'), 40 //array('Name' => 'GM', 'Title' => 'Oprávnění'), 40 41 array('Name' => 'LastLogin', 'Title' => 'Poslední připojení'), 41 42 ); … … 44 45 45 46 46 $Query = 'SELECT `ID`, `User`.`Name`, `LastLogin`, `GM`, ` TranslatedCount` FROM `User` '.$_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit'];47 $Query = 'SELECT `ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount` FROM `User` '.$_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit']; 47 48 48 49 $ID = $Database->SQLCommand($Query); … … 53 54 else $Name = $Line['Name']; 54 55 56 $XP = GetLevelMinMax($Line['XP']); 55 57 echo('<tr><td>'.$Name.'</td> 56 <td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&action=userall" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td> 57 <td><img src="tmp/user/'.$Line['Name'].'/level.png" alt="Úroveň uživatele" /></td> 58 <td>'.$Moderators[$Line['GM']].'</td> 59 <td>'.HumanDate($Line['LastLogin']).'</td></tr>'); 58 <td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&action=userall" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'. 59 '<td>'.$XP['Level'].'</td>'. 60 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'. 61 //<td>'.$Moderators[$Line['GM']].'</td> 62 '<td>'.HumanDate($Line['LastLogin']).'</td></tr>'); 60 63 } 61 64 echo('</table>');
Note:
See TracChangeset
for help on using the changeset viewer.