Exemple #1
0
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  *
  * TODO: migrate stuff
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsDefaultTitle, $egMapsDefaultLabel;
     $params = MapsMapper::getCommonParameters();
     $params['mappingservice']['feature'] = 'display_map';
     $params['zoom']['dependencies'] = array('coordinates', 'mappingservice');
     $params['zoom']['manipulations'] = new MapsParamZoom();
     $params['coordinates'] = array('aliases' => array('coords', 'location', 'address', 'addresses', 'locations', 'points'), 'criteria' => new CriterionIsLocation($type === ParserHook::TYPE_FUNCTION ? '~' : '|'), 'manipulations' => new MapsParamLocation($type === ParserHook::TYPE_FUNCTION ? '~' : '|'), 'dependencies' => array('mappingservice', 'geoservice'), 'default' => array(), 'islist' => true, 'delimiter' => $type === ParserHook::TYPE_FUNCTION ? ';' : "\n");
     $params['title'] = array('name' => 'title', 'default' => $egMapsDefaultTitle);
     $params['label'] = array('default' => $egMapsDefaultLabel, 'aliases' => 'text');
     $params['icon'] = array('default' => '');
     $params['visitedicon'] = array('default' => '');
     $params['lines'] = array('default' => array(), 'criteria' => new CriterionLine('~'), 'manipulations' => new MapsParamLine('~'), 'delimiter' => ';', 'islist' => true);
     $params['polygons'] = array('default' => array(), 'criteria' => new CriterionPolygon('~'), 'manipulations' => new MapsParamPolygon('~'), 'delimiter' => ';', 'islist' => true);
     $params['circles'] = array('default' => array(), 'manipulations' => new MapsParamCircle('~'), 'delimiter' => ';', 'islist' => true);
     $params['rectangles'] = array('default' => array(), 'manipulations' => new MapsParamRectangle('~'), 'delimiter' => ';', 'islist' => true);
     $params['copycoords'] = array('type' => 'boolean', 'default' => false);
     $params['static'] = array('type' => 'boolean', 'default' => false);
     $params['wmsoverlay'] = array('type' => 'string', 'default' => false, 'manipulations' => new MapsParamWmsOverlay(' '), 'delimiter' => ';');
     $params['maxzoom'] = array('type' => 'integer', 'default' => false, 'manipulatedefault' => false, 'dependencies' => 'minzoom');
     $params['minzoom'] = array('type' => 'integer', 'default' => false, 'manipulatedefault' => false, 'lowerbound' => 0);
     foreach ($params as $name => &$param) {
         if (!array_key_exists('message', $param)) {
             $param['message'] = 'maps-displaymap-par-' . $name;
         }
     }
     return $params;
 }
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsDefaultServices, $egMapsDefaultTitle, $egMapsDefaultLabel;
     $params = MapsMapper::getCommonParameters();
     $params['mappingservice']->setDefault($egMapsDefaultServices['display_point']);
     $params['mappingservice']->addManipulations(new MapsParamService('display_point'));
     $params['mappingservice']->setMessage('maps-displaypoints-par-mappingservice');
     $params['zoom']->addDependencies('coordinates', 'mappingservice');
     $params['zoom']->addManipulations(new MapsParamZoom());
     $params['zoom']->setMessage('maps-displaypoints-par-zoom');
     $params['coordinates'] = new ListParameter('coordinates', $type === ParserHook::TYPE_FUNCTION ? ';' : "\n");
     $params['coordinates']->addAliases('coords', 'location', 'address', 'addresses', 'locations');
     $params['coordinates']->addCriteria(new CriterionIsLocation($type === ParserHook::TYPE_FUNCTION ? '~' : '|'));
     $params['coordinates']->addManipulations(new MapsParamLocation($type === ParserHook::TYPE_FUNCTION ? '~' : '|'));
     $params['coordinates']->addDependencies('mappingservice', 'geoservice');
     $params['coordinates']->setMessage('maps-displaypoints-par-coordinates');
     $params['centre'] = new Parameter('centre');
     $params['centre']->setDefault(false);
     $params['centre']->addAliases('center');
     $params['centre']->addCriteria(new CriterionIsLocation());
     $params['centre']->setMessage('maps-displaypoints-par-centre');
     $params['centre']->setDoManipulationOfDefault(false);
     $manipulation = new MapsParamLocation();
     $manipulation->toJSONObj = true;
     $params['centre']->addManipulations($manipulation);
     $params['title'] = new Parameter('title', Parameter::TYPE_STRING, $egMapsDefaultTitle);
     $params['title']->setMessage('maps-displaypoints-par-title');
     $params['label'] = new Parameter('label', Parameter::TYPE_STRING, $egMapsDefaultLabel, array('text'));
     $params['label']->setMessage('maps-displaypoints-par-label');
     $params['icon'] = new Parameter('icon', Parameter::TYPE_STRING, '', array(), array(new CriterionNotEmpty()));
     $params['icon']->setMessage('maps-displaypoints-par-icon');
     return $params;
 }
Exemple #3
0
 /**
  * Returns an array containing the parameter info.
  * 
  * @since 1.0
  * 
  * @return array
  */
 protected function getParameterInfo()
 {
     $params = ParamDefinition::getCleanDefinitions(MapsMapper::getCommonParameters());
     $this->service->addParameterInfo($params);
     $params['zoom']['default'] = false;
     $params['zoom']['manipulatedefault'] = false;
     return array_merge($params, $this->getParameterDefinitions());
 }
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  *
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     $params = MapsMapper::getCommonParameters();
     $params['mappingservice']['feature'] = 'display_map';
     $params['coordinates'] = array('type' => 'mapslocation', 'aliases' => array('coords', 'location', 'address', 'addresses', 'locations', 'points'), 'dependencies' => array('mappingservice', 'geoservice'), 'default' => array(), 'islist' => true, 'delimiter' => $type === ParserHook::TYPE_FUNCTION ? ';' : "\n", 'message' => 'maps-displaymap-par-coordinates');
     $params = array_merge($params, self::getCommonMapParams());
     return $params;
 }
 /**
  * @since 3.1
  *
  * @param string $value
  *
  * @return WmsOverlay
  * @throws ParseException
  */
 protected function stringParse($value)
 {
     $parameters = explode('~', $value);
     $imageParameters = explode(':', $parameters[0], 3);
     if (count($imageParameters) === 3) {
         $boundsNorthEast = $this->stringToLatLongValue($imageParameters[0]);
         $boundsSouthWest = $this->stringToLatLongValue($imageParameters[1]);
         $imageUrl = \MapsMapper::getFileUrl($imageParameters[2]);
         return new ImageOverlay($boundsNorthEast, $boundsSouthWest, $imageUrl);
     }
     throw new ParseException('Need 3 parameters for an image overlay');
 }
    /**
     * @see MapsLayer::getJavaScriptDefinition
     * 
     * @since 0.7.2
     * 
     * @return string
     */
    public function getJavaScriptDefinition()
    {
        foreach ($this->properties as $name => $value) {
            ${$name} = MapsMapper::encodeJsVar($value);
        }
        $options = array('extractStyles' => true, 'extractAttributes' => true, 'maxDepth' => $maxdepth);
        $options = Xml::encodeJsVar((object) $options);
        return <<<EOT
\tnew OpenLayers.Layer.GML(
\t\t{$label},
\t\t{$source},
\t\t{
\t\t\tformat: OpenLayers.Format.KML, 
\t\t\tformatOptions: {$options}
\t\t}
\t)
EOT;
    }
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsMapWidth, $egMapsMapHeight, $egMapsDefaultServices;
     $params = MapsMapper::getCommonParameters();
     $params['mappingservice']->setDefault($egMapsDefaultServices['display_map']);
     $params['mappingservice']->addManipulations(new MapsParamService('display_map'));
     $params['mappingservice']->setMessage('maps-displaymap-par-mappingservice');
     $params['coordinates'] = new Parameter('coordinates');
     $params['coordinates']->addAliases('coords', 'location', 'address');
     $params['coordinates']->addCriteria(new CriterionIsLocation());
     $params['coordinates']->addDependencies('mappingservice', 'geoservice');
     $params['coordinates']->setMessage('maps-displaymap-par-coordinates');
     $params['coordinates']->setDoManipulationOfDefault(false);
     $manipulation = new MapsParamLocation();
     $manipulation->toJSONObj = true;
     $params['coordinates']->addManipulations($manipulation);
     return $params;
 }
 /**
  * Returns the output for a display_uk_point call.
  * A lot of this code has been copied from @see MapsParserFunctions::getMapHtml in Maps.
  *
  * @param unknown_type $parser
  *
  * @return array
  */
 public static function displayUkPointRender(&$parser)
 {
     global $wgLang, $egValidatorErrorLevel;
     $params = func_get_args();
     array_shift($params);
     // We already know the $parser.
     $map = array();
     $coordFails = array();
     $paramInfo = array_merge(MapsMapper::getMainParams(), self::$parameters);
     // Go through all parameters, split their names and values, and put them in the $map array.
     foreach ($params as $param) {
         $split = explode('=', $param);
         if (count($split) > 1) {
             $paramName = strtolower(trim($split[0]));
             $paramValue = trim($split[1]);
             if (strlen($paramName) > 0 && strlen($paramValue) > 0) {
                 $map[$paramName] = $paramValue;
                 if (MapsParserFunctions::inParamAliases($paramName, 'coordinates', $paramInfo)) {
                     $coordFails = MapsParserFunctions::filterInvalidCoords($map[$paramName]);
                 }
             }
         } elseif (count($split) == 1) {
             // Default parameter (without name)
             $split[0] = trim($split[0]);
             if (strlen($split[0]) > 0) {
                 $map['coordinates'] = $split[0];
             }
         }
     }
     if (!MapsParserFunctions::paramIsPresent('service', $map, $paramInfo)) {
         $map['service'] = '';
     }
     $map['service'] = MapsMapper::getValidService($map['service'], 'display_uk_point');
     $mapClass = MapsParserFunctions::getParserClassInstance($map['service'], 'display_uk_point');
     // Call the function according to the map service to get the HTML output
     $output = $mapClass->displayMap($parser, $map);
     if ($egValidatorErrorLevel >= Validator_ERRORS_WARN && count($coordFails) > 0) {
         $output .= '<i>' . wfMsgExt('maps_unrecognized_coords_for', array('parsemag'), $wgLang->listToText($coordFails), count($coordFails)) . '</i>';
     }
     // Return the result
     return $parser->insertStripItem($output, $parser->mStripState);
 }
    /**
     * @see MapsLayer::getJavaScriptDefinition
     * 
     * @since 0.7.2
     * 
     * @return string
     */
    public function getJavaScriptDefinition()
    {
        foreach ($this->properties as $name => $value) {
            ${$name} = MapsMapper::encodeJsVar($value);
        }
        $options = array('isImage' => true);
        if ($zoomlevels !== false) {
            $options['numZoomLevels'] = $zoomlevels;
        }
        $options = Xml::encodeJsVar((object) $options);
        return <<<EOT
\tnew OpenLayers.Layer.Image(
\t\t{$label},
\t\t{$source},
\t\tnew OpenLayers.Bounds({$leftbound}, {$lowerbound}, {$rightbound}, {$upperbound}),
\t\tnew OpenLayers.Size({$width}, {$height}),
\t\t{$options}
\t)
EOT;
    }
 /**
  * Returns an array containing the parameter info.
  * 
  * @since 1.0
  * 
  * @return array
  */
 protected function getParameterInfo()
 {
     global $smgFIMulti, $smgFIFieldSize;
     $params = ParamDefinition::getCleanDefinitions(MapsMapper::getCommonParameters());
     $this->service->addParameterInfo($params);
     $params['zoom']->setDefault(false, false);
     $params['multi'] = new Parameter('multi', Parameter::TYPE_BOOLEAN);
     $params['multi']->setDefault($smgFIMulti, false);
     $params['fieldsize'] = new Parameter('fieldsize', Parameter::TYPE_INTEGER);
     $params['fieldsize']->setDefault($smgFIFieldSize, false);
     $params['fieldsize']->addCriteria(new CriterionInRange(5, 100));
     $params['icon'] = new Parameter('icon');
     $params['icon']->setDefault('');
     $params['icon']->addCriteria(new CriterionNotEmpty());
     $manipulation = new MapsParamLocation();
     $manipulation->toJSONObj = true;
     $params['locations'] = array('aliases' => array('points'), 'criteria' => new CriterionIsLocation(), 'manipulations' => $manipulation, 'default' => array(), 'islist' => true, 'delimiter' => self::SEPARATOR, 'message' => 'semanticmaps-par-locations');
     $params['geocodecontrol'] = new Parameter('geocodecontrol', Parameter::TYPE_BOOLEAN);
     $params['geocodecontrol']->setDefault(true, false);
     $params['geocodecontrol']->setMessage('semanticmaps-par-geocodecontrol');
     return $params;
 }
 /**
  * Converts the data in the coordinates parameter to JSON-ready objects.
  * These get stored in the locations parameter, and the coordinates on gets deleted.
  *
  * FIXME: complexity
  *
  * @since 1.0
  *
  * @param array &$params
  * @param Parser $parser
  */
 protected function handleMarkerData(array &$params, Parser $parser)
 {
     if (is_object($params['centre'])) {
         $params['centre'] = $params['centre']->getJSONObject();
     }
     $parserClone = clone $parser;
     if (is_object($params['wmsoverlay'])) {
         $params['wmsoverlay'] = $params['wmsoverlay']->getJSONObject();
     }
     $iconUrl = MapsMapper::getFileUrl($params['icon']);
     $visitedIconUrl = MapsMapper::getFileUrl($params['visitedicon']);
     $params['locations'] = array();
     /**
      * @var Location $location
      */
     foreach ($params['coordinates'] as $location) {
         $jsonObj = $location->getJSONObject($params['title'], $params['label'], $iconUrl, '', '', $visitedIconUrl);
         $jsonObj['title'] = $parserClone->parse($jsonObj['title'], $parserClone->getTitle(), new ParserOptions())->getText();
         $jsonObj['text'] = $parserClone->parse($jsonObj['text'], $parserClone->getTitle(), new ParserOptions())->getText();
         $jsonObj['inlineLabel'] = strip_tags($parserClone->parse($jsonObj['inlineLabel'], $parserClone->getTitle(), new ParserOptions())->getText(), '<a><img>');
         $hasTitleAndtext = $jsonObj['title'] !== '' && $jsonObj['text'] !== '';
         $jsonObj['text'] = ($hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title']) . $jsonObj['text'];
         $jsonObj['title'] = strip_tags($jsonObj['title']);
         $params['locations'][] = $jsonObj;
     }
     unset($params['coordinates']);
     $this->handleShapeData($params, $parserClone);
     if ($params['mappingservice'] === 'openlayers') {
         $params['layers'] = self::evilOpenLayersHack($params['layers']);
     }
 }
 /**
  * Returns the JSON with the maps data.
  *
  * @since 0.7.3
  *
  * @param array $params
  * @param Parser $parser
  * @param string $mapName
  * 
  * @return string
  */
 protected function getJSON(array $params, Parser $parser, $mapName)
 {
     $object = $this->getJSONObject($params, $parser);
     if ($object === false) {
         return '';
     }
     return Html::inlineScript(MapsMapper::getBaseMapJSON($this->service->getName()) . "mwmaps.{$this->service->getName()}.{$mapName}=" . FormatJson::encode($object) . ';');
 }
Exemple #13
0
 /**
  * Returns an object that can directly be converted to JS using json_encode or similar.
  * 
  * @since 1.0
  * 
  * @return object
  */
 public function getJSONObject($defText = '', $defTitle = '', $defIconUrl = '')
 {
     return array('lat' => $this->getLatitude(), 'lon' => $this->getLongitude(), 'alt' => $this->getAltitude(), 'text' => $this->hasText() ? $this->getText() : $defText, 'title' => $this->hasTitle() ? $this->getTitle() : $defTitle, 'address' => $this->getAddress(false), 'icon' => $this->hasIcon() ? MapsMapper::getFileUrl($this->getIcon()) : $defIconUrl);
 }
 /**
  * Converts the data in the coordinates parameter to JSON-ready objects.
  * These get stored in the locations parameter, and the coordinates on gets deleted.
  *
  * @since 1.0
  *
  * @param array &$params
  * @param Parser $parser
  */
 protected function handleMarkerData(array &$params, Parser $parser)
 {
     $parserClone = clone $parser;
     $iconUrl = MapsMapper::getFileUrl($params['icon']);
     $visitedIconUrl = MapsMapper::getFileUrl($params['visitedicon']);
     $params['locations'] = array();
     /**
      * @var MapsLocation $location
      */
     foreach ($params['coordinates'] as $location) {
         if ($location->isValid()) {
             $jsonObj = $location->getJSONObject($params['title'], $params['label'], $iconUrl, '', '', $visitedIconUrl);
             $jsonObj['title'] = $parserClone->parse($jsonObj['title'], $parserClone->getTitle(), new ParserOptions())->getText();
             $jsonObj['text'] = $parserClone->parse($jsonObj['text'], $parserClone->getTitle(), new ParserOptions())->getText();
             $jsonObj['inlineLabel'] = strip_tags($parserClone->parse($jsonObj['inlineLabel'], $parserClone->getTitle(), new ParserOptions())->getText(), '<a><img>');
             $hasTitleAndtext = $jsonObj['title'] !== '' && $jsonObj['text'] !== '';
             $jsonObj['text'] = ($hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title']) . $jsonObj['text'];
             $jsonObj['title'] = strip_tags($jsonObj['title']);
             $params['locations'][] = $jsonObj;
         }
     }
     unset($params['coordinates']);
     $textContainers = array(&$params['lines'], &$params['polygons'], &$params['circles'], &$params['rectangles'], &$params['imageoverlays']);
     foreach ($textContainers as &$textContainer) {
         if (is_array($textContainer)) {
             foreach ($textContainer as &$obj) {
                 $obj['title'] = $parserClone->parse($obj['title'], $parserClone->getTitle(), new ParserOptions())->getText();
                 $obj['text'] = $parserClone->parse($obj['text'], $parserClone->getTitle(), new ParserOptions())->getText();
                 $hasTitleAndtext = $obj['title'] !== '' && $obj['text'] !== '';
                 $obj['text'] = ($hasTitleAndtext ? '<b>' . $obj['title'] . '</b><hr />' : $obj['title']) . $obj['text'];
                 $obj['title'] = strip_tags($obj['title']);
             }
         }
     }
 }
Exemple #15
0
    /**
     * @see MapsLayer::getJavaScriptDefinition
     * 
     * @since 0.7.2
     * 
     * @return string
     */
    public function getJavaScriptDefinition()
    {
        $this->validate();
        // do image layer options:
        $options = array('isImage' => true, 'units' => $this->properties['units']);
        if ($this->properties['zoomlevels'] !== false) {
            $options['numZoomLevels'] = $this->properties['zoomlevels'];
        }
        if ($this->properties['minscale'] !== false) {
            $options['minScale'] = $this->properties['minscale'];
        }
        if ($this->properties['maxscale'] !== false) {
            $options['maxScale'] = $this->properties['maxscale'];
        }
        $options = Xml::encodeJsVar((object) $options);
        //js-encode all options );
        // for non-option params, get JavaScript-encoded config values:
        foreach ($this->properties as $name => $value) {
            ${$name} = MapsMapper::encodeJsVar($value);
        }
        return <<<JavaScript
new OpenLayers.Layer.Image(
\t{$label},
\t{$source},
\tnew OpenLayers.Bounds({$leftextent}, {$bottomextent}, {$rightextent}, {$topextent}),
\tnew OpenLayers.Size({$width}, {$height}),
\t{$options}
);
JavaScript;
        die;
    }
Exemple #16
0
 /**
  * Converts the data in the coordinates parameter to JSON-ready objects.
  * These get stored in the locations parameter, and the coordinates on gets deleted.
  * 
  * @since 1.0
  * 
  * @param array &$params
  * @param SMQueryHandler $queryHandler
  */
 protected function handleMarkerData(array &$params, SMQueryHandler $queryHandler)
 {
     if (is_object($params['centre'])) {
         $params['centre'] = $params['centre']->getJSONObject();
     }
     $iconUrl = MapsMapper::getFileUrl($params['icon']);
     $visitedIconUrl = MapsMapper::getFileUrl($params['visitedicon']);
     $params['locations'] = $this->getJsonForStaticLocations($params['staticlocations'], $params, $iconUrl, $visitedIconUrl);
     unset($params['staticlocations']);
     $this->addShapeData($queryHandler->getShapes(), $params, $iconUrl, $visitedIconUrl);
     if ($params['format'] === 'openlayers') {
         $params['layers'] = MapsDisplayMapRenderer::evilOpenLayersHack($params['layers']);
     }
 }
Exemple #17
0
 /**
  * Returns an object that can directly be converted to JS using json_encode or similar.
  *
  * FIXME: complexity
  *
  * @since 1.0
  *
  * @param string $defText
  * @param string $defTitle
  * @param string $defIconUrl
  * @param string $defGroup
  * @param string $defInlineLabel
  * @param string $defVisitedIcon
  *
  * @return array
  */
 public function getJSONObject($defText = '', $defTitle = '', $defIconUrl = '', $defGroup = '', $defInlineLabel = '', $defVisitedIcon = '')
 {
     $parentArray = parent::getJSONObject($defText, $defTitle);
     $array = array('lat' => $this->coordinates->getLatitude(), 'lon' => $this->coordinates->getLongitude(), 'alt' => 0, 'address' => $this->getAddress(false), 'icon' => $this->hasIcon() ? \MapsMapper::getFileUrl($this->getIcon()) : $defIconUrl, 'group' => $this->hasGroup() ? $this->getGroup() : $defGroup, 'inlineLabel' => $this->hasInlineLabel() ? $this->getInlineLabel() : $defInlineLabel, 'visitedicon' => $this->hasVisitedIcon() ? $this->getVisitedIcon() : $defVisitedIcon);
     return array_merge($parentArray, $array);
 }
 /**
  * Converts the data in the coordinates parameter to JSON-ready objects.
  * These get stored in the locations parameter, and the coordinates on gets deleted.
  * 
  * @since 1.0
  * 
  * @param array &$params
  * @param Parser $parser
  */
 protected function handleMarkerData(array &$params, Parser $parser)
 {
     $parserClone = clone $parser;
     $iconUrl = MapsMapper::getFileUrl($params['icon']);
     $params['locations'] = array();
     foreach ($params['coordinates'] as $location) {
         if ($location->isValid()) {
             $jsonObj = $location->getJSONObject($params['title'], $params['label'], $iconUrl);
             $jsonObj['title'] = $parserClone->parse($jsonObj['title'], $parserClone->getTitle(), new ParserOptions())->getText();
             $jsonObj['text'] = $parserClone->parse($jsonObj['text'], $parserClone->getTitle(), new ParserOptions())->getText();
             $hasTitleAndtext = $jsonObj['title'] !== '' && $jsonObj['text'] !== '';
             $jsonObj['text'] = ($hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title']) . $jsonObj['text'];
             $jsonObj['title'] = strip_tags($jsonObj['title']);
             $params['locations'][] = $jsonObj;
         }
     }
     unset($params['coordinates']);
 }
	/**
	 * Converts the data in the coordinates parameter to JSON-ready objects.
	 * These get stored in the locations parameter, and the coordinates on gets deleted.
	 * 
	 * @since 1.0
	 * 
	 * @param array &$params
	 * @param array $queryLocations
	 */
	protected function handleMarkerData( array &$params, array $queryLocations ) {
		global $wgParser;

		$parser = version_compare( $GLOBALS['wgVersion'], '1.18', '<' ) ? $wgParser : clone $wgParser;
		
		$iconUrl = MapsMapper::getFileUrl( $params['icon'] );
		$params['locations'] = array();

		foreach ( $params['staticlocations'] as $location ) {
			if ( $location->isValid() ) {
				$jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
				
				$jsonObj['title'] = $parser->parse( $jsonObj['title'], $parser->getTitle(), new ParserOptions() )->getText();
				$jsonObj['text'] = $parser->parse( $jsonObj['text'], $parser->getTitle(), new ParserOptions() )->getText();
				
				$hasTitleAndtext = $jsonObj['title'] !== '' && $jsonObj['text'] !== '';
				$jsonObj['text'] = ( $hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title'] ) . $jsonObj['text'];
				$jsonObj['title'] = strip_tags( $jsonObj['title'] );
				
				$params['locations'][] = $jsonObj;					
			}
		}
		
		foreach ( $queryLocations as $location ) {
			if ( $location->isValid() ) {
				$jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
				
				$jsonObj['title'] = strip_tags( $jsonObj['title'] );
				
				$params['locations'][] = $jsonObj;				
			}
		}
		
		unset( $params['staticlocations'] );
	}	
Exemple #20
0
 /**
  * Get the icon for a row.
  *
  * @since 0.7.3
  *
  * @param array $row
  *
  * @return string
  */
 protected function getLocationIcon(array $row)
 {
     $icon = '';
     $legend_labels = array();
     // Look for display_options field, which can be set by Semantic Compound Queries
     // the location of this field changed in SMW 1.5
     $display_location = method_exists($row[0], 'getResultSubject') ? $row[0]->getResultSubject() : $row[0];
     if (property_exists($display_location, 'display_options') && is_array($display_location->display_options)) {
         $display_options = $display_location->display_options;
         if (array_key_exists('icon', $display_options)) {
             $icon = $display_options['icon'];
             // This is somewhat of a hack - if a legend label has been set, we're getting it for every point, instead of just once per icon
             if (array_key_exists('legend label', $display_options)) {
                 $legend_label = $display_options['legend label'];
                 if (!array_key_exists($icon, $legend_labels)) {
                     $legend_labels[$icon] = $legend_label;
                 }
             }
         }
     } elseif ($this->icon !== '') {
         $icon = MapsMapper::getFileUrl($this->icon);
     }
     return $icon;
 }
Exemple #21
0
 /**
  * @see ItemParameterManipulation::doManipulation
  * 
  * @since 0.7
  */
 public function doManipulation(&$value, Parameter $parameter, array &$parameters)
 {
     $value = MapsMapper::getFileUrl($value);
 }