public function executeShow(sfWebRequest $request) { $this->rt_shop_product = $this->getRoute()->getObject(); $this->forward404Unless($this->rt_shop_product); if (!$this->rt_shop_product->isPublished() && !$this->isAdmin()) { $this->forward404('Product isn\'t published.'); } $this->related_products = $this->getRelatedProducts($this->rt_shop_product); rtSiteToolkit::checkSiteReference($this->rt_shop_product); $this->updateResponse($this->rt_shop_product); }
/** * Run the common show logic which is shared between executeIndex() and executeShow(). * * @param rtShopCategory $rt_shop_category * @param sfWebRequest $request */ public function runShow(rtShopCategory $rt_shop_category, sfWebRequest $request) { $this->rt_shop_category = $rt_shop_category; $this->forward404Unless($this->rt_shop_category); $this->forward404If(!$this->rt_shop_category->isPublished() && !$this->isAdmin(), 'Category isn\'t published.'); rtSiteToolkit::checkSiteReference($this->rt_shop_category); $this->updateResponse($this->rt_shop_category); $query = Doctrine::getTable('rtShopProduct')->addPublishedQuery()->leftJoin('page.rtShopCategories c')->leftJoin('page.rtShopProductToCategory link')->orderBy('link.position ASC')->andWhere('link.category_id = ?', $this->rt_shop_category->getId()); $this->pager = new sfDoctrinePager('rtShopProduct', $this->getCountPerPage($request)); $this->pager->setQuery($query); $this->pager->setPage($request->getParameter('page', 1)); $this->pager->init(); }
public function executeShow(sfWebRequest $request) { $this->rt_wiki_page = $this->getRoute()->getObject(); $this->forward404Unless($this->rt_wiki_page); if (!$this->rt_wiki_page->isPublished() && !$this->isAdmin()) { $this->forward('rtGuardAuth', 'secure'); } rtSiteToolkit::checkSiteReference($this->rt_wiki_page); if ($this->rt_wiki_page->getIsRoot()) { $this->redirect('@rt_wiki_page_index'); } $this->updateResponse($this->rt_wiki_page); }
public function executeShow(sfWebRequest $request) { $q = $this->getRtSitePageTable()->addSiteQuery(); $r = $q->andWhere('slug = ?', $request->getParameter('slug'))->execute(); if (count($r) == 0) { $this->forward404Unless($this->isAdmin()); $this->redirect('rtSitePage/create?slug=' . $request->getParameter('slug')); } $this->rt_site_page = $r[0]; $this->forward404Unless($this->rt_site_page); rtSiteToolkit::checkSiteReference($this->rt_site_page); $this->handleLinks($this->rt_site_page); if ($this->rt_site_page->getNode()->isRoot()) { $this->redirect('/', 301); } if (!$this->rt_site_page->isPublished() && !$this->isAdmin()) { $this->forward404('Page isn\'t published.'); } if ('link:' === substr($this->rt_site_page['content'], 0, 5)) { $this->redirect(trim(substr($this->rt_site_page['content'], 5))); } $this->updateResponse($this->rt_site_page); }