<?PHP
/*
* Copyright (c) www.baojisky.com All rights reserved. 
*/
ob_start(); 
header("Content-type: text/html;charset=gbk");//输出编码,避免中文乱码
$root_path='../..';
include($root_path.'/php/connect_sub.php');
include($root_path.'/php/sub.php');
include($root_path."/php/img_sub.php");
include($root_path.'/php/page_sub_old.php');
include($root_path.'/admin/check.php');


	if($insearch != null)
	{
			$search="and (n_qi like \"%$insearch%\" or z_qi like \"%$insearch%\" or bei_zhu like \"%$insearch%\" or addtime like \"%$insearch%\")";
			$url="Newspaper.php?insearch=$insearch&orderby=$orderby";
	}
	else
	{
			$search="";
			$url="";
	}
	if($orderby==''){$orderby='addtime';}
	//计算分页
	$result=$db->query("SELECT qid from {$db_sux}papers where qid $search ORDER BY $orderby ");
	$total=$db->num_rows($result);
	
	$page_num = 4;
	pageft($total,$page_num,$url);
	
	$result	=	$db->query("SELECT * from {$db_sux}papers where qid $search ORDER BY $orderby DESC limit $firstcount,$displaypg ");

	$i=1;
	if($page==null){$page=1;}
	$i=$page_num*$page-($page_num - 1);
	
	
	if($total>0)
	{
			$xi=1;
  		$fgfg.='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
  	  while ($gb = $db->fetch_array($result))
			{
				$ban_num=$db->num_rows($db->query("SELECT * from {$db_sux}papers_ban where qid='$gb[qid]'"));
				$news_num=$db->num_rows($db->query("SELECT * from {$db_sux}papers_news where qid='$gb[qid]'"));
				if($gb[ban_pdf]!=''){$pdf_ico='<a href="'.$root_path.'/upload/paper_file/'.$gb[ban_pdf].'" title="查看pdf文件" target="_blank"><img src="'.$root_path.'/images/ico_pdf.gif" border="0"></a>';}else{$pdf_ico='';}
				$temp_href=''.$root_path.'/info.php?inid='.$gb['id'];
				//图片
				$gb_ban = $db->fetch_array($db->query("SELECT * from {$db_sux}papers_ban where qid='$gb[qid]' ORDER BY bnum limit 0,1 "));
				if($gb_ban[ban_pic]!=''){$ban_pic=$root_path.'/upload/paper_file/s'.$gb_ban[ban_pic];}else{$ban_pic=$root_path.'/images/no_papers.jpg';}
				
				$temp_html='<table width="350" border="0" cellspacing="1" cellpadding="8" bgcolor="#bdbdbd" >
      <tr>
        <td bgcolor="#fafafa">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="48%" rowspan="8" align="left"><a href="'.$root_path.'/info.php?inid='.$gb[qid].'" target="_blank"><img class="img01" src="'.$ban_pic.'" width="150" height="225" border="1"></a></td>
            <td width="52%" height="40" align="left" ><span class="s02 fbold f14">第'.$gb[n_qi].'期 总第'.$gb[z_qi].'期</span></td>
          </tr>
          <tr>
            <td height="22" align="left">共'.$ban_num.'版 '.$news_num.'条新闻</td>
          </tr>
          <tr>
            <td height="22" align="left">阅读数：'.$gb[click_num].'</td>
          </tr>
          <tr>
            <td height="22" align="left">下载数：'.$gb[down_num].'</td>
          </tr>
          <tr>
            <td height="22" align="left">时间：'.substrgb_old($gb[addtime],0,10).'</td>
          </tr>
          <tr>
            <td height="22" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="17%"><input type="checkbox" name="inid[]" id="x'.$gb[qid].'" value="'.$gb[qid].'"  onclick="checked_numjj(this);" /></td>
                <td width="83%">选择&nbsp;&nbsp;'.$pdf_ico.'</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="35" align="left"><input type="button" value="编辑报纸内容"  name="B222" onClick="location.href=\'Newspaper_ban_list.php?page='.$page.'&qid='.$gb[qid].'\'" class="button_001"></td>
          </tr>
          <tr>
            <td height="35" align="left"><input type="button" value="修改报纸属性"  name="B222" onClick="location.href=\'Newspaper_Properties.php?page='.$page.'&inid='.$gb[qid].'\'" class="button_001"></td>
          </tr>
        </table>
        </td>
      </tr>
    </table>
    			';
						if($xi==1)
						{
							$fgfg.='<tr><td width="50%" align="center" valign="middle">'.$temp_html.'</td>';
							$xi++;
						}
						else
						{
							$fgfg.='<td width="50%" align="center" valign="middle">'.$temp_html.'</td></tr>  <tr><td height="20" colspan="2" align="center"></td>
          </tr>';
							$xi=1;
						}
			}
			//补空
  		if($xi!=1)
			{
				 	$fgfg.='<td width="50%" align="right">&nbsp;</td></tr>';
					$xi=1;
			}
			$fgfg.='</table>';
	}

	$matthew_list=$fgfg;



	
include(parse_template('Newspaper'.'_x',$root_path.'/tpl/admin/',$root_path.'/admin/system/'));
ob_end_flush();
?>