<?php
if (!defined('_GNUBOARD_')) {
    exit;
}
/*
 * PC Slide Gallery
 */
$ask_img = array('width' => 600, 'height' => 450);

add_stylesheet('<link rel="stylesheet" href="' . G5_THEME_CSS_URL . '/skin/asktheme.latest_slide_gallery.css">', 0);
?>
<div class="latest-slide-gallery-wrap">
    <div class="latest-header">
        <h3 class="latest-title">
            <a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><?php echo $bo_subject; ?></a>
        </h3>
    </div>
    <div class="latest-body">
        <div class="orbit" role="region" aria-label="Gallery" data-orbit>
            <div class="orbit-container">
                <button class="orbit-previous"><span class="show-for-sr">Previous Slide</span>&#9664;&#xFE0E;</button>
                <button class="orbit-next"><span class="show-for-sr">Next Slide</span>&#9654;&#xFE0E;</button>
                <?php
                for ($i = 0; $i < count($list); $i++) {
                    $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $ask_img['width'], $ask_img['height']);
                    //$thumb['small'] = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $ask_img['width'], $ask_img['height']);
                    //$thumb['medium'] = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $ask_img['width'] * 2, $ask_img['height'] * 2);
                    //$thumb['large'] = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $ask_img['width'] * 3, $ask_img['height'] * 3);
                    $is_active = '';
                    if ($i == 0) {
                        $is_active = 'is-active';
                    }
                    ?>
                    <div class='<?php echo $is_active?> orbit-slide'>
                        <div class="slide-conttents">
                            <?php
                            echo "<div class='gallery-photo'><a href='{$list[$i]['href']}' class='img-link'>";
                            echo "<div class='webzine-icons'>";
                            if (isset($list[$i]['icon_new'])) {
                                if ($list[$i]['icon_new']) {
                                    echo '<i class="textcon textcon-new">N</i> ';
                                }
                            }
                            if (isset($list[$i]['icon_hot'])) {
                                if ($list[$i]['icon_hot']) {
                                    echo '<i class="textcon textcon-hot">Hot</i> ';
                                }
                            }
                            if (isset($list[$i]['icon_file'])) {
                                if ($list[$i]['icon_file']) {
                                    echo '<i class="textcon textcon-file">F</i> ';
                                }
                            }
                            if (isset($list[$i]['icon_link'])) {
                                if ($list[$i]['icon_link']) {
                                    echo '<i class="textcon textcon-link">L</i> ';
                                }
                            }
                            if (isset($list[$i]['icon_secret'])) {
                                if ($list[$i]['icon_secret']) {
                                    echo '<i class="textcon textcon-new"><i class="fa fa-unlock-alt" aria-hidden="true"></i></i> ';
                                }
                            }
                            if ($list[$i]['is_notice']) {
                                echo '<i class="textcon textcon-notice">Notice</i> ';
                            }
                            if ($list[$i]['comment_cnt']) {
                                echo "<i class='textcon textcon-default'>" . $list[$i]['comment_cnt'] . "</i>";
                            }
                            echo "</div>";
                            if ($thumb) {
                                echo "<img src='{$thumb['src']}' class='orbit-image'>";
                                //echo "<img data-interchange='[{$thumb['small']['src']}, small], [{$thumb['medium']['src']}, medium], [{$thumb['large']['src']}, large]' class='swiper-lazy'>";
                            } else {
                                echo "<img src='{$latest_skin_url}/img/noimage.png' class='orbit-image'>";
                            }
                            echo "</a></div>";
                            echo "<a href='{$list[$i]['href']}' class='latest-link'>";
                            echo $list[$i]['subject'];

                            echo "</a>";

                            // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
                            // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
                            ?>
                        </div>
                    </div>
                <?php } ?>
                <?php if (count($list) == 0) { //게시물이 없을 때   ?>
                    <div class='is-active orbit-slide'>게시물이 없습니다.</div>
                <?php } ?>
            </div>
            <nav class="orbit-bullets">
                <?php
                for ($i = 0; $i < count($list); $i++) {
                    $is_active = '';
                    if ($i == 0) {
                        $is_active = 'is-active';
                    }
                    ?>
                    <button class="<?php echo $is_active ?>" data-slide="<?php echo $i ?>"></button>
                <?php } ?>
            </nav>
        </div>
    </div>

    <div class="latest-footer">
        <div class="latest-more">
            <a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><span class="sound_only"><?php echo $bo_subject ?></span>more</a>
        </div>
    </div>
</div>