public function denyAction($id = null)
 {
     $businessUpdates = BusinessUpdates::findFirst($id);
     if (!$businessUpdates) {
         return $this->response->redirect('admin/business');
     }
     $this->view->setVar('businessUpdates', $businessUpdates);
 }
 public function viewAction($id = null)
 {
     $business = Business::findFirst($id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $averageRate = $business->average_rate;
     $businessCategoryLists = BusinessCategoryLists::find('business_id = "' . $id . '"');
     $businessUpdates = BusinessUpdates::findFirst(array('business_id="' . $id . '"', "order" => "id DESC"));
     if ($businessUpdates) {
         $business = $businessUpdates;
         //$businessCategoryLists = BusinessCategoryListUpdates::find('business_update_id = "'.$businessUpdates->id.'"');
         $business->id = $id;
         $business->average_rate = $averageRate;
     }
     $this->view->setVar('business', $business);
     $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     $query = $this->modelsManager->createQuery("SELECT * from BusinessImages where business_id={$id} and primary_pic='yes'");
     //$businessLastImg = $query->execute();
     $businessLastImg = BusinessImages::findFirst(array('business_id="' . $id . '" and primary_pic="Yes"'));
     $businessImgCover = BusinessBackgroundCovers::findFirst(array('business_id="' . $id . '" and primary_pic="Yes"'));
     //$businessLastImg = BusinessImages::findFirst(array('business_id = "'.$id.'"', "order" => "id DESC"));
     $this->view->setVar('businessLastImg', $businessLastImg);
     $businessImages = BusinessImages::find(array('business_id = "' . $id . '"', "order" => "id DESC", "limit" => 7));
     $this->view->setVar('businessImages', $businessImages);
     $reviews = Reviews::find(array('business_id = "' . $id . '"', "order" => "id DESC"));
     $this->view->setVar('reviews', $reviews);
     $this->view->setVar('businessImgCover', $businessImgCover);
     //error_log("WWWWWW ".print_r($businessCategoryLists));
     // $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     // $reviews = Reviews::find('business_id = "'.$id.'"');
     // $this->view->setVar('reviews', $reviews);
 }
 public function viewAction($id = null)
 {
     $business = Business::findFirst($id);
     if (!$business) {
         return $this->response->redirect('review/search_business');
     }
     $averageRate = $business->average_rate;
     $businessCategoryLists = BusinessCategoryLists::find('business_id = "' . $id . '"');
     $businessUpdates = BusinessUpdates::findFirst(array('business_id="' . $id . '"', "order" => "id DESC"));
     if ($businessUpdates) {
         $business = $businessUpdates;
         //$businessCategoryLists = BusinessCategoryListUpdates::find('business_update_id = "'.$businessUpdates->id.'"');
         $business->id = $id;
         $business->average_rate = $averageRate;
     }
     $this->view->setVar('business', $business);
     $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     $businessLastImg = BusinessImages::findFirst(array('business_id = "' . $id . '"', "order" => "id DESC"));
     $this->view->setVar('businessLastImg', $businessLastImg);
     $businessImages = BusinessImages::find(array('business_id = "' . $id . '"', "order" => "id DESC", "limit" => 7));
     $this->view->setVar('businessImages', $businessImages);
     $reviews = Reviews::find(array('business_id = "' . $id . '"', "order" => "id DESC"));
     $this->view->setVar('reviews', $reviews);
     //error_log("WWWWWW ".print_r($businessCategoryLists));
     // $this->view->setVar('businessCategoryLists', $businessCategoryLists);
     // $reviews = Reviews::find('business_id = "'.$id.'"');
     // $this->view->setVar('reviews', $reviews);
 }