Exemplo n.º 1
0
 public function autopartAction()
 {
     $autopart_id = $this->_getParam('autopart_id', 0);
     $this->view->autopart_id = $autopart_id;
     $index = new Application_Model_DbTable_Index();
     $brands = $index->getAutoPartById($autopart_id);
     if ($brands['status']) {
         $this->view->autopart = $brands['value'][0];
     }
     $brands = $index->getCommentByAutopart($autopart_id);
     if ($brands['status']) {
         $this->view->comment = $brands['value'];
     }
     $allparam = $this->_getAllParams();
     if ($this->getRequest()->isPost()) {
         $index = new Application_Model_DbTable_Index();
         if (getUserId() == 0) {
             $this->view->error = 3;
             return;
         }
         $result = $index->addComment($allparam);
         $brands = $index->getCommentByAutopart($autopart_id);
         if ($brands['status']) {
             $this->view->comment = $brands['value'];
         }
     }
 }