<?php include $this->admin_tpl('meta', 'admin');?>
<title>消息管理 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 消息管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
  <div> 
    <form action="<?php echo U('search');?>" method="get" id="search">
	 <input type="hidden" value="<?php echo ROUTE_M;?>" name="m">
	 <input type="hidden" value="<?php echo ROUTE_C;?>" name="c">
	 <input type="hidden" value="search" name="a">
     时间：<input type="text" class="input-text laydate-icon" style="width:110px;height:30px;" id="start" name="start" <?php if(isset($_GET['start']) && $_GET['start'] != '') echo 'value="'.$_GET['start'].'"'; ?>>
     至 <input type="text" class="input-text laydate-icon" style="width:110px;height:30px;" id="end" name="end" value="<?php if(isset($_GET['end']) &&  $_GET['end'] != '') echo $_GET['end']; else echo date('Y-m-d'); ?>">
     <span class="select-box inline">
		<select name="type" class="select">
			<option value="0">全部</option>
			<option value="1" <?php if(isset($_GET['type']) && $_GET['type']=='1'){?> selected <?php }?>>收件人</option>
			<option value="2" <?php if(isset($_GET['type']) && $_GET['type']=='2'){?> selected <?php }?>>发件人</option>
		</select>
	</span>
      用户名：<input type="text" name="username" class="input-text" style="width:170px" value="<?php if(isset($_GET['username'])) echo $_GET['username'];?>"><button name="dosubmit" class="btn btn-success" type="submit" value="1"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	 </form>	
  </div>
  <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
  <a href="javascript:;" onclick="yzm_dels('ids')" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> 
  <a href="javascript:;" onclick="yzm_open('发送消息','<?php echo U('add');?>','600','400')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 发送消息</a>
  </span> <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> </div>
  <form method="post" action="<?php echo U('del');?>" id="myform">
  <table class="table table-border table-bordered table-bg table-hover">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th>标题</th>
		<th>内容</th>
		<th width='100'>发件人</th>
		<th width='100'>收件人</th>
		<th width='135'>时间</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		?>
		  <tr class="text-c">
			<td><input type="checkbox" value="<?php echo $val['messageid']?>" name="ids[]"></td>
			<td><?php echo $val['subject']?>&nbsp;&nbsp;<?php echo $val['isread'] ? '<span style="color:green">[已读]</span>' : '<span class="c-red">[未读]</span>';?></td>
			<td><?php echo $val['content']?></td>
			<td><?php echo $val['send_from']?></td>
			<td><?php echo $val['send_to']?></td>
			<td><?php echo date("Y-m-d H:i:s",$val['message_time'])?></td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  </form>
  <div id="page"><span class="page_left">共<?php echo $total?>条记录，共<?php echo $page->total()?>页，当前显示第<?php echo $page->getpage()?>页</span>
  <span class="page_right"><?php echo $page->getfull();?></span></div>
</div>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">
var start = {
	elem: '#start',
	format: 'YYYY-MM-DD',
	min: '1999-01-01', //设定最小日期
	max: '2099-01-01', //最大日期
	istime: false,
	istoday: false,
	choose: function(datas){
		 end.min = datas; //开始日选好后，重置结束日的最小日期
		 end.start = datas //将结束日的初始值设定为开始日
	}
};

var end = {
	elem: '#end',
	format: 'YYYY-MM-DD',
	min: '1999-01-01',
	max: '2099-01-01',
	istime: false,
	istoday: false,
	choose: function(datas){
		start.max = datas; //结束日选好后，充值开始日的最大日期
	}
};
laydate(start);
laydate(end);
</script>

</body>
</html>