<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$nanugi = 10;// 그룹수만큼
$colspan = ($nanugi * 2) + 2;
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
	<tr height="30"><td width="3" background="<?=$g4[path]?>/img/speedmap/speedmap_t_1.gif"></td><td background="<?=$g4[path]?>/img/speedmap/speedmap_t_2.gif"></td><td width="3" background="<?=$g4[path]?>/img/speedmap/speedmap_t_3.gif"></td></tr>
	<tr><td width="3" background="<?=$g4[path]?>/img/speedmap/speedmap_m_1.gif"></td><td align="center">
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<tr height="5" align=right><td colspan="<?=$colspan?>"></td></tr>
			<tr>
				<td></td>
			<?
			$cells = 0; 
			$except = "'00','00','00'"; //제외할 그룹을 써주세요.
			//switch(true) 
			//{
			//	case $member[mb_level] <= 4 : // 정회원 5 미만일때
			//		$except="'banner','html'"; // 제외 그룹
			//		break;
			//	case $member[mb_level] <= 5 : // 정회원일때
			//		$except="'content'"; // 제외그룹
			//		break;
			//	default:
			//		$except="''";
			//}

			//접근가능그룹 여분필드 1 순서로 추출
			$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE  (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0'  ORDER BY a.gr_1";
				
			// 제외그룹설정 root님
			// html , banner , guest 라는 그룹은 제외시킴
			$sql = " select * from $g4[group_table] where gr_id not in ($except) order by gr_1";

			//$sql = " select  gr_id, gr_subject from $g4[group_table] where gr_id not in ($except) order by gr_subject desc ";
			$rst1 = sql_query($sql);

			while ($row=sql_fetch_array($rst1)) {

				echo "<td valign='top' align='center'>";	
				echo "<table cellpadding='0' cellspacing='0' border='0'>";
				echo "<tr height='20'><td valign='top'><strong>$row[gr_subject]</strong></td></tr>"; // 그룹명 출력

				$sql2 = " select * from $g4[board_table] where gr_id = '$row[gr_id]' order by bo_order_search ";
				$rst2 = sql_query($sql2);
				$cells++;

				while ($row2=sql_fetch_array($rst2)) {
				$new_time = date("Y-m-d H:i:s", time()-3600*$row2[bo_new]);
				$sql3 = " select count(*) as cnt from $g4[write_prefix]$row2[bo_table] where wr_datetime >= '$new_time' ";
				$row3 = sql_fetch($sql3);
					if ($row3[cnt] > 0)
						$new = "&nbsp;<img src='$g4[path]/img/icon_new.gif'>"; // new 아이콘
					else
						$new = ""; //new 아이콘 없음
				echo "<tr height='20'><td><a href='$g4[bbs_path]/board.php?bo_table=$row2[bo_table]'>$row2[bo_subject]</a>$new<br/></td>";
				}
				echo "</table>";
				if($cells%$nanugi != 0)
				echo "</td><td width='1' background='$g4[path]/img/speedmap/speedmap_bar.gif'></td>";

			}
			?><td></td></tr><tr height="5"><td colspan="<?=$colspan?>"></td></tr></table></td><td width="3" background="<?=$g4[path]?>/img/speedmap/speedmap_m_2.gif"></td></tr>
			<tr height="3"><td width="3" background="<?=$g4[path]?>/img/speedmap/speedmap_b_1.gif"></td><td background="<?=$g4[path]?>/img/speedmap/speedmap_b_2.gif"></td><td width="3" background="<?=$g4[path]?>/img/speedmap/speedmap_b_3.gif"></td></tr></table>