<!DOCTYPE html>
<html lang="ko">

<head>
    <?php $this->load->view('partial/head')?>
    <link rel="stylesheet" href="/ART/cmtv/css/default.css">
    <style>
    .clipInfoArea_channel .clipInfo-content {
        max-height: 80px;
        overflow: hidden;
        font-size: 14px;
        color: #888;
        margin: 0;
        padding: 0
    }

    .clipInfoArea_channel {
        height: auto;
    }
    </style>
</head>

<body>
    <?php $this->load->view('partial/sidemenu')?>
    <?php $this->load->view('partial/header')?>
    <main>
        <section id="cmtv_view_area">
            <div class="container">
                <div class="row">
                    <span class="article_contents" style="dispaly:none" id="<?php echo $post->idx?>"></span>
                    <div class="cmtv_view_area" id="<?php echo $post->idx?>">
                        <div class="video_player"><?php if (!empty($post->video_url)) {?>
                            <div class="video_area">
                                <div class="video_area_in">
                                    <iframe src="<?php echo $post->video_url?>?autoplay=1" frameborder="0"
                                        allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
                                        allowfullscreen></iframe>
                                </div>
                            </div><?php }?>
                            <div class="clipInfoArea">
                                <div class="clipInfoArea_top">
                                    <div class="tit">
                                        <h2><?php echo convertEmoji($post->title, 'DECODE')?></h2>
                                        <ul class="ic_btn">
                                            <li class="favIcon">
                                                <a href="" class="cm-like-btn">
                                                    <span id="like_count"><?php echo $post->likes?></span>
                                                </a>
                                            </li>
                                            <li class="snsIcon">
                                                <a href="" class="cm-share-btn">
                                                    <span>공유</span>
                                                </a>
                                            </li>
                                        </ul>
                                        <div class="num2">
                                            <span> 조회수 <?php echo $post->views?>회</span>
                                            <span class="time"><?php echo date('Y. m. d', strtotime($post->reg_date))?></span>
                                        </div>
                                        <ul class="keyword clearfix">
                                            <? if ($post->tag) foreach(explode(' ', $post->tag) as $tag) {
                                                if(strlen(cleanUrl($tag)) > 2)
                                                echo '<li>#'. $tag. '</li>';
                                            }  ?>
                                        </ul>
                                        <div class="num2">위 영상은 Youtube 영상입니다. 이 영상에서 나오는 광고는 Youtube 에서 관리합니다.</div>
                                    </div>
                                </div>
                                <div class="clipInfoArea_channel">
                                    <div class="tit">
                                        <div class="cha_img">
                                            <a
                                                href="/cmtv/channel/<?php echo $post->editorNameUrl?>/<?php echo $post->editorId?>"><?php echo $post->editorImg ? '<img src="'.imgSrc($post->editorImg).'">' : ''?></a>
                                        </div>
                                        <h4><a
                                                href="/cmtv/channel/<?php echo $post->editorNameUrl?>/<?php echo $post->editorId?>"><?php echo $post->editorName?></a></h4>
                                    </div>
                                    <div class="clipInfo-content"><?php echo convertEmoji($post->content, 'DECODE') ?>
                                    </div>
                                        <?php if(substr_count($post->content, '<br') > 2) {?><div class="morebtn"><a href="" class="cm-morebtn-open">더보기</a><a href="" class="cm-morebtn-close" style="display:none">간략히</a></div><?php }?>
                                </div>
								<?php require_once(APPPATH . "views/grace/socialshare.php"); ?>
                                <?php require_once(APPPATH . "views/grace/comment.php"); ?>

                            </div>



                        </div>
                        <div class="clipEndPlaylist">
                            <div class="tit">
                                <h3>다음 동영상</h3>
                            </div>
                            <?php if($editorPost) {?>
                            <div class="next_vid_box">
                                <div class="img">
                                    <a href="/cmtv/<?php echo $editorPost->titleUrl ?>/<?php echo $editorPost->idx ?>"><img src="<?php echo imgSrc($editorPost->mainImg) ?>"></a>
                                </div>
                                <div class="txtbox">
                                    <h4><a href="/cmtv/<?php echo $editorPost->titleUrl ?>/<?php echo $editorPost->idx ?>"><?php echo convertEmoji($editorPost->title, 'DECODE')?></a> </h4>
                                    <span class="channel"><a href="/cmtv/channel/<?php echo $editorPost->editorNameUrl ?>/<?php echo $editorPost->editorId ?>"><?php echo $editorPost->editorName?></a></span>
                                    <div class="num2">
                                        <span> 조회수 <?php echo $editorPost->views?>회</span>
                                        <span class="time"><?php echo time_elapsed_string($editorPost->reg_date) ?></span>
                                    </div>
                                </div>
                            </div><?php }?>
                            <div class="Playlistbox">
                                <ul><?php foreach($recentPosts as $post) { ?>
                                    <li>
                                        <div class="img">
                                        <a href="/cmtv/<?php echo $post->titleUrl ?>/<?php echo $post->idx ?>"><img src="<?php echo imgSrc($post->mainImg) ?>"></a>
                                        </div>
                                        <div class="txtbox">
                                            <h4><a href=""><a href="/cmtv/<?php echo $post->titleUrl ?>/<?php echo $post->idx ?>"><?php echo $post->title?></a></a> </h4>
                                            <span class="channel"><a href="/cmtv/channel/<?php echo $post->editorNameUrl ?>/<?php echo $post->editorId ?>"><?php echo $post->editorName ?></a></span>
                                            <div class="num2">
                                                <span> 조회수 <?php echo $post->views ?>회</span>
                                                <span class="time"><?php echo time_elapsed_string($post->reg_date) ?></span>
                                            </div>
                                        </div>
                                    </li><?php } ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>
    <?php $this->load->view('partial/footer')?>
    <script src="/ART/cmtv/js/cmtv_slide.js"></script>
</body>

</html>