示例#1
0
 public function respondAction($review_id = null, $business_id = null)
 {
     $userSession = $this->session->get("userSession");
     if ($this->request->isPost()) {
         $biz_id = $this->request->getPost("business_id");
         $respond = new ReviewResponds();
         $respond->created = date('Y-m-d H:i:s');
         $respond->modified = date('Y-m-d H:i:s');
         $respond->member_id = $userSession['id'];
         $respond->review_id = $this->request->getPost("review_id");
         $respond->business_id = $this->request->getPost("business_id");
         $respond->content = $this->request->getPost("content");
         if ($respond->create()) {
             return $this->response->redirect('business/view/' . $biz_id);
         } else {
             $this->view->disable();
             print_r($respond->getMessages());
         }
     }
     $business = Business::findFirstById($business_id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $this->view->setVar('business', $business);
     $reviews = Reviews::findById($review_id);
     if (!$reviews) {
         $this->view->disable();
         echo "failed";
     }
     $this->view->setVar('reviews', $reviews);
 }