<?php
	header("Content-type:text/html;charset=gb2312");
	header("Cache-Control: no-cache, must-revalidate");
	session_start();
	include "../inc/chec.php";
	include "../conn/conn.php";
	include "../inc/func.php";
if(isset($_GET[u_id])){
	$p_sql = "select * from tb_plan where p_id = ".$_SESSION[id]." and p_type = ".$_GET[u_id];
	$p_rst = mysql_query($p_sql,$conn);
?>
<link href="../css/style.css" rel="stylesheet" />
<script src="../js/client_js.js"></script>
<script src="../js/riq.js" language="javascript"></script>
<SCRIPT language=javascript src="../dedeajax2.js"></SCRIPT>
<script type="text/javascript" src="../lhgcore.js"></script>
<script type="text/javascript" src="../lhgdialog.js"></script>
<SCRIPT language=javascript src="../js/ckjh.js"></SCRIPT>
<SCRIPT language=javascript src="../js/ckjhx.js"></SCRIPT>
<script type="text/javascript">
function dlgopen1()
{
	J.dialog.get({ id: 'test1', title: '写计划', page: 'grjh/planxie.php?u_id=<?php echo "$_GET[u_id]"; ?>', width: '630' , height: '500' });
}
</script>
<table width="765" border="0" cellpadding="0" cellspacing="0" class="big_td">
	<tr>
		<td height="33" background="../images/list.jpg" id="list"><?php echo read_field($conn,"tb_list","f_name",$_GET[u_id]); ?></td>
	    <td background="../images/list.jpg" id="list"><input type="button" id="a" value="写计划" onclick="dlgopen1()"/></td>
	</tr>
</table>
<table width="765" border="0" cellpadding="0" cellspacing="0" bgcolor="#DEEBEF" class="big_td">
	<tr>
		<td width="80" height="25" align="center" valign="middle">日期</td>
		<td width="420" align="center" valign="middle">内容提要</td>
		<td width="50" align="center" valign="middle">类型</td>
	</tr>
<?
	while($p_rows = mysql_fetch_array($p_rst)){
?>
	
<?php
	}
?>
<?php
$met=$_GET['u_id'];
$spendor=($met=='srlist')?2:1;
$page=isset($_GET['page'])?(int)($_GET['page']):1;
$num=5;
$total=mysql_num_rows(mysql_query("SELECT * FROM tb_plan where p_id = ".$_SESSION[id]." and p_type = ".$_GET[u_id].""));
                    $url = 'person_plan.php';
                    if ($total <= 0)
                        exit('还没有你的记录，快去记录吧');
//页码计算
$pagenum=ceil($total/$num);
$page=min($pagenum,$page);//获得首页
$prepg=$page-1;//上一页
$nextpg=($page==$pagenum?0:$page+1);//下一页
$offset=($page-1)*$num;
//开始分页导航条代码：
$pagenav="<div class=num>显示第 <B>".($total?($offset+1):0)."</B>-<B>".min($offset+5,$total)."</B> 条记录，共 $total 条记录 ";
$pagenav.=" <a href='$url?u_id=$met&page=1'>首页</a> ";
if($prepg) $pagenav.=" <a href='$url?u_id=$met&page=$prepg'>前页</a> "; else $pagenav.=" 前页 ";
if($nextpg) $pagenav.=" <a href='$url?u_id=$met&page=$nextpg'>后页</a> "; else $pagenav.=" 后页 ";
$pagenav.=" <a href='$url?u_id=$met&page=$pagenum'>尾页</a> ";
//下拉跳转列表，循环列出所有页码：
$pagenav.="　到第 <select name='topage' size='1' onchange='window.location=\"$url?u_id=$met&page=\"+this.value'>\n";
for($i=1;$i<=$pagenum;$i++){
if($i==$page) $pagenav.="<option value='$i' selected>$i</option>\n";
else $pagenav.="<option value='$i'>$i</option>\n";
}
$pagenav.="</select> 页，共 $pagenum 页</div>";
//假如传入的页数参数大于总页数，则显示错误信息
If($page>$pagenum){
       echo "Error : 不能找到页 ".$page;
       Exit;
}
$info="SELECT id,p_time,p_plan,p_type,p_id from tb_plan where p_id = ".$_SESSION[id]." and p_type = ".$_GET[u_id]." order by id desc limit $offset,$num";
$result3=mysql_query($info,$conn);
$j=0;
while($list=mysql_fetch_array($result3)){
$j++;
$list['p_plan']=substr($list['p_plan'],0,40);
$list['p_planlb']=read_field($conn,"tb_list","f_name",$_GET[u_id]);
echo '<tr><td width="100" height="25" align="center" valign="middle">'.$list['p_time'].'</td><td width="420" align="center" valign="middle">'.$list['p_plan'].'.........<A  onclick="AlertMsg( '.$list['id'].','.$list['id'].')" href="javascript:">查看全文</a><td>'.$list['p_planlb'].'</td></tr>';}
echo '</table>';
echo $pagenav;//输出分页导航
ob_end_flush();
?>
</table>


<?php
	}
	else
		echo "<script>alert('非法链接!');location='../index.php';</script>";
?>