diff options
Diffstat (limited to 'www/wiki/extensions/SemanticResultFormats/formats/dygraphs/SRF_Dygraphs.php')
-rw-r--r-- | www/wiki/extensions/SemanticResultFormats/formats/dygraphs/SRF_Dygraphs.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/www/wiki/extensions/SemanticResultFormats/formats/dygraphs/SRF_Dygraphs.php b/www/wiki/extensions/SemanticResultFormats/formats/dygraphs/SRF_Dygraphs.php index 28a91508..02ca3f1b 100644 --- a/www/wiki/extensions/SemanticResultFormats/formats/dygraphs/SRF_Dygraphs.php +++ b/www/wiki/extensions/SemanticResultFormats/formats/dygraphs/SRF_Dygraphs.php @@ -90,27 +90,29 @@ class SRFDygraphs extends SMWResultPrinter { while ( ( $dataValue = $field->getNextDataValue() ) !== false ) { // Data values // Jump the column (indicated by continue) because we don't want the data source being part of the annotation array - if ( $dataValue->getDataItem()->getDIType( - ) == SMWDataItem::TYPE_WIKIPAGE && $this->params['datasource'] === 'raw' && !$dataSource ) { + $dataItem = $dataValue->getDataItem(); + + if ( $dataItem->getDIType() === SMWDataItem::TYPE_WIKIPAGE ) { + $title = $dataItem->getTitle(); + } + + if ( $dataItem->getDIType() == SMWDataItem::TYPE_WIKIPAGE && $this->params['datasource'] === 'raw' && !$dataSource ) { // Support data source = raw which pulls the url from a wikipage in raw format $aggregatedValues['subject'] = $this->makePageFromTitle( - $dataValue->getTitle() + $title )->getLongHTMLText( $this->getLinker( $field->getResultSubject() ) ); - $aggregatedValues['url'] = $dataValue->getTitle()->getLocalURL( 'action=raw' ); + $aggregatedValues['url'] = $title->getLocalURL( 'action=raw' ); $dataSource = true; continue; - } elseif ( $dataValue->getDataItem()->getDIType( - ) == SMWDataItem::TYPE_WIKIPAGE && $this->params['datasource'] === 'file' && $dataValue->getTitle( - )->getNamespace() === NS_FILE && !$dataSource ) { + } elseif ( $dataItem->getDIType() == SMWDataItem::TYPE_WIKIPAGE && $this->params['datasource'] === 'file' && $title->getNamespace() === NS_FILE && !$dataSource ) { // Support data source = file which pulls the url from a uploaded file $aggregatedValues['subject'] = $this->makePageFromTitle( - $dataValue->getTitle() + $title )->getLongHTMLText( $this->getLinker( $field->getResultSubject() ) ); - $aggregatedValues['url'] = wfFindFile( $dataValue->getTitle() )->getUrl(); + $aggregatedValues['url'] = wfFindFile( $title )->getUrl(); $dataSource = true; continue; - } elseif ( $dataValue->getDataItem()->getDIType( - ) == SMWDataItem::TYPE_URI && $this->params['datasource'] === 'url' && !$dataSource ) { + } elseif ( $dataItem->getDIType() == SMWDataItem::TYPE_URI && $this->params['datasource'] === 'url' && !$dataSource ) { // Support data source = url, pointing to an url data source $aggregatedValues['link'] = $dataValue->getShortHTMLText( $this->getLinker( false ) ); $aggregatedValues['url'] = $dataValue->getURL(); @@ -125,7 +127,7 @@ class SRFDygraphs extends SMWResultPrinter { // text -> A longer description of the annotation // @see http://dygraphs.com/annotations.html if ( in_array( $propertyLabel, [ 'series', 'x', 'shortText', 'text' ] ) ) { - if ( $dataValue->getDataItem()->getDIType() == SMWDataItem::TYPE_NUMBER ) { + if ( $dataItem->getDIType() == SMWDataItem::TYPE_NUMBER ) { // Set unit if available $dataValue->setOutputFormat( $this->params['unit'] ); // Check if unit is available @@ -325,4 +327,4 @@ class SRFDygraphs extends SMWResultPrinter { return $params; } -}
\ No newline at end of file +} |