Пример #1
0
 public function action_list()
 {
     $cid = Arr::get($_GET, 'cid');
     $where = array();
     $where['cid'] = $cid;
     $where['status'] = 'open';
     $where['ORDER'] = 'id DESC';
     $where = array_filter($where);
     $m_article = Model::factory('article', 'cms');
     $total = $m_article->count($where);
     $pager = new Pager($total, 10);
     $list = $m_article->select($pager->offset, $pager->size, $where)->as_array();
     $m_category = Model::factory('category', 'cms');
     $cat_list = $m_category->getAll()->as_array('id', 'name');
     foreach ($list as &$item) {
         $item['cat_name'] = isset($cat_list[$item['cid']]) ? $cat_list[$item['cid']] : '';
     }
     unset($item);
     if (isset($_GET['get_next_page'])) {
         $content = View::factory('article/list_incr');
         $content->list = $list;
         $next_page = $pager->next_page ? $pager->url($pager->next_page, array('cid' => $cid, 'get_next_page' => 'ajax')) : '';
         header('Content-Type: application/json; charset=utf-8');
         $ret = array('content' => (string) $content, 'next_page' => $next_page);
         echo json_encode($ret);
         exit;
     }
     $this->content = View::factory('article_list');
     $this->content->list = $list;
     $this->content->pager = $pager->render('common/pager');
     $this->content->next_page = $pager->next_page ? $pager->url($pager->next_page, array('cid' => $cid, 'get_next_page' => 'ajax')) : '';
 }
Пример #2
0
 public function action_grid()
 {
     $where = array();
     $where['ORDER'] = 'id DESC';
     $q = Arr::get($_GET, 'q', '');
     if (!empty($q)) {
         $where['file_src'] = array('like' => "%{$q}%");
     }
     $m_upload = Model::factory('upload');
     $total = $m_upload->count($where);
     $pager = new Pager($total, 20);
     $list = $m_upload->select($pager->offset, $pager->size, $where)->as_array();
     if ($this->auto_render !== TRUE) {
         $this->content = View::factory('upload_grid_increment');
         $this->content->list = $list;
         $nexturl = '';
         if ($pager->next_page) {
             $nexturl = $pager->url($pager->next_page);
         }
         header('Content-Type: application/json; charset=utf-8');
         $ret = array('content' => (string) $this->content, 'nexturl' => $nexturl);
         echo json_encode($ret);
         exit;
     } else {
         $this->content = View::factory('upload_grid');
     }
     $this->content->list = $list;
     $this->content->pager = $pager;
     echo $this->content;
     exit;
 }
Пример #3
0
 public function action_recentbid()
 {
     $logid = Arr::get($_GET, 'logid');
     $item_id = Arr::get($_GET, 'id');
     $where = array('id' => array('<' => $logid), 'item_id' => $item_id, 'ORDER' => 'id desc');
     $size = 5;
     $m_bidlog = Model::factory('bidlog', 'paimai');
     $total = $m_bidlog->count($where);
     $pager = new Pager($total, $size);
     $list_bidlog = $m_bidlog->select($pager->offset, $pager->size, $where)->as_array();
     $next_page = $pager->next_page ? $pager->url($pager->next_page) : '';
     $content = View::factory('auction/bidlog');
     $content->list_bidlog = $list_bidlog;
     header('Content-Type: application/json; charset=utf-8');
     $ret = array('content' => (string) $content, 'next_page' => $next_page);
     echo json_encode($ret);
     exit;
 }