<?php
if($_REQUEST['act'] == 'list'){
//获取信息列表
$order_list = order_list();
$smarty->assign('order_list', $order_list['order_list']);
$smarty->assign('filter', $order_list['filter']);
$smarty->assign('record_count', $order_list['record_count']);
$smarty->assign('page_count', $order_list['page_count']);
//后台页面样式
$smarty->assign('full_page', 1);
//跳转页面
assign_query_info();
$smarty->display('order_list.htm');
}
elseif ($_REQUEST['act'] == 'query'){//分页代码
//获取信息列表
$order_list = order_list();
$smarty->assign('order_list', $order_list['order_list']);
$smarty->assign('filter', $order_list['filter']);
$smarty->assign('record_count', $order_list['record_count']);
$smarty->assign('page_count', $order_list['page_count']);
//跳转页面
make_json_result ( $smarty->fetch ( 'order_list.htm' ), '', array ('filter' => $order_list ['filter'], 'page_count' => $order_list ['page_count'] ) );
}
//查询数据方法
function order_list()
{
$sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('cuanji');
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$filter = page_and_size($filter);
/* 获活动数据 */
$sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('cuanji').' LIMIT '. $filter['start'] .', ' . $filter['page_size'];
$filter['keywords'] = stripslashes($filter['keywords']);
set_filter($filter, $sql);
$row = $GLOBALS['db']->getAll($sql);
$arr = array('order_list' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
return $arr;
}
?>
<!—————————————————html代码———————————————->
<!–导入js–>
{insert_scripts files='../js/utils.js,listtable.js'}
<!–动态赋值div 名字必须相同–>
<div id='listDiv'>
<!–循环显示相关信息–>
</div>
<!–分页样式–>
{include file='page.htm'}
<script>
//分页js赋值
listTable.recordCount = {$record_count};
listTable.pageCount = {$page_count};
{foreach from=$filter item=item key=key}
listTable.filter.{$key} = '{$item}';
{/foreach}
</script>
发表评论