Files
cm-web-legacy/application/views/web/news/column_view.php
2020-06-10 06:19:03 +09:00

213 lines
6.9 KiB
PHP
Executable File

<?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';
?>
<div class="contents">
<div class="wrap">
<div class="list_left">
<div class="news_list">
<img src="<?=$main_img?>" style="width:0px;height:0px;position:absolute; top:0; left:-9999px;">
<div id = "print_area">
<div class="view_header">
<div><span class="beachblue" style="padding-right:5px;"><a href="/web/news/column">오피니언</a></span><a href="/web/news/columnist/<?=$partner_idx?>"><?=$column_name?></a></div>
<h2><?=$title?></h2>
<div class="time"><a href="javascript:bookmark();"><img src="<?=$bookmark_img?>" style="padding-right:5px;" id="bookmark_img"></a>입력 <?=$display_date?>
<span style="padding-left:10px">조회수 <span class="beachblue"><?=number_format($hit_count)?></span>회</span>
<span style="padding-left:10px">댓글 <span class="beachblue"><a href=""><?=number_format($comment_count)?></a></span>개</span>
</div>
</div>
<div class='function'>
<a href="javascript:send_email_content('<?=$content_type?>', '<?=$idx?>');"><img src="/img/web/icon_email.gif"></a>
<a href="javascript:popup_print(document.getElementById('print_area').innerHTML);"><img src="/img/web/icon_print.gif"></a>
<a href="javascript:zoom_in();"><img src="/img/web/icon_plus.gif"></a>
<a href="javascript:zoom_out();"><img src="/img/web/icon_minus.gif"></a>
</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 class="view_article"><?=$content?></div>
<div class="panel_btns">
<span><a href="javascript:;" class="btn btn-default br15 share_btn" style="padding:5px 30px;"><img src="/img/web/img_upload2.gif"> </a></span>
<span><a href="javascript:like_proc();" class="btn btn-default br15" style="padding:5px 30px;"><img src="/img/web/img_heart.gif"> <span id="like_count"><?=number_format($result['like_count'])?></span></a></span>
</div>
</div>
<? if(count($arr_relation_column) > 0) { ?>
<div class="reply"></div>
<div class="relatedarticle">
<h4>관련연재</h4>
<ul>
<? foreach ($arr_relation_column as $val) { ?>
<li><a href="/web/news/column_view/<?=$val['relation_article_idx']?>"><?=$val['title']?></a></li>
<? }?>
</ul>
</div>
<? }?>
<? require_once(APPPATH."views/web/comm/comment_inc.php");?>
</div>
</div>
</div>
<? include_once ('news_right_inc.php');?>
</div>
</div>
<? include_once ('news_footer_inc.php');?>
<? require_once(APPPATH."views/web/comm/share_box_inc.php"); ?>
<script>
$('.share_btn').click(function(e) {
$("#share_box").toggle();
var popH = $(this).offset().top;
$('.popup_share').css('left','38%');
$('.popup_share').css('top',popH+'px');
});
function popup_print() {
var pop_url = "/web/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>