/** * 设置分页信息 * @param $params * @param $p_intTotalNun * @return array */ public function getPager($params, $p_intTotalNun) { if ($params["ff"] == "" || $params["ff"] == "开始日期") { unset($params["ff"]); } if ($params["tt"] == "" || $params["tt"] == "结束日期") { unset($params["tt"]); } $arrNowParam = $params; return Util_MultiPager::multiPage($arrNowParam, '', $p_intTotalNun, $this->page_num, 10, $this->getUrlString(), true); }
public function handle_request() { $apf = APF::get_instance(); $request = $apf->get_request(); $params = $request->get_parameters(); $baseDomain = $apf->get_config('base_domain', 'common'); $baseUri = defined('BASE_URI') ? BASE_URI : ''; $indexUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/index"; $showUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/show"; $guid = $request->get_guid(); $per = 16; $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1; $daBaseinfo = Model_Goodbroker_Baseinfo::data_access()->filter('is_verify', 1); $daTotal = clone $daBaseinfo; if (time() < strtotime(date('2014-03-24'))) { $sort = isset($params['s']) ? $params['s'] : 'n'; } else { $sort = isset($params['s']) ? $params['s'] : 'h'; } if ($sort == 'n') { $Baseinfo = $daBaseinfo->limit($per)->offset(($page - 1) * $per)->sort('create_time', 'DESC')->find_all(); } else { $Baseinfo = $daBaseinfo->limit($per)->offset(($page - 1) * $per)->sort('votes', 'DESC')->find_all(); } $bllgoodbroker = new Bll_Goodbroker(); $votelog = $bllgoodbroker->getVotelog(); $brokers = ''; $votes = array(); if (!empty($Baseinfo)) { foreach ($Baseinfo as $row) { $brokers .= intval($row->broker_id) . ','; } $brokers = substr($brokers, 0, -1); $isvotes = $votelog->getVotesByUser($guid, $brokers); foreach ($isvotes as $row) { $votes[$row['broker_id']]['id'] = $row['id']; } } $total = $daTotal->count(); $pager = Util_MultiPager::multiPage($params, '', $total, $per, 5, $indexUrl); $request->set_attribute('page', $page); $request->set_attribute('pager', $pager); $request->set_attribute('showPager', $total > $per); $request->set_attribute('showUrl', $showUrl); $request->set_attribute('indexUrl', $indexUrl); $request->set_attribute('baseinfo', $Baseinfo); $request->set_attribute('votes', $votes); $request->set_attribute('sort', $sort); return 'Goodbroker_Index'; }
public function handle_request_internal() { try { $searchIndex = $this->getParameter('search_index'); $pageNum = $this->getParameter('p'); if (empty($searchIndex)) { $searchIndex = 0; } if (empty($pageNum)) { $pageNum = 1; } if ($pageNum < 1 || $searchIndex < 0) { return false; } $userId = self::$BrokerInfo['BaseInfo']['USERID']; $params = $this->getParameters(); $anYuanBaoBll = new Bll_Broker_AnYuanBao($userId); //获取总数 $totalNum = $anYuanBaoBll->getTotalNum(); if (empty($totalNum['total'])) { $totalNum['total'] = 0; } //设置列表中展示的时间筛选条件 $this->setSelectMonthList(); //获取查询的开始时间和结束时间 $selectedStartTime = $this->selectMonthList[$searchIndex]['startTime']; $selectedEndTime = $this->selectMonthList[$searchIndex]['endTime']; // var_dump($this->selectMonthList); $records = $anYuanBaoBll->getDetailRecord($selectedStartTime, $selectedEndTime, $pageNum - 1, $this->pageLimit); if (empty($records)) { $multiPage = Util_MultiPager::multiPage($params, '', $this->pageLimit, $this->pageLimit, $this->pagerMax, $this->getUrlString(), true); } else { $multiPage = Util_MultiPager::multiPage($params, '', $records['totalCount'], $this->pageLimit, $this->pagerMax, $this->getUrlString(), true); $finalRecords = array(); foreach ($records['userYuanbaoLog'] as $row) { $finalRecords[] = array('time' => $row['addTime'], 'coin' => $row['yuanbaoNum'], 'note' => $row['note']); } APF::get_instance()->get_request()->set_attribute('finalRecords', $finalRecords); } APF::get_instance()->get_request()->set_attribute('totalNum', $totalNum); APF::get_instance()->get_request()->set_attribute('selectMonthList', $this->selectMonthList); APF::get_instance()->get_request()->set_attribute('multipage', $multiPage); APF::get_instance()->get_request()->set_attribute('searchIndex', $searchIndex); } catch (Exception $e) { APF::get_instance()->get_request()->set_attribute('exceptionError', $searchIndex); } return "Broker_YuanBaoSearch"; }
public function handle_request() { $apf = APF::get_instance(); $request = $apf->get_request(); $params = $request->get_parameters(); $baseDomain = $apf->get_config('base_domain', 'common'); $baseUri = defined('BASE_URI') ? BASE_URI : ''; $showUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/show"; $deemUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/deem"; $per = 16; $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1; $daoinfo = Model_Goodbroker_Baseinfo::data_access()->filter('is_verify', 1)->filter('is_deem', 1); $daoTotal = clone $daoinfo; $Baseinfo = $daoinfo->limit($per)->offset(($page - 1) * $per)->sort('votes', 'DESC')->find_all(); $total = $daoTotal->count(); $pager = Util_MultiPager::multiPage($params, '', $total, $per, 5, $deemUrl); $request->set_attribute('page', $page); $request->set_attribute('pager', $pager); $request->set_attribute('baseinfo', $Baseinfo); $request->set_attribute('showUrl', $showUrl); $request->set_attribute('showPager', $total > $per); return 'Goodbroker_Deem'; }
/** * 设置分页信息 * @param $params * @param $p_intTotalNun * @return array */ public function getPager($params, $p_intTotalNun) { return Util_MultiPager::multiPage($params, '', $p_intTotalNun, $this->page_num, 10, $this->getUrlString(), true); }