<?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');
 

//取报纸主数据
$result	=	$db->query("SELECT * FROM {$db_sux}papers WHERE  qid='$qid'");		
$gb 	=	$db->fetch_array($result);
//遍历版面数据
$result_ban	=	$db->query("SELECT * from {$db_sux}papers_ban where qid='$qid' ORDER BY bnum  ");
$ban_numberz	=	$db->num_rows($result_ban);

if($ban_numberz>0)
{
  	  while($gb_ban = $db->fetch_array($result_ban))
			{
				$ban_list.='<a href="#b'.$gb_ban[bnum].'">'.$gb_ban[ban_name].'</a>&nbsp;&nbsp;';				
				$news_num=$db->num_rows($db->query("SELECT * from {$db_sux}papers_news where qid='$gb[qid]' and bid=$gb_ban[bid]"));
				//图片
				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';}
				//取新闻
				$news_list_html='';
				$result_news	=	$db->query("SELECT * from {$db_sux}papers_news where bid='$gb_ban[bid]' ORDER BY addtime  ");
				$news_numberz	=	$db->num_rows($result_news);
				if($news_numberz>0)
				{
  		  		while($gb_news = $db->fetch_array($result_news))
						{
							//热点链接
							if($gb_news[redian]==''){$re_dian_html='<font color="#ff0000">未设置</font> <a href="Newspaper_news_redian.php?nid='.$gb_news[nid].'&qid='.$qid.'&bid='.$gb_ban[bid].'&page='.$page.'&maodian=b'.$gb_ban[bnum].'">设置</a>';}else{$re_dian_html='<font color="#33993d">已设置</font> <a href="Newspaper_news_redian.php?nid='.$gb_news[nid].'&qid='.$qid.'&bid='.$gb_ban[bid].'&page='.$page.'&maodian=b'.$gb_ban[bnum].'">修改</a>';}
							$news_list_html.="<tr bgcolor=#FFFFFF onmouseover=this.style.backgroundColor='#FFFFD4';return true;  onmouseout=this.style.backgroundColor='#FFFFFF'; >
  						  <td height=\"18\" align=\"center\" bgcolor=\"#F1F5FA\">".'<input type="checkbox" name="inid[]" id="x'.$gb_news[nid].'" value="'.$gb_news[nid].'"  onclick="checked_numjj(this);" />'."</td>
  						  <td align=\"left\">$re_dian_html</td>
							 <td align=\"left\"><a href=\"/bao/z.php?inid=$gb_news[nid]\" target=\"_blank\" title=\"$gb_news[ztitle]\">".substrgb($gb_news[ztitle],0,18,'gbk')."</a></td>
							 <td align=\"left\"><a href=\"Newspaper_news_edit.php?nid=$gb_news[nid]&qid=$qid&bid=$gb_ban[bid]&page=$page&maodian=b$gb_ban[bnum]\">修改</a></td>
  						 <td align=\"left\">".substrgb_old($gb_news[addtime],0,16)."</td>
  						 <td align=\"center\">$gb_news[click_num]</td>       
							 </tr>";
						}
				}
				
				$fgfg.='<table width="97%" border="0" cellpadding="15" cellspacing="1" bgcolor="#BEC6CE">
      <tr>
        <td bgcolor="#EFEFEF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="180" height="25" align="left">第'.$gb_ban[ban_name].'<a name="b'.$gb_ban[bnum].'"></a></td>
            <td align="left"><input type="button" value="&nbsp;&nbsp;&nbsp;&nbsp;添加新闻"  name="B2" onClick="location.href=\'Newspaper_news_add.php?page='.$page.'&qid='.$qid.'&bid='.$gb_ban[bid].'&maodian=b'.$gb_ban[bnum].'\'" class="button_add">
&nbsp;
<input type="button" value="删除选中"  name="B2" onclick="del_select(\'新闻\',\'Newspaper_news_del.php?page='.$page.'&qid='.$qid.'\');" class="button_del">
&nbsp; &nbsp;<font color="#336699">总数：'.$news_num.'条</font></td>
            <td align="right"><input type="button" value="删除这个版面"  name="B2" onClick="isdel_ban(\'Newspaper_ban_del.php?page='.$page.'&qid='.$qid.'&bid='.$gb_ban[bid].'\')" class="button_del"></td>
          </tr>
          <tr>
            <td height="5" colspan="3" align="left">&nbsp;</td>
            </tr>
        </table>
          <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
          <tr>
            <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="172" align="center"><table width="172" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="center"><a href="/bao/info.php?inid='.$qid.'&ban='.$gb_ban[bnum].'" target="_blank"><img src="'.$ban_pic.'" width="150" height="225" class="img01"></a></td>
                  </tr>
                  <tr>
                    <td height="30" align="center"><input type="button" value="版面设置（图片、名称）"  name="B" onClick="location.href=\'Newspaper_ban.php?page='.$page.'&qid='.$qid.'&bid='.$gb_ban[bid].'\'" class="button_001"></td>
                  </tr>
                </table></td>
                <td valign="top"><table width="100%"  border="0" cellpadding="2" cellspacing="1" bgcolor="#DBE2E7">
                  <tr align="left" >
                    <td width="6%" height="22" align="center" class="title_02">&nbsp;</td>
                    <td width="18%" align="left" class="title_02">链接区域</td>
                    <td width="40%" class="title_02">主标题</td>
                    <td width="7%" class="title_02">修改</td>
                    <td width="20%" class="title_02">时间</td>
                    <td width="9%" class="title_02">点击数</td>
                    '.$news_list_html.'
                    </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table><br><br>
    			';
						
			}

}
$matthew_list=$fgfg;
	
include(parse_template('Newspaper_ban_list'.'_x',$root_path.'/tpl/admin/',$root_path.'/admin/system/'));
ob_end_flush();
?>