예제 #1
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $widget = Widget_Manager::load($id);
     if (!$widget) {
         Messages::errors(__('Widget not found!'));
         $this->go_back();
     }
     $this->template->title = $widget->name;
     $this->breadcrumbs->add($widget->type(FALSE))->add($widget->name);
     // check if trying to save
     if (Request::current()->method() == Request::POST) {
         return $this->_edit($widget);
     }
     $roles = ORM::factory('role')->find_all()->as_array('name', 'name');
     $this->template->content = View::factory('widgets/edit', array('widget' => $widget, 'templates' => Model_File_Snippet::html_select(), 'content' => $widget->fetch_backend_content(), 'roles' => $roles, 'params' => Widget_Manager::get_params($widget->type())));
 }