<?php
if (!defined("_GNUBOARD_"))
    exit; // 개별 페이지 접근 불가 
    /*
     * http://www.g4mob.com
     * g4m mobile new.skin.php
     */
?>
<div class="row">
    <div class="col-sm-12">
        <div class="page-header">
            <h1><?php echo $g4['title'] ?></h1>
        </div>
        <div class="well">
            <!-- 분류 시작 -->
            <form name='fnew' method='get' action="" class="form-inline" role='form'>
                <div class='form-group'>
                    <?php echo $group_select ?>
                </div>
                <div class='form-group'>
                    <select id='view' name='view' onchange="select_change()" class='form-control'>
                        <option value=''>게시물</option>
                        <option value='w'>원글</option>
                        <option value='c'>코멘트</option>
                    </select>
                </div>
                <div class='form-group'>
                    <input type='text' id='mb_id' name='mb_id' size="6" class="form-control" value='<?php echo $mb_id ?>' placeholder="아이디"/>
                </div>            
                <button type="submit" class="btn btn-primary btn-100">검색</button>
            </form>
            <script type="text/javascript">
                function select_change() {
                    document.fnew.submit();
                }
                document.getElementById("gr_id").value = "<?php echo $gr_id ?>";
                document.getElementById("view").value = "<?php echo $view ?>";
            </script>

        </div>
        <!-- 분류 끝 -->

        <!-- 제목 시작 -->
        <table class="table table-nohover">
            <thead>
                <tr>
                    <th>[그룹]제목</th>
                    <th>게시판</th>
                </tr>
            </thead>
            <tbody>

                <?php
                $list_count = count($list);
                for ($i = 0; $i < $list_count; $i++) {
                    $gr_subject = cut_str($list[$i]['gr_subject'], 30);
                    $bo_subject = cut_str($list[$i]['bo_subject'], 30);
                    $wr_subject = get_text(cut_str($list[$i]['wr_subject'], 40));
                    ?>
                    <tr>
                        <td>
                            <a href="./new.php?gr_id=<?php echo $list[$i]['gr_id'] ?>" title="<?php echo $gr_subject ?>" class="group">[<?php echo $gr_subject ?>]</a>
                            <a href='<?php echo $list[$i]['href'] ?>' title="제목" class="subj"> &middot; <?php echo $list[$i]['comment'] ?><?php echo $wr_subject ?></a>
                            <br/>
                            <span><?php echo $list[$i]['datetime2'] ?></span>
                        </td>
                        <td style="width: 100px;">
                            <a href='./board.php?bo_table=<?php echo $list[$i]['bo_table'] ?>' title="<?php echo $bo_subject ?>"> <?php echo $bo_subject ?></a>
                            <?php echo $list[$i]['name'] ?>
                        </td>
                    </tr>
                <? } //for?>
                <? if ($list_count == 0) { ?>
                    <tr><td colspan="2"><p style="text-align:center; padding: 40px;">게시물이 없습니다.</p></td></tr>
                <?php } ?>
            </tbody>
        </table>
        <footer>
            <div id="paging" style="text-align: center">
                <?php echo $write_pages ?>
            </div>        
        </footer>

    </div>

</div>