コード例 #1
0
ファイル: Administrator.php プロジェクト: nightraiser/rdine
 public function getListJson($request, $baseUrl)
 {
     try {
         $searchLocation = $request->searchLocation;
         $searchCriteria = $request->searchCriteria;
         $restaurantMapper = new Administrator_Model_AdministratorMapper();
         $rawData = $restaurantMapper->getListJson($searchLocation, $searchCriteria);
         $jsonData['data'] = array();
         foreach ($rawData as $value) {
             $arrData = array();
             $arrData['id'] = $value['resid'];
             $arrData['category'] = 'restaurant';
             $arrData['title'] = $value['resname'];
             $arrData['location'] = $value['resaddress'];
             $latlong = explode(",", str_replace(array('(', ')'), '', $value['reslocation']));
             $arrData['latitude'] = $latlong[0];
             $arrData['longitude'] = $latlong[1];
             $arrData['url'] = $value['resid'];
             $arrData['diningStyle'] = $value['resdining_style'];
             $arrData['type_icon'] = "/images/icons/cusine/restaurant.png";
             $arrData['rating'] = 0;
             $arrData['google_place_id'] = $value['resgoogle_place_id'];
             $arrData['country_name'] = $value['country_name'];
             $arrData['state_name'] = $value['state_name'];
             $arrData['city_name'] = $value['city_name'];
             $arrData['time_zone'] = $value['time_zone'];
             $dir = $_SERVER['DOCUMENT_ROOT'] . $baseUrl . "/uploads/Administrator_images/" . $value['resid'] . "/resimages/";
             $abspath = $baseUrl . "/uploads/Administrator_images/" . $value['resid'] . "/resimages/";
             if (file_exists($dir)) {
                 $images = scandir($dir);
                 if (sizeof($images) > 2) {
                     $i = 0;
                     foreach ($images as $image) {
                         if ($i >= 2) {
                             $arrData['gallery'][] = $abspath . $image;
                         }
                         $i = $i + 1;
                     }
                 } else {
                     $arrData['gallery'] = array("/images/items/1.jpg");
                 }
             } else {
                 $arrData['gallery'] = array("/images/items/1.jpg");
             }
             $arrData['color'] = "";
             $arrData['item_specific'] = array("wifi" => $value['reswifi'], "alcohol" => $value['resalcohol'], "private_party" => $value['resparty_allowed'], "menu" => $value['resmenu'], "parking" => $value['resparking'], "ac" => $value['resair_conditioned'], "mealprice_min" => intval($value['resavg_mealprice_min']), "mealprice_max" => intval($value['resavg_mealprice_max']), "smoking" => $value['res_smoking'], "cusine" => $value['cusine'], "diningStyle" => $value['resdining_style']);
             $jsonData['data'][] = $arrData;
         }
         if ($request->isMap == "true") {
             $locationMapper = new Application_Model_LocationboundariesMapper();
             $jsonData['borderDetails'] = $locationMapper->getBorder($request->searchLocation);
             $jsonData['mapcenter'] = $locationMapper->getMapCenter($request->searchLocation);
         }
         return $jsonData;
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
コード例 #2
0
ファイル: Restaurant.php プロジェクト: nightraiser/rdine
 public function getListJson($request, $baseurl)
 {
     try {
         $searchLocation = $request->searchLocation;
         $searchCriteria = $request->searchCriteria;
         $searchOrder = $request->searchOrder;
         $searchCityId = $request->searchCityId;
         $restaurantMapper = new Restaurant_Model_RestaurantMapper();
         $rawData = array();
         $searchCriteria = str_replace("_", "/", $searchCriteria);
         //$searchLocation = array("searchType"=>"near-me","latlng"=>array('lat'=>17.391069299999998,'lng'=>78.49675189999999));
         if (is_array($searchLocation)) {
             if (array_key_exists("searchType", $searchLocation)) {
                 if ($searchLocation['searchType'] == "near-me") {
                     $rawData = $this->getNearByRestaurants($restaurantMapper->getListJson(null, $searchCriteria, null, null, $searchCityId), $searchLocation['latlng']);
                 }
             }
         } else {
             $rawData = $restaurantMapper->getListJson($searchLocation, $searchCriteria, null, $searchOrder, $searchCityId);
         }
         $rwtMapper = new Restaurant_Model_RestaurantWorkingTimingsMapper();
         $weekday = date('l');
         $resCusineDataMapper = new Restaurant_Model_RestaurantCusineDataMapper();
         $jsonData['data'] = array();
         foreach ($rawData as $value) {
             $arrData = array();
             $arrData['id'] = $value['resid'];
             $arrData['category'] = 'restaurant';
             $arrData['title'] = $value['resname'];
             $arrData['location'] = $value['resaddress'];
             $latlong = explode(",", str_replace(array('(', ')'), '', $value['reslocation']));
             $arrData['latitude'] = $latlong[0];
             $arrData['longitude'] = $latlong[1];
             $arrData['url'] = "/" . strtolower($value['city_name']) . "/{$value['resvanity_url']}";
             $arrData['diningStyle'] = $value['resdining_style'];
             $arrData['type_icon'] = "/images/icons/cusine/restaurant.png";
             $arrData['rating'] = $value['resrating'];
             $arrData['google_place_id'] = $value['resgoogle_place_id'];
             $arrData['country_name'] = $value['country_name'];
             $arrData['city_name'] = $value['city_name'];
             $arrData['location_name'] = $value['location_name'];
             $arrData['time_zone'] = $value['time_zone'];
             $arrData["views"] = $value['resview'];
             $arrData["visits"] = $value['resvisit'];
             $arrData['restaurant_id'] = $value['reslisted_restaurant_id'];
             $otherRestaurantData = $restaurantMapper->getOtherLocationRestaurants($value['restaurant_owner_fk_id'], $value['reslocation_id']);
             foreach ($otherRestaurantData as $reskey => $restaurant) {
                 $gallery = $this->getGalleryByRestaurantId($restaurant['restaurant_id'], $baseurl);
                 $otherRestaurantData[$reskey]['display_pic'] = $gallery[0];
             }
             $arrData['other_restaurants'] = $otherRestaurantData;
             $arrData['vanityUrl'] = $value['resvanity_url'];
             $dir = $_SERVER['DOCUMENT_ROOT'] . $baseurl . "/uploads/Restaurant_images/" . $value['resid'] . "/resimages/";
             $abspath = $baseurl . "/uploads/Restaurant_images/" . $value['resid'] . "/resimages/";
             if (file_exists($dir)) {
                 $images = scandir($dir);
                 if (sizeof($images) > 2) {
                     $i = 0;
                     foreach ($images as $image) {
                         if ($i >= 2) {
                             $arrData['gallery'][] = $abspath . $image;
                         }
                         $i = $i + 1;
                     }
                 } else {
                     $arrData['gallery'] = array("/images/items/1.jpg");
                 }
             } else {
                 $arrData['gallery'] = array("/images/items/1.jpg");
             }
             $arrData['color'] = "";
             $arrData['item_specific'] = array("wifi" => $value['reswifi'], "alcohol" => $value['resalcohol'], "specialities" => $value['res_specialities'], "private_party" => $value['resparty_allowed'], "menu" => $value['resmenu'], "parking" => $value['resparking'], "ac" => $value['resair_conditioned'], "mealprice_min" => intval($value['resavg_mealprice_min']), "mealprice_max" => intval($value['resavg_mealprice_max']), "smoking" => $value['res_smoking'], "home_delivery" => $value['resdelivery'], "cusine" => $resCusineDataMapper->getCusineNamesByResid($value['resid']), "diningStyle" => $value['resdining_style'], "nonveg" => $value['resnon_veg'], "reservations" => $value['resreservation_system'], "likes" => $value['res_likes'], "dislikes" => $value['res_dislikes'], "reviews" => $value['res_reviews'], "payment_methods" => array("cash" => $value['res_cash'], "gift_vouchers" => $value['res_gift_vouchers'], "credit_card" => $value['res_credit_card'], "visa_card" => $value['res_visa_card'], "master_card" => $value['res_master_card']), "pricefor2" => $value['resprice'], "seating_type" => array("outdoor_seating" => $value['resoutdoor_seating'], "ac" => $value['resair_conditioned'], "dine_in" => $value['resdine_in'], "delivery" => $value['resdelivery'], "alcohol" => $value['resalcohol']), "entertainment" => array("sports_telecast" => $value['res_sports_telecast'], "live_music" => $value['reslive_music'], "television" => $value['restelevision'], "wifi" => $value['reswifi']), "special" => array("romantic_setup" => $value['resromantic_setup'], "special_ocassion_dining" => $value['res_special_ocassion_dining']), "dining_type" => array("lunch" => $rwtMapper->isMealExits($value['resid'], $weekday, "Lunch"), "breakfast" => $rwtMapper->isMealExits($value['resid'], $weekday, "Breakfast"), "dinner" => $rwtMapper->isMealExits($value['resid'], $weekday, "Dinner"), "brunch" => $rwtMapper->isMealExits($value['resid'], $weekday, "Brunch")), "buffet" => array("break" => $value['resbreakfast_buffet'], "lunch_buffet" => $value['reslunch_buffet'], "dinner_buffet" => $value['resdinner_buffet']), "convinience" => array("wheelchair" => $value['reswheel_chair'], "kids_section" => $value['reskids_section']), "parking" => array("parking" => $value['resparking'], "parking_valet" => $value['resparking_valet'], 'parking_public' => $value['resparking_public'], 'parking_prepaid' => $value['resparking_prepaid']));
             $rwtMapper = new Restaurant_Model_RestaurantWorkingTimingsMapper();
             $rwtdata = $rwtMapper->getByRestaurantId($value['resid']);
             $today = date("l");
             date_default_timezone_set("Asia/Kolkata");
             $rwtisOpen = $rwtMapper->isOpen($value['resid'], $today, date("H:i:s"));
             $arrData['item_specific']['isOpen'] = $rwtisOpen;
             $arrData['timings'] = array();
             foreach ($rwtdata as $value) {
                 if (!isset($arrData['timings'][$value['rwt_week_day']])) {
                     $arrData['timings'][$value['rwt_week_day']] = array();
                 }
                 $start = $value['rwt_start_time'];
                 $start = date('h:i A', strtotime(substr($start, 0, strlen($start) - 3)));
                 $end = $value['rwt_end_time'];
                 $end = date('h:i A', strtotime(substr($end, 0, strlen($end) - 3)));
                 array_push($arrData['timings'][$value['rwt_week_day']], array('rwt_sch_type' => $value['rwt_sch_type'], 'rwt_start_time' => $start, 'rwt_end_time' => $end));
             }
             $jsonData['data'][] = $arrData;
         }
         if ($request->isMap == "true") {
             $locationMapper = new Application_Model_LocationboundariesMapper();
             $jsonData['borderDetails'] = $locationMapper->getBorder($request->searchLocation);
             $jsonData['mapcenter'] = $locationMapper->getMapCenter($request->searchLocation);
         }
         return $jsonData;
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }