Ejemplo n.º 1
0
 public function render()
 {
     $token = Profiler::start(__CLASS__, __FUNCTION__);
     $r = parent::render();
     Profiler::stop($token);
     return $r;
 }
Ejemplo n.º 2
0
 public function format($template)
 {
     $view_name = 'View_' . $template;
     $view = new $view_name();
     $view->data = $this->data;
     $renderer = \Kostache_Layout::factory($this->layout);
     return $renderer->render($view);
 }
Ejemplo n.º 3
0
 /**
  * Set the response body to $this->view if $this->view is defined..
  */
 public function after()
 {
     if ($this->view != NULL) {
         $renderer = Kostache_Layout::factory();
         $renderer->set_layout($this->layout);
         $this->response->body($renderer->render($this->view));
     }
 }
Ejemplo n.º 4
0
 public function get_response()
 {
     $view = new View_Error_404();
     $renderer = Kostache_Layout::factory('404');
     $response = Response::factory()->status(404);
     $response->body($renderer->render($view));
     return $response;
 }
Ejemplo n.º 5
0
 public function __construct($template = NULL, array $partials = NULL)
 {
     parent::__construct($template, $partials);
     $this->query = Request::current()->query();
     $session = Session::instance();
     $session->set('album_list', $this->query);
     // Create pagination instance
     $this->pagination = Kostache_Pagination::factory(array('kostache' => $this, 'items_per_page' => 5, 'total_items' => $this->get_count(), 'partial' => 'pagination', 'view' => 'pagination/basic'));
 }
Ejemplo n.º 6
0
 public function render()
 {
     $return_render = parent::render();
     if (isset($this->swift_email_message) and $this->swift_email_message) {
         $this->swift_email_message->setBody($return_render, 'text/html');
         return $this->swift_email_message;
     }
     return $return_render;
 }
Ejemplo n.º 7
0
 public function action_login()
 {
     $content = new View_LoginPage();
     $content->isLoginPage = true;
     if (isset($_GET['type'])) {
         $content->type = $_GET['type'];
     }
     $renderer = Kostache_Layout::factory('layout');
     $this->response->body($renderer->render($content));
 }
Ejemplo n.º 8
0
 /**
  * If text use Class.text.mustache, if html use Class.html.mustache
  */
 public function render($class, $template = NULL)
 {
     if ($this->type != NULL and $template == NULL) {
         $template = explode('_', get_class($class));
         array_shift($template);
         $template = implode('/', $template);
         $template .= $this->type;
     }
     return parent::render($class, $template);
 }
Ejemplo n.º 9
0
 /**
  * Load [Kostache_Layout] and POO View
  *
  * Attempts to load a POO View based on the names of the Controller and Action requested
  **/
 public function before()
 {
     parent::before();
     if ($this->auto_render === TRUE) {
         $this->layout = Kostache_Layout::factory('layout/default');
         $view = 'View_' . ucfirst(Request::initial()->controller()) . '_' . ucfirst(Request::initial()->action());
         if (class_exists($view)) {
             $this->view = new $view();
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Run CSRF check and load frontend assets.
  */
 public function get_response()
 {
     // Lets log the Exception, Just in case it's important!
     Kohana_Exception::log($this);
     if (Kohana::$environment >= Kohana::DEVELOPMENT) {
         // Show the normal Kohana error page.
         return parent::get_response();
     }
     $response = Response::factory();
     $assets = Kohana::$config->load('assets.global');
     $this->_load_assets($assets);
     $view = new View_Error();
     $view->title = $this->getCode();
     $view->message = $this->getMessage();
     $renderer = Kostache_Layout::factory();
     $response->body($renderer->render($view));
     return $response;
 }
Ejemplo n.º 11
0
 public function __construct($template = NULL, array $partials = NULL)
 {
     parent::__construct('pages/album/form', $partials);
 }
Ejemplo n.º 12
0
 public function after()
 {
     $renderer = Kostache_Layout::factory();
     $renderer->set_layout('install/layout');
     $this->response->body($renderer->render($this->_view));
 }