Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php |
— | — | @@ -66,44 +66,31 @@ |
67 | 67 | protected $m_parentRelation; |
68 | 68 | protected $m_wordWrapLimit = 25; |
69 | 69 | |
70 | | - protected function readParameters( $params, $outputmode ) { |
71 | | - parent::readParameters( $params, $outputmode ); |
72 | | - |
73 | | - if ( array_key_exists( 'graphname', $params ) ) { |
74 | | - $this->m_graphName = trim( $params['graphname'] ); |
75 | | - } |
| 70 | + /** |
| 71 | + * (non-PHPdoc) |
| 72 | + * @see SMWResultPrinter::handleParameters() |
| 73 | + */ |
| 74 | + protected function handleParameters( array $params, $outputmode ) { |
| 75 | + parent::handleParameters( $params, $outputmode ); |
76 | 76 | |
77 | | - if ( array_key_exists( 'graphsize', $params ) ) { |
78 | | - $this->m_graphSize = trim( $params['graphsize'] ); |
79 | | - } |
| 77 | + $this->m_graphName = trim( $params['graphname'] ); |
| 78 | + $this->m_graphSize = trim( $params['graphsize'] ); |
80 | 79 | |
81 | | - $this->m_graphLegend = array_key_exists( 'graphlegend', $params ) && strtolower( trim( $params['graphlegend'] ) ) == 'yes'; |
82 | | - $this->m_graphLabel = array_key_exists( 'graphlabel', $params ) && strtolower( trim( $params['graphlabel'] ) ) == 'yes'; |
83 | | - |
84 | | - if ( array_key_exists( 'arrowdirection', $params ) ) { |
85 | | - $params['rankdir'] = $params['arrowdirection']; |
86 | | - } |
| 80 | + $this->m_graphLegend = $params['graphlegend']; |
| 81 | + $this->m_graphLabel = $params['graphlabel']; |
87 | 82 | |
88 | | - if ( array_key_exists( 'rankdir', $params ) ) { |
89 | | - $this->m_rankdir = strtoupper( trim( $params['rankdir'] ) ); |
90 | | - } |
| 83 | + $params['rankdir'] = $params['arrowdirection']; // TODO |
| 84 | + $this->m_rankdir = strtoupper( trim( $params['rankdir'] ) ); |
91 | 85 | |
92 | | - $this->m_graphLink = array_key_exists( 'graphlink', $params ) && strtolower( trim( $params['graphlink'] ) ) == 'yes'; |
93 | | - $this->m_graphColor = array_key_exists( 'graphcolor', $params ) && strtolower( trim( $params['graphcolor'] ) ) == 'yes'; |
| 86 | + $this->m_graphLink = $params['graphlink']; |
| 87 | + $this->m_graphColor =$params['graphcolor']; |
94 | 88 | |
95 | | - if ( array_key_exists( 'nameproperty', $params ) ) { |
96 | | - $this->m_nameProperty = trim( $params['nameproperty'] ); |
97 | | - } |
| 89 | + $this->m_nameProperty = trim( $params['nameproperty'] ); |
98 | 90 | |
99 | | - $this->m_parentRelation = array_key_exists( 'relation', $params ) && strtolower( trim( $params['relation'] ) ) == 'parent'; |
| 91 | + $this->m_parentRelation = strtolower( trim( $params['relation'] ) ) == 'parent'; |
100 | 92 | |
101 | | - if ( array_key_exists( 'nodeshape', $params ) && in_array( trim( $params['nodeshape'] ), self::$NODE_SHAPES ) ) { |
102 | | - $this->m_nodeShape = trim( $params['nodeshape'] ); |
103 | | - } |
104 | | - |
105 | | - if ( array_key_exists( 'wordwraplimit', $params ) && is_int( $params['wordwraplimit'] ) ) { |
106 | | - $this->m_wordWrapLimit = (int)$params['wordwraplimit']; |
107 | | - } |
| 93 | + $this->m_nodeShape = $params['nodeshape']; |
| 94 | + $this->m_wordWrapLimit = $params['wordwraplimit']; |
108 | 95 | } |
109 | 96 | |
110 | 97 | protected function getResultText( SMWQueryResult $res, $outputmode ) { |
— | — | @@ -290,9 +277,18 @@ |
291 | 278 | } |
292 | 279 | |
293 | 280 | public function getParameters() { |
| 281 | + $params = parent::getParameters(); |
| 282 | + |
| 283 | + $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, '' ); |
| 284 | + $params['graphname']->setMessage( 'srf_paramdesc_graphname' ); |
| 285 | + |
| 286 | + $params['graphsize'] = new Parameter( 'graphsize', Parameter::TYPE_INTEGER ); |
| 287 | + $params['graphsize']->setMessage( 'srf_paramdesc_graphsize' ); |
| 288 | + $params['graphsize']->setDefault( '', false ); |
| 289 | + |
| 290 | + return $params; // TODO |
| 291 | + |
294 | 292 | return array( |
295 | | - array( 'name' => 'graphname', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_graphname' ) ), |
296 | | - array( 'name' => 'graphsize', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_graphsize' ) ), |
297 | 293 | array( 'name' => 'graphlegend', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlegend' ), 'values'=> array( 'yes', 'no' ) ), |
298 | 294 | array( 'name' => 'graphlabel', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlabel' ), 'values'=> array( 'yes', 'no' ) ), |
299 | 295 | array( 'name' => 'arrowdirection', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_rankdir' ) ), |