Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Distributable.php |
— | — | @@ -164,10 +164,8 @@ |
165 | 165 | $name = $row[0]->getNextDataValue()->getShortWikiText(); |
166 | 166 | |
167 | 167 | foreach ( $row as $field ) { |
168 | | - while ( ( $object = $field->getNextDataValue() ) !== false ) { |
169 | | - if ( $object->isNumeric() ) { // use numeric sortkey |
170 | | - $values[$name] = $object->getDataItem()->getNumber(); |
171 | | - } |
| 168 | + while ( ( /* SMWDataItem */ $dataItem = $field->getNextDataItem() ) !== false ) { |
| 169 | + $this->addNumbersForDataItem( $dataItem, $values, $name ); |
172 | 170 | } |
173 | 171 | } |
174 | 172 | } |
— | — | @@ -176,6 +174,29 @@ |
177 | 175 | } |
178 | 176 | |
179 | 177 | /** |
| 178 | + * Adds all numbers contained in a dataitem to the list. |
| 179 | + * |
| 180 | + * @since 1.7 |
| 181 | + * |
| 182 | + * @param SMWDataItem $dataItem |
| 183 | + * @param array $values |
| 184 | + * @param string $name |
| 185 | + */ |
| 186 | + protected function addNumbersForDataItem( SMWDataItem $dataItem, array &$values, $name ) { |
| 187 | + switch ( $dataItem->getDIType() ) { |
| 188 | + case SMWDataItem::TYPE_NUMBER: |
| 189 | + $values[$name] = $dataItem->getNumber(); |
| 190 | + break; |
| 191 | + case SMWDataItem::TYPE_CONTAINER: |
| 192 | + foreach ( $dataItem->getDataItems() as $di ) { |
| 193 | + $this->addNumbersForDataItem( $di, $values, $name ); |
| 194 | + } |
| 195 | + break; |
| 196 | + default: |
| 197 | + } |
| 198 | + } |
| 199 | + |
| 200 | + /** |
180 | 201 | * @see SMWResultPrinter::getParameters |
181 | 202 | * @since 1.7 |
182 | 203 | */ |
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php |
— | — | @@ -48,6 +48,7 @@ |
49 | 49 | if ( !is_numeric( $namespace ) ) { |
50 | 50 | throw new SMWDataItemException( "Given namespace '$namespace' is not an integer." ); |
51 | 51 | } |
| 52 | + |
52 | 53 | $this->m_dbkey = $dbkey; |
53 | 54 | $this->m_namespace = (int)$namespace; // really make this an integer |
54 | 55 | $this->m_interwiki = $interwiki; |