コード例 #1
0
 /**
  * Displays a value, including all relevant links (browse and search by property)
  *
  * @param[in] $property SMWPropertyValue  The property this value is linked to the subject with
  * @param[in] $value DataValue  The actual value
  * @param[in] $incoming bool  If this is an incoming or outgoing link
  *
  * @return string  HTML with the link to the article, browse, and search pages
  */
 private function displayValue(\SMWPropertyValue $property, DataValue $dataValue, $incoming)
 {
     $linker = smwfGetLinker();
     // Allow the DV formatter to access a specific language code
     $dataValue->setOption(DataValue::OPT_CONTENT_LANGUAGE, Localizer::getInstance()->getPreferredContentLanguage($this->subject->getDataItem())->getCode());
     $dataValue->setOption(DataValue::OPT_USER_LANGUAGE, Localizer::getInstance()->getUserLanguage()->getCode());
     $dataValue->setContextPage($this->subject->getDataItem());
     // Use LOCL formatting where appropriate (date)
     $dataValue->setOutputFormat('LOCL');
     $html = $dataValue->getLongHTMLText($linker);
     if ($dataValue->getTypeID() === '_wpg' || $dataValue->getTypeID() === '__sob') {
         $html .= " " . \SMWInfolink::newBrowsingLink('+', $dataValue->getLongWikiText())->getHTML($linker);
     } elseif ($incoming && $property->isVisible()) {
         $html .= " " . \SMWInfolink::newInversePropertySearchLink('+', $dataValue->getTitle(), $property->getDataItem()->getLabel(), 'smwsearch')->getHTML($linker);
     } elseif ($dataValue->getProperty() instanceof DIProperty && $dataValue->getProperty()->getKey() !== '_INST') {
         $html .= $dataValue->getInfolinkText(SMW_OUTPUT_HTML, $linker);
     }
     return $html;
 }
コード例 #2
0
	/**
	 * Displays a value, including all relevant links (browse and search by property)
	 *
	 * @param[in] $property SMWPropertyValue  The property this value is linked to the subject with
	 * @param[in] $value SMWDataValue  The actual value
	 * @param[in] $incoming bool  If this is an incoming or outgoing link
	 *
	 * @return string  HTML with the link to the article, browse, and search pages
	 */
	private function displayValue( SMWPropertyValue $property, SMWDataValue $dataValue, $incoming ) {
		$linker = smwfGetLinker();

		$html = $dataValue->getLongHTMLText( $linker );

		if ( $dataValue->getTypeID() == '_wpg' ) {
			$html .= " " . SMWInfolink::newBrowsingLink( '+', $dataValue->getLongWikiText() )->getHTML( $linker );
		} elseif ( $incoming && $property->isVisible() ) {
			$html .= " " . SMWInfolink::newInversePropertySearchLink( '+', $dataValue->getTitle(), $property->getDataItem()->getLabel(), 'smwsearch' )->getHTML( $linker );
		} else {
			$html .= $dataValue->getInfolinkText( SMW_OUTPUT_HTML, $linker );
		}

		return $html;
	}