Title = T('Translators');
$Output = '';
if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
if ($_SESSION['search'] != '')
{
$SearchQuery = ' AND (`User`.`Name` LIKE "%'.$_SESSION['search'].'%")';
$Output .= '
';
} else $SearchQuery = '';
$TeamFilter = '';
if (array_key_exists('team', $_GET))
{
$TeamId = $_GET['team'] * 1;
$DbResult = $this->Database->select('Team', 'Name', '`Id`='.$TeamId);
if ($DbResult->num_rows > 0)
{
$Team = $DbResult->fetch_assoc();
$Output .= ''.sprintf(T('Users in team %s'), htmlspecialchars($Team['Name'])).'
';
$TeamFilter = ' AND (`Team`='.$_GET['team'].')';
} else
{
$Output .= ShowMessage(sprintf(T('Team %d not found'), $TeamId), MESSAGE_CRITICAL);
}
} else
{
$Output .= ''.T('User list').'
';
}
$DbResult = $this->Database->query('SELECT COUNT(*) FROM `User` WHERE 1'.$SearchQuery.$TeamFilter);
$DbRow = $DbResult->fetch_row();
$PageList = GetPageList($DbRow[0]);
$Output .= $PageList['Output'].
'';
$TableColumns = array(
array('Name' => 'Name', 'Title' => T('Name')),
array('Name' => 'TranslatedCount', 'Title' => T('Translated count')),
array('Name' => 'XP', 'Title' => T('Level')),
array('Name' => 'XP', 'Title' => T('Experience')),
array('Name' => 'LastLogin', 'Title' => T('Last logged in')),
array('Name' => 'RegistrationTime', 'Title' => T('Registration time')),
);
$Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
$Output .= $Order['Output'];
$Query = 'SELECT `User`.`ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` '.
'FROM `User` '.
'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '.
'WHERE 1'.$SearchQuery.$TeamFilter.$Order['SQL'].$PageList['SQLLimit'];
$DbResult = $this->Database->query($Query);
while ($Line = $DbResult->fetch_assoc())
{
$XP = GetLevelMinMax($Line['XP']);
$Output .= ''.$Line['Name'].' | '.
''.$Line['TranslatedCount'].' | '.
''.$XP['Level'].' | '.
''.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).' | '.
''.HumanDate($Line['LastLogin']).' | '.
''.HumanDate($Line['RegistrationTime']).' |
';
}
$Output .= '
'.
$PageList['Output'];
return $Output;
}
}