<?php
/* Author :Serezha
Data: 05.06.2018
*/
profile :: is_user(true);
$title = $l ="Группы";
require (CORE."head.php");
?>
<div class="app-block">
<div class="list tab">
<a class="" href="/groups/">Группы</a>
<? if (isset($user['id']))
{
?> <a class="tab_active" href="/groups/?setts">Управления группами</a>
<?}?>
</div>
<?
$total = DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `groups_users` WHERE `id_user` = '".$user['id']."'");
if ($total == 0)
{
?>
<div class="list _gray _font-s _center">Группы не найдены!</div>
<?
} else {
if ($total > 10)
{
$p = (($_GET['p']) ? intval($_GET['p']) : 1);
$pagination = new pagination(10, $total, $p);
$total_lin = $pagination -> limit;
} else {
$total_lin = '';
}
$query = DB :: $pdo -> query("SELECT * FROM `groups_users` WHERE `id_user` = '".$user['id']."' ORDER BY `id` DESC ".$total_lin."");
while($gpp = $query -> fetch())
{
$group = DB :: $pdo -> queryFetch("SELECT * FROM `groups` WHERE `id` = ? LIMIT 1;", array($gpp['id_group']));
$k_pc = DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `groups_users` WHERE `id_group` = '".$group['id']."'");
echo system :: touch("/groups/?group={$group['id']}","
<div class=\"post-l\">
".group :: Avatar($group,0)."
</div>
<div class=\"post-c\">
<div>".group :: getName($group)."</div>
<div class=\"_gray\">участников: {$k_pc}</div>
</div>
");
}
if ($total > 10)
{
echo $pagination -> printPages("/groups/?");
}
}
if (isset($user['id']))
{
?>
<div class="touch"><a href="/groups/?add_group" class="touch-cont _oh">
Создать группу
</a></div>
<?
}
require (CORE."foot.php");
?>