<?php
  
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "<a href='/id".$user['ID']."'>".$user['LOGIN']."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "".LG('Лента')."";
ECHO "</div>";

IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `TAPE` WHERE `USER_ID` = '".$user['ID']."' AND `READ` = '1' LIMIT 1") > 0){
  
  DB::GET_SET("UPDATE `TAPE` SET `READ` = '0' WHERE `USER_ID` = '".$user['ID']."'");
  
}

IF (GET('delete') && DB::GET_COLUMN("SELECT COUNT(*) FROM `TAPE` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('delete'))."' LIMIT 1") > 0){
  
  DB::GET_SET("DELETE FROM `TAPE` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('delete'))."' LIMIT 1");
  
  REDIRECT('/users/profile/?path=tape&page='.$page.'');
  
}

$column = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `TAPE` WHERE `USER_ID` = '".$user['ID']."'");
$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 `TAPE` WHERE `USER_ID` = '".$user['ID']."' ORDER BY `TIME` DESC LIMIT ".$limit.", ".$page_settings."");

WHILE ($list = $data->FETCH()){
  
  ECHO "<div class='list-menu'>";
  
  IF (IS_FILE(ROOT.'/users/profile/tape/components/'.$list['TYPE'].'.php')){
    
    REQUIRE (ROOT.'/users/profile/tape/components/'.$list['TYPE'].'.php');
    
  }ELSE{
    
    ECHO "<font color='red'>".ICONS('exclamation-triangle', 15, 'fa-fw')." <b>".LG('Ошибка')." ".$list['TYPE']."</b>: ".LG('компонент не обнаружен')."</font>";
    
  }
  
  ECHO "<div style='text-align: right;'><a href='/users/profile/?path=tape&delete=".$list['ID']."&page=".$page."'>".ICONS('times', 18, 'fa-fw')."</a></div>";
  
  ECHO "</div>";
  
}

IF ($column > 0){
  
  ECHO "</div>";
  
}

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

ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "<a href='/id".$user['ID']."'>".$user['LOGIN']."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "".LG('Лента')."";
ECHO "</div>";
  
?>