⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.php

📁 通达OA官方提供的30源代码,感觉很实在
💻 PHP
字号:
<?
include_once("inc/auth.php");
$PAGE_SIZE=15;
?>

<html>
<head>
<title>图书查询结果 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language="JavaScript">
function set_page()
{
 PAGE_START=(PAGE_NUM.value-1)*<?=$PAGE_SIZE?>+1;
 location="list.php?TYPE_ID=<?=$TYPE_ID?>&BOOK_NAME=<?=$BOOK_NAME?>&AUTHOR=<?=$AUTHOR?>&ISBN=<?=$ISBN?>&PUB_HOUSE=<?=$PUB_HOUSE?>&LEND=<?=$LEND?>&AREA=<?=$AREA?>&DEPT_ID=<?=$DEPT_ID?>&PAGE_START="+PAGE_START;
}

function detail(BOOK_ID)
{
 URL="detail.php?BOOK_ID="+BOOK_ID;
 myleft=(screen.availWidth-500)/2;
 window.open(URL,"read_notify","height=400,width=500,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}

</script>
</head>

<body class="bodycolor" topmargin="5" >
<?
//-----------先组织SQL语句-----------
$WHERE_STR=" where 1=1";
if($LEND!="")
   $WHERE_STR.=" and LEND='$LEND'";
   
if($BOOK_NAME!="")
   $WHERE_STR.=" and BOOK_NAME like '%".$BOOK_NAME."%'";
   
if($BOOK_NO!="")
   $WHERE_STR.=" and BOOK_NO like '%".$BOOK_NO."%'";    

if($AUTHOR!="")
   $WHERE_STR.=" and AUTHOR like '%".$AUTHOR."%'";

if($ISBN!="")
   $WHERE_STR.=" and ISBN like '%".$ISBN."%'";

if($PUB_HOUSE!="")
   $WHERE_STR.=" and PUB_HOUSE like '%".$PUB_HOUSE."%'";

if($AREA!="")
   $WHERE_STR.=" and AREA like '%".$AREA."%'";

if($TYPE_ID!="all")
   $WHERE_STR.=" and TYPE_ID='$TYPE_ID'";

$WHERE_STR.=" and ((OPEN='0' and DEPT='$LOGIN_DEPT_ID') or OPEN='' or OPEN='1' or find_in_set('$LOGIN_DEPT_ID',OPEN) or OPEN='ALL_DEPT')";

$query="SELECT DEPT,OPEN from BOOK_INFO ".$WHERE_STR." order by TYPE_ID desc, BOOK_NO desc";
$cursor= exequery($connection,$query);
$BOOK_COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
  $DEPT1=$ROW["DEPT"];
  $OPEN1=$ROW["OPEN"];
    
  if($OPEN1=="0" && $DEPT1!=$LOGIN_DEPT_ID)
     continue;

  $BOOK_COUNT++;
}

$PAGE_TOTAL=$BOOK_COUNT/$PAGE_SIZE;
$PAGE_TOTAL=ceil($PAGE_TOTAL);

//--- 计算,末页 ---
if($BOOK_COUNT<=$PAGE_SIZE)
   $LAST_PAGE_START=1;
else if($BOOK_COUNT%$PAGE_SIZE==0)
   $LAST_PAGE_START=$BOOK_COUNT-$PAGE_SIZE+1;
else
   $LAST_PAGE_START=$BOOK_COUNT-$BOOK_COUNT%$PAGE_SIZE+1;

//--- 智能分页 ---
//-- 页首 --
if($PAGE_START=="")
   $PAGE_START=1;

if($PAGE_START>$BOOK_COUNT)
   $PAGE_START=$LAST_PAGE_START;

if($PAGE_START<1)
   $PAGE_START=1;

//-- 页尾 --
$PAGE_END=$PAGE_START+$PAGE_SIZE-1;

if($PAGE_END>$BOOK_COUNT)
   $PAGE_END=$BOOK_COUNT;

//--- 计算当前页 ---
$PAGE_NUM=($PAGE_START-1)/$PAGE_SIZE+1;


$query1=str_replace("DEPT,OPEN","*",$query);
$cursor1 = exequery($connection, $query1);

if($BOOK_COUNT==0)
{
    Message("<br>提示","没有符合条件的图书");
?>
<br>
<div align="center">
  <input type="button"  value="返回" class="BigButton" onClick="location='search.php';">
</div>
<?
    exit;
}
?>

<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/book.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><span class="big3"> 图书查询结果 </span><br>
    </td>
    <td valign="bottom" align="right">
    <span class="small1">当前为第<b><?=$PAGE_START?></b>至<b><?=$PAGE_END?></b>条 (第<?=$PAGE_NUM?>页,共<?=$PAGE_TOTAL?>页,每页最多<?=$PAGE_SIZE?>条)</small>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    </tr>
</table>

<table class="TableList"  width="95%">
  <tr class="TableHeader">
      <td nowrap align="center">部门</td>
      <td nowrap align="center">书名</td>
      <td nowrap align="center">编号</td>
      <td nowrap align="center">类别</td>
      <td nowrap align="center">作者</td>
      <td nowrap align="center">出版社</td>
      <td nowrap align="center">存放地点</td>
      <td nowrap align="center">借阅状态</td>
      <td nowrap align="center">操作</td>
  </tr>
<?
$BOOK_COUNT = 0;
while($ROW=mysql_fetch_array($cursor1))
{
  $DEPT1=$ROW["DEPT"];
  $OPEN1=$ROW["OPEN"];
    
  if($OPEN1=="0" && $DEPT1!=$LOGIN_DEPT_ID)
     continue;

  $BOOK_COUNT++;
  if($BOOK_COUNT<$PAGE_START)
     continue;
  else if($BOOK_COUNT>$PAGE_END)
     break;

  $BOOK_ID=$ROW["BOOK_ID"];
  $BOOK_NAME1=$ROW["BOOK_NAME"];
  $TYPE_ID1=$ROW["TYPE_ID"];
  $AUTHOR1=$ROW["AUTHOR"];
  $ISBN1=$ROW["ISBN"];
  $PUB_HOUSE1=$ROW["PUB_HOUSE"];
  $PUB_DATE1=$ROW["PUB_DATE"];
  $AREA1=$ROW["AREA"];
  $AMT1=$ROW["AMT"];
  $PRICE1=$ROW["PRICE"];
  $BRIEF1=$ROW["BRIEF"];
  $LEND1=$ROW["LEND"];
  $BORR_PERSON1=$ROW["BORR_PERSON"];
  $MEMO1=$ROW["MEMO"];
     
  $BOOK_NO=$ROW["BOOK_NO"];

  if($LEND1=="1")
  	$LEND_DESC="已借出";
  else
  	$LEND_DESC="未借出";

  $query2 = "SELECT TYPE_NAME from BOOK_TYPE where TYPE_ID='$TYPE_ID1'";
  $cursor2=exequery($connection,$query2);

  if($ROW=mysql_fetch_array($cursor2))
  $TYPE_NAME=$ROW["TYPE_NAME"];

  $query3 = "SELECT DEPT_NAME from DEPARTMENT where DEPT_ID='$DEPT1'";
  $cursor3=exequery($connection,$query3);
  if($ROW=mysql_fetch_array($cursor3))
     $DEPT_NAME=$ROW["DEPT_NAME"];

  $query3 = "SELECT BOOK_STATUS,STATUS from BOOK_MANAGE where BOOK_NO='$BOOK_NO'";
  $cursor3=exequery($connection,$query3);
  $COUNT=0;
  while($ROW3=mysql_fetch_array($cursor3))
  {
  	$BOOK_STATUS3=$ROW3["BOOK_STATUS"];
  	$STATUS3=$ROW3["STATUS"]; 	
  	
  	if(($BOOK_STATUS3==0 && $STATUS3==0) || ($BOOK_STATUS3==0 && $STATUS3==1)|| ($BOOK_STATUS3==1 && $STATUS3==0))
  	  $COUNT++;
  }   

  if($BOOK_COUNT%2==1)
     $TableLine="TableLine1";
  else
     $TableLine="TableLine2";
?>

  <tr class="<?=$TableLine?>">
    <td nowrap align="center"><?=$DEPT_NAME?></td>
    <td nowrap align="center"><?=$BOOK_NAME1?></td>
    <td nowrap align="center"><?=$BOOK_NO?></td>
    <td nowrap align="center"><?=$TYPE_NAME?></td>
    <td nowrap align="center"><?=$AUTHOR1?></td>
    <td nowrap align="center"><?=$PUB_HOUSE1?></td>
    <td nowrap align="center"><?=$AREA1?></td>
    <td nowrap align="center"><?=$LEND_DESC?></td>
    <td nowrap align="center" width="80">
<?
if($LEND1==0 && $COUNT < $AMT1)
{
?>    	
      <a href="#" onClick="window.open('new.php?BOOK_ID=<?=$BOOK_ID?>&BOOK_NO=<?=$BOOK_NO?>','','height=400,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,left=220,top=180,resizable=yes');">借阅 </a>
<?
}
?>
      <a href="javascript:detail('<?=$BOOK_ID?>');">详情 </a>
    </td>
  </tr>

<?
}//while
?>
<tr class="TableControl">
<td colspan="9" align="right">
   <input type="button"  value="首页" class="SmallButton"  <?if($PAGE_START==1)echo "disabled";?> onclick="location='list.php?TYPE_ID=<?=$TYPE_ID?>&BOOK_NAME=<?=$BOOK_NAME?>&AUTHOR=<?=$AUTHOR?>&ISBN=<?=$ISBN?>&PUB_HOUSE=<?=$PUB_HOUSE?>&AREA=<?=$AREA?>&DEPT_ID=<?=$DEPT_ID?>&LEND=<?=$LEND?>'"> &nbsp;&nbsp;
   <input type="button"  value="上一页" class="SmallButton" <?if($PAGE_START==1)echo "disabled";?> onclick="location='list.php?TYPE_ID=<?=$TYPE_ID?>&BOOK_NAME=<?=$BOOK_NAME?>&AUTHOR=<?=$AUTHOR?>&ISBN=<?=$ISBN?>&PUB_HOUSE=<?=$PUB_HOUSE?>&AREA=<?=$AREA?>&DEPT_ID=<?=$DEPT_ID?>&PAGE_START=<?=($PAGE_START-$PAGE_SIZE)?>&LEND=<?=$LEND?>'"> &nbsp;&nbsp;
   <input type="button"  value="下一页" class="SmallButton" <?if($PAGE_END>=$BOOK_COUNT)echo "disabled";?> onclick="location='list.php?TYPE_ID=<?=$TYPE_ID?>&BOOK_NAME=<?=$BOOK_NAME?>&AUTHOR=<?=$AUTHOR?>&ISBN=<?=$ISBN?>&PUB_HOUSE=<?=$PUB_HOUSE?>&AREA=<?=$AREA?>&DEPT_ID=<?=$DEPT_ID?>&PAGE_START=<?=($PAGE_END+1)?>&LEND=<?=$LEND?>'"> &nbsp;&nbsp;
   <input type="button"  value="末页" class="SmallButton"  <?if($PAGE_END>=$BOOK_COUNT)echo "disabled";?> onclick="location='list.php?TYPE_ID=<?=$TYPE_ID?>&BOOK_NAME=<?=$BOOK_NAME?>&AUTHOR=<?=$AUTHOR?>&ISBN=<?=$ISBN?>&PUB_HOUSE=<?=$PUB_HOUSE?>&AREA=<?=$AREA?>&DEPT_ID=<?=$DEPT_ID?>&PAGE_START=<?=$LAST_PAGE_START?>&LEND=<?=$LEND?>'"> &nbsp;&nbsp;
   页数
   <input type="text" name="PAGE_NUM" value="<?=$PAGE_NUM?>" class="SmallInput" size="2"> <input type="button"  value="转到" class="SmallButton" onclick="set_page();" title="转到指定的页面">&nbsp;&nbsp;
</td>
</tr>
</table>

<br>
<div align="center">
 <input type="button"  value="返回" class="BigButton" onClick="location='search.php';">
</div>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -