r91398 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91397‎ | r91398 | r91399 >
Date:08:21, 4 July 2011
Author:yuvipanda
Status:ok
Tags:
Comment:
Produces wikitable formatted output
Modified paths:
  • /trunk/extensions/GPoC/TableDisplay.php (modified) (history)
  • /trunk/extensions/GPoC/models/Statistics.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GPoC/TableDisplay.php
@@ -14,9 +14,27 @@
1515 return true;
1616 }
1717
 18+ private static function formatTable( $projectName, $projectStats ) {
 19+ // Column Headers
 20+ $col_headers = array_keys($projectStats['top']);
 21+ $output = "{| class='wikitable' \n|+ $projectName article ratings\n";
 22+ $output .= "|-\n ! scope='col' | \n";
 23+ foreach( $col_headers as $col_header ) {
 24+ $output .= "! scope='col' | $col_header \n";
 25+ }
 26+ foreach( $projectStats as $importance => $qualityRatings ) {
 27+ $output .= "|- \n ! scope='row' | $importance\n";
 28+ foreach( $qualityRatings as $quality => $qualityCount ) {
 29+ $output .= "| $qualityCount \n";
 30+ }
 31+ }
 32+ $output .= "|}";
 33+ return $output;
 34+ }
 35+
1836 public static function AssessmentStatsRender( $parser, $project ) {
1937 $projectStats = Statistics::getProjectStats( $project );
20 - $output = print_r( $projectStats, true );
 38+ $output = TableDisplay::formatTable( $project, $projectStats );
2139 return $output;
2240 }
2341 }
Index: trunk/extensions/GPoC/models/Statistics.php
@@ -47,6 +47,10 @@
4848 }
4949 }
5050
 51+ // Make '' into 'unclassified'
 52+ $project_statistics['unclassified'] = $project_statistics[''];
 53+ unset( $project_statistics[''] );
 54+
5155 return $project_statistics;
5256 }
5357

Status & tagging log