<?php
  
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".LG('Онлайн игры')."</a>";
ECHO "</div>";

ECHO "<div class='tmenu_body'>";

IF (GET('get') == 'new'){
  
  $sql = "ORDER BY `TIME` DESC";
  $url = "&get=new";
  
  ECHO "<a href='/modules/?path=games' class='tmenu-33'>".LG('ТОП')."</a>";
  ECHO "<a href='/modules/?path=games&get=new' class='tmenu-33 tmenu-33-o'>".LG('Новые')."</a>";
  ECHO "<a href='/modules/?path=games&get=all' class='tmenu-33'>".LG('Все')."</a>";
  
}ELSEIF (GET('get') == 'all'){
  
  $sql = NULL;
  $url = "&get=all";
  
  ECHO "<a href='/modules/?path=games' class='tmenu-33'>".LG('ТОП')."</a>";
  ECHO "<a href='/modules/?path=games&get=new' class='tmenu-33'>".LG('Новые')."</a>";
  ECHO "<a href='/modules/?path=games&get=all' class='tmenu-33 tmenu-33-o'>".LG('Все')."</a>";
  
}ELSE{
  
  $sql = "ORDER BY `RATING` DESC";
  $url = NULL;
  
  ECHO "<a href='/modules/?path=games' class='tmenu-33 tmenu-33-o'>".LG('ТОП')."</a>";
  ECHO "<a href='/modules/?path=games&get=new' class='tmenu-33'>".LG('Новые')."</a>";
  ECHO "<a href='/modules/?path=games&get=all' class='tmenu-33'>".LG('Все')."</a>";
  
}

ECHO "</div>";

IF (ISSET($user)){
  
  ECHO "<div class='list'>";  
  ECHO "<a class='btn-o' href='/modules/?path=games&section=users&id=".$user['ID']."'>".ICONS('user', 15, 'fa-fw')." ".LG('Мои игры')."</a>";
  ECHO "</div>";
  
  IF (MANAGEMENT == 1){
    
    ECHO "<div class='list'>";    
    ECHO LG('Вы можете добавлять/удалять игры через')." <a load='none' href='/panel/?path=system&section=alpha_install'>".LG('Alpha установщик')."</a>.";
    ECHO "</div>";
    
  }
  
}

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `GAMES`");
$spage = SPAGE($column, $page_settings);
$page = PAGE($spage);
$limit = $page_settings * $page - $page_settings;

IF ($column == 0){ 
  
  HTML::EMPTY();
  
}ELSE{
  
  ECHO "<div class='list-body'>"; 
  
}

$data = DB::GET_STRING_ALL("SELECT * FROM `GAMES` ".$sql." LIMIT ".$limit.", ".$page_settings."");

WHILE ($list = $data->FETCH())
{
  
  REQUIRE (ROOT.'/modules/games/plugins/games_list.php');

}

IF ($column > 0){

  ECHO "</div>";
  
}

IF ($spage > 1){ ECHO STR_PAGE('/modules/?path=games'.$url.'&', $spage, $page); }

IF (ISSET($user)){
  
  ECHO "<div class='list'>";
  ECHO "<a href='/modules/?path=games&section=users&id=".$user['ID']."'>".ICONS('arrow-left', 15, 'fa-fw')." ".LG('К моим играм')."</a>";
  ECHO "</div>";
  
}

//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".LG('Онлайн игры')."</a>";
ECHO "</div>"; 
  
?>