Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php |
— | — | @@ -229,6 +229,13 @@ |
230 | 230 | |
231 | 231 | public function getDataItemSerialization( SMWDataItem $dataItem ) { |
232 | 232 | switch ( $dataItem->getDIType() ) { |
| 233 | + case SMWDataItem::TYPE_WIKIPAGE: |
| 234 | + $title = $dataItem->getTitle(); |
| 235 | + $result = array( |
| 236 | + 'fulltext' => $title->getFullText(), |
| 237 | + 'fullurl' => $title->getFullUrl(), |
| 238 | + ); |
| 239 | + break; |
233 | 240 | case SMWDataItem::TYPE_NUMBER: |
234 | 241 | $result = $dataItem->getNumber(); |
235 | 242 | break; |
— | — | @@ -248,7 +255,16 @@ |
249 | 256 | |
250 | 257 | public function serializeToArray() { |
251 | 258 | $results = array(); |
| 259 | + $printRequests = array(); |
252 | 260 | |
| 261 | + foreach ( $this->mPrintRequests as /* SMWPrintRequest */ $printRequest ) { |
| 262 | + $printRequests[] = array( |
| 263 | + 'label' => $printRequest->getLabel(), |
| 264 | + 'typeid' => $printRequest->getTypeID(), |
| 265 | + 'mode' => $printRequest->getMode(), |
| 266 | + ); |
| 267 | + } |
| 268 | + |
253 | 269 | foreach ( $this->mResults as /* SMWDIWikiPage */ $diWikiPage ) { |
254 | 270 | $result = array(); |
255 | 271 | |
— | — | @@ -264,7 +280,7 @@ |
265 | 281 | $results[$diWikiPage->getTitle()->getFullText()] = $result; |
266 | 282 | } |
267 | 283 | |
268 | | - return $results; |
| 284 | + return array( 'results' => $results, 'printrequests' => $printRequests ); |
269 | 285 | } |
270 | 286 | |
271 | 287 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | protected function addQueryResult( SMWQueryResult $queryResult ) { |
59 | 59 | // TODO: create general SMWQueryResult serialization method that can then also be used for JSON printer |
60 | | - $this->getResult()->addValue( 'result', null, $queryResult->serializeToArray() ); |
| 60 | + $this->getResult()->addValue( 'query', null, $queryResult->serializeToArray() ); |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function getPossibleErrors() { |