<?php
$sub_menu = "777300";
include_once('./_common.php');

include_once(AMINA_PATH.'/lib/admin.lib.php');

$g5['title'] = $g4['title'] = '메뉴설정';

include_once(G5_ADMIN_PATH.'/admin.head.php');

if(AMINA) echo '<br /><br />'."\n";

?>

<link rel="stylesheet" href="<?php echo AMINA_URL; ?>/css/admin.css" />
<script>
	var amina_url = "<?php echo AMINA_URL; ?>";
	var gnu_url = "<?php echo AMINA_URL; ?>";
	var bo_table  = "<?php echo $bo_table; ?>";
</script>
<script src="<?php echo AMINA_URL; ?>/js/admin.js"></script>

<div style="padding:10px; background:#333; color:#fff;">
	<b>※ 메뉴설정방법</b>
</div>
<div style="border:1px solid #ddd; line-height:20px; background#fafafa;">
	<ol>
	<li>등록된 그룹과 게시판에 대해서만 설정가능하며, 설정값들은 각 그룹 여분필드(gr_)와 게시판 여분필드(bo_)에 등록됨</li>
	<li>아이콘은 {아이콘:FA아이콘명} 또는 img 태그 등을 이용하여 등록 가능(등록시 큰따옴표 대신 작은 따옴표 사용)</li>
	<li>별도링크는 그룹메인이나 혹은 게시판이 아닌 다른 곳으로 이동하고자 할 경우 설정(목록이 아닌 글쓰기 바로가기 등)</li>
	<li>일반문서ID는 그룹에 묶고 싶은 page_id 값을 콤마(,)로 구분해서 등록 → 등록된 page_id는 현재 위치표시나 서브메뉴 출력 등 활용</li>
	<li>보기는 해당 메뉴가 그누 회원등급보다 같거나 큰 회원에게만 출력됨(게시판 접근이나 권한은 따로 설정)</li>
	<li>ASR 사용여부는 G4에서 아미나스킨 이외의 타스킨 사용시 모바일 등에서 아미나스킨 사용여부를 체크(G4만 설정가능)</li>
	</ol>
</div>
<form id="amina_setup" name="fboardform" method="post" action="<?php echo AMINA_URL; ?>/admin.menu.update.php" enctype="multipart/form-data">
<input type="hidden" name="mode" value="cf">


<table border=0 class="admin_tbl">
<tr class="head_gray" align="center">
<td>구분</td>
<td>순서</td>
<td>아이디</td>
<td>아이콘</td>
<td>메뉴명</td>
<td>별도링크</td>
<td>일반문서ID</td>
<td>보기</td>
<td>메뉴명/ASR</td>
</tr>
<?php
	if(AMINA) {
		$gr_order = 'gr_order';
		$bo_order = 'bo_order';
		$input_w = '20';
	} else {
		$gr_order = 'gr_10';
		$bo_order = 'bo_order_search';
		$input_w = '10';
	}

	$sql = " select * from {$g5['group_table']} order by $gr_order ";
	$result = sql_query($sql);
	for ($i=0; $row=sql_fetch_array($result); $i++) {
		$gr_sort = AMINA ? $row['gr_order'] : $row['gr_10'];

?>
	<tr bgcolor="#f5f5f5" align="center">
	<td>
		<b>메인</b>
	</td>
	<td>
		<input type="hidden" name="m_type[]" value="gr">
		<input type="text" name="m_order[]" size="2" value="<?php echo $gr_sort;?>"> &nbsp; &nbsp;
	</td>
	<td align="left">
		<input type="hidden" name="m_id[]" value="<?php echo $row['gr_id'];?>">
		<b><?php echo $row['gr_id'];?></b>
	</td>
	<td><input type="text" name="m_icon[]" size="<?php echo $input_w;?>" value="<?php echo $row['gr_2_subj'];?>"></td>
	<td><input type="text" name="m_name[]" size="<?php echo $input_w;?>" value="<?php echo $row['gr_subject'];?>"></td>
	<td><input type="text" name="m_link[]" size="<?php echo $input_w;?>" value="<?php echo $row['gr_2'];?>"></td>
	<td><input type="text" name="m_html[]" size="<?php echo $input_w;?>" value="<?php echo $row['gr_9'];?>"></td>
	<td><?php echo get_member_level_select("m_limit[]", 1, 10, $row['gr_10_subj']); ?></td>
	<td>
		<select name="m_view[]" style="width:80px;">
			<option value="">서브 2개 이상</option>
			<option value="view"<?php if($row['gr_9_subj'] == "view") echo " selected";?>>무조건 보이기</option>
			<option value="none"<?php if($row['gr_9_subj'] == "none") echo " selected";?>>메뉴출력안함</option>
		</select>
	</td>
	</tr>
	<?php
		$sql2 = " select * from {$g5['board_table']} where gr_id = '{$row['gr_id']}' order by $bo_order ";
		$result2 = sql_query($sql2);
		$ressult2_cnt = mysql_num_rows($result2);
		for ($k=0; $row2=sql_fetch_array($result2); $k++) {
			$bo_sort = AMINA ? $row2['bo_order'] : $row2['bo_order_search'];
	?>
		<tr align="center">
		<td>
			서브
		</td>
		<td>
			<input type="hidden" name="m_type[]" value="bo">
			&nbsp; &nbsp; <input type="text" name="m_order[]" size="2" value="<?php echo $bo_sort;?>">
		</td>
		<td align="left">
		<input type="hidden" name="m_id[]" value="<?php echo $row2['bo_table'];?>">
			<?php echo $row2['bo_table'];?>
		</td>
		<td><input type="text" name="m_icon[]" size="<?php echo $input_w;?>" value="<?php echo $row2['bo_2_subj'];?>"></td>
		<td><input type="text" name="m_name[]" size="<?php echo $input_w;?>" value="<?php echo $row2['bo_subject'];?>"></td>
		<td><input type="text" name="m_link[]" size="<?php echo $input_w;?>" value="<?php echo $row2['bo_2'];?>"></td>
		<td>
			<input type="hidden" name="m_html[]" value="">
			-
		</td>
		<td><?php echo get_member_level_select("m_limit[]", 1, 10, $row2['bo_10_subj']); ?></td>
		<td>
			<?php if(AMINA) { ?>
				<input type="hidden" name="m_view[]" value="">
				-
			<?php } else { ?>
				<select name="m_view[]" style="width:80px;">
					<option value="">모두 ASR</option>
					<option value="pc"<?php if($row2['bo_10'] == "pc") echo " selected";?>>모바일만 ASR</option>
					<option value="mobile"<?php if($row2['bo_10'] == "mobile") echo " selected";?>>PC만 ASR</option>
					<option value="none"<?php if($row2['bo_10'] == "none") echo " selected";?>>메뉴출력안함</option>
				</select>
			<?php } ?>
		</td>
		</tr>
	<?php } ?>
<?php } ?>
</table>
<br>
<p align="center"><input type="submit" accesskey="s" value=" 저장하기 " class="btn_red"></p>
</form>

<?php include_once (G5_ADMIN_PATH.'/admin.tail.php'); ?>