<?php

//var_dump($result);
$press_logo     = $result['logo_img'];
$press_name     = $result['press_name'];
$homepage       = $result['homepage'];
$org_url       = $result['org_url'];
$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'];
$category_code  = $result['category_code'];
$category_name1 = $result['category_name1'];
$category_name2 = $result['category_name2'];
$category_name3 = $result['category_name3'];
$category_code1 = substr($category_code, 0, 2);
$category_code2 = substr($category_code, 0, 4);
$category_code3 = substr($category_code, 0, 6);
$sub_title      = $result['sub_title'];
$main_img       = $result['main_img'];
$content        = $result['content'];
$reporter_name  = $result['reporter_name'];

$review_count1  = $result['review_count1'];
$review_count2  = $result['review_count2'];
$review_count3  = $result['review_count3'];
$review_count4  = $result['review_count4'];
$review_count5  = $result['review_count5'];
$video_url 	    =  $result['video_url'];
$weather_icon = '';
if(count($arr_weather) > 0){
	$weather_icon       = $arr_weather['weather_icon'];
	$continent          = $arr_weather['continent'];
	$country            = $arr_weather['country'];
	$weather_content    = $arr_weather['weather_content'];

}
$SES_MEMBER_ID          = $this->session->userdata('C_Member_Id');

$http_host 		= $_SERVER['HTTP_HOST'];
$request_uri 	= $_SERVER['REQUEST_URI'];
$url = 'http://' . $http_host . $request_uri;

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

$review_type = '';
if(isset($arr_review['review_type'])==true) {
	$review_type = $arr_review['review_type'];
}

?>

<?


$page_title = "뉴스";
$page_title_link = '/m/#news';
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 class="view_alm">
                <ul class="tapt">
                    <li><img src="/img/mobile/cloud.gif"></li>
                    <li>비</li>
                </ul>
                <p class="tit">영적기상도</p>
            </div>
			<div>
				<a target="_blank" href="<?=$homepage?>"><span class="logo_company"><img src="<?=$press_logo?>" width="30" height="25" alt="logo"></span><?=$press_name?></a>
			</div>
			<h2 style="padding-right: 75px;"><?=$title?>
				<span class="category">
                                    <a href="/m/news/category/<?=$category_code1?>"><?=$category_name1?></a>
                                    <img src="/img/web/arrow_left.gif">
                                    <a href="/m/news/category/<?=$category_code2?>"><?=$category_name2?></a>
					<? if($category_name3!='') {?> <img src="/img/web/arrow_left.gif">
						<a href="/m/news/category/<?=$category_code3?>"><?=$category_name3?></a> <?}?> 　    　
                                    </span>


<!--				--><?//   if(count($arr_weather) > 0){?>
<!--					<div class="spirit_weather" style="float: right; margin-top: 5px;">-->
<!--						<ul class="w_info">-->
<!--							<li><img src="--><?//=$weather_icon?><!--" style="width:48px"></li>-->
<!--							<li style="color:#fff">-->
<!---->
<!--								<table style="line-height: 22px;width:100%; margin-top: 10px;">-->
<!--									<tr>-->
<!--										<td style="font-size:18px; padding-top: 15px;">--><?//=$weather_content?><!--</td>-->
<!--									</tr>-->
<!--								</table>-->
<!--							</li>-->
<!--						</ul>-->
<!--						<div class="w_location">--><?//=$continent?><!-- <span style="padding:0 5px;"><img src="/img/web/w_bg.gif" style="padding-top:8px;"></span>--><?//=$country?><!--</div>-->
<!--					</div>-->
<!--				--><?//  }?>
			</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><?=number_format($hit_count)?></a></span>회</span>
				<span style="padding-right:10px">댓글 <span class="beachblue"><a><?=number_format($comment_count)?></a></span>개</span>
				<span style="margin-right:10px;"><a class="btn btn-default br20 share_btn" 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> -->
					<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">-->
<!--		<div class="view_img">-->
<!--			<div><img src="/img/mobile/img_photo.jpg"></div>-->
<!--			<div class="img_desc">ⓒPexel</div>-->
<!--		</div>-->
<!--	</div>-->
	<?  if($sub_title!='') { ?>
		<div class="sub_tit"><?=$sub_title?>
		</div>
		<div class="sub_tit_bar"><img src="/img/mobile/bg_row2.gif"></div>
	<?  }?>
	<? 	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: 100%; height: 240px;" data-ratio="0.5625" data-width="100%" data-height="240" width="100%" height="240"></iframe></div>
	<?	}?>


	<div class="view_article">
		<?=$content?>
	</div>
	<div class="writer">
		<?=$reporter_name?> 기자

	</div>



	<? if(count($arr_relation_news) > 0) { ?>
		<div class="relatedarticle">
			<h4>관련뉴스 </h4>
			<ul>
				<? foreach ($arr_relation_news as $val) {?>
					<li><a href="/m/news/news_view/<?=$val['idx']?>"><?=$val['title']?></a></li>
				<? }?>

			</ul>
		</div>
	<?	}?>

	<div class="reaction" >
		<div class="reaction_box">
			<a href="javascript:review_select(1);"><img src="/img/web/img_reaction1.png"></a>
			<div class="rb">
				<p class="like">좋아요</p>
				<p class="click" id="review1"><?=number_format($review_count1)?></p>
			</div>
		</div>
		<div class="reaction_box">
			<a href="javascript:review_select(2);"><img src="/img/web/img_reaction2.png"></a>
			<div class="rb">
				<p class="like">훈훈해요</p>
				<p class="click" id="review2"><?=number_format($review_count2)?></p>
			</div>
		</div>
		<div class="reaction_box" style="width:19%;">
			<a href="javascript:review_select(3);"><img src="/img/web/img_reaction3.png"></a>
			<div class="rb">
				<p class="like">슬퍼요 </p>
				<p class="click" id="review3"><?=number_format($review_count3)?></p>
			</div>
		</div>
		<div class="reaction_box" style="width:19%;">
			<a href="javascript:review_select(4);"><img src="/img/web/img_reaction4.png"></a>
			<div class="rb">
				<p class="like">화나요 </p>
				<p class="click" id="review4"><?=number_format($review_count4)?></p>
			</div>
		</div>
		<div class="reaction_box" style="width:22%;">
			<a href="javascript:review_select(5);"><img src="/img/web/img_reaction5.png"></a>
			<div class="rb">
				<p class="like">후속기사 원해요 </p>
				<p class="click" id="review5"><?=number_format($review_count5)?></p>
			</div>
		</div>
	</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>
	</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>
<? require_once(APPPATH."views/m/news/news_footer_inc.php");?>

</div>







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


<script>
	$(document).ready(function(){
		<? if($review_type != '') {?>
		var review_type = "<?=$review_type?>";
		$("#review"+review_type).css("font-weight", "bold");

		<?}?>
	});



	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 review_select(t) {
		if("<?=$SES_MEMBER_ID?>"=="") {
			alert("로그인 후에 이용가능합니다.");
			return;
		}

		$("#review1").css("font-weight", "normal");
		$("#review2").css("font-weight", "normal");
		$("#review3").css("font-weight", "normal");
		$("#review4").css("font-weight", "normal");
		$("#review5").css("font-weight", "normal");

		var form_data = {
			"type"			: t,
			"idx"			: "<?=$idx?>"
		};
		$.ajax({
			url: '/web/comm/review_proc',
			async: false,
			type: 'POST',
			dataType: 'JSON',
			data: form_data,
			success: function (rtnJson) {
				if (rtnJson.result_code == "0000") {
					var review_count1 = setComma(rtnJson.result_data.review_count1);
					var review_count2 = setComma(rtnJson.result_data.review_count2);
					var review_count3 = setComma(rtnJson.result_data.review_count3);
					var review_count4 = setComma(rtnJson.result_data.review_count4);
					var review_count5 = setComma(rtnJson.result_data.review_count5);

					$("#review1").html(review_count1);
					$("#review2").html(review_count2);
					$("#review3").html(review_count3);
					$("#review4").html(review_count4);
					$("#review5").html(review_count5);

					$("#review"+t).css("font-weight", "bold");

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

	}


	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("북마크함에 추가 되었습니다");
						return false;
					}

				} 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>
