first commit
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/*
|
||||
* @author Krzysztof Bebło <krzysztof.beblo@sote.pl>
|
||||
*/
|
||||
class smMyTabsFrontendActions extends stActions
|
||||
{
|
||||
|
||||
public function executeTab1()
|
||||
{
|
||||
|
||||
if (!$_SERVER['HTTP_REFERER']){
|
||||
|
||||
$this->getResponse()->setStatusCode(404);
|
||||
|
||||
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
|
||||
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
$this->setLayout(false);
|
||||
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
|
||||
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
|
||||
|
||||
$product_id = $this->getRequestParameter('product_id');
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addJoin(ProductPeer::ID, ProductHasTab1Peer::TAB1_ID);
|
||||
|
||||
$c->add(ProductHasTab1Peer::PRODUCT_ID, $product_id);
|
||||
|
||||
$c->add(ProductPeer::ACTIVE, 1);
|
||||
|
||||
$c->addAscendingOrderByColumn(ProductHasTab1Peer::ID);
|
||||
|
||||
$this->products = ProductPeer::doSelectForPager($c);
|
||||
}
|
||||
|
||||
public function executeTab2()
|
||||
{
|
||||
if (!$_SERVER['HTTP_REFERER']){
|
||||
|
||||
$this->getResponse()->setStatusCode(404);
|
||||
|
||||
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
|
||||
|
||||
return sfView::NONE;
|
||||
|
||||
}
|
||||
$this->setLayout(false);
|
||||
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
|
||||
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
|
||||
|
||||
$product_id = $this->getRequestParameter('product_id');
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addJoin(ProductPeer::ID, ProductHasTab2Peer::TAB2_ID);
|
||||
|
||||
$c->add(ProductHasTab2Peer::PRODUCT_ID, $product_id);
|
||||
|
||||
$c->add(ProductPeer::ACTIVE, 1);
|
||||
|
||||
$c->addAscendingOrderByColumn(ProductHasTab2Peer::ID);
|
||||
|
||||
$this->products = ProductPeer::doSelectForPager($c);
|
||||
}
|
||||
|
||||
|
||||
public function executeTab3()
|
||||
{
|
||||
if (!$_SERVER['HTTP_REFERER']){
|
||||
$this->getResponse()->setStatusCode(404);
|
||||
|
||||
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
|
||||
|
||||
return sfView::NONE;
|
||||
|
||||
}
|
||||
$this->setLayout(false);
|
||||
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
|
||||
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
|
||||
|
||||
$product_id = $this->getRequestParameter('product_id');
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addJoin(ProductPeer::ID, ProductHasTab3Peer::TAB3_ID);
|
||||
|
||||
$c->add(ProductHasTab3Peer::PRODUCT_ID, $product_id);
|
||||
|
||||
$c->add(ProductPeer::ACTIVE, 1);
|
||||
|
||||
$c->addAscendingOrderByColumn(ProductHasTab3Peer::ID);
|
||||
|
||||
$this->products = ProductPeer::doSelectForPager($c);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function executeTab4()
|
||||
{
|
||||
if (!$_SERVER['HTTP_REFERER']){
|
||||
|
||||
$this->getResponse()->setStatusCode(404);
|
||||
|
||||
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
|
||||
|
||||
return sfView::NONE;
|
||||
|
||||
}
|
||||
$this->setLayout(false);
|
||||
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
|
||||
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
|
||||
|
||||
$product_id = $this->getRequestParameter('product_id');
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addJoin(ProductPeer::ID, ProductHasTab4Peer::TAB4_ID);
|
||||
|
||||
$c->add(ProductHasTab4Peer::PRODUCT_ID, $product_id);
|
||||
|
||||
$c->add(ProductPeer::ACTIVE, 1);
|
||||
|
||||
$c->addAscendingOrderByColumn(ProductHasTab4Peer::ID);
|
||||
|
||||
$this->products= ProductPeer::doSelectForPager($c);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user