<?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>";

//Добавление раздела
IF (GET('get') == "add"){  
  
  IF (ACCESS('forum_section', NULL, 1) || MANAGEMENT == 1){
    
    REQUIRE (ROOT.'/modules/forum/plugins/section_add.php');
    
  }
  
}
  
ECHO "<div class='tmenu_body'>";  
ECHO "<a href='/modules/?path=forum&get=new' class='tmenu-33'>".LG('Новые')."</a>";
ECHO "<a href='/modules/?path=forum&get=top' class='tmenu-33'>".LG('Популярные')."</a>";
ECHO "<a href='/modules/?path=forum' class='tmenu-33 tmenu-33-o'>".LG('Разделы')."</a>";
ECHO "</div>";

//Поиск
REQUIRE (ROOT.'/modules/search/plugins/form/forum.php');

IF (ISSET($user)){ 
  
  ECHO "<div class='list'>";
  
  IF (ACCESS('forum_section', NULL, 1) || MANAGEMENT == 1){
    
    ECHO "<a href='/modules/?path=forum&get=add' class='btn'>".ICONS('plus', 15, 'fa-fw')." ".LG('Добавить раздел')."</a>";
    
  }
  
  ECHO "<a href='/modules/?path=forum&section=users' class='btn-o'>".ICONS('user', 15, 'fa-fw')." ".LG('Мои темы')."</a>";
  
  ECHO "</div>";
  
}

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_SECTION`");
$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 `FORUM_SECTION` ORDER BY `ID` DESC LIMIT ".$limit.", ".$page_settings."");

WHILE ($list = $data->FETCH())
{
  
  ECHO "<a href='/modules/?path=forum&section=subsection&id=".$list['ID']."'><div class='list-menu hover'><span class='icons'>".ICONS('angle-double-right', 23, 'fa-fw')."</span><b>".TEXT_ABSOLUTE($list['NAME'])."</b><br />";
  ECHO "<font color='#7B8285'><small>".TEXT($list['MESSAGE'])."</small></font></div></a>";

}

IF ($column > 0){

  ECHO "</div>";
  
}

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

//Навигация
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>";
  
?>