/** * 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) { global $wgParser; $params = $this->params; $queryHandler = new SMQueryHandler($res, $outputmode); $queryHandler->setShowSubject($params['showtitle']); $queryHandler->setTemplate($params['template']); $this->handleMarkerData($params, $queryHandler->getLocations()); $locationAmount = count($params['locations']); if ($params['forceshow'] || $locationAmount > 0) { // We can only take care of the zoom defaulting here, // as not all locations are available in whats passed to Validator. if ($params['zoom'] === false && $locationAmount <= 1) { $params['zoom'] = $this->service->getDefaultZoom(); } $mapName = $this->service->getMapId(); // MediaWiki 1.17 does not play nice with addScript, so add the vars via the globals hook. if (version_compare($GLOBALS['wgVersion'], '1.18', '<')) { $GLOBALS['egMapsGlobalJSVars'] += $this->service->getConfigVariables(); } SMWOutputs::requireHeadItem($mapName, $this->service->getDependencyHtml() . ($configVars = Skin::makeVariablesScript($this->service->getConfigVariables()))); foreach ($this->service->getResourceModules() as $resourceModule) { SMWOutputs::requireResource($resourceModule); } $result = $this->getMapHTML($params, $wgParser, $mapName) . $this->getJSON($params, $wgParser, $mapName); return array($result, 'noparse' => true, 'isHTML' => true); } else { return ''; } } else { return $this->fatalErrorMsg; } }
/** * 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']; } }