<?php

$par = DB::GET_STRING("SELECT `ADMINISTRATION`,`USER_ID`,`ID`,`ACT` FROM `COMMUNITIES_PAR` WHERE `COMMUNITY_ID` = '".$comm['ID']."' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '1' LIMIT 1");
$account = DB::GET_STRING("SELECT `LOGIN`,`ID` FROM `USERS` WHERE `ID` = '".$comm['USER_ID']."' LIMIT 1");

IF (!ISSET($comm['ID'])){
  
  ERROR('Неверная директива', 'session');
  REDIRECT('/modules/?path=communities');

}

//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities'>".LG('Сообщества')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($comm['NAME'])."";
ECHO "</div>";

/*
-----------------
Список участников
-----------------
*/

IF (GET('get') == "users"){ 
  
  REQUIRE (ROOT.'/modules/communities/plugins/users.php');
  
}

/*
-------------
Список заявок
-------------
*/

IF (GET('get') == "plus" && $comm['PRIVATE'] == 2){ 
  
  IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || ISSET($par['ID']) && $par['ADMINISTRATION'] == 2 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
    
    REQUIRE (ROOT.'/modules/communities/plugins/plus.php');
    
  }
  
}

/*
------------------
Список приглашений
------------------
*/

IF (GET('get') == "inv"){ 
  
  REQUIRE (ROOT.'/modules/communities/plugins/inv.php');
  
}

/*
-------------------------
Редактирование сообщества
-------------------------
*/

IF (GET('get') == "edit"){ 
  
  IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
    
    REQUIRE (ROOT.'/modules/communities/plugins/edit.php');
    
  }
  
}

ECHO "<div class='list-body' style='table-layout: fixed;'>";

//Заставка
REQUIRE (ROOT.'/modules/communities/plugins/screensaver.php');

ECHO "<div class='login-info'>";

ECHO "<b>".TEXT_ABSOLUTE($comm['NAME'])."</b><br />";

ECHO "</div>";

IF (STR($comm['MESSAGE'])  > 0){
  
  ECHO "<div class='status'>";
  
  ECHO " ".TEXT($comm['MESSAGE'], 0, 1, 0, 0)."";
  
  ECHO "</div>";
  
}

ECHO "</div>";

//Вступление + приглашение
REQUIRE (ROOT.'/modules/communities/plugins/introduction.php');

//Информация
REQUIRE (ROOT.'/modules/communities/plugins/info.php');

//Меню сообщества
REQUIRE (ROOT.'/modules/communities/plugins/menu_list.php');

ECHO "<div class='list-body'>";

IF ($comm['PRIVATE'] == 2){
  
  IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || ISSET($par['ID']) && $par['ADMINISTRATION'] == 2 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
    
    $count = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_PAR` WHERE `COMMUNITY_ID` = '".$comm['ID']."' AND `ACT` = '0'");
    
    ECHO "<div class='list-menu'>";
    ECHO "<a href='/modules/?path=communities&section=show&id=".$comm['ID']."&get=plus'><span class='icons'>".ICONS('plus', 17, 'fa-fw')."</span> ".LG('Заявки на вступление')."</a> <span class='count'>".$count."</sapn>";
    ECHO "</div>";
  
  }
  
}

$count = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_PAR` WHERE `COMMUNITY_ID` = '".$comm['ID']."' AND `ACT` = '2'");

ECHO "<div class='list-menu'>";
ECHO "<a href='/modules/?path=communities&section=show&id=".$comm['ID']."&get=inv'><span class='icons'>".ICONS('plus', 17, 'fa-fw')."</span> ".LG('Приглашения')."</a> <span class='count'>".$count."</sapn>";
ECHO "</div>";

ECHO "</div>";

//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities'>".LG('Сообщества')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($comm['NAME'])."";
ECHO "</div>";

?>