Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_ResultArray.php |
— | — | @@ -128,8 +128,22 @@ |
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | if ( $this->mPrintRequest->getMode() == SMWPrintRequest::PRINT_PROP && |
132 | | - ( $this->mPrintRequest->getTypeID() != '_rec' || |
133 | | - $this->mPrintRequest->getParameter( 'index' ) === false ) ) { |
| 132 | + $this->mPrintRequest->getTypeID() == '_rec' && |
| 133 | + $this->mPrintRequest->getParameter( 'index' ) !== false ) { |
| 134 | + // Not efficient, but correct: we need to find the right property for |
| 135 | + // the selected index of the record here. |
| 136 | + $pos = $this->mPrintRequest->getParameter( 'index' ) - 1; |
| 137 | + $recordValue = SMWDataValueFactory::newDataItemValue( $di, |
| 138 | + $this->mPrintRequest->getData()->getDataItem() ); |
| 139 | + $diProperties = $recordValue->getPropertyDataItems(); |
| 140 | + |
| 141 | + if ( array_key_exists( $pos, $diProperties ) && |
| 142 | + !is_null( $diProperties[$pos] ) ) { |
| 143 | + $diProperty = $diProperties[$pos]; |
| 144 | + } else { |
| 145 | + $diProperty = null; |
| 146 | + } |
| 147 | + } elseif ( $this->mPrintRequest->getMode() == SMWPrintRequest::PRINT_PROP ) { |
134 | 148 | $diProperty = $this->mPrintRequest->getData()->getDataItem(); |
135 | 149 | } else { |
136 | 150 | $diProperty = null; |