コード例 #1
0
ファイル: Page.php プロジェクト: nchervyakov/evolve2
 public function after()
 {
     $this->prepareViewBeforeRendering();
     //var_dump($this->view->pageTitle);exit;
     $this->response->body = $this->view->render();
     parent::after();
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: brennantom/hackazon
 public function run($action)
 {
     try {
         parent::run($action);
     } catch (HttpException $e) {
         $e->setOrigin(HttpException::ORIGIN_ADMIN);
         throw $e;
     }
 }
コード例 #3
0
ファイル: Helper.php プロジェクト: nchervyakov/evolve2
    public function addToCartLink($productId)
    {
        static $productsInCart;
        if (!$productsInCart) {
            $productsInCart = $this->controller->getProductsInCartIds();
        }
        if (!in_array($productId, $productsInCart)) {
            ?>
            <a href="/cart/view" class="btn btn-primary pull-left ladda-button buy-link js-add-to-cart-shortcut"
               data-product-id="<?php 
            echo $productId;
            ?>
"
               data-style="contract" title="Add to Cart"><span class="ladda-label"><span
                            class="glyphicon glyphicon-shopping-cart"></span></span></a><?php 
        } else {
            ?>
<a href="/cart/view" class="btn btn-success btn-sm pull-left ladda-button buy-link added-to-cart" data-product-id="<?php 
            echo $productId;
            ?>
"
                    data-style="contract" title="Go to Cart">Added to Cart</a> <?php 
        }
    }
コード例 #4
0
ファイル: Controller.php プロジェクト: sdavis-r7/hackazon
 /**
  * @inheritdoc
  */
 public function after()
 {
     $this->response->setHeader('Content-Type', $this->responseFormat . '; charset=utf-8');
     if ($this->request->method == 'HEAD') {
         $this->response->body = '';
         return;
     }
     if ($this->response->body instanceof Model) {
         /** @var Model $tmpData */
         $tmpData = $this->response->body;
         $tmpData = $tmpData->as_array();
         foreach ($tmpData as $key => $field) {
             if (!in_array($key, $this->exposedFields()) && $key != $this->model->id_field) {
                 unset($tmpData[$key]);
             }
         }
         $this->response->body = $tmpData;
     }
     if ($this->isCollectionRequested) {
         $this->response->body = array_merge(['data' => $this->response->body], $this->meta);
     }
     if ($this->responseFormat == self::FORMAT_XML) {
         $this->response->body = $this->asXML(is_array($this->response->body) ? $this->response->body : []);
     } else {
         $this->response->body = $this->response->body || is_array($this->response->body) ? json_encode($this->response->body) : '';
     }
     if (!is_string($this->response->body)) {
         $this->response->body = (string) $this->response->body;
     }
     //file_put_contents(__DIR__.'/../../../rest.log', date('Y-m-d H:i:s') . "\n" . $this->response->body . "\n\n\n", FILE_APPEND);
     if (!$this instanceof ErrorController) {
         parent::after();
     }
 }
コード例 #5
0
ファイル: Page.php プロジェクト: brennantom/hackazon
 public function after()
 {
     $this->response->body = $this->view->render();
     parent::after();
 }
コード例 #6
0
ファイル: Controller.php プロジェクト: nchervyakov/evolve2
 /**
  * @inheritdoc
  */
 public function after()
 {
     $this->response->setHeader('Content-Type', $this->responseFormat . '; charset=utf-8');
     if ($this->request->method == 'HEAD') {
         $this->response->body = '';
         return;
     }
     if ($this->response->body instanceof Model) {
         /** @var Model $tmpData */
         $tmpData = $this->response->body;
         $tmpData = $tmpData->as_array();
         foreach ($tmpData as $key => $field) {
             if (!in_array($key, $this->exposedFields()) && $key != $this->model->id_field) {
                 unset($tmpData[$key]);
             }
         }
         $this->response->body = $tmpData;
     }
     if ($this->responseFormat == self::FORMAT_XML) {
         $this->response->body = $this->asXML(is_array($this->response->body) ? $this->response->body : []);
         // echo $this->response->body;exit;
     } else {
         $this->response->body = $this->response->body || is_array($this->response->body) ? json_encode($this->response->body) : '';
     }
     if (!is_string($this->response->body)) {
         $this->response->body = (string) $this->response->body;
     }
     if (!$this instanceof ErrorController) {
         parent::after();
     }
 }