<?php
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
require("../../class/dpfun.php");
require("../../class/tag.php");
require("../../data/dbcache/class.php");
require '../'.LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
//验证用户
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];

$tagid=$_GET['tagid'];

if(!$tagid){
	printerror('ErrorUrl','history.go(-1)');
}
$t=$empire->fetch1("select * from {$dbtbpre}enewstags where tagid=$tagid limit 1");
if($t[tagid]!=$tagid){
	printerror('ErrorUrl','history.go(-1)');
}
$search='&tagid='.$tagid;

$start=0;
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$line=20;//每页显示
$page_line=12;
$offset=$page*$line;


$num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewstagsdata where tagid=$tagid");//取得总条数
$query="select * from {$dbtbpre}enewstagsdata where tagid=$tagid order by tid desc limit $offset,$line";

$returnpage=page2($num,$line,$page_line,$start,$page,$search);

//导航
$url='<a href="ListTags.php">管理TAGS</a>&nbsp;>&nbsp;<a href="ListWriterClass.php"><b>'.$t[tagname].'</b></a>';

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" type="text/css">
<title>作者分类管理</title>

</head>
<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr> 
    <td width="52%">位置： 
      <?=$url?>
    </td>
    <td width="48%"><div align="right"></div>
	</td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<form name="listform" method="post" action="ListTags.php">
  <input type=hidden name=enews value=MvOutTag>
  	<tr class="header">
      <td width="10%" height="25"><div align="center">BookID</div></td>
	  <td width="35%" height="25"> <div align="center">书名</div></td>
      <td width="30%" height="25"> <div align="center">栏目</div></td>
      <td width="25%" height="25"> <div align="center">操作</div></td>
    </tr>
<?php
	$sql=$empire->query($query);
	while($r=$empire->fetch($sql)){
		$book=$empire->fetch1("select * from {$dbtbpre}ecms_bookname where id=$r[id] order by id desc");

?>
				<tr  bgcolor='#ffffff'>
				  <td height="25"><div align="center"><?=$r[id]?></div></td>
				  <td height="25"> <div align="center"><a href="<?=$book[titleurl]?>" target="_blank">《<?=$book[title]?>》</a></div></td>
				  <td height="25"> <div align="center"><a href="<?=ClassUrl($book[classid])?>" target="_blank"><?=$class_r[$book[classid]][classname]?></a></div></td>
				  <td height="25"> <div align="center"><a href="../AddBook.php?enews=EditNews&id=<?=$book[id]?>&classid=<?=$book[classid]?>">修改</a>&nbsp;|&nbsp;<a href="ListTags.php?enews=DelBfromT&tid=<?=$r[tid]?>">移除</a></div></td>
				</tr>


<?
	}
?>
	<tr bgcolor='#ffffff'> 
    <td  colspan=4> 
      <?=$returnpage?>
    </td>
	</td>
  </tr>
 </form>
</table>
</body>
</html>
<?
db_close();
$empire=null;
?>