Пример #1
0
 /**
  * Edit image in gallery
  *
  * @param integer $img_id
  *
  * @access public
  * @author Dao Anh Minh
  */
 public function action_edit($img_id = null)
 {
     $view = View::forge('admin/gallery/edit');
     $view->img_info = Model_Img::find($img_id);
     if (empty($view->img_info)) {
         Session::set_flash('error', 'Hình ảnh không tồn tại');
         Response::redirect('admin/gallery');
     }
     if (Input::method() == 'POST') {
         $view->img_info->info = serialize(array('info' => Input::post('desc', '')));
         $view->img_info->active = Input::post('active', false);
         $view->img_info->save();
         Session::set_flash('success', 'Sửa thành công');
         Response::redirect('admin/gallery');
     }
     $view->desc = unserialize($view->img_info->info)['info'];
     $this->template->content = $view;
 }