Added intermediate step when parsing GeoJSON to have access to future attributes...
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.php
1 <?php
2 /* This extension creates a map using OpenLayers to show sledrun details and sledrun overviews.
3 This extension depends on no other extension.
4
5
6 Example 1
7 ---------
8
9 <wrgmap lat="47.267648" lon="11.40465" zoom="10"/>
10
11 (Shows icons for all sledruns. lat, lon and zoom are optional.)
12
13
14 Example 2
15 ---------
16
17 <wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
18
19 <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
20 <gasthaus name="Stiglreith">47.238186 11.221940</gasthaus>
21 <gasthaus name="Sulzstich">47.240287 11.203006</gasthaus>
22 <parkplatz>47.245789 11.238971</parkplatz>
23 <parkplatz>47.237627 11.218886</parkplatz>
24 <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
25 <achtung name="Kreuzung mit Schipiste">47.2383200 11.2235592</achtung>
26
27 <gehweg>
28 47.238587 11.203360
29 47.239743 11.203522
30 47.240135 11.203247
31 </gehweg>
32
33 <gehweg>
34 47.238442 11.203263
35 47.237799 11.203511
36 47.237133 11.202988
37 47.238091 11.206642
38 47.237273 11.211675
39 47.237133 11.214466
40 47.237513 11.218199
41 </gehweg>
42
43 <alternative>
44 47.240487 11.190169
45 47.238996 11.188628
46 47.238987 11.188018
47 47.238267 11.187075
48 47.238461 11.190511
49 47.239751 11.191795
50 47.240037 11.192702
51 47.239525 11.193535
52 47.239688 11.194272
53 47.239017 11.193925
54 47.239536 11.195457
55 47.240063 11.196230
56 47.240747 11.196658
57 47.239734 11.198295
58 47.238857 11.198346
59 47.237743 11.199778
60 47.238250 11.202755
61 47.238587 11.203360
62 </alternative>
63
64 <rodelbahn>
65 47.238587 11.203360
66 47.238185 11.203982
67 47.238297 11.204381
68 47.239417 11.204972
69 47.239210 11.208772
70 47.238999 11.209523
71 47.239126 11.209839
72 47.238933 11.210641
73 47.239102 11.210739
74 47.238666 11.215042
75 47.238203 11.216089
76 47.238183 11.218151
77 47.237851 11.218599
78 47.238055 11.219755
79 47.237686 11.222441
80 47.238000 11.223367
81 47.238625 11.223687
82 47.239915 11.223118
83 47.240992 11.219781
84 47.243412 11.214141
85 47.243207 11.218331
86 47.243990 11.216205
87 47.243785 11.223251
88 47.242845 11.228510
89 47.242917 11.232501
90 47.242524 11.235001
91 47.244737 11.231791
92 47.244951 11.230868
93 47.245470 11.237853
94 </rodelbahn>
95
96 <lift>
97 47.245656 11.237286
98 47.238189 11.221344
99 </lift>
100
101 </wrmap>
102
103 lat, lon and zoom are optional.
104 */
105
106 $wgExtensionCredits['parserhook'][] = array(
107         'name' => 'Winterrodeln Map',
108         'version' => '3.0.0',
109         'author' =>'Philipp Spitzer', 
110         'url' => 'http://www.winterrodeln.org/trac/wiki/WrMap', 
111         'description' => 'This extension creates a map using OpenLayers to show sledrun details and sledrun overviews.'
112 );
113
114
115
116 $wgResourceModules['ext.wrmap'] = array(
117         'scripts' => array('openlayers/OpenLayers.js', 'wrmap.js'),
118         'styles' => array('openlayers/theme/default/style.css', 'openlayers/theme/default/google.css'),
119
120         // When your module is loaded, these messages will be available through mw.msg()
121         //'messages' => array( 'myextension-hello-world', 'myextension-goodbye-world' ),
122
123         // If your scripts need code from other modules, list their identifiers as dependencies
124         // and ResourceLoader will make sure they're loaded before you.
125         // You don't need to manually list 'mediawiki' or 'jquery', which are always loaded.
126         //'dependencies' => array( 'jquery.ui.datepicker' ),
127
128         // You need to declare the base path of the file paths in 'scripts' and 'styles'
129         'localBasePath' => dirname( __FILE__ ),
130
131         // ... and the base from the browser as well. For extensions this is made easy,
132         // you can use the 'remoteExtPath' property to declare it relative to where the wiki
133         // has $wgExtensionAssetsPath configured:
134         'remoteExtPath' => 'wrmap',
135
136         'position' => 'top'
137 );
138
139
140 $wgAutoloadClasses['WrMap'] = dirname(__FILE__) . '/wrmap.body.php';
141 $wgAutoloadClasses['WrGMap'] = $wgAutoloadClasses['WrMap'];
142
143
144 $wgHooks['ParserFirstCallInit'][] = 'wrMapParserFirstCallInit';
145
146
147 function wrMapParserFirstCallInit($parser) {
148         $parser->setHook('wrgmap', 'WrGMap::render');
149         $parser->setHook('wrmap', 'WrMap::render');
150         return true;
151 }
152
153
154 ?>