tag /// @param $content string - the content of the tag /// @param $args array - the array of attribute name/value pairs for the tag /// @param $parser Parser - the MW Parser object for the current page /// /// @return string - the html for rendering the map public static function render($content, $args, $parser, $frame) { // Get center and zoom level from $args if (isset($args['lat'])) $latitude = floatval($args['lat']); else $latitude = 47.267648; // latitude as float value if (isset($args['lon'])) $longitude = floatval($args['lon']); else $longitude = 11.404655; // longitude as float value if (isset($args['zoom'])) $zoom = intval($args['zoom']); else $zoom = 10; // Google Zoom Level $latitude_s = sprintf('%.6F', $latitude); $longitude_s = sprintf('%.6F', $longitude); // Query database $dbr = wfGetDB(DB_SLAVE); $res = $dbr->select('wrsledruncache', array('page_title', 'position_latitude', 'position_longitude'), array('show_in_overview', 'not under_construction')); $sledruns = array(); while ($sledrun = $dbr->fetchRow($res)) $sledruns[] = $sledrun; $dbr->freeResult($res); $parserOutput = $parser->getOutput(); $parserOutput->addHeadItem('', 'googlemaps'); $parserOutput->addModules('ext.wrmap'); // Create
element where the map is placed in $output = "
\n"; foreach ($sledruns as $sledrun) { $lat = $sledrun['position_latitude']; $lon = $sledrun['position_longitude']; if (!$lat || !$lon) continue; $title = Title::newFromText($sledrun['page_title']); $output .= "

getText()}\" data-url=\"{$title->getLocalUrl()}\" />\n"; } $output .= "

\n"; return $output; } } ?>