<?
$id = (int)abs($_GET['id']);
$ank = profile :: getUser($id);
$title = "Группы";
$l = "Группы";
$back = system :: back(profile :: getLink($ank), "Профиль");
require (CORE."head.php");
require('inc.php');
$total = DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `groups_users` WHERE `id_user` = '".$ank['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` = '".$ank['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']."'");
?>
<a class="sim_groups15" href="/groups/?group=<?echo $group['id'];?>">
<img class="sim_groups16" src="<?echo group_ava($group['id']);?>" alt="*" />
<div class="sim_groups17">
<span class="sim_groups18">
<?echo stripcslashes(htmlspecialchars($group['name']));?>
</span>
<div class="sim_groups19">
участников: <?echo $k_pc;?>
</div>
</div>
</a>
<?
}
if ($total > 10)
{
echo $pagination -> printPages("/groups/?");
}
}
if (isset($user['id']) && $user['id'] == $ank['id'])
{
?>
<a class="sim_groups20" href="/groups/?add_group">
<div class="sim_groups21">
<div class="sim_groups22">
Создать группу
</div>
</div>
</a>
<?
}
echo $back;
require (CORE."foot.php");
?>