Ejemplo n.º 1
0
 public function action_error()
 {
     $code = $this->response->status;
     $message = $this->template->message;
     $this->template = Twig_View::factory('error/' . $code);
     $this->template->set('message', $message);
 }
Ejemplo n.º 2
0
 public function before()
 {
     if ($this->auto_render) {
         // Auto-generate template filename ('index' method called on Controller_Admin_Users looks for 'admin/users/index')
         if ($this->template === NULL) {
             $this->template = $this->request->controller() . DIRECTORY_SEPARATOR . $this->request->action();
             if ($this->request->directory()) {
                 // Preprend directory if needed
                 $this->template = $this->request->directory() . DIRECTORY_SEPARATOR . $this->template;
             }
         }
         $this->template = Twig_View::factory($this->template);
     }
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param Request $request 
  * @author Jonathan Geiger
  */
 public function __construct(Request $request)
 {
     // Auto-generate template filename
     if (empty($this->template)) {
         $this->template = $request->controller . '/' . $request->action;
         // Prepend directory if needed
         if (!empty($request->directory)) {
             $this->template = $request->directory . '/' . $this->template;
         }
         // Convert underscores to slashes
         $this->template = str_replace('_', '/', $this->template);
     }
     // Create the initial context object
     $this->template = Twig_View::factory($this->template, $this->twig);
     $this->twig = $this->template->environment();
     parent::__construct($request);
 }