当前位置: 首页>>代码示例>>PHP>>正文


PHP DataValueFactory::newDataItemValue方法代码示例

本文整理汇总了PHP中SMW\DataValueFactory::newDataItemValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DataValueFactory::newDataItemValue方法的具体用法?PHP DataValueFactory::newDataItemValue怎么用?PHP DataValueFactory::newDataItemValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMW\DataValueFactory的用法示例。


在下文中一共展示了DataValueFactory::newDataItemValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getQueryString

 /**
  * @see SMWDescription::getQueryString
  * 
  * @since 0.6
  * 
  * @param boolean $asValue
  * @return string
  */
 public function getQueryString($asValue = false)
 {
     if ($this->getDataItem() !== null) {
         $queryString = DataValueFactory::newDataItemValue($this->getDataItem(), $this->getPropertyCompat())->getWikiValue();
         return $asValue ? $queryString : "[[{$queryString}]]";
     } else {
         return $asValue ? '+' : '';
     }
 }
开发者ID:hangya,项目名称:SemanticMaps,代码行数:17,代码来源:SM_GeoCoordsValueDescription.php

示例2: testConstruct

 public function testConstruct()
 {
     $geoDI = new SMWDIGeoCoord(23, 42);
     /**
      * @var SMGeoCoordsValue $geoValue
      */
     $geoValue = DataValueFactory::newDataItemValue($geoDI);
     $this->assertInstanceOf('SMGeoCoordsValue', $geoValue);
     $this->assertEquals($geoDI, $geoValue->getDataItem());
     $this->assertEquals('23° 0\' 0", 42° 0\' 0"', $geoValue->getShortWikiText());
 }
开发者ID:hangya,项目名称:SemanticMaps,代码行数:11,代码来源:SMGeoCoordsValueTest.php

示例3: getTableContent

 /**
  * Renders table content for a given SMWSemanticData object
  *
  * @since 1.9
  *
  * @param SMWSemanticData $semanticData
  */
 protected function getTableContent(SemanticData $semanticData)
 {
     Profiler::In(__METHOD__);
     // 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', 'sup', 'sub');
     $attributes = array();
     foreach ($semanticData->getProperties() as $propertyDi) {
         $propertyDv = $this->dataValueFactory->newDataItemValue($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->newDataItemValue($dataItem, $propertyDi);
             $dataValue->setServiceLinksRenderState(false);
             if ($dataValue->isValid()) {
                 $valuesHtml[] = Sanitizer::removeHTMLtags($dataValue->getLongWikiText(true), null, array(), array(), $excluded) . $dataValue->getInfolinkText(SMW_OUTPUT_WIKI);
             }
         }
         // Invoke table content
         $this->tableBuilder->addCell($propertyDv->getShortWikiText(true), $attributes['property']);
         $this->tableBuilder->addCell($this->messageBuilder->listToCommaSeparatedText($valuesHtml), $attributes['values']);
         $this->tableBuilder->addRow();
     }
     Profiler::Out(__METHOD__);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:50,代码来源:Factbox.php

示例4: getLocatedInValue

 /**
  * @since 2.1
  *
  * @return DataValue
  */
 public function getLocatedInValue()
 {
     $locatedInProperty = new LocatedInProperty();
     return $this->dataValueFactory->newDataItemValue(new DIWikiPage('France', NS_MAIN), $locatedInProperty->getProperty());
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:10,代码来源:ParisFactsheet.php

示例5: getLocatedInValue

 /**
  * @since 2.1
  *
  * @return DataValue
  */
 public function getLocatedInValue()
 {
     $locatedInProperty = new LocatedInProperty();
     return $this->dataValueFactory->newDataItemValue(DIWikiPage::newFromText('European Union', NS_MAIN), $locatedInProperty->getProperty(), 'EU');
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:10,代码来源:FranceFactsheet.php

示例6: defineElementsForImportDataItem

 private function defineElementsForImportDataItem(DataItem $dataItem)
 {
     $importValue = $this->dataValueFactory->newDataItemValue($dataItem, new DIProperty('_IMPO'));
     return array($importValue->getLocalName(), $importValue->getNS(), $importValue->getNSID());
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:5,代码来源:CachedDataItemToExpResourceEncoder.php


注:本文中的SMW\DataValueFactory::newDataItemValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。