Ignore:
Timestamp:
Sep 13, 2013, 8:58:04 PM (11 years ago)
Author:
chronos
Message:
  • Modified: Page statistic moved to module Translation and renamed to progress.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Translation/Progress.php

    r578 r584  
    11<?php
    22
    3 $InitSystem = true;
    4 include_once('includes/global.php');
     3class 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  }
    565
     66  function Show()
     67  {
    668$LanguageList = GetLanguageList();
    769
    870if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
    9 if(!array_key_exists('StatVersion', $_SESSION)) $_SESSION['StatVersion'] = $Config['Web']['GameVersion'];
     71if(!array_key_exists('StatVersion', $_SESSION)) $_SESSION['StatVersion'] = $this->System->Config['Web']['GameVersion'];
    1072
    1173if(!isset($_SESSION['language']))
    1274{
    13         if($User->Licence(LICENCE_USER))
     75        if($this->System->User->Licence(LICENCE_USER))
    1476        {
    15                 $_SESSION['language'] = $User->Language;
     77                $_SESSION['language'] = $this->System->User->Language;
    1678  } else $_SESSION['language'] = '';
    1779}
     
    2486if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
    2587
    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 
    9088// Show client version selection
    9189$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`');
    9391while($DbRow = $DbResult->fetch_assoc())
    9492  $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> ';
     
    111109  else $LanguageName = 'Všechny';
    112110$Output .= '<br/><br /><h3>Statistika dokončení překladů jazyka '.$LanguageName.' pro verzi '.$_SESSION['StatVersion'].'</h3><br/>';
    113 $Output .= ShowStatTable();
     111$Output .= $this->ShowStatTable();
    114112
    115113$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');
    117115$Line = $ID->fetch_row();
    118116$Output .= $Line[0];
     
    120118               
    121119$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');
    123121$Line = $ID->fetch_row();
    124122$Output .= $Line[0];
    125123$Output .= '</strong></div>';
    126 
    127 ShowPage($Output);
     124    return($Output);
     125  }
     126}
Note: See TracChangeset for help on using the changeset viewer.