r61891 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61890‎ | r61891 | r61892 >
Date:22:08, 2 February 2010
Author:kipcool
Status:deferred
Tags:
Comment:
added sort to getSelectOptions
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/SpecialSelect.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSelect.php
@@ -60,6 +60,7 @@
6161 $options_res = $dbr->query( $sql );
6262
6363 $optionsString = '';
 64+ $optionsArray = array() ;
6465 while ( $options_row = $dbr->fetchObject( $options_res ) ) {
6566 /* Use a simpler query if the user's language is English. */
6667 if ( $lang_code == 'en' || !( $lang_id = getLanguageIdForCode( $lang_code ) ) ) {
@@ -95,11 +96,16 @@
9697
9798 $spelling_res = $dbr->query( $sql );
9899 $spelling_row = $dbr->fetchObject( $spelling_res );
99 - if ( $optionsString != '' )
100 - $optionsString .= "\n";
101 - $optionsString .= $options_row->option_id . ';' . $spelling_row->spelling;
 100+
 101+ $optionsArray[$options_row->option_id] = $spelling_row->spelling ;
102102 }
103103
 104+ asort( $optionsArray ) ;
 105+ foreach ($optionsArray as $option_id => $spelling ) {
 106+ if ( $optionsString != '' ) $optionsString .= "\n";
 107+ $optionsString .= $option_id . ';' . $spelling ;
 108+ }
 109+
104110 return $optionsString;
105111 }
106112

Status & tagging log