<?php
  
ECHO "<div class='right-optimize'>";

ECHO "<div class='right-title'>".LG('Общение в гостевой')."</div>";

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `GUESTBOOK`");

IF ($column == 0){
  
  ECHO "<div class='list-menu'>";
  ECHO "".LG('Пока пусто')."";
  ECHO "</div>";
  
}

$data = DB::GET_STRING_ALL("SELECT * FROM `GUESTBOOK` ORDER BY `TIME` DESC LIMIT 3");

WHILE ($list = $data->FETCH())
{
  
  ECHO "<div class='list-menu'>";
  
  ECHO "<table style='width: 100%;'><tr>";

  ECHO "<td class='comments-avatar'>";
  ECHO USER::AVATAR($list['USER_ID'], 40);
  ECHO "</td>";
  
  ECHO "<td class='comments-info'>";
  ECHO USER::LOGIN($list['USER_ID'], 0, 1);
  
  ECHO "<br /><span class='time'>".STIME($list['TIME'])."</span>";
  ECHO "</td>";
  
  ECHO "</tr></table>";
  
  ECHO "<span class='icons'>".ICONS('comment', 15, 'fa-fw')."</span> ".CROP_TEXT(TEXT($list['MESSAGE']), 0, 80)."";
  
  ECHO "</div>";

}

ECHO "<div class='list-menu'>";
ECHO "<a href='/modules/?path=guestbook'>".ICONS('arrow-right', 15, 'fa-fw')." ".LG('В гостевую')."</a>";
ECHO "</div>";

ECHO "</div>";
  
?>