示例#1
0
 /**
  * product cron jobs stats
  * @author Stom
  */
 public function product_cron_jobs($page = 1)
 {
     $this->load->model('ranking_model');
     $this->load->library('pagination');
     $data = array();
     $page = intval($page);
     $offset = $page > 1 ? ($page - 1) * self::PROD_CRON_JOBS_STAT_LIMIT : 0;
     $product_list_jobs_stats = $this->ranking_model->getProductListJobsStats(self::PROD_CRON_JOBS_STAT_LIMIT, $offset);
     $total_rows = 0;
     if (is_array($product_list_jobs_stats)) {
         $f_product_list_jobs_stat = reset($product_list_jobs_stats);
         if (!empty($f_product_list_jobs_stat->total_count)) {
             $total_rows = $f_product_list_jobs_stat->total_count;
         }
     }
     $data['product_list_jobs_stats'] = $product_list_jobs_stats;
     $pagination_config = array('base_url' => base_url('system/product_cron_jobs'), 'total_rows' => $total_rows, 'per_page' => self::PROD_CRON_JOBS_STAT_LIMIT, 'use_page_numbers' => true, 'anchor_class' => 'class="product-cron-jobs-page" ', 'cur_tag_open' => '<b class="cur_keyword_pagination">', 'cur_tag_close' => '</b>');
     $this->pagination->initialize($pagination_config);
     $data['pagination'] = $this->pagination->create_links(2);
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
         $this->jsonResponse($data);
         return;
     }
     $this->data = array_merge($this->data, $data);
     $this->render();
 }