Name = 'ClientVersion';
$this->Version = '1.0';
$this->Creator = 'Chronos';
$this->License = 'GNU/GPL';
$this->Description = 'Manage and show list of known versions of WoW client.';
$this->Dependencies = array();
}
function DoStart(): void
{
$this->System->RegisterPage(['client-version'], 'PageClientVersion');
Core::Cast($this->System)->RegisterMenuItem(array(
'Title' => T('Game version'),
'Hint' => T('List of the game client versions'),
'Link' => $this->System->Link('/client-version/'),
'Permission' => LICENCE_ANONYMOUS,
'Icon' => '',
), 10);
}
}
class PageClientVersion extends Page
{
function Show(): string
{
if (array_key_exists('action', $_GET))
{
if ($_GET['action'] == 'item') $Output = $this->ShowItem();
else $Output = $this->ShowList();
} else $Output = $this->ShowList();
return $Output;
}
function ShowItem(): string
{
$Id = 0;
if (TryGetUrlParameterInt('id', $Id))
{
$YesNo = array('Ne', 'Ano');
$DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$Id);
if ($DbResult->num_rows > 0)
{
$Version = $DbResult->fetch_assoc();
$Output = '
'.T('Client version').'
';
$Output .= ''.
''.T('Version').' | '.$Version['Version'].' |
'.
''.T('More information').' | wowwiki.com'.
' |
'.
''.T('Build number').' | '.$Version['BuildNumber'].' |
'.
''.T('Release date').' | '.HumanDate($Version['ReleaseDate']).' |
'.
''.T('Title').' | '.$Version['Title'].' |
'.
''.T('Imported').' | '.$YesNo[$Version['Imported']].' |
'.
'
';
$Output .= '';
if ($Version['Imported'])
{
$Output .= '';
}
} else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
} else $Output = ShowMessage(T('Id not valid'), MESSAGE_CRITICAL);
return $Output;
}
function ShowList(): string
{
$this->Title = T('Game version');
$DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ClientVersion`');
$DbRow = $DbResult->fetch_row();
$PageList = GetPageList($DbRow[0]);
$Output = ''.T('Game version').'
'.
$PageList['Output'];
$TableColumns = array(
array('Name' => 'Version', 'Title' => T('Version')),
array('Name' => 'BuildNumber', 'Title' => T('Build')),
array('Name' => 'ReleaseDate', 'Title' => T('Release date')),
array('Name' => 'Title', 'Title' => T('Title')),
array('Name' => 'Imported', 'Title' => T('Imported')),
);
$Order = GetOrderTableHeader($TableColumns, 'BuildNumber', 1);
$Output .= ''.
$Order['Output'];
$YesNo = array('Ne', 'Ano');
$DbResult = $this->System->Database->query('SELECT * FROM ClientVersion '.$Order['SQL'].$PageList['SQLLimit']);
while ($Version = $DbResult->fetch_assoc())
{
$Output .= ''.
$Version['Version'].' | '.$Version['BuildNumber'].' | '.
HumanDate($Version['ReleaseDate']).' | '.$Version['Title'].' | '.
''.$YesNo[$Version['Imported']].' |
';
}
$Output .= '
'.
$PageList['Output'];
return $Output;
}
}