Пример #1
0
 protected function parameters()
 {
     switch ($this->action) {
         case self::ACTION_PLACEMARKS:
             $fields = $this->parser->getFieldKeys();
             $params = array('text' => '%', 'inSR' => $this->parser->getProjection(), 'spatialRel' => 'esriSpatialRelIntersects', 'where' => '', 'returnGeometry' => 'true', 'outSR' => '', 'outFields' => implode(',', $fields), 'f' => 'json');
             if ($this->useExtentGeometry) {
                 $extent = $this->parser->getExtent();
                 $bbox = $extent['xmin'] . ',' . $extent['ymin'] . ',' . $extent['xmax'] . ',' . $extent['ymax'];
                 $params['text'] = '';
                 $params['geometry'] = $bbox;
                 $params['geometryType'] = 'esriGeometryEnvelope';
             }
             if ($this->orderByFields) {
                 $params['where'] = 'OBJECTID>0';
                 $params['orderByFields'] = $this->orderByFields;
             }
             return $params;
         case self::ACTION_SEARCH:
             $displayField = null;
             if (isset($this->selectedLayer)) {
                 $displayField = $this->parser->getDisplayFieldForFolder($this->selectedLayer);
             }
             if ($displayField) {
                 $searchText = strtoupper(str_replace("'", "''", $this->searchFilters['text']));
                 return array('where' => "UPPER({$displayField}) LIKE '%{$searchText}%'", 'f' => 'json');
             } else {
                 return array('text' => str_replace("'", "''", $this->searchFilters['text']), 'f' => 'json');
             }
         case self::ACTION_SEARCH_NEARBY:
             $bbox = normalizedBoundingBox($this->searchFilters['center'], $this->searchFilters['tolerance'], null, $this->parser->getProjection());
             return array('spatialRel' => 'esriSpatialRelIntersects', 'geometryType' => 'esriGeometryEnvelope', 'geometry' => "{$bbox['min']['lon']},{$bbox['min']['lat']},{$bbox['max']['lon']},{$bbox['max']['lat']}", 'f' => 'json');
     }
     return parent::parameters();
 }
 protected function parameters()
 {
     switch ($this->action) {
         case self::ACTION_PLACEMARKS:
             $fields = $this->parser->getFieldKeys();
             $params = array('text' => '%', 'inSR' => $this->parser->getProjection(), 'spatialRel' => 'esriSpatialRelIntersects', 'where' => '1=1', 'orderByFields' => $this->parser->getDisplayFieldForFolder($this->selectedLayer), 'returnGeometry' => 'true', 'outSR' => '', 'outFields' => implode(',', $fields), 'f' => 'json');
             if ($this->useExtentGeometry) {
                 $extent = $this->parser->getExtent();
                 $bbox = $extent['xmin'] . ',' . $extent['ymin'] . ',' . $extent['xmax'] . ',' . $extent['ymax'];
                 $params['text'] = '';
                 $params['geometry'] = $bbox;
                 $params['geometryType'] = 'esriGeometryEnvelope';
             }
             // If we have order fields, assume they are separated by commas
             if ($this->orderByFields) {
                 $orderFields = array_map('trim', explode(',', $this->orderByFields));
                 // take intersection of configured sort fields and existing fields in layer
                 $validFields = array_intersect($orderFields, $fields);
                 // If we have at least one valid field, update the orderByFields to use the valid field(s)
                 if (!empty($validFields)) {
                     $params['orderByFields'] = implode(',', $validFields);
                 }
             }
             return $params;
         case self::ACTION_SEARCH:
             $displayField = null;
             if (isset($this->selectedLayer)) {
                 $displayField = $this->parser->getDisplayFieldForFolder($this->selectedLayer);
             }
             if ($displayField) {
                 $searchText = strtoupper(str_replace("'", "''", $this->searchFilters['text']));
                 return array('where' => "UPPER({$displayField}) LIKE '%{$searchText}%'", 'f' => 'json');
             } else {
                 return array('text' => str_replace("'", "''", $this->searchFilters['text']), 'f' => 'json');
             }
         case self::ACTION_SEARCH_NEARBY:
             $bbox = normalizedBoundingBox($this->searchFilters['center'], $this->searchFilters['tolerance'], null, $this->parser->getProjection());
             return array('spatialRel' => 'esriSpatialRelIntersects', 'geometryType' => 'esriGeometryEnvelope', 'geometry' => "{$bbox['min']['lon']},{$bbox['min']['lat']},{$bbox['max']['lon']},{$bbox['max']['lat']}", 'f' => 'json');
     }
     return parent::parameters();
 }
Пример #3
0
 protected function parameters()
 {
     $parameters = parent::parameters();
     //don't include the oauth_* parameters if the first argument is true
     $args = func_get_args();
     if (isset($args[0]) && $args[0]) {
         return $parameters;
     }
     $_parameters = array();
     foreach ($parameters as $parameter => $value) {
         if (substr($parameter, 0, 6) !== 'oauth_') {
             $_parameters[$parameter] = $value;
         }
     }
     return $_parameters;
 }