Exemplo n.º 1
0
 public function action_edit()
 {
     $layout_name = $this->request->param('id');
     $layout = new Model_File_Layout($layout_name);
     if (!$layout->is_exists()) {
         if (($found_file = $layout->find_file()) !== FALSE) {
             $layout = new Model_File_Layout($found_file);
         } else {
             Messages::errors(__('Layout not found!'));
             $this->go();
         }
     }
     $this->set_title($layout_name);
     // check if trying to save
     if (Request::current()->method() == Request::POST and ACL::check('layout.edit')) {
         return $this->_edit($layout);
     }
     Assets::package('ace');
     $this->template->content = View::factory('layout/edit', array('action' => 'edit', 'layout' => $layout));
 }
Exemplo n.º 2
0
 /**
  * 
  * @return Model_File_Layout
  * @throws Kohana_Exception
  */
 public function get_layout_object()
 {
     if ($this->_layout_object === NULL) {
         $layout_name = $this->layout();
         $this->_layout_object = new Model_File_Layout($layout_name);
     }
     if (!$this->_layout_object->is_exists()) {
         if (($found_file = $this->_layout_object->find_file()) !== FALSE) {
             $this->_layout_object = new Model_File_Layout($found_file);
         } else {
             throw new HTTP_Exception_500('Layout file :file not found!', array(':file' => $layout_name));
         }
     }
     return $this->_layout_object;
 }