Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 26 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
CargoBPMNFormat | |
0.00% |
0 / 26 |
|
0.00% |
0 / 2 |
72 | |
0.00% |
0 / 1 |
allowedParameters | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
queryAndDisplay | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
56 |
1 | <?php |
2 | /** |
3 | * @author Yaron Koren |
4 | * @ingroup Cargo |
5 | */ |
6 | |
7 | class CargoBPMNFormat extends CargoDeferredFormat { |
8 | |
9 | public static function allowedParameters() { |
10 | return [ |
11 | 'height' => [ 'type' => 'int', 'label' => wfMessage( 'cargo-viewdata-heightparam' )->parse() ], |
12 | 'width' => [ 'type' => 'int', 'label' => wfMessage( 'cargo-viewdata-widthparam' )->parse() ], |
13 | ]; |
14 | } |
15 | |
16 | /** |
17 | * @param array $sqlQueries |
18 | * @param array $displayParams |
19 | * @param array|null $querySpecificParams |
20 | * @return string HTML |
21 | */ |
22 | public function queryAndDisplay( $sqlQueries, $displayParams, $querySpecificParams = null ) { |
23 | $this->mOutput->addModules( [ 'ext.cargo.bpmn' ] ); |
24 | $ce = SpecialPage::getTitleFor( 'CargoExport' ); |
25 | $queryParams = $this->sqlQueriesToQueryParams( $sqlQueries ); |
26 | $queryParams['format'] = 'bpmn'; |
27 | |
28 | if ( array_key_exists( 'height', $displayParams ) && $displayParams['height'] != '' ) { |
29 | $height = $displayParams['height']; |
30 | // Add on "px", if no unit is defined. |
31 | if ( is_numeric( $height ) ) { |
32 | $height .= "px"; |
33 | } |
34 | } else { |
35 | $height = "350px"; |
36 | } |
37 | if ( array_key_exists( 'width', $displayParams ) && $displayParams['width'] != '' ) { |
38 | $width = $displayParams['width']; |
39 | // Add on "px", if no unit is defined. |
40 | if ( is_numeric( $width ) ) { |
41 | $width .= "px"; |
42 | } |
43 | } else { |
44 | $width = "100%"; |
45 | } |
46 | |
47 | $attrs = [ |
48 | 'id' => 'canvas', |
49 | 'class' => 'cargoBPMN', |
50 | 'dataurl' => $ce->getFullURL( $queryParams ), |
51 | 'style' => "height: $height; width: $width; border: 1px solid #aaa;" |
52 | ]; |
53 | |
54 | $text = Html::rawElement( 'div', $attrs, '' ); |
55 | |
56 | return $text; |
57 | } |
58 | |
59 | } |