コード例 #1
0
ファイル: SM_QueryHandler.php プロジェクト: Tjorriemorrie/app
 /**
  * Handles a single property (SMWPrintRequest) to be displayed for a record (SMWDataValue).
  *
  * @since 1.0
  *
  * @param SMWDataValue $object
  * @param SMWPrintRequest $printRequest
  *
  * @return string
  */
 protected function handleResultProperty(SMWDataValue $object, SMWPrintRequest $printRequest)
 {
     if ($this->template) {
         if ($object instanceof SMWWikiPageValue) {
             return $object->getTitle()->getPrefixedText();
         } else {
             return $object->getLongText(SMW_OUTPUT_WIKI, NULL);
         }
     }
     if ($this->linkAbsolute) {
         $t = Title::newFromText($printRequest->getHTMLText(NULL), SMW_NS_PROPERTY);
         if ($t instanceof Title && $t->exists()) {
             $propertyName = $propertyName = Html::element('a', array('href' => $t->getFullUrl()), $printRequest->getHTMLText(NULL));
         } else {
             $propertyName = $printRequest->getHTMLText(NULL);
         }
     } else {
         $propertyName = $printRequest->getHTMLText(smwfGetLinker());
     }
     if ($this->linkAbsolute) {
         $hasPage = $object->getTypeID() == '_wpg';
         if ($hasPage) {
             $t = Title::newFromText($object->getLongText($this->outputmode, NULL), NS_MAIN);
             $hasPage = $t->exists();
         }
         if ($hasPage) {
             $propertyValue = Html::element('a', array('href' => $t->getFullUrl()), $object->getLongText($this->outputmode, NULL));
         } else {
             $propertyValue = $object->getLongText($this->outputmode, NULL);
         }
     } else {
         $propertyValue = $object->getLongText($this->outputmode, smwfGetLinker());
     }
     return $propertyName . ($propertyName === '' ? '' : ': ') . $propertyValue;
 }