示例#1
0
 /**
  * Builds up and returns the HTML for the map, with the queried coordinate data on it.
  *
  * @param SMWQueryResult $res
  * @param $outputmode
  * 
  * @return array or string
  */
 public final function getResultText(SMWQueryResult $res, $outputmode)
 {
     if ($this->fatalErrorMsg !== false) {
         return $this->fatalErrorMsg;
     }
     /**
      * @var Parser $wgParser
      */
     global $wgParser;
     $params = $this->params;
     $queryHandler = new SMQueryHandler($res, $outputmode);
     $queryHandler->setLinkStyle($params['link']);
     $queryHandler->setHeaderStyle($params['headers']);
     $queryHandler->setShowSubject($params['showtitle']);
     $queryHandler->setTemplate($params['template']);
     $queryHandler->setHideNamespace($params['hidenamespace']);
     $queryHandler->setActiveIcon($params['activeicon']);
     $this->handleMarkerData($params, $queryHandler);
     $locationAmount = count($params['locations']);
     if ($locationAmount > 0) {
         // We can only take care of the zoom defaulting here,
         // as not all locations are available in whats passed to Validator.
         if ($this->fullParams['zoom']->wasSetToDefault() && $locationAmount > 1) {
             $params['zoom'] = false;
         }
         $mapName = $this->service->getMapId();
         SMWOutputs::requireHeadItem($mapName, $this->service->getDependencyHtml() . ($configVars = Skin::makeVariablesScript($this->service->getConfigVariables())));
         foreach ($this->service->getResourceModules() as $resourceModule) {
             SMWOutputs::requireResource($resourceModule);
         }
         if (array_key_exists('source', $params)) {
             unset($params['source']);
         }
         return $this->getMapHTML($params, $wgParser, $mapName);
     } else {
         return $params['default'];
     }
 }