<?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 (ISSET($user)){
  
  IF (ACCESS('news', NULL, 1) || MANAGEMENT == 1){
    
    IF (GET('get') == 'add'){
      
      REQUIRE (ROOT.'/modules/news/plugins/add.php');
      
    }
    
    ECHO "<div class='list'>";
    
    ECHO "<a class='btn' href='/modules/?path=news&get=add'>".ICONS('plus', 15, 'fa-fw')." ".LG('Добавить новость')."</a>";
    
    ECHO "</div>";
    
  }
  
}

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

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

}

IF ($column > 0){

  ECHO "</div>";
  
}

IF ($spage > 1){ ECHO STR_PAGE('/modules/?path=news&', $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>"; 
  
?>