Index: trunk/extensions/ResearchTools/pages/ResearchToolsPrefsPage.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class ResearchToolsPrefsPage implements ResearchToolsPage { |
5 | 5 | |
6 | | - public function main() { |
| 6 | + public function main( array $steps ) { |
7 | 7 | ?> |
8 | 8 | Hello pref stats! |
9 | 9 | <?php |
Index: trunk/extensions/ResearchTools/pages/ResearchToolsSurveysPage.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class ResearchToolsSurveysPage implements ResearchToolsPage { |
5 | 5 | |
6 | | - public function main() { |
| 6 | + public function main( array $steps ) { |
7 | 7 | ?> |
8 | 8 | Hello surveys! |
9 | 9 | <?php |
Index: trunk/extensions/ResearchTools/pages/ResearchToolsDashboardPage.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class ResearchToolsDashboardPage implements ResearchToolsPage { |
5 | 5 | |
6 | | - public function main() { |
| 6 | + public function main( array $steps ) { |
7 | 7 | ?> |
8 | 8 | Hello dashboard! |
9 | 9 | <?php |
Index: trunk/extensions/ResearchTools/pages/ResearchToolsClicksPage.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class ResearchToolsClicksPage implements ResearchToolsPage { |
5 | 5 | |
6 | | - public function main() { |
| 6 | + public function main( array $steps ) { |
7 | 7 | ?> |
8 | 8 | Hello click tracking! |
9 | 9 | <?php |
Index: trunk/extensions/ResearchTools/ResearchToolsPage.php |
— | — | @@ -2,5 +2,5 @@ |
3 | 3 | |
4 | 4 | interface ResearchToolsPage { |
5 | 5 | |
6 | | - public function main(); |
| 6 | + public function main( array $steps ); |
7 | 7 | } |
Index: trunk/extensions/ResearchTools/SpecialResearchTools.php |
— | — | @@ -26,32 +26,33 @@ |
27 | 27 | |
28 | 28 | $this->setHeaders(); |
29 | 29 | |
30 | | - $current = current( explode( '/', $par ) ); |
31 | | - if ( !isset( self::$pages[$current] ) ) { |
32 | | - $current = key( self::$pages ); |
| 30 | + $steps = explode( '/', $par ); |
| 31 | + $base = array_shift( $steps ); |
| 32 | + if ( !isset( self::$pages[$base] ) ) { |
| 33 | + $base = key( self::$pages ); |
33 | 34 | } |
34 | 35 | |
35 | 36 | ob_start(); |
36 | 37 | |
37 | | - self::renderNavigation( $current ); |
| 38 | + self::renderNavigation( $base ); |
38 | 39 | |
39 | 40 | ?><div class="researchTools-page"><?php |
40 | 41 | |
41 | | - $page = new self::$pages[$current]; |
42 | | - $page->main(); |
| 42 | + $page = new self::$pages[$base]; |
| 43 | + $page->main( $steps ); |
43 | 44 | |
44 | 45 | ?></div><?php |
45 | 46 | |
46 | 47 | $wgOut->addHtml( ob_get_clean() ); |
47 | 48 | } |
48 | 49 | |
49 | | - protected function renderNavigation( $current ) { |
| 50 | + protected function renderNavigation( $base ) { |
50 | 51 | global $wgUser; |
51 | 52 | |
52 | 53 | ?> |
53 | 54 | <ul class="researchTools-navigation"> |
54 | 55 | <?php foreach ( self::$pages as $page => $class ): ?> |
55 | | - <li class="researchTools-navigation-item <?php echo $page == $current ? 'researchTools-navigation-item-current' : '' ?>"> |
| 56 | + <li class="researchTools-navigation-item <?php echo $page == $base ? 'researchTools-navigation-item-current' : '' ?>"> |
56 | 57 | <?php echo $wgUser->getSkin()->link( $this->getTitle( $page ), wfMsg( "researchtools-page-$page" ) ) ?> |
57 | 58 | </li> |
58 | 59 | <?php endforeach; ?> |