<?php
$db->SetQuery("SELECT uid,username FROM #@__group_user WHERE gid='{$id}' ORDER BY jointime DESC LIMIT 0,8");
$db->Execute();
$newmenber = '';
while($rs = $db->GetArray()){
	$newmenber .= "<li><a href='{$cfg_member_dir}/index.php?id=".$rs['uid']."' target=\"_blank\">".$rs['username']."</a></li>\n";
}
//最多回贴
$db->SetQuery("SELECT uid,username,replies FROM #@__group_user WHERE gid='{$id}' ORDER BY replies DESC LIMIT 0,5");
$db->Execute();
$replies = '';
while($rs = $db->GetArray()){
	$replies .= "<li><a href='{$cfg_member_dir}/index.php?id=".$rs['uid']."' target=\"_blank\">".$rs['username']."</a> (".$rs['replies'].")</li>\n";
}
//最多发贴
$db->SetQuery("SELECT uid,username,posts FROM #@__group_user WHERE gid='{$id}' ORDER BY posts DESC LIMIT 0,5");
$db->Execute();
$posts = '';
while($rs = $db->GetArray()){
	$posts .= "<li><a href='{$cfg_member_dir}/index.php?id=".$rs['uid']."' target=\"_blank\">".$rs['username']."</a> (".$rs['posts'].")</li>\n";
}
if(!isset($typeid)) $typeid = '';
//小分类
if(!isset($smalltype)) $smalltype = '0';
$smalltype = ereg_replace("[^0-9,]","",$smalltype);
$smalltypes = "";
$smalltype_array = array();
if($smalltype!='0'){
	$smalltype = @explode(",",$smalltype);
	if(is_array($smalltype)) $smalltype = array_filter($smalltype);
	$smalltype = @implode(",",$smalltype);
	if(empty($smalltype)) $smalltype = 0;
	$db->SetQuery("SELECT `id`,`smalltypes` FROM `#@__group_smalltypes` WHERE `userid`=".$userid." AND `id` IN(".$smalltype.") ORDER BY `disorder` ASC");
	$db->Execute();
	while($rs = $db->GetArray()){
		array_push($smalltype_array,$rs);
		$selected = "";
    if($typeid==$rs['id']) $selected = "style='color:red;'";
		$smalltypes .= "<dd><a href='groupdisplay.php?id={$id}&typeid=".$rs['id']."' ".$selected.">".$rs['smalltypes']."</a></dd>\n";
	}
}
?>
    <div id="group_class_left">
   	  <div class="group_classtitle_form">
       	<div class="group_classtitle_bg">栏目列表
        </div>
            <div class="group_class_formtext">
           	  <dl>
                <dt><a href="groupdisplay.php?id=<?php echo $id;?>">所有主题</a></dt>
                <?php if(isset($smalltypes)) echo $smalltypes;?>
              </dl>
                <div class="clear">
                </div>
            </div>
      </div>
        <div class="group_classtitle_form">
       	  <div class="group_classtitle_bg">活跃用户
            </div>
            <div class="group_class_formtext1">
            	<div class="subtitle">
               	  <ul id="subtitle">
					<li><a href="###">发帖数</a></li>
						<li><a href="###">回帖数</a></li>
					</ul>
                    <div class="clear">
                    </div>
                </div>
                <div id="replaytitle">
                	<dl>
                	<dt>正在载入，请稍后...</dt>
					<!--菜单：发帖数-->
						<dd>
                        	<!--DIG循环体开始-->
                            <div class="group_member_class">
                           	  <div class="group_member_img">
                              </div>
                              	<div class="group_member_class_text1">
                               	  <ul>
                                    <?php echo $posts;?>
                                  </ul>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="clear">
                            </div>
                        </dd>
                    <!--菜单：回帖数-->
						<dd>
                        	<!--DIG循环体开始-->
                            <div class="group_member_class">
                            	<div class="group_member_img">
                                </div>
                              	<div class="group_member_class_text1">
                               	  <ul>
                                    <?php echo $replies;?>
                                  </ul>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="clear">
                            </div>
                        </dd>
                  </dl>
                </div>
                <div class="clear">
                </div>
          </div>
        </div>
        
        <div class="group_classtitle_form">
        	<div class="group_classtitle_bg">新加入用户
            </div>
            <div class="group_class_formtext">
            	<ul>
                <?php echo $newmenber;?>
                </ul>
                <div class="clear">
                </div>
            </div>
      </div>

        <div class="group_classtitle_form">
       	  <div class="group_classtitle_bg">最新留言
          </div>
            <?php
            $db->SetQuery("SELECT uname,message FROM #@__group_guestbook WHERE gid='{$id}' ORDER BY stime DESC LIMIT 0,5");
            $db->Execute();
            while($rs = $db->GetArray()){
			?>
          <div class="group_class_gbtext"><?php echo $rs['uname'];?><img src="images/forum01.gif" align="absmiddle" />:<?php echo cn_substr(trim(ClearHtml($rs['message'])),60);?> </div>
          <?php } ?>
            <div class="group_class_more">[<a href="guestbookform.php?id=<?php echo $id;?>">我要留言</a>] <a href="guestbook.php?id=<?php echo $id;?>">更多...</a>
            </div>
      </div>
    </div>