Index: trunk/extensions/SemanticResultFormats/Math/SRF_Math.php |
— | — | @@ -29,17 +29,17 @@ |
30 | 30 | $max = ''; |
31 | 31 | |
32 | 32 | while ( $row = $res->getNext() ) { |
33 | | - $last_col = array_pop( $row ); |
| 33 | + /* SMWResultArray */ $last_col = array_pop( $row ); |
34 | 34 | |
35 | | - foreach ( $last_col->getContent() as $value ) { |
| 35 | + while ( ( $value = efSRFGetNextDV( $last_col ) ) !== false ) { |
36 | 36 | // handle each value only if it's of type Number or NAry |
37 | 37 | if ( $value instanceof SMWNumberValue ) { |
38 | | - if ( method_exists( $value, 'getValueKey' ) ) { |
| 38 | + // getDataItem was introduced in SMW 1.6, getValueKey was deprecated in the same version. |
| 39 | + if ( method_exists( $value, 'getDataItem' ) ) { |
| 40 | + $num = $value->getDataItem()->getNumber(); |
| 41 | + } else { |
39 | 42 | $num = $value->getValueKey(); |
40 | 43 | } |
41 | | - else { |
42 | | - $num = $value->getNumericValue(); |
43 | | - } |
44 | 44 | } elseif ( $value instanceof SMWNAryValue ) { |
45 | 45 | $inner_values = $value->getDVs(); |
46 | 46 | // find the first inner value that's of |
— | — | @@ -49,12 +49,12 @@ |
50 | 50 | |
51 | 51 | foreach ( $inner_values as $inner_value ) { |
52 | 52 | if ( $inner_value instanceof SMWNumberValue ) { |
53 | | - if ( method_exists( $inner_value, 'getValueKey' ) ) { |
| 53 | + // getDataItem was introduced in SMW 1.6, getValueKey was deprecated in the same version. |
| 54 | + if ( method_exists( $inner_value, 'getDataItem' ) ) { |
| 55 | + $num = $inner_value->getDataItem()->getNumber(); |
| 56 | + } else { |
54 | 57 | $num = $inner_value->getValueKey(); |
55 | 58 | } |
56 | | - else { |
57 | | - $num = $inner_value->getNumericValue(); |
58 | | - } |
59 | 59 | break; |
60 | 60 | } |
61 | 61 | } |