Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
CargoJSONFormat | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
allowedParameters | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
queryAndDisplay | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | /** |
3 | * @author Yaron Koren |
4 | * @ingroup Cargo |
5 | */ |
6 | |
7 | use MediaWiki\Html\Html; |
8 | |
9 | class CargoJSONFormat extends CargoDeferredFormat { |
10 | |
11 | public static function allowedParameters() { |
12 | return [ 'parse values' => [ 'type' => 'boolean' ] ]; |
13 | } |
14 | |
15 | /** |
16 | * @param array $sqlQueries |
17 | * @param array $displayParams Unused |
18 | * @param array|null $querySpecificParams Unused |
19 | * @return string HTML |
20 | */ |
21 | public function queryAndDisplay( $sqlQueries, $displayParams, $querySpecificParams = null ) { |
22 | $ce = SpecialPage::getTitleFor( 'CargoExport' ); |
23 | $queryParams = $this->sqlQueriesToQueryParams( $sqlQueries ); |
24 | $queryParams['format'] = 'json'; |
25 | if ( array_key_exists( 'parse values', $displayParams ) && $displayParams['parse values'] != '' ) { |
26 | $queryParams['parse values'] = $displayParams['parse values']; |
27 | } |
28 | |
29 | $linkAttrs = [ |
30 | 'href' => $ce->getFullURL( $queryParams ), |
31 | ]; |
32 | return Html::element( 'a', $linkAttrs, wfMessage( 'cargo-viewjson' )->text() ); |
33 | } |
34 | |
35 | } |