<?php

$column_name    = $result['column_name'];
$title     		= $result['title'];
$display_date   = $result['display_date'];
$display_date   = str_replace('-', '.', $display_date);
$display_date   = substr($display_date, 0, 16);
$hit_count      = $result['hit_count'];
$comment_count  = $result['comment_count'];
$content        = $result['content'];
$main_img       = $result['main_img'];
$partner_idx  	= $result['partner_idx'];
$SES_MEMBER_ID          = $this->session->userdata('C_Member_Id');
$video_url 		=  $result['video_url'];

$bookmark_img = '/img/web/star4_off.png';
if($bookmark_count > 0) {
	$bookmark_img = '/img/web/star4_on.png';
}
$content_type = '2';



?>
<?
$page_title = $column_name;
$page_title_link = '/m/news/columnist/'.$partner_idx;
require_once(APPPATH."/views/m/common/light_header.php");?>
<div class="article_cont article_cont_fixed">
	<div class="news_list">
		<div class="view_header">
			<div>
				<a href="/m/news/column"><span class="beachblue">[오피니언]</span></a><a href="<?=$page_title_link?>"> <?=$column_name?></a>
			</div>
			<h2><span class="blue">[<?=$column_name?>]</span> <?=$title?></h2>
			<div class="time">
				<img src="<?=$bookmark_img?>" style="vertical-align:sub;cursor:pointer" onclick="bookmark()" id="bookmark_img">  입력   <?=$display_date?><br>
				<span style="padding-right:10px;">조회수 <span class="beachblue"><a href=""><?=number_format($hit_count)?></a></span>회</span>
				<span style="padding-right:10px">댓글 <span class="beachblue"><a href=""><?=number_format($comment_count)?></a></span>개</span>
				<span style="margin-right:10px;"><a class="btn btn-default share_btn br20" style=" padding:2px 10px;"><img src="/img/mobile/img_upload3.gif"></a></span>
				<!-- <span class="fr"><a href="javascript:zoom_out();"><img src="/img/mobile/s_a.gif"></a><a href="javascript:zoom_in();"><img src="/img/mobile/l_a.gif" style="padding-left:5px;"></a></span> -->
				<span class="fr"><a href="javascript:ts('body', -1);"><img src="/img/mobile/s_a.gif"></a><a href="javascript:ts('body', 1);"><img src="/img/mobile/l_a.gif" style="padding-left:5px;"></a></span>
			</div>
		</div>
	</div>
	<div class="view_main">
		<? 	if($video_url!='') {?>
			<div style="text-align:center; display: block;"><iframe type="text/html" src="<?=$video_url?>" allowfullscreen="true" style="border: 0px; display: block; margin: 0px; width: 560px; height: 315px;" data-ratio="0.5625" data-width="560" data-height="315"></iframe></div>
		<?	}?>
	</div>
	<div class="view_article">
		<?=$content?>
	</div>
		<? 	if(count($arr_relation_column) > 0) { ?>
			<div class="reply"></div>
			<div class="relatedarticle">
				<h4 class="beachblue">관련연재</h4>
				<ul>
					<? foreach ($arr_relation_column as $val) { ?>
						<li><a href="/m/news/columnist/<?=$val['partner_idx']?>"><span class="blue">[<?=$val['column_name']?>]</span></a> <a href="/m/news/column_view/<?=$val['relation_article_idx']?>"><?=$val['title']?></a></li>
					<? }?>
				</ul>
			</div>
		<?	}?>

	<div style="margin:30px 0; text-align:center;">
		<span style="margin-left:10px;"><a class="btn btn-default share_btn br10" style=" padding:2px 20px;color:#000; font-size:16px;"><img src="/img/mobile/img_upload2.gif" style="vertical-align: middle;"> </a></span>
		<span style="margin-left:10px;"><a href="javascript:like_proc()" class="btn btn-default br10" style=" padding:2px 20px;color:#000; font-size:16px;" id=""><img src="/img/mobile/img_heart.gif" style="vertical-align: middle;"> <span id="like_count"><?=number_format($result['like_count'])?></span></a></span>
	</div>

		<div class="banner_grace">
			<!-- <a href="#"><img src="/img/mobile/banner_grace.jpg" alt="banner"></a> -->
<!-- m크맵 _칼럼_뷰 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:720px;height:74px"
     data-ad-client="ca-pub-7071495522658800"
     data-ad-slot="5412203153"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
		</div>

		<? require_once(APPPATH."views/m/common/comment_inc.php");?>
</div>

	<? include_once ('news_footer_inc.php');?>

	<? require_once(APPPATH."views/web/comm/share_box_inc.php"); ?>
</div>



<script>

function popup_print() {
    var pop_url = "/m/news/news_print";
    var pop_option = "width=760,height=750,top=0,left=0,noresizable,toolbar=no,status=no,scrollbars=yes,directory=n";
    window.open(pop_url, "news_print", pop_option);
}

function bookmark(){
	if("<?=$SES_MEMBER_ID?>"=="") {
        alert("로그인 후에 이용가능합니다.");
        return;
    }
	var form_data = {
		"content_idx"			: "<?=$idx?>",
		"content_type"			: "<?=$content_type?>"
	};
	$.ajax({
        url: '/web/comm/bookmark_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
				$("#bookmark_img").attr("src", "/img/web/star4_"+rtnJson.data.bookmark_status+".png");
				$("#share_box").hide();
                if(rtnJson.data.bookmark_status == 'off') {
                    alert("북마크함에서 삭제 되었습니다");
                    return false;
                } else {
                    alert("북마크함에 추가 되었습니다");
                }


            } else {
                alert("북마크에 실패했습니다.");
                return false;
            }
        },
        error: function (rtnJson) {
            alert('북마크에 실패했습니다.');
            return false;
        }
    });
}

function like_proc(){
	if("<?=$SES_MEMBER_ID?>"=="") {
        alert("로그인 후에 이용가능합니다.");
        return;
    }
	var form_data = {
		"content_idx"			: "<?=$idx?>",
		"content_type"			: "<?=$content_type?>"
	};
	$.ajax({
        url: '/web/comm/like_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.result_code == "0000") {
            	var like_count = setComma(rtnJson.result_data.like_count);
				$("#like_count").html(like_count);

            } else {
                alert("저장에 실패했습니다.");
                return false;
            }
        },
        error: function (rtnJson) {
            alert('저장에 실패했습니다.');
            return false;
        }
    });

}



function send_email_content(content_type, content_idx) {
    if("<?=$SES_MEMBER_ID?>"=="") {
        alert("로그인 후에 이용가능합니다.");
        return;
    }


	var form_data = {
		"content_idx"			: content_idx,
		"content_type"			: content_type
	};
	$.ajax({
        url: '/web/comm/send_email_content',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
				alert("이메일이 발송되었습니다.");
                return false;
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('이메일 발송에 실패했습니다.');
            return false;
        }
    });

}







</script>
