protected function beforeAction($action) { if (Yii::app()->user->isGuest) { $this->redirect(Yii::t('urls', 'login')); } return parent::beforeAction($action); }
public function init() { if ('CheckoutController' == get_class($this) && $this->config->get('CHECKOUT_METHOD') == 'CHECKOUT_ONEPAGE') { if (in_array($this->request->getActionName(), array('index', 'selectAddress', 'shipping', 'pay'))) { if (!$this->order->isMultiAddress->get() && !$this->session->get('noJS')) { return new ActionRedirectResponse('onePageCheckout', 'index'); } } } $this->loadLanguageFile('User'); parent::init(); $this->addBreadCrumb($this->translate('_checkout'), $this->router->createUrl(array('controller' => 'order', 'action' => 'index'), true)); $action = $this->request->getActionName(); if ('index' == $action) { return false; } $this->addBreadCrumb($this->translate('_select_addresses'), $this->router->createUrl(array('controller' => 'checkout', 'action' => 'selectAddress'), true)); if ('selectAddress' == $action) { return false; } $this->addBreadCrumb($this->translate('_shipping'), $this->router->createUrl(array('controller' => 'checkout', 'action' => 'shipping'), true)); if ('shipping' == $action) { return false; } $this->addBreadCrumb($this->translate('_pay'), $this->router->createUrl(array('controller' => 'checkout', 'action' => 'pay'), true)); }
public function init() { parent::init(); $this->addBlock('FILTER_BOX', 'boxFilter', 'block/box/filter'); $this->addBlock('FILTER_TOP', 'boxFilterTop', 'category/boxFilterTopBlock'); $this->addBlock('PRODUCT_LISTS', 'productList', 'block/productList'); $this->addBlock('RELATED_CATEGORIES', 'relatedCategories', 'category/block/relatedCategories'); }
public function init() { $initRes = parent::init(); if ($this->user->getID()) { $this->user->load(); } return $initRes; }
public function __construct(Tracking $trackingModel, FlightPublisherBaseModel $flightPublisherModel, AdFlightBaseModel $adFlightModel, publisherBaseModel $publisherModel, Delivery $deliveryModel) { parent::__construct(pathinfo(dirname(__DIR__), PATHINFO_BASENAME)); $this->flightPublisherModel = $flightPublisherModel; $this->adFlightModel = $adFlightModel; $this->publisherModel = $publisherModel; $this->deliveryModel = $deliveryModel; $this->trackingModel = $trackingModel; }
public function init() { $initRes = parent::init(); $this->loadLanguageFile('Frontend'); $this->loadLanguageFile('User'); if ($this->user->getID()) { $this->user->load(); } return $initRes; }
public function beforeAction($action) { $isValid = true; try { $isValid = parent::beforeAction($action); } catch (\Exception $exc) { $isValid = FALSE; } if (!$isValid) { //验证不通过的可能是匿名用户,可能是没有应用权限的 } return true; }
public function init() { parent::init(); $this->addBlock('PRODUCT-ATTRIBUTE-SUMMARY', 'attributeSummary', 'product/block/attributeSummary'); $this->addBlock('PRODUCT-PURCHASE', 'purchase', 'product/block/purchase'); $this->addBlock('PRODUCT-PRICE', 'price', 'product/block/price'); $this->addBlock('PRODUCT-UP-SELL', 'upSell', 'product/block/upsell'); $this->addBlock('PRODUCT-OPTIONS', 'options', 'product/block/options'); $this->addBlock('PRODUCT-VARIATIONS', 'variations', 'product/block/variations'); $this->addBlock('PRODUCT-TO-CART', 'addToCart', 'product/block/toCart'); $this->addBlock('PRODUCT-ACTIONS', 'actions', 'product/block/actions'); $this->addBlock('PRODUCT-IMAGES', 'images', 'product/block/images'); $this->addBlock('PRODUCT-SUMMARY', 'summary', 'product/block/summary'); $this->addBlock('PRODUCT-MAININFO', 'mainInfo', 'product/block/mainInfo'); $this->addBlock('PRODUCT-OVERVIEW', 'overview', 'product/block/overview'); $this->addBlock('PRODUCT-RATING-SUMMARY', 'ratingSummary', 'product/ratingSummary'); $this->addBlock('PRODUCT-PURCHASE-VARIATIONS', 'purchaseVariations', 'product/block/purchaseVariations'); }
public function init() { parent::init(); $this->setLayout('dating'); }
public function __construct() { parent::__construct(pathinfo(dirname(__DIR__), PATHINFO_BASENAME)); $this->model = new PublisherModel(); $this->errors = array(); }
public function __construct() { parent::__construct(); $this->model = new ProductsModel(); }
private function setUpController(FrontendController $controller) { $this->initOrder(); $controller->setOrder($this->order); $controller->setUser($this->user); }
public function __construct() { parent::__construct(pathinfo(dirname(__DIR__), PATHINFO_BASENAME)); }
function init() { parent::init(); }
/** * Rules for CAccessControlFilter. * * We enable the registration and other basic pages for guest users. * * @see http://www.yiiframework.com/doc/api/1.1/CController#accessRules-detail * * @return array Rules for the "accessControl" filter. */ public function accessRules() { return array_merge([['allow', 'actions' => ['index', 'error']]], parent::accessRules()); }
public function __construct() { parent::__construct(); $this->model = new ContactModel(); }
/** * Prepare controller */ function __before() { parent::__before(); }
public function __construct() { parent::__construct(); }
public function __construct() { parent::__construct(); $this->model = new UserModel(); }
public function init() { parent::init(); $this->loadLanguageFile('Err'); }