<?php
/*
 *  배너 목록
 */
include_once './_common.php';
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_cslider_parent";
$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">
                                    배경
                                </div>
                                <div class="tb-cell">
                                    상태
                                </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['acp_area'] ?>
                                    </div>
                                    <div class="tb-cell">
                                        <img src='./images/<?php echo $rows['acp_bg']?>' width="80">
                                    </div>
                                    <div class="tb-cell">
                                        <?php
                                        if($rows['acp_status'] == '1'){
                                            echo "사용중";
                                        }else{
                                            echo "중지됨";
                                        }
                                        ?>
                                    </div>
                                    <div class="tb-cell">
                                        <?php
                                        $sql= "select count(*) as cnt from ask_plugin_cslider where ac_parent_idx = '{$rows['acp_idx']}'";
                                        $count = sql_fetch($sql);
                                        echo $count['cnt'];
                                        ?>
                                    </div>
                                    <div class="tb-cell">
                                        <div class="button-group">
                                            <a href="./slider_add.php?w=u&idx=<?php echo $rows['acp_idx'] ?>" class="button"><i class="fa fa-pencil"></i> <span class='show-for-large'>수정</div></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">
                    &middot; 페이지 등록은 수정을 클릭후 등록하세요!
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('.banner-delete').click(function () {
            if (confirm('배너를 삭제하시겠습니까?')) {
                return true;
            } else {
                return false;
            }
        });
    });
</script>
<?php
include_once G5_PLUGIN_PATH . "/asktheme/_admin/tail.php";

