<?php
if(!defined('MOD'))  die("access die");
$class  = intval($_GET['class']);
$pagesize = 10;
$pageno = intval($_GET['pageno']) ? intval($_GET['pageno']) : 1;
$startid = ($pageno -1)*$pagesize;
if($class != ""){
	$arrchildids = qdb::QueryAlone("select arrchildids from ".TABLEPRE."acategory where cid='$class' limit 1"); 
	$where = "WHERE r.cid IN (".$arrchildids.") and r.channelid='$channelid'";
}else{
 	$where = "WHERE  r.channelid='$channelid'";
}
$menuTree   = str_replace("value=\"{$class}-", " selected value=\"{$class}-", $menuTree);
$sql = "SELECT count(*) FROM ".TABLEPRE."collect_rule as r $where ORDER BY r.id ASC";
$total = qdb::QueryAlone( $sql);
$sql = "SELECT r.*, c.title  FROM ".TABLEPRE."collect_rule as r left join ".TABLEPRE."acategory as c on r.cid=c.cid $where ORDER BY r.id ASC limit $startid, $pagesize";
$lists = qdb::fetchAll($sql);
foreach ($lists as &$row_rule)
{
	if( $row_rule['last_update'] == 0){
		$row_rule['last_update'] = 'ΙΠΞ΄²ΙΌ―';
	}else{
		$row_rule['last_update'] = qbase::formatTime( 'Y-m-d H:i:s', $row_rule['last_update']);
	}
}
include qbase::template( $path . '/' . 'rules_show');
?> 