Exemplo n.º 1
0
 public function display(array $data, $template = null, $return = false)
 {
     $view = waSystem::getInstance()->getView();
     if ($template === null) {
         $template = ucfirst($this->action);
     }
     if (strpbrk($template, '/:') === false) {
         $match = array();
         preg_match("/[A-Z][^A-Z]+/", get_class($this), $match);
         $template = $this->getPluginRoot() . 'templates/actions/' . strtolower($match[0]) . "/" . $match[0] . $template . $view->getPostfix();
     }
     // assign vars
     $view->assign($data);
     if ($this->layout && $this->layout instanceof waLayout) {
         // assign result to layout
         $this->layout->setBlock('content', $view->fetch($template));
         $this->layout->display();
     } else {
         // send headers
         $this->getResponse()->sendHeaders();
         // display
         if ($return) {
             return $view->fetch($template);
         } else {
             $view->display($template);
         }
     }
 }
Exemplo n.º 2
0
 public function display()
 {
     if ($this->layout && $this->layout instanceof waLayout) {
         $this->layout->setBlock('content', $this->view->fetch($this->getTemplate()));
         $this->layout->display();
     } else {
         waSystem::getInstance()->getResponse()->sendHeaders();
         $this->view->display($this->getTemplate());
     }
 }
 public function display(array $data, $template = null, $return = false)
 {
     $view = $this->getView();
     if ($template === null) {
         $template = $this->getTemplate();
     }
     // assign vars
     $view->assign($data);
     if ($this->layout && $this->layout instanceof waLayout) {
         // assign result to layout
         $this->layout->setBlock('content', $view->fetch($template));
         $this->layout->display();
     } else {
         // send headers
         $this->getResponse()->sendHeaders();
         // display
         if ($return) {
             return $view->fetch($template);
         } else {
             $view->display($template);
         }
     }
 }
 /**
  * Display result
  */
 public function display()
 {
     if ($this->layout instanceof waLayout) {
         foreach ($this->blocks as $name => $content) {
             $this->layout->setBlock($name, $content);
         }
         $this->layout->display();
     } else {
         // Send headers
         waSystem::getInstance()->getResponse()->sendHeaders();
         // Print all blocks
         foreach ($this->blocks as $content) {
             echo $content;
         }
     }
 }
Exemplo n.º 5
0
 /**
  * Display result
  */
 public function display()
 {
     if ($this->layout instanceof waLayout) {
         foreach ($this->blocks as $name => $content) {
             $this->layout->setBlock($name, $content);
         }
         $this->layout->display();
     } else {
         if (wa()->getEnv() == 'frontend' && waRequest::param('theme_mobile') && waRequest::param('theme') != waRequest::param('theme_mobile')) {
             wa()->getResponse()->addHeader('Vary', 'User-Agent');
         }
         // Send headers
         waSystem::getInstance()->getResponse()->sendHeaders();
         // Print all blocks
         foreach ($this->blocks as $content) {
             echo $content;
         }
     }
 }