<?php
  
ECHO "<span id='panel-nav-ajax-count'>";
  
ECHO "<div class='panel-bottom-optimize'>";

IF (ISSET($user)){
  
  /*
  -------
  Кабинет
  -------
  */
  
  ECHO "<a href='/users/cabinet/' class='panel-bottom-user'>";
  ECHO "<div class='panel-bottom-title'>";
  ECHO ICONS('bars', '20', 'fa-fw');
  ECHO "<br />".LG('Кабинет')."";
  ECHO "</div>";
  ECHO "</a>";
  
  /*
  -----
  Почта
  -----
  */
  
  ECHO "<a href='/users/profile/?path=mail' class='panel-bottom-user'>";
  ECHO "<div class='panel-bottom-title'>";
  
  $mess = DB::GET_COLUMN("SELECT COUNT(*) FROM `MAIL_MESSAGE` WHERE `USER_ID` = '".$user['ID']."' AND `USER` = '".$user['ID']."' AND `READ` = '0'");
  
  IF ($mess > 99){
    
    $c_mess = "<span class='count-panel-bottom' style='position: absolute; right: -10px;'>99+</span>";
  
  }ELSEIF ($mess > 0){
    
    $c_mess = "<span class='count-panel-bottom' style='position: absolute; right: -10px;'>".$mess."</span>";
  
  }ELSE{
    
    $c_mess = NULL;
  
  }
  
  ECHO "".$c_mess."";  
  ECHO ICONS('envelope', '19', 'fa-fw');
  ECHO "<br />".LG('Почта')."";
  ECHO "</div>";
  ECHO "</a>";
  
  /*
  -----------
  Уведомления
  -----------
  */
  
  ECHO "<a href='/users/profile/?path=notifications' class='panel-bottom-user'>";
  ECHO "<div class='panel-bottom-title'>";
  $notif = DB::GET_COLUMN("SELECT COUNT(*) FROM `NOTIFICATIONS` WHERE `USER_ID` = '".$user['ID']."' AND `READ` = '1'");
  
  IF ($notif > 99){
    
    $c_notif = "<span class='count-panel-bottom'>99+</span>";
  
  }ELSEIF ($notif > 0){
    
    $c_notif = "<span class='count-panel-bottom'>".$notif."</span>";
  
  }ELSE{
    
    $c_notif = NULL;
  
  }
  
  ECHO "".$c_notif."";
  ECHO ICONS('bell', '19', 'fa-fw');
  ECHO "<br />".LG('Уведомления')."";
  ECHO "</div>";
  ECHO "</a>";
  
  /*
  -----
  Лента
  -----
  */
  
  ECHO "<a href='/users/profile/?path=tape' class='panel-bottom-user'>";
  ECHO "<div class='panel-bottom-title'>";
  
  $ta = DB::GET_COLUMN("SELECT COUNT(*) FROM `TAPE` WHERE `USER_ID` = '".$user['ID']."' AND `READ` = '1'");
  
  IF ($ta > 99){
    
    $c_ta = "<span class='count-panel-bottom' style='position: absolute; right: -10px;'>99+</span>";
  
  }ELSEIF ($ta > 0){
    
    $c_ta = "<span class='count-panel-bottom' style='position: absolute; right: -10px;'>".$ta."</span>";
  
  }ELSE{
    
    $c_ta = NULL;
  
  }
  
  ECHO "".$c_ta."";
  ECHO ICONS('feed', '20', 'fa-fw');
  ECHO "<br />".LG('Лента')."";
  ECHO "</div>";
  ECHO "</a>";
  
}ELSE{
  
  /*
  -----------
  Авторизация
  -----------
  */
  
  ECHO "<a href='/?get=login' class='panel-bottom-user' style='width: 33.333%'>";
  ECHO "<div class='panel-bottom-title'>";
  ECHO ICONS('sign-in', '20', 'fa-fw');
  ECHO "<br />".LG('Авторизация')."";
  ECHO "</div>";
  ECHO "</a>"; 
  
  /*
  ---------------------
  Восстановление пароля
  ---------------------
  */
  
  ECHO "<a href='/?get=password' class='panel-bottom-user' style='width: 33.333%'>";
  ECHO "<div class='panel-bottom-title'>";
  ECHO ICONS('lock', '20', 'fa-fw');
  ECHO "<br />".LG('Пароль')."";
  ECHO "</div>";
  ECHO "</a>"; 
  
  /*
  -----------
  Регистрация
  -----------
  */
  
  ECHO "<a href='/?get=registration' class='panel-bottom-user' style='width: 33.333%'>";
  ECHO "<div class='panel-bottom-title'>";
  ECHO ICONS('plus', '20', 'fa-fw');
  ECHO "<br />".LG('Регистрация')."";
  ECHO "</div>";
  ECHO "</a>";
  
}
  
ECHO "</div>";
ECHO "</span>";
  
?>