public function view_index() { $condition = ''; $partitionManage = new PartitionManageAct(); $this->smarty->assign('title', '分区管理'); //接收参数生成条件 $curpage = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1; $type = isset($_GET['type']) ? trim($_GET['type']) : ''; $key = isset($_GET['key']) ? post_check(trim($_GET['key'])) : ''; $chid = isset($_GET['chid']) ? intval($_GET['chid']) : 0; //渠道ID $condition .= "1"; $condition .= " AND channelId = {$chid}"; if ($type && $key) { if (!in_array($type, array('partitionCode', 'partitionName'))) { redirect_to("index.php?mod=partitionManage&act=index"); } $condition .= ' AND ' . $type . " = '" . $key . "'"; } //获取符合条件的数据并分页 $pagenum = 20; //每页显示的个数 $res = $partitionManage->actList($condition, $curpage, $pagenum); $total = $partitionManage->actListCount($condition); //页面总数量 $page = new Page($total, $pagenum, '', 'CN'); $pageStr = ""; if ($res) { if ($total > $pagenum) { $pageStr = $page->fpage(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $pageStr = $page->fpage(array(0, 1, 2, 3)); } } else { $pageStr = '暂无数据'; } $carrierId = PartitionManageModel::getCarrierId($chid); //替换页面内容变量 $this->smarty->assign('chid', $chid); //渠道ID $this->smarty->assign('carrierId', $carrierId); //运输方式ID $this->smarty->assign('key', $key); //关键词 $this->smarty->assign('type', $type); //查询选项 $this->smarty->assign('lists', $res); //循环赋值 $this->smarty->assign('pageStr', $pageStr); //分页输出 $this->smarty->display('partitionManage.htm'); }