Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php |
— | — | @@ -42,6 +42,12 @@ |
43 | 43 | */ |
44 | 44 | public function __construct( $format, $inline, iMappingService $service ) { |
45 | 45 | $this->service = $service; |
| 46 | + |
| 47 | + parent::__construct( $format, $inline ); |
| 48 | + |
| 49 | + if ( property_exists( $this, 'useValidator' ) ) { |
| 50 | + $this->useValidator = true; |
| 51 | + } |
46 | 52 | } |
47 | 53 | |
48 | 54 | /** |
— | — | @@ -323,26 +329,32 @@ |
324 | 330 | public function getParameters() { |
325 | 331 | $params = parent::getParameters(); |
326 | 332 | |
327 | | - // Now go through the descriptions, and convert them from Validator- to SMW-style. |
328 | | - foreach ( $this->getParameterInfo() as $paramDesc ) { |
329 | | - $param = array( |
330 | | - 'name' => $paramDesc->getName(), |
331 | | - 'type' => $this->getMappedParamType( $paramDesc->getType() ), |
332 | | - 'description' => $paramDesc->getDescription() ? $paramDesc->getDescription() : '', |
333 | | - 'default' => $paramDesc->isRequired() ? '' : $paramDesc->getDefault() |
334 | | - ); |
335 | | - |
336 | | - foreach ( $paramDesc->getCriteria() as $criterion ) { |
337 | | - if ( $criterion instanceof CriterionInArray ) { |
338 | | - $param['values'] = $criterion->getAllowedValues(); |
339 | | - $param['type'] = $paramDesc->isList() ? 'enum-list' : 'enumeration'; |
340 | | - break; |
341 | | - } |
342 | | - } |
| 333 | + if ( version_compare( SMW_VERSION, '1.6', '<' ) ) { |
| 334 | + // Go through the descriptions, and convert them from Validator- to SMW-style. |
| 335 | + // This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects. |
| 336 | + foreach ( $this->getParameterInfo() as $paramDesc ) { |
| 337 | + $param = array( |
| 338 | + 'name' => $paramDesc->getName(), |
| 339 | + 'type' => $this->getMappedParamType( $paramDesc->getType() ), |
| 340 | + 'description' => $paramDesc->getDescription() ? $paramDesc->getDescription() : '', |
| 341 | + 'default' => $paramDesc->isRequired() ? '' : $paramDesc->getDefault() |
| 342 | + ); |
| 343 | + |
| 344 | + foreach ( $paramDesc->getCriteria() as $criterion ) { |
| 345 | + if ( $criterion instanceof CriterionInArray ) { |
| 346 | + $param['values'] = $criterion->getAllowedValues(); |
| 347 | + $param['type'] = $paramDesc->isList() ? 'enum-list' : 'enumeration'; |
| 348 | + break; |
| 349 | + } |
| 350 | + } |
| 351 | + |
| 352 | + $params[] = $param; |
| 353 | + } |
| 354 | + } |
| 355 | + else { |
| 356 | + $params = array_merge( $params, $this->getParameterInfo() ); |
| 357 | + } |
343 | 358 | |
344 | | - $params[] = $param; |
345 | | - } |
346 | | - |
347 | 359 | return $params; |
348 | 360 | } |
349 | 361 | |