當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataValueFactory::newDataValueByItem方法代碼示例

本文整理匯總了PHP中SMW\DataValueFactory::newDataValueByItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataValueFactory::newDataValueByItem方法的具體用法?PHP DataValueFactory::newDataValueByItem怎麽用?PHP DataValueFactory::newDataValueByItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SMW\DataValueFactory的用法示例。


在下文中一共展示了DataValueFactory::newDataValueByItem方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTableContent

 /**
  * Renders table content for a given SMWSemanticData object
  *
  * @since 1.9
  *
  * @param SMWSemanticData $semanticData
  */
 protected function getTableContent(SemanticData $semanticData)
 {
     // Do exclude some tags from processing otherwise the display
     // can become distorted due to unresolved/open tags (see Bug 23185)
     $excluded = array('table', 'tr', 'th', 'td', 'dl', 'dd', 'ul', 'li', 'ol', 'b', 'sub');
     $attributes = array();
     foreach ($semanticData->getProperties() as $propertyDi) {
         $propertyDv = $this->dataValueFactory->newDataValueByItem($propertyDi, null);
         if (!$propertyDi->isShown()) {
             // showing this is not desired, hide
             continue;
         } elseif ($propertyDi->isUserDefined()) {
             // User defined property (@note the preg_replace is a slight
             // hack to ensure that the left column does not get too narrow)
             $propertyDv->setCaption(preg_replace('/[ ]/u', ' ', $propertyDv->getWikiValue(), 2));
             $attributes['property'] = array('class' => 'smwpropname');
             $attributes['values'] = array('class' => 'smwprops');
         } elseif ($propertyDv->isVisible()) {
             // Predefined property
             $attributes['property'] = array('class' => 'smwspecname');
             $attributes['values'] = array('class' => 'smwspecs');
         } else {
             // predefined, internal property
             // @codeCoverageIgnoreStart
             continue;
             // @codeCoverageIgnoreEnd
         }
         $valuesHtml = array();
         foreach ($semanticData->getPropertyValues($propertyDi) as $dataItem) {
             $dataValue = $this->dataValueFactory->newDataValueByItem($dataItem, $propertyDi);
             $dataValue->setOutputFormat('LOCL');
             $dataValue->disableServiceLinks();
             if ($dataValue->isValid()) {
                 $valuesHtml[] = Sanitizer::removeHTMLtags($dataValue->getLongWikiText(true), null, array(), array(), $excluded) . $this->getInfolink($dataValue);
             }
         }
         // Invoke table content
         $this->htmlTableRenderer->addCell($propertyDv->getShortWikiText(true), $attributes['property']);
         $this->htmlTableRenderer->addCell($this->messageBuilder->listToCommaSeparatedText($valuesHtml), $attributes['values']);
         $this->htmlTableRenderer->addRow();
     }
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:49,代碼來源:Factbox.php

示例2: getLocatedInValue

 /**
  * @since 2.1
  *
  * @return DataValue
  */
 public function getLocatedInValue()
 {
     $locatedInProperty = new LocatedInProperty();
     return $this->dataValueFactory->newDataValueByItem(new DIWikiPage('France', NS_MAIN), $locatedInProperty->getProperty());
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:10,代碼來源:ParisFactsheet.php

示例3: defineElementsForImportDataItem

 private function defineElementsForImportDataItem(DataItem $dataItem)
 {
     $importValue = $this->dataValueFactory->newDataValueByItem($dataItem, new DIProperty('_IMPO'));
     return array($importValue->getLocalName(), $importValue->getNS(), $importValue->getNSID());
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:5,代碼來源:DataItemToExpResourceEncoder.php

示例4: getLocatedInValue

 /**
  * @since 2.1
  *
  * @return DataValue
  */
 public function getLocatedInValue()
 {
     $locatedInProperty = new LocatedInProperty();
     return $this->dataValueFactory->newDataValueByItem(DIWikiPage::newFromText('European Union', NS_MAIN), $locatedInProperty->getProperty(), 'EU');
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:10,代碼來源:FranceFactsheet.php


注:本文中的SMW\DataValueFactory::newDataValueByItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。