Esempio n. 1
0
 protected function setCategoryId($categoryId)
 {
     $this->clearCategoryId();
     parent::setCategoryId($categoryId);
     if ($this->selectedCategory) {
         $this->retriever->setSelectedLayer($categoryId);
     }
 }
 public function init($args)
 {
     // alter args for initializing retriever
     if (isset($args['title'])) {
         $args['TITLE'] = $args['title'];
     }
     $this->isPlaces = Kurogo::getOptionalSiteVar('USE_GOOGLE_PLACES', false, 'maps');
     if ($this->isPlaces) {
         $args['BASE_URL'] = self::PLACES_BASE_URL;
         $this->apiKey = Kurogo::getSiteVar('GOOGLE_PLACES_API_KEY', 'maps');
     } else {
         $args['BASE_URL'] = self::GEOCODE_BASE_URL;
         // the Google Maps license requires that geocode results
         // be displayed with a Google Map
         $this->staticMapClass = 'GoogleStaticMap';
         $this->dynamicMapClass = 'GoogleJSMap';
     }
     $this->defaultCenter = $args['center'];
     if (isset($args['NEARBY_THRESHOLD'])) {
         $this->defaultRadius = $args['NEARBY_THRESHOLD'];
     }
     parent::init($args);
     $this->retriever->setCacheLifetime(1);
 }
 public function searchByProximity($center, $tolerance, $maxItems = 0)
 {
     $this->retriever->setSaveMemory(true);
     $categories = $this->leafCategories();
     if (!$categories) {
         return parent::searchByProximity($center, $tolerance, $maxItems);
     } else {
         $results = array();
         foreach ($categories as $category) {
             $this->retriever->setSelectedLayer($category->getId());
             $results = array_merge($results, parent::searchByProximity($center, $tolerance, $maxItems));
         }
     }
     $this->retriever->setSaveMemory(false);
     return $results;
 }
Esempio n. 4
0
function mapModelFromFeedData($feedData)
{
    if (isset($feedData['CONTROLLER_CLASS'])) {
        // legacy
        $modelClass = $feedData['CONTROLLER_CLASS'];
    } elseif (isset($feedData['MODEL_CLASS'])) {
        $modelClass = $feedData['MODEL_CLASS'];
    } else {
        $modelClass = 'MapDataModel';
    }
    try {
        $model = MapDataModel::factory($modelClass, $feedData);
    } catch (KurogoConfigurationException $e) {
        $model = DataController::factory($modelClass, $feedData);
    }
    return $model;
}
Esempio n. 5
0
function mapModelFromFeedData($feedData)
{
    if (isset($feedData['MODEL_CLASS'])) {
        $modelClass = $feedData['MODEL_CLASS'];
    } else {
        $modelClass = 'MapDataModel';
    }
    $model = MapDataModel::factory($modelClass, $feedData);
    return $model;
}