<?

$data = $this->session->userdata;

$ci = &get_instance();
$now_date = date("Y-m-d");
$ci->load->model('web/m_today_word');
$arr_today_word = $ci->m_today_word->today_word_where_display_date_select($now_date);
$today_word 		= '하나님이 세상을 이처럼 사랑하사 </br>독생자를 주셨으니 이는 그를 믿는 자마다 </br>멸망하지 않고 영생을 얻게 하려 하심이라';
$today_word_title 	= '요한복음 3장 16절';
if(count($arr_today_word)>0) {
	$today_word 		= $arr_today_word['word'];
	$today_word_title 	= $arr_today_word['title'];
}

$ci->load->helper('cookie');
$comment_sns_id 		= get_cookie('crossmap_comment_sns_id');
$comment_sns_name 		= get_cookie('crossmap_comment_sns_name');

$comment_sns_type 		= get_cookie('crossmap_comment_sns_type');

if (isset($data['C_Member_Id']) || isset($comment_sns_name)) {
    if($comment_sns_name) {
        $data['C_Member_Profile'] = '/img/mobile/life_profile.png';
        $data['C_Member_Nicname'] = $comment_sns_name;
        $data['C_Member_Group_Name'] = $comment_sns_type;
        $logout_link = "comment_logout();";
    } else if($data['C_Member_Id']) {
        $logout_link = "window.location='/m/member/logout_proc'";
    } else {
        $logout_link = "";
    }
}
?>

<script>
function comment_logout(){
	location.href="/web/comm/comment_logout";
}
</script>

<div class="life_menu">
	<div class="life_menu_top">
		<h1 class="logo"><a href="/m"><img src="/img/mobile/life_logo.png"></a></h1>
		<span class="life_close"><img src="/img/mobile/close.png" style="cursor:pointer"></span>

		<? if (isset($data['C_Member_Id']) || isset($comment_sns_name)): ?>

			<div class="profile"><a href="https://crossmap.co.kr/m/mypage/req_password"><img src="<?= $data['C_Member_Profile'] ?>"
																							 onerror="this.src='/img/mobile/life_profile.png'"
																							 style="max-width:77px;max-height:77px;"></a></div>
			<div class="nickname"><a href="https://crossmap.co.kr/m/mypage/req_password"><?= $data['C_Member_Nicname'] ?></a></div>
			<div class="member"><a href="https://crossmap.co.kr/m/mypage/req_password"><?= $data['C_Member_Group_Name'] ?></a></div>
			<div class="life_menu_btn" style="background: #f6f6f6;">
				<button type="button" class="btn btn-default br20" style="width:100px;color:#a7a7a7"
						onclick="<?=$logout_link;?>">로그아웃
				</button>
			</div>


		<? else: ?>

			<div class="profile"><a><img src="/img/mobile/life_profile.png"></a></div>
			<div class="bible"><?=$today_word?><br><span class="chpter"><?=$today_word_title?></span>
			</div>
			<div class="life_menu_btn" style="background: #f6f6f6;">
				<button type="button" class="btn btn-default br20" style="width:100px;color:#a7a7a7" onclick="login()">
					로그인
				</button>
			</div>
		<? endif; ?>
		<div class="life_cate">
			<span style="width:30%;"><img src="/img/mobile/life_icon2.png"><a <?=(isset($data['C_Member_Id']))? 'href="/m/mypage/user_comment"' : 'href="javascript:alert(\'로그인 후 사용 가능합니다.\')" '  ?> >내댓글보기</a></span>
			<span><img src="/img/mobile/life_bar.gif"></span>
			<span style="width:28%;"><img src="/img/mobile/life_icon3.png"> <a <?=(isset($data['C_Member_Id']))? 'href="/m/mypage/bookmark"' : 'href="javascript:alert(\'로그인 후 사용 가능합니다.\')" '  ?>>북마크</a></span>
			<span><img src="/img/mobile/life_bar.gif"></span>
			<span style="width:28%;"><img src="/img/mobile/life_icon1.png"><a <?=(isset($data['C_Member_Id']))? 'href="/m/mypage/delivery"' : 'href="javascript:alert(\'로그인 후 사용 가능합니다.\')" '  ?>>배달함</a></span>
		</div>


	</div>
	<ul class="life_list_top">
		<li><a href="/web/maptoon" style="cursor:pointer;" >웹툰</a></li>
		<li><a href="/web/news" style="cursor:pointer;" >뉴스</a></li>
		<li><a href="/m/life" style="cursor:pointer;" >은혜</a></li>
		<li><a href="/m/cmtv" style="cursor:pointer;" >크맵TV</a></li>
		<li><a href="/m/prayer" style="cursor:pointer;" >기도공감</a></li>
	</ul>
	<div class="life_app">
		<h4 style="padding: 0 20px 10px 20px;">추천앱</h4>
		<?
		$ci = &get_instance();
		$ci->load->model('web/m_recommend_app');
		$result = $ci->m_recommend_app->recommend_app_list(array("offset" => 0, "limit" => 99));
		?>
		<div class="swiper-container swiper-03">


			<div class="swiper-wrapper">
				<? foreach ($result as $key => $app_data): ?>
					<div class="swiper-slide"><a href="<?= $app_data['market_url'] ?>" target="_blank"><img style="width:66px;height:66px;"
																											src="<?= thumb($app_data['icon_img']) ?>"></a><a href="<?= $app_data['market_url'] ?>"
																																							 target="_blank"
																																							 class="app_txt"><?= $app_data['app_name'] ?></a>
					</div>
				<? endforeach; ?>
			</div>


			<!-- Add Arrows -->
			<div class="swiper-button-next"></div>
			<div class="swiper-button-prev"></div>
			<div class="swiper-pagination"> </div>
		</div>
	</div>
	<ul class="life_list_bottom">
		<li><a href="/m/board/notice">공지사항</a> <span class="new" style="display:none;">N</span></li>
		<li><a href="/m/board/faq">FAQ</a></li>
		<?if(isset($data['C_Member_Id'])):?>
			<li><a href="/m/mypage/qna">1:1 문의</a></li>
		<?endif?>
	</ul>
	<div class="life_menu_btn">
		<? if (isset($data['C_Member_Id'])): ?>
			<button type="button" class="btn btn-default br20" style="widh:100px;color:#a7a7a7"
					onclick="window.location='/m/member/logout_proc'">로그아웃
			</button>
		<? else: ?>
			<button type="button" class="btn btn-default br20" style="width:100px;color:#a7a7a7" onclick="login()">로그인
			</button>
		<? endif ?>
	</div>
	<div class="life_menu_btn" style="padding-bottom:80px;">
		<button type="button" class="btn btn-default_bb br20" style="width:100px;" onclick="window.location='/'">PC 버전
		</button>
	</div>
	<div class="dims" id='swipeme'></div>
	<div class="dims2"></div>
</div>
<script>

	$(document).ready(function(){
		$(".mypage_menu").click(function(event){
			event.preventDefault();
			$(".life_menu").addClass("active");

		});
	});

	$('.life_close').click(function(){
		$('.life_menu').removeClass('active');

	});
    
    $('.dims').click(function(){
		$('.life_menu').removeClass('active');

	});

	function login(){
		window.location="/m/member/login?redir="+window.location.href;
	}
	var swiper2 = new Swiper('.swiper-03', {
		slidesPerView: 3,
		spaceBetween: 10,
		pagination : { // 페이징 설정
			el : '.swiper-pagination',
			clickable : true, // 페이징을 클릭하면 해당 영역으로 이동, 필요시 지정해 줘야 기능 작동
		},
 		navigation: {
			nextEl: '.swiper-button-next',
			prevEl: '.swiper-button-prev',
		},
	});
</script>







