コード例 #1
0
 /**
  * Execute action $action and save result to array $this->blocks
  *
  * @param waViewAction $action
  * @param waDecorator $decorator
  * @param string $name
  */
 public function executeAction(waViewAction $action, $name = 'content', waDecorator $decorator = null)
 {
     $action->setController($this);
     $content = $decorator ? $decorator->display($action) : $action->display();
     if (isset($this->blocks[$name])) {
         $this->blocks[$name] .= $content;
     } else {
         $this->blocks[$name] = $content;
     }
 }
コード例 #2
0
 public function execute()
 {
     if (!$this->action instanceof waViewAction) {
         $class_name = $this->action;
         $this->action = new $class_name();
     }
     if (!$this->layout && $this->action && $this->action->getLayout()) {
         $this->setLayout($this->action->getLayout());
     }
     $this->executeAction($this->action);
 }
コード例 #3
0
 public function __construct($params = null)
 {
     parent::__construct($params);
     $this->hash = $this->getHash();
     if (!$this->hash) {
         if (waRequest::get('sort')) {
             $this->getUser()->setSettings('shop', 'all:sort', waRequest::get('sort') . ' ' . waRequest::get('order', 'desc'));
         } else {
             $sort = $this->getUser()->getSettings('shop', 'all:sort');
             if ($sort) {
                 $sort = explode(' ', $sort);
                 $this->sort = $_GET['sort'] = $sort[0];
                 $this->order = $_GET['order'] = $sort[1];
             }
         }
     }
     $this->collection = $this->getCollection($this->hash ? implode('/', $this->hash) : '');
     $info = $this->collection->getInfo();
     list($this->sort, $this->order) = $this->collection->getOrderBy();
     if ($info['hash'] == 'category' && empty($info['id'])) {
         throw new waException("Unkown category", 404);
     }
     if ($info['hash'] == 'set' && empty($info['id'])) {
         throw new waException("Unknown list", 404);
     }
 }
コード例 #4
0
 public function getTemplate()
 {
     $template = parent::getTemplate();
     $template = str_replace('templates/actions/', 'templates/actions-mobile/', $template);
     $template = str_replace('Mobile' . $this->view->getPostfix(), $this->view->getPostfix(), $template);
     return $template;
 }
コード例 #5
0
 public function getTemplate()
 {
     $template = parent::getTemplate();
     if ($this->getRequest()->isMobile()) {
         $template = str_replace('actions', 'actions-mobile', $template);
     }
     return $template;
 }
コード例 #6
0
 public function __construct($params = null)
 {
     parent::__construct($params);
     if (!waRequest::isXMLHttpRequest()) {
         $this->setLayout(new photosDefaultFrontendLayout());
     }
     $this->view->getHelper()->globals($this->getRequest()->param());
     return $this;
 }
コード例 #7
0
 public function getTemplate()
 {
     $template = parent::getTemplate();
     if (($id = $this->getRequest()->isMobile()) || false) {
         $this->view->assign('mobile_id', $id);
         $template = str_replace('templates/actions/', 'templates/actions-mobile/', $template);
     }
     return $template;
 }
コード例 #8
0
 protected function getTemplate()
 {
     if (!$this->template) {
         $this->template = 'ApiAuth';
     }
     if (waRequest::isMobile()) {
         $this->template .= 'Mobile';
     }
     return parent::getTemplate();
 }
コード例 #9
0
 public function display($clear_assign = true)
 {
     if (waSystemConfig::isDebug()) {
         return parent::display($clear_assign);
     }
     try {
         return parent::display($clear_assign);
     } catch (SmartyCompilerException $e) {
         $message = preg_replace('/(on\\sline\\s[0-9]+).*$/i', '$1', $e->getMessage());
         $message = str_replace($this->getConfig()->getRootPath(), '', $message);
         throw new SmartyCompilerException($message, $e->getCode());
     }
 }
コード例 #10
0
 /**
  * @param string $name
  * @param waViewAction $action
  * @param waDecorator $decorator
  */
 public function executeAction($name, $action, waDecorator $decorator = null)
 {
     $action->setLayout($this);
     $content = $decorator ? $decorator->display($action) : $action->display();
     $this->setBlock($name, $content);
 }
コード例 #11
0
 public function display($clear_assign = true)
 {
     return parent::display(false);
 }
コード例 #12
0
 public function __construct($params = null)
 {
     $this->settings_model = new waContactSettingsModel();
     parent::__construct($params);
 }
コード例 #13
0
 public function display($clear_assign = true)
 {
     $this->view->assign('type', $this->type);
     $this->view->assign('templates_path', 'templates/actions/dialog/');
     return parent::display($clear_assign);
 }
コード例 #14
0
 public function display($clear_assign = false)
 {
     $this->view->getHelper()->globals($this->getRequest()->param());
     return parent::display($clear_assign);
 }
コード例 #15
0
 public function __construct($params = null)
 {
     $this->product_pages_model = new shopProductPagesModel();
     parent::__construct($params);
 }
コード例 #16
0
 public function display($clear_assign = true)
 {
     /**
      * @event frontend_nav
      * @return array[string]string $return[%plugin_id%] html output for navigation section
      */
     $this->view->assign('frontend_nav', wa()->event('frontend_nav'));
     // set globals
     $params = waRequest::param();
     foreach ($params as $k => $v) {
         if (in_array($k, array('url', 'module', 'action', 'meta_keywords', 'meta_description', 'private', 'url_type', 'type_id', 'payment_id', 'shipping_id', 'currency', 'stock_id'))) {
             unset($params[$k]);
         }
     }
     $this->view->getHelper()->globals($params);
     try {
         return parent::display(false);
     } catch (waException $e) {
         if ($e->getCode() == 404) {
             $url = $this->getConfig()->getRequestUrl(false, true);
             if (substr($url, -1) !== '/' && strpos(substr($url, -5), '.') === false) {
                 wa()->getResponse()->redirect($url . '/', 301);
             }
         }
         /**
          * @event frontend_error
          */
         wa()->event('frontend_error', $e);
         $this->view->assign('error_message', $e->getMessage());
         $code = $e->getCode();
         $this->view->assign('error_code', $code);
         $this->getResponse()->setStatus($code ? $code : 500);
         $this->setThemeTemplate('error.html');
         return $this->view->fetch($this->getTemplate());
     }
 }
コード例 #17
0
 public function __construct($params = null)
 {
     parent::__construct($params);
     $this->model = new shopOrderModel();
     $this->collection = new shopOrdersCollection($this->getHash());
 }
コード例 #18
0
ファイル: shopStocks.action.php プロジェクト: Lazary/webasyst
 public function __construct($params = null)
 {
     parent::__construct($params);
     $this->product_model = new shopProductModel();
 }
コード例 #19
0
 public function __construct($params = null)
 {
     $this->order_model = new shopOrderModel();
     return parent::__construct($params);
 }
コード例 #20
0
 public function display($clear_assign = true)
 {
     $this->setLayout(new developerBackendLayout());
     return parent::display($clear_assign);
 }