<?php
/*
 *  배너 목록
 */
include_once './_common.php';
set_session("ask_delete_token", $token = uniqid(time()));
include_once './index.php';

if (!defined('_GNUBOARD_')) {
    exit;
}

include_once G5_PLUGIN_PATH . "/asktheme/_admin/head.php";
add_stylesheet('<link rel="stylesheet" href="' . G5_PLUGIN_URL . '/asktheme/plugin/' . $plugin['id'] . '/plugin_style.css">', 0);
$banner_config = get_plugin_config($plugin['id']);
$sql = "select * from ask_plugin_sidemenu";
$result = sql_query($sql);
?>
<div id="container">
    <div class="row">
        <div class="small-12 medium-12 large-12 columns">
            <?php
            if ($banner_config['pc_use'] == 0) {
                echo "<div class='alert alert-default'>배너 플러그인이 사용 중지상태입니다. 설정 메뉴에서 변경가능합니다.</div>";
            }
            ?>
            <div class="panel panel-default">
                <div class="panel-header">
                    <h1><?php echo $plugin['name'], $plugin['version']; ?> 목록</h1>
                </div>
                <div class="panel-body">
                    <div class="responsetable tb-even center">
                        <div class="caption">
                            사이드메뉴 매칭 목록
                        </div>
                        <div class="tb-header">
                            <div class="tb-row">
                                <div class="tb-cell">
                                    그룹
                                </div>
                                <div class="tb-cell">
                                    1차메뉴
                                </div>
                                <div class="tb-cell">
                                    사용여부
                                </div>
                                <div class="tb-cell">
                                    관리
                                </div>
                            </div>
                        </div>
                        <div class="tb-body">
                            <?php for ($i = 0; $rows = sql_fetch_array($result); $i++) { ?>
                                <div class="tb-row">
                                    <div class="tb-cell">
                                        <?php echo $rows['as_gr_id'] ?>
                                    </div>
                                    <div class="tb-cell">
                                        <?php
                                            $sql = "select me_name from {$g5['menu_table']} where me_code = '{$rows['as_me_code']}'";
                                            $menu = sql_fetch($sql);
                                            echo $menu['me_name'];
                                        ?>
                                    </div>

                                    <div class="tb-cell">
                                        <?php
                                        if ($rows['as_status'] == 1) {
                                            echo '<span class="label label-default">사용중</span>';
                                        } else {
                                            echo '<span class="label label-danger">중지됨</span>';
                                        }
                                        ?>
                                    </div>
                                    <div class="tb-cell">
                                        <div class="button-group small">
                                            <a href="./sidemenu_add.php?w=u&idx=<?php echo $rows['as_idx'] ?>" class="button"><i class='fa fa-pencil'></i> <span class='show-for-medium'>수정</span></a>
                                            <a href="./sidemenu_delete.php?idx=<?php echo $rows['as_idx'] ?>&amp;token=<?php echo $token?>" class="button alert sidemenu-delete"><i class='fa fa-trash'></i> <span class='show-for-medium'>삭제</span></a>
                                        </div>
                                    </div>
                                </div>
                            <?php } ?>
                            <?php if ($i == 0) { ?>
                                <div class="tb-row-group">
                                    <div class="tb-row">
                                        <div class="tb-cell empty-table">
                                            등록된 사이드메뉴 매칭이 없습니다.
                                        </div>
                                    </div>
                                </div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">

                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('.sidemenu-delete').click(function () {
            if (confirm('사이드메뉴 매칭를 삭제하시겠습니까?')) {
                return true;
            } else {
                return false;
            }
        });
    });
</script>
<?php
include_once G5_PLUGIN_PATH . "/asktheme/_admin/tail.php";

