Esempio n. 1
0
 /**
  * 获取列表
  * 
  * $offset
  * $count
  * $activity_id
  * $sub_activity_id
  * $category_id
  */
 public function indexAction()
 {
     $offset = $this->getRequest()->getParam('offset', 0);
     $count = $this->getRequest()->getParam('count', 20);
     $keyword = $this->getRequest()->getParam('keyword');
     $companyId = $this->getRequest()->getParam('company_id');
     $acitvityId = $this->getRequest()->getParam('activity_id');
     $subId = $this->getRequest()->getParam('sub_id');
     // not used
     $isPublished = $this->getRequest()->getParam('is_published');
     $isCompleted = $this->getRequest()->getParam('is_completed');
     $mAntique = new Application_Model_Antique();
     $condition = array('keyword' => $keyword, 'company_id' => $companyId, 'activity_id' => $activityId, 'sub_id' => $subId);
     $mAntique->setWithCompany()->setWithPhoto();
     $rs = $mAntique->getSearch($condition, $count, $offset);
     echo json_encode($rs);
 }
Esempio n. 2
0
 /**
  * 列表页
  * 
  */
 public function listAction()
 {
     //$this->view->title = '搜索结果页';
     $perpage = 8;
     $pageno = $this->getRequest()->getParam('page', 1);
     $mAntique = new Application_Model_Antique();
     $keyword = $this->getRequest()->getParam('keyword');
     $condition = array('keyword' => $keyword);
     $mAntique->setWithCompany()->setWithPhoto();
     $rs = $mAntique->getSearch($condition, $perpage, ($pageno - 1) * $perpage);
     $antiques = $rs['data'];
     $total = $rs['total'];
     $this->view->assign('antiques', $antiques);
     $this->view->assign('total', $total);
     $this->view->assign('keyword', $keyword);
     // paginator
     $paginator = Zend_Paginator::factory(intval($total));
     $paginator->setDefaultItemCountPerPage($perpage);
     $paginator->setCurrentPageNumber($pageno);
     $this->view->paginator = $paginator;
 }