Exemplo n.º 1
0
 public function send($result)
 {
     if (!$result) {
         $result = array();
     }
     $type = $this->request->type;
     if ($type == 'json') {
         return $this->sendJson($result);
     }
     if ($type == 'html' || $type == 'ajax') {
         $layout = Registry::get('app')->layout;
         $view = new View();
         $view->setData($result);
         $content = $view->render('modules/' . $this->request->module . '/views/' . $this->request->controller . '/' . $this->request->action);
         if ($layout->isLayout()) {
             $layout->content = $content;
             $content = $layout->render();
         }
         echo $content;
         return $content;
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Renders a view.
  * @access public
  * @param string $file      The file to be rendered.
  * @param array $vars       The variables to be substituted in the view.
  * @return mixed
  */
 public function renderHtml($file, $vars = array())
 {
     return $this->view->render($file, $vars);
 }
Exemplo n.º 3
0
 public function partial($path, $data = array())
 {
     $view = new View();
     $view->setData($data);
     return $view->render($path);
 }