コード例 #1
0
ファイル: actions.class.php プロジェクト: morganney/livewire
 public function executeSubpagination(sfWebRequest $request)
 {
     // eliminated subcategory route to prevent dup. content issues on page-1
     $manuf_slug = $request->getParameter('manuf_slug');
     $this->param = array();
     $this->param['cat_id'] = LWS::getCategoryPk($request->getParameter('cat_slug'));
     $this->param['manuf'] = LWS::unslugify($manuf_slug, true);
     $this->param['category'] = LWS::getCategoryName($request->getParameter('cat_slug'));
     $this->param['subcategory'] = LWS::unslugify($request->getParameter('subcat_slug'));
     $this->param['section'] = LWS::getSectionName($this->param['subcategory'], $request->getParameter('section'));
     $this->param['current_page_num'] = LWS::extractPaginationNum($request->getParameter('page_num'));
     $category = CategoryFactory::make(array('cat_id' => $this->param['cat_id'], 'list_decorator_type' => 'basic'));
     $this->param['parts'] = $category->fetchSubcatListByManuf(LWS::getManufPk($manuf_slug), $this->param['section'], $this->param['current_page_num']);
     $this->forward404Unless($this->param['parts']);
     $this->param['part_count'] = $this->param['parts'][0]['part_count'];
     $this->param['next_page_num'] = $this->param['current_page_num'] + 1;
     $this->param['total_pages'] = ceil($this->param['part_count'] / intval(sfConfig::get('app_pagination_items_limit', 100)));
     $prefix = $this->param['current_page_num'] > 1 ? "Page {$this->param['current_page_num']} of {$this->param['total_pages']} : " : '';
     $response = $this->getResponse();
     $response->setSlot('body_id', str_replace('-', '_', $request->getParameter('cat_slug')));
     $response->setSlot('body_class', 'pagination');
     $response->addMeta('description', "{$this->param['manuf']} {$this->param['category']} {$this->param['section']} {$this->param['subcategory']} Catalog - {$prefix}");
     $response->setTitle("{$prefix}{$this->param['section']} {$this->param['subcategory']} - {$this->param['manuf']} {$this->param['category']} - " . sfConfig::get('app_biz_name'));
     return sfView::SUCCESS;
 }