public function editAction()
 {
     $form = new Admin_Form_GalleryForm();
     $id = $this->_getParam('id');
     if ($id == null) {
         $this->_helper->redirector('index');
     } else {
         $image = $this->_db->find($id)->current();
         if (null == $image) {
             $this->_helper->redirector('index');
         }
     }
     $form->populate($image->toArray());
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost('gallery');
         if ($form->isValid($post)) {
             $data = array('source' => $form->getValue('source'), 'caption' => $form->getValue('caption'), 'caption_en' => $form->getValue('caption_en'), 'updated_at' => date('Y-m-d H:i:s'), 'updated_by' => $this->_userInfo->id);
             if ($form->image->isUploaded()) {
                 if ($form->image->receive()) {
                     $data['image'] = $form->getValue("image");
                 }
             }
             $this->_db->update($data, array("id = ?" => $id));
             $this->_helper->redirector('index');
         }
     }
     $this->view->form = $form;
     $this->view->image = $image->image;
 }