<?php
if (!defined('_GNUBOARD_')) {
    exit;
}
$pc_list = '';
$mobile_list = '';
$sql = "select * from {$g5['group_table']} order by gr_order, gr_subject";
$result = sql_query($sql);
while ($rows = sql_fetch_array($result)) {
    $pc_list .= "<li>";
    $pc_list .= "<a href='./detail_list.php?group_id={$rows['gr_id']}#tab1'>";
    $pc_list .= $rows['gr_subject'];
    $pc_list .= "</a>";
    $pc_list .= "</li>";
    $mobile_list .= "<li>";
    $mobile_list .= "<a href='./detail_list.php?group_id=mobile-{$rows['gr_id']}#tab2'>";
    $mobile_list .= '<i class="fa fa-mobile-phone" aria-hidden="true"></i> ';
    $mobile_list .= $rows['gr_subject'];
    $mobile_list .= "</a>";
    $mobile_list .= "</li>";
}
?>
<ul class="side-menu">
    <li>
        <a href="./setup.php" class="button"><i class="fa fa-gear"></i> 설정</a>
    </li>
    <li>
        <a href="./indexgroup_list.php" class="button"><i class="fa fa-list"></i> 전체목록</a>
        <h1 class="sub-title">그룹별목록보기</h1>
        <!-- LIST -->
        <script type="text/javascript">
            $(function () {
                $('.list-tab li a').click(function () {
                    var targetItem = $(this).data('target');
                    $(this).parent('li').siblings('li').removeClass('active');
                    $(this).parent('li').addClass('active');
                    $('.' + targetItem).siblings('.tab-item').hide();
                    $('.' + targetItem).show();
                });
                //탭 유지
                if (window.location.hash === '#tab1') {
                    $('#menu_tab1').trigger('click');
                } else if (window.location.hash === '#tab2') {
                    $('#menu_tab2').trigger('click');
                } else if (window.location.hash === '#tab3') {
                    $('#menu_tab3').trigger('click');
                }
            });
        </script>
        <div class="tab-wrap">
            <ul class="tabs tab-header list-tab">
                <li class="active"><a href="#tab1" data-target="tab-s1" id='menu_tab1'> PC </a></li>
                <li class=""><a href="#tab2" data-target="tab-s2" id='menu_tab2'><i class="fa fa-2x fa-mobile-phone" style="font-size: 1.5em;"></i></a></li>
                <li class=""><a href="#tab3" data-target="tab-s3" id='menu_tab3'>기타</a></li>
            </ul>
            <div class="tab-contents">
                <div class="tab-item tab-s1">
                    <div class="side_menu_wrap">
                        <ul class="side_menu">
                            <li><a href='./detail_list.php?webpage=index#tab1'>메인페이지</a></li>
                            <li><a href='./detail_list.php?webpage=index-aside#tab1'>메인ASIDE</a></li>
                            <?php echo $pc_list ?>
                        </ul>
                    </div>
                </div>
                <div class="tab-item tab-s2">
                    <div class="side_menu_wrap">
                        <ul class="side_menu">
                            <li><a href='./detail_list.php?webpage=mobile-index#tab2'><i class="fa fa-mobile-phone" aria-hidden="true"></i> 메인페이지</a></li>
                            <?php echo $mobile_list ?>
                        </ul>
                    </div>
                </div>
                <div class="tab-item tab-s3">
                    <div class="side_menu_wrap">
                        <ul class="side_menu">
                            <li><a href='./detail_list.php?webpage=etc_1#tab3'></i>기타페이지1</a></li>
                            <li><a href='./detail_list.php?webpage=etc_2#tab3'></i>기타페이지2</a></li>
                            <li><a href='./detail_list.php?webpage=etc_3#tab3'></i>기타페이지3</a></li>
                            <li><a href='./detail_list.php?webpage=etc_4#tab3'></i>기타페이지4</a></li>
                            <li><a href='./detail_list.php?webpage=etc_5#tab3'></i>기타페이지5</a></li>
                            <li><a href='./detail_list.php?webpage=etc_6#tab3'></i>기타페이지6</a></li>
                            <li><a href='./detail_list.php?webpage=etc_7#tab3'></i>기타페이지7</a></li>
                            <li><a href='./detail_list.php?webpage=etc_8#tab3'></i>기타페이지8</a></li>
                            <li><a href='./detail_list.php?webpage=etc_9#tab3'></i>기타페이지9</a></li>
                            <li><a href='./detail_list.php?webpage=etc_10#tab3'></i>기타페이지10</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </li>
    <li>
        <a href="./indexgroup_add.php" class="button"><i class="fa fa-plus"></i> 1단계 - 등록</a>
    </li>
</ul>
