public function indexAction()
 {
     $this->view->data = $this->_getAllParams();
     $topicGroupTbl = new VC_DbTable_Store_TopicGroup();
     $this->view->topicGroup = $topicGroupTbl->fetchAll("user_id = " . $this->userId);
     $message = $this->_helper->flashMessenger->getMessages();
     if ($message) {
         $this->view->message = $message[0];
     }
     $menuObj = new VC_Business_MenuFactory();
     $groupAndTopic = $menuObj->getGroupsAndTopicsOfUser($this->userId);
     //echo "<pre>"; var_dump($groupAndTopic); echo "</pre>"; die;
     $this->view->groupAndTopic = $groupAndTopic;
 }
 public function editAction()
 {
     $articleId = (int) $this->_getParam('id');
     if ($articleId == 0) {
         throw new VC_Exception("Invalid article delete information");
     }
     $insertTokenNamespace = new Zend_Session_Namespace("INSERT_TOKEN");
     $message = "";
     //Check if this article belong with this user
     $articleTbl = new VC_DbTable_Store_Article();
     $article = $articleTbl->findByIdAndUserId($articleId, $this->userId);
     if ($article) {
         if ($this->_getParam('submit')) {
             if ($this->_getParam('title') && $this->_getParam('content') && $this->_getParam('tpid')) {
                 $updateData = array();
                 $updateData['title'] = $this->_getParam('title');
                 $updateData['content'] = $this->_getParam('content');
                 $updateData['root_link'] = $this->_getParam('root_link');
                 $updateData['topic_id'] = $this->_getParam('tpid');
                 $articleTbl->update($updateData, "id = " . $articleId);
                 $this->_redirect("article/view/?tpid=" . $article->topic_id . "&id=" . $articleId);
             } else {
                 $message = "Bạn phải nhập đầy đủ các phần có dấu  sao (*)";
             }
         }
         $menuObj = new VC_Business_MenuFactory();
         $groupAndTopic = $menuObj->getGroupsAndTopicsOfUser($this->userId);
         //echo "<pre>"; var_dump($groupAndTopic); echo "</pre>"; die;
         $this->view->groupAndTopic = $groupAndTopic;
         $this->view->message = $message;
         $this->view->article = $article;
         $this->view->insertToken = $insertTokenNamespace->insertToken;
         //Get all temp file uploaded of this article
         $uploadTmpTbl = new VC_DbTable_Common("upload_tmp", "id");
         $this->view->listUploadFiles = $uploadTmpTbl->fetchAll("user_id = " . $this->userId . " AND insert_token = '" . $insertTokenNamespace->insertToken . "'");
     } else {
         throw new VC_Exception("This article not belong with you");
     }
 }