r99851 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99850‎ | r99851 | r99852 >
Date:08:45, 15 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
smw 1.7 compat
Modified paths:
  • /trunk/extensions/SemanticResultFormats/jqPlot/SRF_jqPlotPie.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/jqPlot/SRF_jqPlotPie.php
@@ -7,22 +7,23 @@
88 */
99
1010 class SRFjqPlotPie extends SMWResultPrinter {
11 - protected $m_width = 400;
12 - protected $m_height = 400;
13 - protected $m_charttitle = " ";
14 - static protected $m_piechartnum = 1;
 11+
 12+ protected static $m_piechartnum = 1;
 13+
 14+ protected $m_width;
 15+ protected $m_height;
 16+ protected $m_charttitle;
1517
16 - protected function readParameters( $params, $outputmode ) {
17 - parent::readParameters( $params, $outputmode );
18 - if ( array_key_exists( 'width', $this->m_params ) ) {
19 - $this->m_width = $this->m_params['width'];
20 - }
21 - if ( array_key_exists( 'height', $this->m_params ) ) {
22 - $this->m_height = $this->m_params['height'];
23 - }
24 - if ( array_key_exists( 'charttitle', $this->m_params ) ) {
25 - $this->m_charttitle = $this->m_params['charttitle'];
26 - }
 18+ /**
 19+ * (non-PHPdoc)
 20+ * @see SMWResultPrinter::handleParameters()
 21+ */
 22+ protected function handleParameters( array $params, $outputmode ) {
 23+ parent::handleParameters( $params, $outputmode );
 24+
 25+ $this->m_width = $this->m_params['width'];
 26+ $this->m_height = $this->m_params['height'];
 27+ $this->m_charttitle = $this->m_params['charttitle'];
2728 }
2829
2930 public function getName() {
@@ -164,12 +165,18 @@
165166 }
166167
167168 public function getParameters() {
168 - return array(
169 - array( 'name' => 'limit', 'type' => 'int', 'description' => wfMsg( 'smw_paramdesc_limit' ) ),
170 - array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_chartheight' ) ),
171 - array( 'name' => 'charttitle', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_charttitle' ) ),
172 - array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_chartwidth' ) ),
173 - );
 169+ $params = parent::getParameters();
 170+
 171+ $params['height'] = new Parameter( 'height', Parameter::TYPE_INTEGER, 400 );
 172+ $params['height']->setMessage( 'srf_paramdesc_chartheight' );
 173+
 174+ $params['width'] = new Parameter( 'width', Parameter::TYPE_INTEGER, 400 );
 175+ $params['width']->setMessage( 'srf_paramdesc_chartwidth' );
 176+
 177+ $params['charttitle'] = new Parameter( 'charttitle', Parameter::TYPE_STRING, ' ' );
 178+ $params['charttitle']->setMessage( 'srf_paramdesc_charttitle' );
 179+
 180+ return $params;
174181 }
175182
176183 }