Пример #1
0
 public function action_edit()
 {
     $data = array('edit' => array());
     $code = $this->request->param('id');
     $portfolio = new Model_Portfolio();
     $data['edit'] = $portfolio->getRecord($code);
     if (!$data['edit']) {
         $data['edit'] = array('id' => '', 'no' => '', 'name' => '', 'path' => '', 'type' => '');
     }
     if ($this->request->method() === Request::POST) {
         if ($portfolio->editPortfolio($code)) {
             $data['msg'] = Kohana::message('portfolio', 'edit');
         } else {
             $data['msg'] = Kohana::message('portfolio', 'editNot');
         }
     }
     $data['menu'] = Kohana::$config->load('app')->get('dirApp') . 'admin/';
     $data['portfolio'] = $portfolio->getAll();
     $content = View::factory('editview');
     $content->bind('data', $data);
     $this->template->content = $content;
 }