<?php
session_start();
require_once "../init.php";
require_once "../authority.inc.php";

$page = $_GET['page'];

$keyword=trim($keyword);
if($keyword){
	$wheres=" AND (DocID like '%$keyword%' or Title like '%$keyword%') ";
}
//得到总记录数
$sql="select count(*) from doc where 1 $wheres";
$rs=$DB->query($sql);
$pageSize=30;
$totalRecord=$DB->result($rs,0,0);
$totalPage=@ceil($totalRecord/$pageSize);
if(!$page)$page=1;
$offset=($page-1)*$pageSize;
//查询
$sql = "select * from doc where 1 $wheres order by dtCreate desc limit $offset,$pageSize";
$result = $DB->query($sql);
$pageList = GetPageList($_SERVER[PHP_SELF],"page","15",$totalPage,$page);
$PNum = $DB->num_rows($result);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>技术支持文档管理</title>
<LINK href="../share/style.css" rel=stylesheet>
<script src='../share/global.js'></script>
</head>
<body>

<? include "../share/top.php"?>
<div id="topLink">
<div id="topInfo">
	<span class="tTitle">技术支持文档</span>
	<span class="sarr"> >> </span><a href="<?=$GLOBALS["parentpath"]?>">返回到管理首页</a>
</div>
</div>
<!--子导航-->
<? include "doc_nav.inc.php"?>
<!--结束-->

<!--搜索-->
<div id="search">
<form method='post' action='<?=$_SERVER['PHP_SELF']?>'>
快速搜索:
<input type="text" name="keyword" class="input">
<input name="submit" type="submit" class="bt2" value="搜 索">
<input type="button" class="bt2" value="全部列出" onClick="location='doc_list.php'">
</form>
</div>
<!--搜索-->
<div id="page">
<?
	$pageStr="共 $totalRecord 条记录,共 $totalPage 页,当前第 $page 页";
	echo $pageStr;
?>
</div>
<?
	if($PNum){
?>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="table">
        <tr id="tr">
          <td height="20">编号</td>
		  <td>类别</td>
          <td>文档标题</td>
          <td>发布时间</td>
          <td>操作</td>
        </tr>
        <? while($DocInfo=$DB->fetch_array($result)){?>
        <tr id="td" onmouseover='inStyle(this)' onmouseout='outStyle(this)'>
          <td width="80"><?=$DocInfo[DocID]?></td>
		  <td width="80"><?=$DocInfo[ClassName]?></td>
          <td style="text-align:left;"><?=$DocInfo[Title]?></td>
          <td width="150"><?=$DocInfo[dtCreate]?></td>
          <td width="120"> 
		    <? $key = GetHashKey('doc'.$DocInfo[DocID]);?>
			<a href="/doc/show.php?DocID=<?=$DocInfo[DocID]?>" target="_blank">浏览</a> |
			<a href="doc_edit.php?DocID=<?=$DocInfo[DocID]?>&key=<?=$key?>">修改</a> |
			<a href="doc_del.php?DocID=<?=$DocInfo[DocID]?>&key=<?=$key?>" onClick="return confirm('确定删除吗?')">删除</a> 
		  </td>
        </tr>
        <? }?>
		<tr>
		  <td colspan="4"  align='left'>
		  </td>
	    </tr>
 </table>
<div id="page">
<? echo $pageStr;?>
</div>
<center>
<?
  if($pageList) echo "$pageList[0] <br> $pageList[1]";
?>
</center>

      <?	}else{
			   echo "<center><br><br>没有相关记录<br><br></center>";
			}
?>
<br>    
<? 
$DB->close();
include "../share/bottom.php";
?>
</body>
</html>
