<?php 

if ($type  ==  'groups_topic')
{
$topic = mysql_fetch_assoc(mysql_query("SELECT p.*, u.level, ru.nick, ru.date_last, g.name AS 'group_name', g.public_admin, g.avatar AS 'img'
                                            FROM `groups_topic` AS p
                                            LEFT JOIN groups_users AS u ON u.id_user = p.id_user
                                            LEFT JOIN user AS ru ON p.id_user = ru.id
                                            LEFT JOIN groups AS g ON g.uid = p.id_group
                                            WHERE p.uid = '$post[id_sim]'
                                            LIMIT 1"));

?>
<div class="groups">
  <div class="group-post">
    <div class="group-table">
      <div class="group-table-cell group-post-title">
        <img src="/groups/<?= ($topic['img'] ? '30x30/' . $topic['img'] . '.jpg' : 'style/img/group_ava_50.png')?>" class="group-small-avatar" /> 
        <? if ($topic['public_admin'] == 1 && $topic['level'] > 1) { ?>
          <a href="/groups/group.php?uid=<?= $topic['id_group']?>"><?= text($topic['group_name'])?></a>
        <? } else { ?>
          <a href="/groups/group.php?uid=<?= $topic['id_group']?>"><?= text($topic['group_name'])?></a><b>.:</b>  
          <a href="/info.php?id=<?= $topic['id_user']?>"><?= text($topic['nick'])?></a> 
          <span class="<?= ($topic['date_last'] >= ($time - $set['time_online']) ? 'online' : 'offline')?>"></span>
        <? } ?>
        
        Тема из группы
        <span class="<?= ($post['count'] == 0 ? 'group-post-time' : 'time')?>">
          <?= ($post['count'] > 0 ? '<span class="off"><b>+' . $post['count'] . '</b> ' . vremja($post['time']) . '</span>' : vremja($post['time']))?>
        </span>
      </div>
    </div>
    
  <div class="group-post-content topic-text">
    <a href="/groups/topic.php?uid=<?= $topic['id_group']?>&amp;topic=<?= $topic['uid']?>&amp;disc=true"><?= wordtextwrap(output_text($topic['name'], 1, 1, 1, 0))?></a>
  </div>
  
  <div class="ic-panel">
    <?php echo get_comments_count('topic', $topic['id_group'], $post['id_sim']); ?>
  </div>
</div>
<? 
}