Index: trunk/extensions/Collection/Collection.suggest.php |
— | — | @@ -598,3 +598,24 @@ |
599 | 599 | return count( $this->mPropList ); |
600 | 600 | } |
601 | 601 | } |
| 602 | + |
| 603 | +/** |
| 604 | + * sort $mPropList by the entries values |
| 605 | + * sort alphabetically by equal values |
| 606 | + * |
| 607 | + * @param $a, $b: arrays that contain two entries |
| 608 | + * the keys: 'name' & 'val' |
| 609 | + * 'name': an articlename |
| 610 | + * 'val' : a value from 1 to 1.5 |
| 611 | + * @return 1, -1 or 0 |
| 612 | + */ |
| 613 | +function wgCollectionCompareProps( $a, $b ) { |
| 614 | + if ( $a['val'] == $b['val'] ) { |
| 615 | + return strcmp( $a['name'], $b['name'] ); |
| 616 | + } |
| 617 | + if ( $a['val'] < $b['val'] ) { |
| 618 | + return 1; |
| 619 | + } else { |
| 620 | + return - 1; |
| 621 | + } |
| 622 | +} |