params = $params; } /** * @since 3.1 * * @param Linker|null|false $linker */ public function setLinker( $linker ) { $this->linker = $linker; } /** * @since 3.1 * * @param OutlineTree $tree * * @return string */ public function build( OutlineTree $outlineTree ) { return $this->tree( $outlineTree ); } private function tree( $outline_tree, $level = 0 ) { $text = ""; if ( !is_null( $outline_tree->items ) ) { $text .= "\n"; } if ( $level > 0 ) { $text .= "\n"; } return $text; } private function item( $item ) { $first_col = true; $found_values = false; // has anything but the first column been printed? $result = ""; foreach ( $item->row as $resultArray ) { $printRequest = $resultArray->getPrintRequest(); $val = $printRequest->getText( SMW_OUTPUT_WIKI, null ); $first_value = true; if ( in_array( $val, $this->params['outlineproperties'] ) ) { continue; } $linker = $this->params['link'] === 'all' ? $this->linker : null; if ( $this->params['link'] === 'subject' && $printRequest->isMode( PrintRequest::PRINT_THIS ) ) { $linker = $this->linker; } while ( ( $dv = $resultArray->getNextDataValue() ) !== false ) { if ( !$first_col && !$found_values ) { // first values after first column $result .= ' ('; $found_values = true; } elseif ( $found_values || !$first_value ) { // any value after '(' or non-first values on first column $result .= ', '; } if ( $first_value ) { // first value in any column, print header $first_value = false; if ( $this->params['showHeaders'] && ( '' != $printRequest->getLabel() ) ) { $result .= $printRequest->getText( SMW_OUTPUT_WIKI, $linker ) . ' '; } } $dataItem = $dv->getDataItem(); if ( $linker === null && $dataItem->getDIType() === DataItem::TYPE_WIKIPAGE && ( $caption = $dv->getDisplayTitle() ) !== '' ) { $dv->setCaption( $caption ); } $result .= $dv->getShortText( SMW_OUTPUT_WIKI, $linker ); } $first_col = false; } if ( $found_values ) { $result .= ')'; } return $result; } }