Index: trunk/extensions/GPoC/TableDisplay.php |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?php |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 4 | + exit( 1 ); |
| 5 | +} |
| 6 | + |
| 7 | +class TableDisplay { |
| 8 | + public static function ParserFunctionInit( &$parser ) { |
| 9 | + $parser->setFunctionHook( 'AssessmentStats', 'TableDisplay::AssessmentStatsRender' ); |
| 10 | + return true; |
| 11 | + } |
| 12 | + |
| 13 | + public static function LanguageGetMagic( &$magicWords, $langCode ) { |
| 14 | + $magicWords['AssessmentStats'] = array( 0, 'AssessmentStats' ); |
| 15 | + return true; |
| 16 | + } |
| 17 | + |
| 18 | + public static function AssessmentStatsRender( $parser, $project ) { |
| 19 | + $projectStats = Statistics::getProjectStats( $project ); |
| 20 | + $output = print_r( $projectStats, true ); |
| 21 | + return $output; |
| 22 | + } |
| 23 | +} |
Index: trunk/extensions/GPoC/GPoC.php |
— | — | @@ -20,8 +20,13 @@ |
21 | 21 | $dir = dirname( __FILE__ ) . '/'; |
22 | 22 | |
23 | 23 | $wgAutoloadClasses['GPoCHooks'] = $dir . 'GPoC.hooks.php'; |
| 24 | +$wgAutoloadClasses['Statistics'] = $dir . 'models/Statistics.php'; |
| 25 | +$wgAutoloadClasses['TableDisplay'] = $dir . 'TableDisplay.php'; |
24 | 26 | |
25 | 27 | $wgHooks['ArticleSaveComplete'][] = 'GPoCHooks::ArticleSaveComplete'; |
26 | 28 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'GPoCHooks::SetupSchema'; |
27 | 29 | |
| 30 | +$wgHooks['ParserFirstCallInit'][] = 'TableDisplay::ParserFunctionInit'; |
| 31 | +$wgHooks['LanguageGetMagic'][] = 'TableDisplay::LanguageGetMagic'; |
| 32 | + |
28 | 33 | // Configuration |