public function showAction() { $perpage = 20; $pageno = $this->getRequest()->getParam('page', 1); $id = $this->getRequest()->getParam('id'); if (!$id) { throw new Zend_Controller_Exception(); } // get sub-activity info $mSubActivity = new Application_Model_SubActivity(); $subActivity = $mSubActivity->getOneById($id); if (!$subActivity) { throw new Zend_Controller_Exception(); } else { // get antique $condition = array('sub_id' => $id); $mAntique = new Application_Model_Antique(); $mAntique->setWithPhoto()->setWithActivity()->setWithCompany(); $rs = $mAntique->getSearch($condition, $perpage, ($pageno - 1) * $perpage, 'lotup'); $this->view->antiques = $antiques = $rs['data']; $total = $rs['total']; // get activity $subActivity['activity'] = $antiques[0]['activity']; // get company $subActivity['company'] = $antiques[0]['company']; } $this->view->subActivity = $subActivity; $paginator = Zend_Paginator::factory(intval($total)); $paginator->setDefaultItemCountPerPage($perpage); $paginator->setCurrentPageNumber($pageno); $this->view->paginator = $paginator; }
/** * 详情页 * */ public function showAction() { $id = $this->getRequest()->getParam('id'); if (!$id) { throw new Zend_Controller_Exception(); } $mAntique = new Application_Model_Antique(); $mAntique->setWithActivity()->setWithCompany()->setWithSubActivity()->setWithPhoto(); $this->view->antique = $mAntique->getOneById($id); // random antiques $condition = array('activity_id' => $this->similarAntiqueActivityId); $rs = $mAntique->getSearch($condition, 4, 0, 'random'); $this->view->antiquesRandom = $rs['data']; }
/** * 获取列表 * * $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); }