protected function deliverPropertiesManyValues($manyValue_items, $isMissingProperty, $isPageTitle, SMWResultArray $data) { if (empty($manyValue_items)) { return null; } $text = implode($this->mManySep, $manyValue_items); // if property names should be displayed and this is not the page titles value: if ($this->mShowHeaders != SMW_HEADERS_HIDE && !$isPageTitle) { $linker = $this->mShowHeaders == SMW_HEADERS_PLAIN ? null : $this->mLinker; $text = $data->getPrintRequest()->getText(SMW_OUTPUT_WIKI, $linker) . $this->mHeaderSep . $text; } return $text; }
/** * Code mostly copied from SMW's SMWListResultPrinter::getResultText() */ function printItem( $item ) { $first_col = true; $found_values = false; // has anything but the first column been printed? $result = ""; foreach ( $item->mRow as $orig_ra ) { // handling is somewhat simpler for SMW 1.5+ $realFunction = array( 'SMWQueryResult', 'getResults' ); if ( is_callable( $realFunction ) ) { // make a new copy of this, so that the call to // getNextText() will work again $ra = clone ( $orig_ra ); } else { // make a new copy of this, so that the call to // getNextText() will work again $ra = new SMWResultArray( $orig_ra->getContent(), $orig_ra->getPrintRequest() ); } $val = $ra->getPrintRequest()->getText( SMW_OUTPUT_WIKI, null ); if ( in_array( $val, $this->mOutlineProperties ) ) { continue; } $first_value = true; while ( ( $text = $ra->getNextText( SMW_OUTPUT_WIKI, $this->mLinker ) ) !== 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->mShowHeaders && ( '' != $ra->getPrintRequest()->getLabel() ) ) { $result .= $ra->getPrintRequest()->getText( SMW_OUTPUT_WIKI, $this->mLinker ) . ' '; } } $result .= $text; // actual output value } $first_col = false; } if ( $found_values ) $result .= ')'; return $result; }
/** * Gets a table cell for all values of a property of a subject. * * @since 1.6.1 * * @param SMWResultArray $resultArray * @param $outputmode * * @return string */ protected function getCellForPropVals(SMWResultArray $resultArray, $outputmode, $columnClass) { $resultArray->reset(); $dataValues = array(); while (($dv = $resultArray->getNextDataValue()) !== false) { $dataValues[] = $dv; } $attribs = array(); $content = null; if (count($dataValues) > 0) { $sortkey = $dataValues[0]->getDataItem()->getSortKey(); if (is_numeric($sortkey)) { $attribs['data-sort-value'] = $sortkey; } $alignment = trim($resultArray->getPrintRequest()->getParameter('align')); if (in_array($alignment, array('right', 'left', 'center'))) { $attribs['style'] = "text-align:' . {$alignment} . ';"; } $attribs['class'] = $columnClass; $content = $this->getCellContent($dataValues, $outputmode, $resultArray->getPrintRequest()->getMode() == SMWPrintRequest::PRINT_THIS); } return Html::rawElement('td', $attribs, $content); }