<?
require_once('include/global.php');
auth_limit("admin");


// set
	$CFG['TITLE'] = '<b>관리자메뉴</b> >> <b>공용게시판관리</b> >> <b>메뉴관리</b>';


// data
	// db - select
		$DEBUG['db_select']['start'] = getmicrotime();
		$sql = "
			SELECT
				bm_no, bm_name, bm_sort
			FROM
				" . $TB['BOARD_MENU'] . "
			WHERE				
				d_no='" . $AUTH['auth_d_no'] . "'
			GROUP BY
				bm_no, bm_name, bm_sort
			ORDER BY
				bm_sort, bm_name
			";
		$rows = db_get_rows($sql);
		$DEBUG['db_select']['exec'] += getmicrotime() - $DEBUG['db_select']['start'];


	// view
		for ($i=0; $i<sizeof($rows); $i++)
		{
			$bm_cnt = db_get_one("SELECT COUNT(*)  FROM " . $TB['BOARD_ADMIN'] . " WHERE bm_no='" . $rows[$i]['bm_no'] . "'");
			$rows[$i]['bm_cnt'] = number_format($bm_cnt);
		}	// for()

		// 마지막 출력순서
		$q = "SELECT MAX(bm_sort) FROM ".$TB['BOARD_MENU']." WHERE d_no='" . $AUTH['auth_d_no'] . "'";
		$bm_sort = db_get_one($q)+1;


// skin view
	nskinset('sadmin', 'admin_board_menu.html');
	include($NSKIN['view_layout']);


require_once('include/global_end.php');
?>