Просмотр файла 2/3020.ru/users/profile/notifications/content/index.php

Размер файла: 2.59Kb
<?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 `NOTIFICATIONS` WHERE `USER_ID` = '".$user['ID']."' AND `READ` = '1' LIMIT 1") > 0){
  
  DB::GET_SET("UPDATE `NOTIFICATIONS` SET `READ` = '0' WHERE `USER_ID` = '".$user['ID']."'");
  
}

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

ECHO "<div class='list'>";
ECHO "<a href='/users/profile/?path=notifications&section=settings' class='btn'>".ICONS('gear', 15, 'fa-fw')." ".LG('Настройки')."</a>";
ECHO "</div>";

$column = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `NOTIFICATIONS` 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 `NOTIFICATIONS` 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/notifications/components/'.$list['TYPE'].'.php')){
    
    REQUIRE (ROOT.'/users/profile/notifications/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=notifications&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=notifications&', $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>";
  
?>