/**
  * 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;
 }
 /**
  * Format $diWikiPages chunked by letter in a table that shows subject
  * articles in one column and object articles/values in the other one.
  *
  * @param $diWikiPages array
  * @return string
  */
 protected function subjectObjectList(array $diWikiPages)
 {
     global $wgContLang, $smwgMaxPropertyValues;
     $ac = count($diWikiPages);
     if ($ac > $this->limit) {
         if ($this->until !== '') {
             $start = 1;
         } else {
             $start = 0;
             $ac = $ac - 1;
         }
     } else {
         $start = 0;
     }
     $r = '<table style="width: 100%; ">';
     $prev_start_char = 'None';
     for ($index = $start; $index < $ac; $index++) {
         $diWikiPage = $diWikiPages[$index];
         $dvWikiPage = DataValueFactory::getInstance()->newDataItemValue($diWikiPage, null);
         $sortkey = $this->store->getWikiPageSortKey($diWikiPage);
         $start_char = $wgContLang->convert($wgContLang->firstChar($sortkey));
         // Header for index letters
         if ($start_char != $prev_start_char) {
             $r .= '<tr><th class="smwpropname"><h3>' . htmlspecialchars($start_char) . "</h3></th><th></th></tr>\n";
             $prev_start_char = $start_char;
         }
         // Property name
         $searchlink = SMWInfolink::newBrowsingLink('+', $dvWikiPage->getShortHTMLText());
         $r .= '<tr><td class="smwpropname">' . $dvWikiPage->getShortHTMLText(smwfGetLinker()) . '&#160;' . $searchlink->getHTML(smwfGetLinker()) . '</td><td class="smwprops">';
         // Property values
         $ropts = new SMWRequestOptions();
         $ropts->limit = $smwgMaxPropertyValues + 1;
         $values = $this->store->getPropertyValues($diWikiPage, $this->mProperty, $ropts);
         $i = 0;
         foreach ($values as $di) {
             if ($i != 0) {
                 $r .= ', ';
             }
             $i++;
             if ($i < $smwgMaxPropertyValues + 1) {
                 $dv = DataValueFactory::getInstance()->newDataItemValue($di, $this->mProperty);
                 $r .= $dv->getShortHTMLText(smwfGetLinker()) . $dv->getInfolinkText(SMW_OUTPUT_HTML, smwfGetLinker());
             } else {
                 $searchlink = SMWInfolink::newInversePropertySearchLink('…', $dvWikiPage->getWikiValue(), $this->mTitle->getText());
                 $r .= $searchlink->getHTML(smwfGetLinker());
             }
         }
         $r .= "</td></tr>\n";
     }
     $r .= '</table>';
     return $r;
 }
	/**
	 * 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 .= "&#160;" . SMWInfolink::newBrowsingLink( '+', $dataValue->getLongWikiText() )->getHTML( $linker );
		} elseif ( $incoming && $property->isVisible() ) {
			$html .= "&#160;" . SMWInfolink::newInversePropertySearchLink( '+', $dataValue->getTitle(), $property->getDataItem()->getLabel(), 'smwsearch' )->getHTML( $linker );
		} else {
			$html .= $dataValue->getInfolinkText( SMW_OUTPUT_HTML, $linker );
		}

		return $html;
	}
 /**
  * Format a list of articles chunked by letter in a table that shows subject articles in
  * one column and object articles/values in the other one.
  */
 private function subjectObjectList()
 {
     global $wgContLang;
     $store = smwfGetStore();
     $ac = count($this->annotations);
     if ($ac > $this->limit) {
         if ($this->until != '') {
             $start = 1;
         } else {
             $start = 0;
             $ac = $ac - 1;
         }
     } else {
         $start = 0;
     }
     $r = '<table style="width: 100%; ">';
     $prev_start_char = 'None';
     for ($index = $start; $index < $ac; $index++) {
         list($article, $values) = $this->annotations[$index];
         $start_char = $wgContLang->convert($wgContLang->firstChar($article->getSortkey()));
         // Header for index letters
         if ($start_char != $prev_start_char) {
             $r .= '<tr><th class="smwpropname"><h3>' . htmlspecialchars($start_char) . "</h3></th><th></th></tr>\n";
             $prev_start_char = $start_char;
         }
         // Property name
         $searchlink = SMWInfolink::newBrowsingLink('+', $article->getShortHTMLText());
         $r .= '<tr><td class="smwpropname">' . $article->getLongHTMLText($this->getSkin()) . '&nbsp;' . $searchlink->getHTML($this->getSkin()) . '</td><td class="smwprops">';
         // Property values
         $ropts = new SMWRequestOptions();
         $ropts->limit = 4;
         for ($i = 0; $i < 4; $i++) {
             if (!array_key_exists($i, $values)) {
                 break;
             }
             $value = $values[$i];
             if ($i != 0) {
                 $r .= ', ';
             }
             if ($i < 3) {
                 $r .= $value->getLongHTMLText($this->getSkin()) . $value->getInfolinkText(SMW_OUTPUT_HTML, $this->getSkin());
             } else {
                 $searchlink = SMWInfolink::newInversePropertySearchLink('&hellip;', $article->getWikiValue(), $this->mTitle->getText());
                 $r .= $searchlink->getHTML($this->getSkin());
             }
         }
         $r .= "</td></tr>\n";
     }
     $r .= '</table>';
     return $r;
 }