Exemplo n.º 1
0
 /**
  * Require the correct pagenav class based on template
  *
  * @param   int  $total       total
  * @param   int  $limitStart  start
  * @param   int  $limit       length of records to return
  *
  * @return  object	pageNav
  */
 public function &getPagination($total = 0, $limitStart = 0, $limit = 0)
 {
     if (!isset($this->nav)) {
         if ($this->randomRecords) {
             $limitStart = $this->getRandomLimitStart();
         }
         $params = $this->getParams();
         $this->nav = new FPagination($total, $limitStart, $limit);
         if ($limit == -1) {
             $this->nav->viewAll = true;
         }
         // $$$ rob set the nav link urls to the table action to avoid messed up url links when  doing ranged filters via the querystring
         $this->nav->url = $this->getTableAction();
         $this->nav->showAllOption = $params->get('showall-records', false);
         $this->nav->setId($this->getId());
         $this->nav->showTotal = $params->get('show-total', false);
         $item = $this->getTable();
         $this->nav->startLimit = FabrikWorker::getMenuOrRequestVar('rows_per_page', $item->rows_per_page, $this->isMambot);
         $this->nav->showDisplayNum = $params->get('show_displaynum', true);
     }
     return $this->nav;
 }
Exemplo n.º 2
0
 public function actionRecharge()
 {
     $data = array();
     $attr = array('condition' => 'user_id = :user_id', 'params' => array(':user_id' => $this->user['id']));
     $userProBuyList = $this->userProductBuy_model->findAll($attr);
     $sumBuyVal = 0.0;
     foreach ($userProBuyList as $userProVal) {
         $buyPro = $userProVal->getAttributes();
         $sumBuyVal += $buyPro['buy_val'];
     }
     $data['sumBuyVal'] = $sumBuyVal;
     $dType = $this->request->getParam('dType');
     $rType = $this->request->getParam('rType');
     $dTime = FConfig::item('config.time_type.' . $dType);
     if ($rType == 3) {
         //分页参数
         $page = $this->request->getParam('page') > 0 ? (int) $this->request->getParam('page') : 1;
         $page_size = $this->request->getParam('size') > 0 ? (int) $this->request->getParam('size') : FConfig::item('config.pageSize');
         $where = "1=1";
         $where .= " and user_id = {$this->user['id']}";
         if (!empty($dType)) {
             $where .= " and create_time >= :create_time";
             $data['dType'] = $dType;
         }
         $condition_arr = array('condition' => $where, 'order' => 'create_time DESC', 'limit' => $page_size, 'offset' => ($page - 1) * $page_size);
         $condition_arr['params'] = array();
         if (!empty($dType)) {
             $condition_arr['params'][':create_time'] = $dTime;
         }
         $data['cashList'] = $this->withdrawCash_model->findAll($condition_arr);
         $data['count'] = $this->withdrawCash_model->count($condition_arr);
         $pages = new FPagination($data['count']);
         $pages->setPageSize($page_size);
         $pages->setCurrent($page);
         $pages->makePages();
         $data['page'] = $pages;
     }
     //分页参数
     $page = $this->request->getParam('page') > 0 ? (int) $this->request->getParam('page') : 1;
     $page_size = $this->request->getParam('size') > 0 ? (int) $this->request->getParam('size') : FConfig::item('config.pageSize');
     $where = "1=1";
     $where .= " and user_id = {$this->user['id']} and trade_status=1";
     if (!empty($rType)) {
         $where .= " and trade_type = :trade_type";
         $data['rType'] = $rType;
     }
     if (!empty($dType)) {
         $where .= " and trade_time >= :trade_time";
         $data['dType'] = $dType;
     }
     $condition_arr = array('condition' => $where, 'order' => 'trade_time DESC', 'limit' => $page_size, 'offset' => ($page - 1) * $page_size);
     $condition_arr['params'] = array();
     if (!empty($dType)) {
         $condition_arr['params'][':trade_time'] = $dTime;
     }
     $tType = FConfig::item("config.r_type." . $rType);
     if (!empty($rType)) {
         $condition_arr['params'][':trade_type'] = FConfig::item("config.trade_type." . $tType);
     }
     $data['tradeList'] = $this->tradingRecord_model->findAll($condition_arr);
     $data['count'] = $this->tradingRecord_model->count($condition_arr);
     $pages = new FPagination($data['count']);
     $pages->setPageSize($page_size);
     $pages->setCurrent($page);
     $pages->makePages();
     $data['tradeList'] = $this->tradingRecord_model->findAll($condition_arr);
     $data['page'] = $pages;
     $this->render('recharge', $data);
 }