Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Process.php |
— | — | @@ -59,100 +59,67 @@ |
60 | 60 | // internal variables |
61 | 61 | protected $m_process; // process to be rendered |
62 | 62 | |
63 | | - |
64 | 63 | /** |
65 | | - * This method is called before rendering the output to push |
66 | | - * the parameters for result formatting to the printer |
67 | | - * |
68 | | - * @param params array of parameters provided for the ask-query |
69 | | - * @param outputmode ? |
70 | | - * @return void |
71 | | - * |
| 64 | + * (non-PHPdoc) |
| 65 | + * @see SMWResultPrinter::handleParameters() |
72 | 66 | */ |
73 | | - protected function readParameters( $params, $outputmode ) { |
74 | | - |
75 | | - parent::readParameters( $params, $outputmode ); |
76 | | - |
| 67 | + protected function handleParameters( array $params, $outputmode ) { |
| 68 | + parent::handleParameters( $params, $outputmode ); |
| 69 | + |
77 | 70 | // init process graph instance |
78 | 71 | $this->m_process = new ProcessGraph(); |
79 | | - |
80 | | - // process configuration |
81 | | - |
82 | | - if ( array_key_exists( 'graphname', $params ) ) { |
83 | | - $this->m_process->setGraphName( trim( $params['graphname'] ) ); |
84 | | - } |
85 | | - |
86 | | - if ( array_key_exists( 'graphsize', $params ) ) { |
87 | | - $this->m_process->setGraphSize( trim( $params['graphsize'] ) ); |
88 | | - } |
89 | | - |
90 | | - if ( array_key_exists( 'clustercolor', $params ) ) { |
91 | | - $this->m_process->setClusterColor( trim( $params['clustercolor'] ) ); |
92 | | - } |
93 | | - |
94 | | - if ( array_key_exists( 'rankdir', $params ) ) { |
95 | | - $this->m_process->setRankdir( strtoupper( trim( $params['rankdir'] ) ) ); |
96 | | - } |
97 | | - |
98 | | - if ( array_key_exists( 'showroles', $params ) ) { |
99 | | - if ( self::isTrue( $params['showroles'] ) ) $this->m_process->setShowRoles( true ); |
100 | | - } |
101 | | - |
102 | | - if ( array_key_exists( 'showstatus', $params ) ) { |
103 | | - if ( self::isTrue( $params['showstatus'] ) ) $this->m_process->setShowStatus( true ); |
104 | | - } |
105 | | - |
106 | | - if ( array_key_exists( 'showresources', $params ) ) { |
107 | | - if ( self::isTrue( $params['showresources'] ) ) $this->m_process->setShowRessources( true ); |
108 | | - } |
109 | | - |
110 | | - if ( array_key_exists( 'highlight', $params ) ) { |
111 | | - $this->m_process->setHighlightNode( trim( $params['highlight'] ) ); |
112 | | - } |
113 | | - |
114 | | - if ( array_key_exists( 'highlightcolor', $params ) ) { |
115 | | - $this->m_process->setHighlightColor( trim( $params['highlightcolor'] ) ); |
116 | | - } |
117 | | - |
118 | | - if (array_key_exists('showdiscussion', $params)) { |
119 | | - if (self::isTrue($params['showdiscussion'])) $this->m_process->setShowDiscussion(true); |
120 | | - } |
121 | | - |
122 | | - if ( array_key_exists( 'redlinkcolor', $params ) ) { |
123 | | - $this->m_process->setHighlightColor( trim( $params['redlinkcolor'] ) ); |
124 | | - } |
125 | | - |
126 | | - if ( array_key_exists( 'showredlinks', $params ) ) { |
127 | | - if ( self::isTrue( $params['showredlinks'] ) ) $this->m_process->setShowRedLinks( true ); |
128 | | - } |
129 | | - |
130 | | - if ( array_key_exists( 'showcompound', $params ) ) { |
131 | | - if ( self::isTrue( $params['showcompound'] ) ) $this->m_process->setShowCompound( true ); |
132 | | - } |
133 | | - |
134 | | - // method configuration |
135 | | - |
136 | | - if ( array_key_exists( 'debug', $params ) ) { |
137 | | - if ( self::isTrue( $params['debug'] ) ) $this->m_isDebugSet = true; |
138 | | - } |
139 | | - |
140 | | - if ( array_key_exists( 'graphvalidation', $params ) ) { |
141 | | - if ( self::isTrue( $params['graphvalidation'] ) ) $this->m_graphValidation = true; |
142 | | - } |
143 | | - |
144 | | - if ( array_key_exists( 'processcat', $params ) ) { |
145 | | - $this->m_processCategory = $params['processcat']; |
146 | | - } |
147 | | - |
| 72 | + |
| 73 | + $this->m_process->setGraphName( trim( $params['graphname'] ) ); |
| 74 | + $this->m_process->setGraphSize( trim( $params['graphsize'] ) ); |
| 75 | + $this->m_process->setClusterColor( trim( $params['clustercolor'] ) ); |
| 76 | + $this->m_process->setRankdir( strtoupper( trim( $params['rankdir'] ) ) ); |
| 77 | + $this->m_process->setHighlightNode( trim( $params['highlight'] ) ); |
| 78 | + $this->m_process->setHighlightColor( trim( $params['highlightcolor'] ) ); |
| 79 | + $this->m_process->setHighlightColor( trim( $params['redlinkcolor'] ) ); |
| 80 | + |
| 81 | + $this->m_process->setShowRoles( $params['showroles'] ); |
| 82 | + $this->m_process->setShowStatus( $params['showstatus'] ); |
| 83 | + $this->m_process->setShowRessources( $params['showresources'] ); |
| 84 | + $this->m_process->setShowDiscussion( $params['showdiscussion'] ); |
| 85 | + $this->m_process->setShowRedLinks( $params['showredlinks'] ); |
| 86 | + $this->m_process->setShowCompound( $params['showcompound'] ); |
| 87 | + |
| 88 | + $this->m_processCategory = $params['processcat']; |
| 89 | + $this->m_isDebugSet = $params['debug']; |
| 90 | + $this->m_graphValidation = $params['graphvalidation']; |
148 | 91 | } |
149 | | - |
150 | | - public static function isTrue( $value ) { |
151 | | - $res = false; |
152 | | - if ( ( strtolower( trim( $value ) ) == 'yes' ) || ( strtolower( trim( $value ) ) == 'true' ) ) $res = true; |
153 | | - return $res; |
| 92 | + |
| 93 | + /** |
| 94 | + * (non-PHPdoc) |
| 95 | + * @see SMWResultPrinter::getParameters() |
| 96 | + * |
| 97 | + * TODO: add messages and criteria |
| 98 | + */ |
| 99 | + public function getParameters() { |
| 100 | + $params = parent::getParameters(); |
| 101 | + |
| 102 | + $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, '' ); |
| 103 | + $params['rankdir'] = new Parameter( 'rankdir', Parameter::TYPE_STRING, 'TB' ); |
| 104 | + $params['graphsize'] = new Parameter( 'graphsize', Parameter::TYPE_STRING, '' ); |
| 105 | + $params['clustercolor'] = new Parameter( 'clustercolor', Parameter::TYPE_STRING, 'lightgrey' ); |
| 106 | + $params['highlight'] = new Parameter( 'highlight', Parameter::TYPE_STRING, '' ); |
| 107 | + $params['highlightcolor'] = new Parameter( 'highlightcolor', Parameter::TYPE_STRING, 'blue' ); |
| 108 | + $params['redlinkcolor'] = new Parameter( 'redlinkcolor', Parameter::TYPE_STRING, 'red' ); |
| 109 | + |
| 110 | + $params['showroles'] = new Parameter( 'showroles', Parameter::TYPE_BOOLEAN, false ); |
| 111 | + $params['showstatus'] = new Parameter( 'showstatus', Parameter::TYPE_BOOLEAN, false ); |
| 112 | + $params['showresources'] = new Parameter( 'showresources', Parameter::TYPE_BOOLEAN, false ); |
| 113 | + $params['showdiscussion'] = new Parameter( 'showdiscussion', Parameter::TYPE_BOOLEAN, false ); |
| 114 | + $params['showredlinks'] = new Parameter( 'showredlinks', Parameter::TYPE_BOOLEAN, false ); |
| 115 | + $params['showcompound'] = new Parameter( 'showcompound', Parameter::TYPE_BOOLEAN, true ); |
| 116 | + |
| 117 | + $params['processcat'] = new Parameter( 'processcat', Parameter::TYPE_STRING, 'Process' ); |
| 118 | + $params['debug'] = new Parameter( 'debug', Parameter::TYPE_BOOLEAN, false ); |
| 119 | + $params['graphvalidation'] = new Parameter( 'graphvalidation', Parameter::TYPE_BOOLEAN, false ); |
| 120 | + |
| 121 | + return $params; |
154 | 122 | } |
155 | 123 | |
156 | | - |
157 | 124 | /** |
158 | 125 | * This method renders the result set provided by SMW according to the printer |
159 | 126 | * |