<extend name="Public/base"/>

<!-- 子导航 -->
<block name="sidebar">
    <include file="sidemenu" />
</block>


<block name="body">
	<!-- 标题 -->
    <div class="main-place">
        <span class="main-placetitle">位置</span>
        <ul class="main-placeul">
            <li><a href="{:U('Article/index')}">文章</a></li>
            <li><a href="{:U('Article/mydocument')}">个人中心</a></li>
            <li><a href="#">我的文档({$_total})</a></li>
        </ul>
    </div>

	<!-- 按钮工具栏 -->
	<div class="cf top_nav_list">
		<div class="fl button_list">
            <a class=" ajax-post" target-form="ids" url="{:U("Article/setStatus",array("status"=>1))}"><span class="button_icon button_icon4"></span>正常</a>
			<a class=" ajax-post" target-form="ids" url="{:U("Article/setStatus",array("status"=>0))}"><span class="button_icon button_icon5"></span>禁用</a>
			<a class=" ajax-post confirm" target-form="ids" url="{:U("Article/setStatus",array("status"=>-1))}"><span class="button_icon button_icon2"></span>删除</a>
		</div>

		<!-- 高级搜索 -->
		<div class="jssearch fr cf search_list">
            <div class="input-list" >
                <label>创建时间:</label>
                <input type="text" id="time-start" name="time-start" class="" value="{:I('time-start')}" placeholder="开始时间" />
                -
                <input type="text" id="time-end" name="time-end" class="" value="{:I('time-end')}" placeholder="结束时间" />
            </div>
            <div class="input-list">
                <label>状态:</label>
                <select name="status">
                    <option value="">全部</option>
                    <option value="0">禁用</option>
                    <option value="1">正常</option>
                    <option value="0">待审核</option>
                </select>
            </div>
            <div class="input-list">
                <label>文档标题:</label>
				<input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入文档标题">
            </div>
			<div class="input-list">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('article/mydocument','pid='.I('pid',0).'&cate_id='.$cate_id,false)}">搜索</a>
			</div>
		</div>
	</div>


	<!-- 数据表格 -->
    <div class="data_list">
		<table class="">
    <thead>
        <tr>
		<th class=""><input class="check-all" type="checkbox"/></th>
		<th class="">编号</th>
		<th class="">标题</th>
		<th class="">类型</th>
		<th class="">分类</th>
		<th class="">最后更新</th>
		<th class="">浏览</th>
		<th class="">状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
    <empty name="list" >
       <tr>
       <td colspan="9" class="text-center">aOh! 暂时还没有内容!</td>
       </tr>
       <else />
		<volist name="list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>
			<td><a href="{:U('Article/edit?cate_id='.$vo['category_id'].'&id='.$vo['id'])}">{$vo.title}</a></td>
			<td><span>{$vo['type']}</span></td>
			<td><span>{:get_cate($vo['category_id'])}</span></td>
			<td><span>{$vo.update_time}</span></td>
			<td>{$vo.view}</td>
			<td>{$vo.status}</td>
			<td><a href="{:U('Article/edit?cate_id='.$vo['category_id'].'&id='.$vo['id'])}">编辑</a>
				<a href="{:U('Article/setStatus?ids='.$vo['id'].'&status='.abs(1-$vo['status']))}" class="ajax-get">{$vo.status|show_status_op}</a>
				<a href="{:U('Article/setStatus?status=-1&ids='.$vo['id'])}" class="confirm ajax-get">删除</a>
                </td>
		</tr>
		</volist>
		</empty>
	</tbody>
    </table> 

        
	</div>

	<!-- 分页 -->
    <div class="page">
        {$_page}
    </div>
</div>

</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var status = $("#sch-sort-txt").attr("data");
        var query  = $('.jssearch').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query = 'status=' + status + "&" + query;
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	$(".jssearch").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

    //回车自动提交
    $('.jssearch').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

    $('#time-start').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });

    $('#time-end').datetimepicker({
       format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true,
        pickerPosition:'bottom-right'
    });
    
})
</script>
</block>