public function updateAction()
 {
     $id = $this->_getParam('id');
     $this->_form->image->setRequired(false);
     $this->_form->draft->setLabel('Save as draft');
     $this->_form->submit->setLabel('Save and publish');
     if (!$this->_userInfo->canApprove) {
         $this->_form->submit->setLabel('Save and submit for review');
     }
     if (null != $id) {
         $article = $this->_article->fetchWithDescription($id, self::LANGUAGE_ID);
         if (null != $article) {
             $this->_form->populate($article->toArray());
         } else {
             $this->_helper->redirector('index');
         }
     } else {
         $this->_helper->redirector('index');
     }
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $data = $post['article'];
         if ($this->_form->isValid($data)) {
             $status = self::STATUS_ARCHIVED;
             if (isset($data['draft'])) {
                 $status = self::STATUS_DRAFT;
             } else {
                 if (isset($data['submit'])) {
                     if ($this->_userInfo->canApprove) {
                         $status = self::STATUS_PUBLISHED;
                     } else {
                         $status = self::STATUS_PENDING;
                     }
                 }
             }
             $data = array('name' => $this->_form->getValue('name'), 'updated_by' => $this->_userInfo->id, 'updated_at' => Date('Y-m-d H:i:s'), 'status' => $status);
             if ($this->_form->image->isUploaded()) {
                 if ($this->_form->image->receive()) {
                     $data['image'] = $this->_form->getValue('image');
                 }
             }
             $this->_article->update($data, array('id = ?' => $id));
             $data = array('description' => $this->_form->getValue('description'));
             $this->_description->update($data, array('article_id = ?' => $id, 'language_id = ?' => self::LANGUAGE_ID));
             $this->_flashMessenger->addMessage('Article updated successfully.');
             $this->_helper->redirector('index');
         }
     }
     if (null != $article->image) {
         if (file_exists(UPLOAD_FOLDER . 'article/' . $article->image)) {
             $this->view->image = 'upload/article/' . $article->image;
         }
     }
     $this->view->form = $this->_form;
 }