<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>HT在线平台</title>
 <!-- <link href="/css/webht/bootstrap.min.css" rel="stylesheet">
  <link href="/css/webht/webht.css?v=1" rel="stylesheet">-->
  <link href="/min?f=/css/webht/bootstrap.min.css,/css/webht/webht.css" rel="stylesheet">
 
  
  
  <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
  <!--
  <script src="/js/jquery.min.js"></script>
  <script src="/js/bootstrap.min.js"></script>
  <script src="/js/webht.js?v=1"></script>
  -->
  <script src="/min?f=/js/jquery.min.js,/js/bootstrap.min.js,/js/webht.js,/js/jquery.suggest.js"></script>
  <script src="/js/jquery-ui.min.js?v=1"></script>
  
  <link href="/css/webht/jquery-ui-1.10.0.custom.css" rel="stylesheet">
  
  <link rel="shortcut icon" href="/css/images/webht.jpg">
</head>
<body>
  <nav class="navbar navbar-inverse navbar-red">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="<?php echo site_url('');?>"><span class="icon-home"></span> 中华游在线</a>
          <a class="navbar-brand visible-xs-block"><?php if(isset($navtitle)) echo $navtitle;?></a>
        </div>
		
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav">
            <li><a href="<?php echo site_url('apps/dingmail/index/mail_index');?>">Value发送</a></li>
			<li><a href="<?php echo site_url('apps/dingmail/index/index/'.$this->session->userdata('dingdinguserinfo')->ddu_Unionid);?>">个人中心</a></li>
			<li><a href="<?php echo site_url('apps/dingmail/index/rank_person');?>">排行榜</a></li>
		  </ul>
		  <ul class="nav navbar-nav navbar-right">
              <li><a href="<?php echo site_url('apps/dingmail/index/logout');?>">退出</a></li>
           </ul>
	    </div>		
      </div><!-- /.container-fluid -->
    </nav>
	
<div class="container">
	<div class="row">
		<div class="col-xs-24 btn-lg"></div>
		<div class="col-xs-24">
			<h3>个人获赞排行榜 | 全年参与点赞次数：<?php echo $click_like->like_count?></h3>
		</div>
		<div class="col-xs-8">
		  <div class="col-xs-24 bg-white min-height-500">
			<div class="row" style="border-bottom:1px solid #e5e5e5;margin-bottom:20px;">
				<div class="col-xs-4"><p style="font-size:15px;color:#333;padding-top:8px;">周榜</p></div>
				<div class="col-xs-10"><input class="form-control" placeholder="起始时间" id="from_time" value=""/></div>
				<div class="col-xs-10"><input class="form-control" placeholder="截止时间" id="to_time" value=""/></div>
			</div>
			<ul class="nav rank_ul" id="week_data">
			  <?php foreach ($rank_week as $key_rw => $rw) { ?>
		      	<li class="col-xs-24 nopadding">
		      		<span class="text-danger<?php echo $key_rw+1; ?>">No.<?php echo $key_rw+1; ?></span>
		      		<span> 
		      		<a href="<?php echo site_url('apps/dingmail/index/index/'.$rw->ddv_Comment_Unionid); ?>">
		      			<?php echo $rw->ddv_Comment_Name; ?>
		      		</a>
		      		</span>
		      		<span class="badge pull-right"><?php echo $rw->like_count;?> like</span>
		      	</li>
		      <?php } ?>
		      <?php if(empty($rank_week)) { ?><p>暂无数据</p><?php } ?>
		    </ul>
		  </div>
		</div>
		<div class="col-xs-8">
		  <div class="col-xs-24 bg-white min-height-500">
			<div class="row" style="border-bottom:1px solid #e5e5e5;margin-bottom:20px;">
				<div class="col-xs-4"><p style="font-size:15px;color:#333;padding-top:8px;">月榜</p></div>
				<div class="col-xs-10">
					<select class="form-control" id="month_time">
						<option select="selected" value="null">选择月份</option>
						<option value="1">一月</option>
						<option value="2">二月</option>
						<option value="3">三月</option>
						<option value="4">四月</option>
						<option value="5">五月</option>
						<option value="6">六月</option>
						<option value="7">七月</option>
						<option value="8">八月</option>
						<option value="9">九月</option>
						<option value="10">十月</option>
						<option value="11">十一月</option>
						<option value="12">十二月</option>
					</select>
				</div>
				<div class="col-xs-10">
					<select class="form-control" id="month_year_time">
						<!--<option select="selected" value="null">选择年份</option>-->
						<?php 
							for($i=2017; $i<=date('Y'); $i++){
								if($i == date('Y')){
									echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
								}else{
									echo '<option value="'.$i.'">'.$i.'</option>';
								}
							}
						?>
					</select>
				</div>
			</div>
			<ul class="nav rank_ul" id="month_data">
			  <?php foreach ($rank_month as $key_rm => $rm) { ?>
		      	<li class="col-xs-24 nopadding">
		      		<span class="text-danger<?php echo $key_rm+1; ?>">No.<?php echo $key_rm+1; ?></span> 
		      		<span> 
		      		<a href="<?php echo site_url('apps/dingmail/index/index/'.$rm->ddv_Comment_Unionid); ?>">
		      			<?php echo $rm->ddv_Comment_Name; ?>
		      		</a>
		      		</span>
		      		<span class="badge pull-right"><?php echo $rm->like_count;?> like</span>
		      	</li>
		      <?php } ?>
		      <?php if(empty($rank_month)) { ?><p>暂无数据</p><?php } ?>
		    </ul>
		  </div>
		</div>
		<div class="col-xs-8">
		  <div class="col-xs-24 bg-white min-height-500">
			<div class="row" style="border-bottom:1px solid #e5e5e5;margin-bottom:20px;">
				<div class="col-xs-6"><p style="font-size:15px;color:#333;padding-top:8px;">年榜</p></div>
				<div class="col-xs-18">
				<select class="form-control" id="year_time">
						<?php 
							for($i=2017; $i<=date('Y'); $i++){
								if($i == date('Y')){
									echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
								}else{
									echo '<option value="'.$i.'">'.$i.'</option>';
								}
							}
						?>
					</select>
				</div>
			</div>
			<ul class="nav rank_ul" id="year_data">
			  <?php foreach ($rank_year as $key_ry => $ry) { ?>
		      	<li class="col-xs-24 nopadding">
		      		<span class="text-danger<?php echo $key_ry+1; ?>">No.<?php echo $key_ry+1; ?></span> 
		      		<span> 
		      		<a href="<?php echo site_url('apps/dingmail/index/index/'.$ry->ddv_Comment_Unionid); ?>">
		      			<?php echo $ry->ddv_Comment_Name; ?>
		      		</a>
		      		</span>
		      		<span class="badge pull-right"><?php echo $ry->like_count;?> like</span>
		      	</li>
		      <?php } ?>
		      <?php if(empty($rank_year)) { ?><p>暂无数据</p><?php } ?>
		    </ul>
		  </div>
		</div>
	</div>

</div>
</body>
<script>
$(function(){
	//日期选择
	$('#from_time,#to_time').datepicker({
		
	});
	
	//周榜触发事件
	var from_time = '';
	var to_time = '';
	var month_time = '';
	var year_time = '';
	var type = '';
	var month_year_time = '';
	$('#from_time,#to_time').change(function(){
		from_time = $('#from_time').val();
		to_time = $('#to_time').val();
		if(from_time != '' && to_time != ''){
			type = 'week';
			ajax_gethtml(from_time,to_time,type);
		}
	});
	
	//月榜触发事件
	$('#month_time').change(function(){
		month_time = $('#month_time').val();
		month_year_time = $('#month_year_time').val();
		if(month_time != null){
			type = 'month';
			if(month_year_time == 'null'){
				var myDate = new Date();
				from_time = myDate.getFullYear()+'-'+month_time+'-01';
			}else{
				from_time = month_year_time+'-'+month_time+'-01';
			}
			to_time = '';
			ajax_gethtml(from_time,to_time,type);
		}
	});
	
	$('#month_year_time').change(function(){
		month_time = $('#month_time').val();
		month_year_time = $('#month_year_time').val();
		if(month_time != 'null'){
			type = 'month';
			from_time = month_year_time+'-'+month_time+'-01';
			to_time = '';
			ajax_gethtml(from_time,to_time,type);
		}
	});
	
	
	//年榜触发事件
	$('#year_time').change(function(){
		year_time = $('#year_time').val();
		if(year_time != null){
			type = 'year';
			from_time = year_time+'-01-01';
			to_time = year_time+'-12-31';
			ajax_gethtml(from_time,to_time,type);
		}
	});
});

function ajax_gethtml(from_time,to_time,type){
	$.ajax({
		url:'http://www.mycht.cn/webht.php/apps/dingmail/index/ajax_get_data/?from_time='+from_time+'&to_time='+to_time+'&type='+type,
		type:'get',
		success:function(data){
			$('#'+type+'_data').html(data);
		}
	});
}
</script>
</html>