System)->Config['OriginalLanguage'].')';
$GroupListQuery = 'SELECT `Id`, `TablePrefix`, `Name` FROM `Group`';
$Query = '';
$DbResult = $this->Database->query($GroupListQuery);
if ($DbResult->num_rows > 0)
{
while ($DbRow = $DbResult->fetch_assoc())
{
$Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
'WHERE (`Complete` = 1) '.$LanguageFilter.' '.
'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
') AS `C1`) AS `Translated`, '.
'(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
'WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '.
'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';
}
$Query = substr($Query, 0, - 6);
$DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
$DbRow = $DbResult->fetch_row();
$PageList = GetPageList($DbRow[0]);
$Output .= $PageList['Output'];
$Output .= '
';
$TableColumns = array(
array('Name' => 'Name', 'Title' => T('Name')),
array('Name' => 'Translated', 'Title' => T('Translated')),
array('Name' => 'Total', 'Title' => T('Original')),
array('Name' => 'Percent', 'Title' => T('Percentage')),
);
$Order = GetOrderTableHeader($TableColumns, 'Name', 0);
$Output .= $Order['Output'];
$Translated = 0;
$Total = 0;
$DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
while ($Group = $DbResult->fetch_assoc())
{
$Output .= ''.T($Group['Name']).' | '.$Group['Translated'].' | '.$Group['Total'].' | '.ProgressBar(150, $Group['Percent']).' |
';
$Translated += $Group['Translated'];
$Total += $Group['Total'];
}
if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);
else $TotalCount = 0;
$Output .= ''.T('Total').' | '.$Translated.' | '.$Total.' | '.ProgressBar(150, $TotalCount).' |
'.
'
';
}
return $Output;
}
function Show(): string
{
$User = ModuleUser::Cast($this->System->GetModule('User'))->User;
$this->Title = T('Progress');
$LanguageList = GetLanguageList();
if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
if (!array_key_exists('StatVersion', $_SESSION))
{
if ($User->Licence(LICENCE_USER) and ($User->PreferredVersionGame != ''))
{
$_SESSION['StatVersion'] = $User->PreferredVersionGame;
} else
{
$_SESSION['StatVersion'] = Core::Cast($this->System)->Config['Web']['GameVersion'];
}
}
if (!isset($_SESSION['language']))
{
if ($User->Licence(LICENCE_USER))
{
$_SESSION['language'] = $User->Language;
} else
{
$_SESSION['language'] = '';
}
}
if (array_key_exists('language', $_GET))
{
if ($_GET['language'] == '') {
$_SESSION['language'] = '';
} else
{
$_SESSION['language'] = $_GET['language'] * 1;
}
}
if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
// Show client version selection
$Output = T('Client version:').' ';
$DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');
while ($DbRow = $DbResult->fetch_assoc())
{
$Output .= ''.$DbRow['Version'].' ';
}
$Output .= '
';
// Show language selection
$Output .= T('Language:').' ';
$Lang = ''.T('All').'';
if ($_SESSION['language'] == '') $Output .= ''.$Lang.' ';
else $Output .= $Lang;
foreach ($LanguageList as $Language)
if ($Language['Enabled'] == 1)
{
$Lang = ' '.T($Language['Name']).'';
if ($Language['Id'] == $_SESSION['language']) $Output .= ''.$Lang.' ';
else $Output .= $Lang;
}
if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
else $LanguageName = T('All');
$Output .= '
'.sprintf(T('Statistics of translation completion of language %s for version %s'), T($LanguageName), $_SESSION['StatVersion']).'
';
$Output .= $this->ShowStatTable();
return $Output;
}
}