public function editAction()
 {
     $form = new Admin_Form_PartnerForm();
     $id = $this->_getParam('id');
     if ($id == null) {
         $this->_helper->redirector('index');
     } else {
         $partner = $this->_partner->fetchWithDescription($id, Model_DbTable_PartnerDescription::LANG_ID);
         if (null == $partner) {
             $this->_helper->redirector('index');
         }
     }
     $form->populate($partner->toArray());
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $partner = $post['partner'];
         if ($form->isValid($partner)) {
             $data = array('name' => $form->getValue('name'), 'website' => $form->getValue('website'));
             if ($form->logo->isUploaded()) {
                 if ($form->logo->receive()) {
                     $data['logo'] = $form->logo->getFileName('logo', false);
                 }
             }
             $where = array('id = ?' => $id);
             $this->_partner->update($data, $where);
             $data = array('description' => $form->getValue('description'));
             $where = array('partner_id = ?' => $id, 'language_id = ?' => Model_DbTable_PartnerDescription::LANG_ID);
             $this->_partnerDescription->update($data, $where);
             $this->_helper->redirector('index');
         }
     }
     $this->view->form = $form;
     $this->view->logo = $partner->logo;
 }
 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;
 }