<?php
	require '../../Run.php';
	require root_path.'/include/getmkurl.fun.php';
	require root_path.'/include/class/AdminView.class.php';
	require root_path."/include/page.inc.php";
	echo head('小说管理');
	if($_GET['cid'] == NULL){
	echo topNav('小说列表','<a href="http://'.HTTP_HOST.'/admin/wap_admin.php">返回</a>',' ');
			echo '<div class="title">请选择栏目|<a href="?cid=0">全部列表</a></div>';
			$classl = new AdminView('book/list.php',$_GET['cid']);
			echo $classl -> showClass();
	}else{
		if($_GET['cid'] == '0'){
			echo topNav('小说列表','<a href="?cid=">栏目</a>',' ');
		$mysql = new D('dd_book_name');
		$back = $mysql
		->where(array('siteid'=>WAPID))
		->limit(slist($_GET['page'],15),15)
		->order('bookid DESC')
		->select();
		if($back){
		$num = 0;
			foreach($back as $value)
			{
			$olt = '[已完结]';
			if($value['ol'] == '1'){
				$olt = '[连载中]';
			}
				$div = $num++%2 == 0?'line1':'line2';
				echo '<div class="'.$div.'"><a href="content.php?cid='.$value['gro'].'&id='.$value['bookid'].'">'.$olt.$value['title'].'</a>[作者:'.user('nc','id',$value['userid']).'('.user('xid','id',$value['userid']).')]</div>';
			}
		}else{
			echo '<div class="tip">暂无记录</div>';
		}
		$backnums = $mysql
		->where(array('siteid'=>WAPID))
		->select();
		$url = 'list.php?cid='.$_GET['cid'].'&';
		echo page(count($backnums),12,$url,NULL,'view');
		}else{
		echo topNav('小说列表','<a href="?cid=">栏目</a>','<a href="add.php?cid='.$_GET['cid'].'">添加</a>');
		$mysql = new D('dd_book_name');
		$back = $mysql
		->where(array('gro'=>$_GET['cid'],'siteid'=>WAPID))
		->limit(slist($_GET['page'],15),15)
		->order('bookid DESC')
		->select();
		if($back){
		$num = 0;
			foreach($back as $value)
			{
			$olt = '[已完结]';
			if($value['ol'] == '1'){
				$olt = '[连载中]';
			}
				$div = $num++%2 == 0?'line1':'line2';
				echo '<div class="'.$div.'"><a href="content.php?cid='.$value['gro'].'&id='.$value['bookid'].'">'.$olt.$value['title'].'</a>[作者:'.user('nc','id',$value['userid']).'('.user('xid','id',$value['userid']).')]</div>';
			}
		}else{
			echo '<div class="tip">暂无记录</div>';
		}
		$backnums = $mysql
		->where(array('gro'=>$_GET['cid'],'siteid'=>WAPID))
		->select();
		$url = 'list.php?cid='.$_GET['cid'].'&';
		echo page(count($backnums),12,$url,NULL,'view');
		}
	}
	echo footer(1);