<?php

IF (ISSET($user)){  

  ECHO "<span id='panel-nav-ajax-count'>";
  
  /*
  -------
  Кабинет
  -------
  */
  
  ECHO "<a href='/users/cabinet/' class='panel-top-middle'>";
  ECHO "<span class='panel-top-icons'>";
  ECHO ICONS('bars', '20', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Кабинет')."";
  ECHO "</span>";
  ECHO "</a>";
  
  /*
  -----
  Почта
  -----
  */
  
  ECHO "<a href='/users/profile/?path=mail' class='panel-top-middle'>";
  ECHO "<span class='panel-top-icons'>";
  
  $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-top'>99+</span>";
  
  }ELSEIF ($mess > 0){
    
    $c_mess = "<span class='count-panel-top'>".$mess."</span>";
  
  }ELSE{
    
    $c_mess = NULL;
  
  }
  
  ECHO "".$c_mess."";
  ECHO ICONS('envelope', '19', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Почта')."";
  ECHO "</span>";
  ECHO "</a>";
  
  /*
  -----------
  Уведомления
  -----------
  */
  
  ECHO "<a href='/users/profile/?path=notifications' class='panel-top-middle'>";
  ECHO "<span class='panel-top-icons'>";
  $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-top'>99+</span>";
  
  }ELSEIF ($notif > 0){
    
    $c_notif = "<span class='count-panel-top'>".$notif."</span>";
  
  }ELSE{
    
    $c_notif = NULL;
  
  }
  
  ECHO "".$c_notif."";
  ECHO ICONS('bell', '19', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Уведомления')."";
  ECHO "</span>";
  ECHO "</a>";
  
  /*
  -----
  Лента
  -----
  */
  
  ECHO "<a href='/users/profile/?path=tape' class='panel-top-middle'>";
  ECHO "<span class='panel-top-icons'>";
  
  $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-top' style='position: absolute; right: -4px;'>99+</span>";
  
  }ELSEIF ($ta > 0){
    
    $c_ta = "<span class='count-panel-top' style='position: absolute; right: -4px;'>".$ta."</span>";
  
  }ELSE{
    
    $c_ta = NULL;
  
  }
  
  ECHO "".$c_ta."";
  ECHO ICONS('feed', '20', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Лента')."";
  ECHO "</span>";
  ECHO "</a>";
  
  ECHO "</span>";
  
}ELSE{
  
  /*
  -----------
  Авторизация
  -----------
  */
  
  ECHO "<a href='/?get=login' class='panel-top-middle' style='width: 16%'>";
  ECHO "<span class='panel-top-icons'>";
  ECHO ICONS('sign-in', '20', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Авторизация')."";
  ECHO "</span>";
  ECHO "</a>"; 
  
  /*
  ---------------------
  Восстановление пароля
  ---------------------
  */
  
  ECHO "<a href='/?get=password' class='panel-top-middle' style='width: 16%'>";
  ECHO "<span class='panel-top-icons'>";
  ECHO ICONS('lock', '20', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Пароль')."";
  ECHO "</span>";
  ECHO "</a>"; 
  
  /*
  -----------
  Регистрация
  -----------
  */
  
  ECHO "<a href='/?get=registration' class='panel-top-middle' style='width: 16%'>";
  ECHO "<span class='panel-top-icons'>";
  ECHO ICONS('plus', '20', 'fa-fw');
  ECHO "</span>";
  ECHO "<span class='panel-top-title'>";
  ECHO "<br />".LG('Регистрация')."";
  ECHO "</span>";
  ECHO "</a>";
  
}
  
?>