<?php
require_once("../check.php");
require_once("../../config.php");
ini_set("date.timezone",'PRC');
$m="12";//每页显示的记录数
isset($_GET['page'])?$page=$_GET['page']:$page="1";//当前页数
$numsql = "select count(id) as num from dunling_web where username='$username'";
$numery = mysql_query($numsql,$config);
$numery = mysql_fetch_array($numery);
$zongjilushu = $numery['num'];//总记录数
$zy = (int)(($zongjilushu-1)/$m)+1;//总页数
$one = (int)($page-1)*$m;//当前页的首条记录
$articlesql = "select * from dunling_web where username='$username' order by id desc limit $one,$m";
$articleery = mysql_query($articlesql,$config);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>任务管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../date/jquery.cxcalendar.js"></script>
<link rel="stylesheet" href="../date/jquery.cxcalendar.css"/>
</head>
<body>
<script>
$(function(){
    $(".del").click(function(){
    var id = $(this).parent().attr("class");
    var danhao = $(this).parent().find(".danhao").text();
    var delok = confirm('确定删除编号为 '+ danhao +' 的任务吗？');
    if(delok==true){
    $.post("../core/delrw.php",{
        id:id
    },function(aaa,bbb){
      $("."+id).remove();
    });
    }else{
    return false;
    }
        
        
    });

});
</script>
<style>
body{
    margin:0;
    padding:0;
    text-align:left;
}
#table{
    width:auto;
    width:100%;
    height:auto;
    min-height: 45px;
    display: table;
    text-align:center;
    color: #505050;

    font-size:14px;
}
#table:hover{
    background-color: #DDEEFF;

}
#table .W50{
    width:50px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}
#table .W100{
    width:100px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}

#table .W150{
    width:150px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}

#table .W200{
    width:200px;
    height:40px;
    line-height:40px;
    text-align:center;
    float:left;
}

#table .W250{
    width:250px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}
#table .W300{
    width:300px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}
#table .W350{
    width:350px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}

#table .W400{
    width:400px;
    height:40px;
    line-height:40px;
    text-align:left;
    float:left;
}

table tr td{
    line-height:35px;
}
#p{
    margin-top:25px;
    margin-left:20px;
    width:auto;
    max-width:950px;
    min-height:50px;
    height:auto;
    display: table;
    line-height:50px;
    text-align:left;
    color: #505050;
    font-size:14px;
}
#p .page{
    width:950px;
    height:50px;
    line-height:50px;
    text-align:right;
}

#p .page li{
    text-align:center;
    display:inline;
    margin:0 5px 0 0px;
    float:left;
    height:50px;
}



#p .page li a{
    border-radius:3px;
    text-decoration: none;
    font-size:14px;
    color:#08246B;
    display: block;
    line-height: 30px;
    height:30px;
    padding-left: 12px;
    padding-right:12px;
    border:1px solid #08246B;
    box-shadow:0px 0px 3px 3px #DFDFDF;
}
#p .page li a:hover{
    border-radius:3px;
    width:auto;
    text-decoration: none;
    font-size:14px;
    color:#FFFFFF;
    display:table;
    line-height: 30px;
    height:30px;
    padding-left: 12px;
    padding-right:12px;
    background-color:#08246B;
}
#p .page li.dangqianye a{
    border-radius:3px;
    text-decoration: none;
    font-size:14px;
    color:#FFFFFF;
    display: block;
    line-height: 30px;
    height:30px;
    width:auto;
    padding-left: 12px;
    padding-right:12px;
    border:1px solid #08246B;
    background-color: #08246B;
}

#windows{
    display:none;
    text-align:left;
    width:500px;
    height:230px;
    left:0;
    background-color: #F2F2F2;
    border:1px solid #D5D5D5;
    border-radius:8px;
    position: absolute;
    margin-top:100px;
    margin-left:300px;
    box-shadow:0px 0px 5px 5px #D5D5D5;
    color: #5E5E5E;
    font-size:14px;
}
#windows .close{
    width:48px;
    height:48px;
    display: table;
    background-image:url("../images/close.png");
    position: absolute;
    margin-left:505px;
    margin-top:-10px;
    
}

.daterili{
    width:120px;
    height:20px;
    line-height:20px;
    text-align:center;
    color: green;
    font-weight:bold;
    background:url(../date/cxcalendar.png) no-repeat right;
}
#so{
    height:30px;
    line-height:30px;
    font-size:14px;
    color: red;
    margin-left:20px;
}
#form{
    margin:0;
    padding:0;
}
a{
    text-decoration:none;
    color:red;
}
</style>
<div id="windows">
<input type="hidden" value="" id="payid" />
<input type="hidden" value="" id="Hclass" />
<div class="close" title="点击关闭"></div>
<div>
<table cellpadding="1" cellspacing="2" align="center">
<tr><td align="right"><strong>收款姓名:</strong></td><td class="a1"></td></tr>
<tr><td align="right"><strong>收款方式:</strong></td><td class="a2"></td></tr>
<tr><td align="right"><strong>收款账号:</strong></td><td class="a3"></td></tr>
<tr><td align="right"><strong>应付金额:</strong></td><td class="a4">0.00</td></tr>
<tr><td align="right"></td><td><input id="form" style="width: 200px;height:33px;line-height:33px;" type="button" value="已支付并确认" /></td></tr>
</table>
</div>
</div>


<div id="table">
<div class="W50"></div>
<div class="W150"><strong>发布人账号</strong></div>
<div class="W150"><strong>任务编号</strong></div>
<div class="W100"><strong>任务单价</strong></div>
<div class="W100"><strong>共耗金币</strong></div>
<div class="W100"><strong>剩余金币</strong></div>
<div class="W100"><strong>阅览时间(秒)</strong></div>
<div class="W100"><strong>阅览网址</strong></div>
<div class="W150"><strong>发布时间</strong></div>
<div class="W100"><strong>操作</strong></div>
</div>
<?php
while($list = mysql_fetch_array($articleery)){
?>
<div id="table" class="<?php echo $list['id'];?>">
<div class="W50"></div>
<div class="W150"><?php echo $list['username'];?></div>
<div class="W150 danhao"><?php echo $list['danhao'];?></div>
<div class="W100"><?php echo $list['danjia'];?></div>
<div class="W100"><?php echo $list['zmoney'];?></div>
<div class="W100"><?php echo $list['smoney'];?></div>
<div class="W100"><?php echo $list['time'];?></div>
<div class="W100"><a href="<?php echo $list['url'];?>" target="_blank">浏览查看</a></div>
<div class="W150"><?php echo date("m-d H:i",$list['datetime']);?></div>
<div class="W100 del">删除</div>

</div>
<?php
}
?>
<div id="p">
<div class="page">
<?php
$shangyiye = $page-1;
$xiayiye = $page+1;
if($page>"1"){
        echo '<li><a href="?page='.$shangyiye.'">上一页</a></li>';
        echo '<li><a href="?page=1">1</a></li>';
}
if($page>="6"){
for($pagea=$page-4;$pagea<=$page-1;$pagea++){
        echo '<li><a href="?page='.$pagea.'">'.$pagea.'</a></li>';
}
}
echo '<li class="dangqianye"><a href="?page='.$page.'">'.$page.'</a></li>';

     
if(($zy-$page)>="5"){
for($pageb=$page+1;$pageb<=$page+4;$pageb++){
        echo '<li><a href="?page='.$pageb.'">'.$pageb.'</a></li>';
}
}

if("5">=($zy-$page)){
for($pagec=$page+1;$pagec<=$zy-1;$pagec++){
        echo '<li><a href="?page='.$pagec.'">'.$pagec.'</a></li>';
}
}

if($page<$zy){
        echo '<li><a href="?page='.$zy.'">..'.$zy.'</a></li>';
        echo '<li><a href="?page='.$xiayiye.'">下一页</a></li>';
}
?>
</div>
</div>
<script>
$(function(){
    $('#date1').cxCalendar();
    $('#date2').cxCalendar();
});
</script>
</body>