Created
March 20, 2012 15:39
-
-
Save arpitr/2137209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "citygrid-places-api-class.php"; | |
/* | |
* | |
* | |
*/ | |
class ExternalListingService { | |
public function lookupListing(); | |
public function getReviewCount(); | |
public function getListingURL(); | |
public function getAllReviews(); | |
public function getListingData(); | |
public function postListing(); | |
public function postReview(); | |
public function applyListingDataToLocalRecord($search) { | |
} | |
} | |
class CitySearch extends ExternalListingService { | |
public function lookupListing() { | |
/* $sql = "SELECT phone FROM {location_phone}"; | |
$result = db_query($sql); | |
$workPhoneNumber = array(); | |
foreach ($result as $row) { | |
$workPhoneNumber[] = $row->phone; | |
// var_dump($workPhoneNumber);} */ | |
$query = db_select('location_phone', 'n'); | |
$query->join('location_instance', 'b', 'n.lid = b.lid'); | |
$query | |
->fields('n', array('phone')) | |
->fields('b', array('nid')) | |
$result = $query->execute(); | |
//$workPhoneNumber = array(); | |
//$nid = array(); | |
foreach ($result as $row) { | |
//$workPhoneNumber[] = $row->phone; | |
//$nid[] = $row->nid; | |
dpm($workPhoneNumber); | |
$publishercode = "test"; | |
$phone = $row->phone; | |
$customer_only = null; | |
$placement = null; | |
$all_results = null; | |
$review_count = null; | |
$i = null; | |
$format = 'json'; | |
$callback = null; | |
$id_type = 'cg'; | |
//Get Place Detail | |
$citygrid = new citygrid($publishercode); | |
$search = $citygrid->places_detail($id, $id_type, $phone, $customer_only, $all_results, $review_count, $placement, $format, $callback, $i); | |
//var_dump($search); | |
if ($search) { | |
applyListingDataToLocalRecord($search,$row->nid); | |
} | |
else | |
$query = db_select('location', 'l'); | |
$query | |
->fields('n', array('name')) | |
$result = $query->execute(); | |
foreach ($result as $row) { | |
} | |
} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment