<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

include_once(G5_LIB_PATH.'/thumbnail.lib.php');
$thumb_width = 1000;
$thumb_height = 1000;
?>

<!-- 전체게시물 목록 시작 { -->
<div id="fnewlist" class="new_list">
    <ul>

    <?php
    for ($i=0; $i<count($list); $i++)
    {
        $gr_subject = cut_str($list[$i]['gr_subject'], 20);
        $bo_subject = cut_str($list[$i]['bo_subject'], 20);
        $wr_subject = get_text(cut_str($list[$i]['wr_subject'], 80));

        // 게시물에 첨부된 이미지 출력
        $thumb = get_list_thumbnail($list[$i]['bo_table'], $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
        if($thumb['src']) {
            $img = $thumb['src'];
            $img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
        } else {
            $img_content = '';
        }
    ?>

<li style="border: 1px solid #e1e8ed; border-radius: 8px; margin:10px; padding: 15px; margin-bottom: 15px; background-color: #ffffff; position: relative;">
    <div class="new_info" style="display: flex; justify-content: space-between; align-items: center;">
        <span class="sound_only" style="font-weight: bold; color: #1da1f2;">작성자</span>
        <span class="profile_new_name" style="color: #657786;"><?php echo $list[$i]['name'] ?></span>
    </div>
    
    <div style="margin-top: 10px;margin-left:30px">
    <a href="<?php echo $list[$i]['href'] ?>" class="new_tit" style="font-size: 1.2em; text-decoration: none; font-weight: bold;">
            <?php echo $list[$i]['comment'] ?>
            </a>
        <div style="margin-top: 5px; color: #3a3a3a;font-weight:520;font-size:1.3em">
        <a href="<?php echo $list[$i]['href'] ?>" class="new_tit" style="font-size: 1.2em;text-decoration: none; font-weight: bold;">
            <?php echo $wr_subject ?>
            </a>
        </div>
        <div class="img_content" style="margin-top:5px;">
        <a href="<?php echo $list[$i]['href'] ?>" class="new_tit" style="font-size: 1.2em; text-decoration: none; font-weight: bold;">
            <?php echo $img_content ?>
            </a>
        </div>
        <div stule="margin-top:10px;">
        <a href="<?php echo $list[$i]['href'] ?>" class="new_tit" style="font-size: 1.2em; color: #1da1f2; text-decoration: none; font-weight: bold;">
        <p style="margin-top: 5px; padding-bottom: 25px; color: #14171a;"><?php echo cut_str(strip_tags($list[$i]['wr_content']), 80) ?></p>
        </a>
        </div>
    </div>
<style>
.img_content img {
min-width:200px;width:80%;max-width:850px;height:auto;border-radius:15px
}

.profile_new_name img{
border-radius:50%;
}
</style>

    <span class="new_date" style="color: #657786; position: absolute; bottom: 15px; right: 15px;"><?php echo $list[$i]['datetime2'] ?></span>
</li>
    <?php } ?>

    <?php if ($i == 0)
        echo '<li class="empty_table">게시물이 없습니다.</li>';
    ?>
    </ul>
</div>

<?php echo $write_pages ?>
<!-- } 전체게시물 목록 끝 -->