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


PHP DIWikiPage::getWikiValue方法代码示例

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


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

示例1: displayData

 /**
  * Creates the HTML table displaying the data of one subject.
  *
  * @param[in] $data SMWSemanticData  The data to be displayed
  * @param[in] $left bool  Should properties be displayed on the left side?
  * @param[in] $incoming bool  Is this an incoming? Or an outgoing?
  *
  * @return string A string containing the HTML with the factbox
  */
 private function displayData(SemanticData $data, $left = true, $incoming = false)
 {
     // Some of the CSS classes are different for the left or the right side.
     // In this case, there is an "i" after the "smwb-". This is set here.
     $ccsPrefix = $left ? 'smwb-' : 'smwb-i';
     $html = "<table class=\"{$ccsPrefix}factbox\" cellpadding=\"0\" cellspacing=\"0\">\n";
     $diProperties = $data->getProperties();
     $noresult = true;
     foreach ($diProperties as $key => $diProperty) {
         $dvProperty = DataValueFactory::getInstance()->newDataValueByItem($diProperty, null);
         if ($dvProperty->isVisible()) {
             $dvProperty->setCaption($this->getPropertyLabel($dvProperty, $incoming));
             $proptext = $dvProperty->getShortHTMLText(smwfGetLinker()) . "\n";
         } elseif ($diProperty->getKey() == '_INST') {
             $proptext = smwfGetLinker()->specialLink('Categories');
         } elseif ($diProperty->getKey() == '_REDI') {
             $proptext = smwfGetLinker()->specialLink('Listredirects', 'isredirect');
         } else {
             continue;
             // skip this line
         }
         $head = '<th>' . $proptext . "</th>\n";
         $body = "<td>\n";
         $values = $data->getPropertyValues($diProperty);
         if ($incoming && count($values) >= $this->incomingValuesCount) {
             $moreIncoming = true;
             array_pop($values);
         } else {
             $moreIncoming = false;
         }
         $first = true;
         foreach ($values as $di) {
             if ($first) {
                 $first = false;
             } else {
                 $body .= ', ';
             }
             if ($incoming) {
                 $dv = DataValueFactory::getInstance()->newDataValueByItem($di, null);
             } else {
                 $dv = DataValueFactory::getInstance()->newDataValueByItem($di, $diProperty);
             }
             // For a redirect, disable the DisplayTitle to show the original (aka source) page
             if ($diProperty->getKey() == '_REDI') {
                 $dv->setOption('smwgDVFeatures', $dv->getOptionBy('smwgDVFeatures') & ~SMW_DV_WPV_DTITLE);
             }
             $body .= "<span class=\"{$ccsPrefix}value\">" . $this->displayValue($dvProperty, $dv, $incoming) . "</span>\n";
         }
         // Added in 2.3
         // link to the remaining incoming pages
         if ($moreIncoming && \Hooks::run('SMW::Browse::BeforeIncomingPropertyValuesFurtherLinkCreate', array($diProperty, $this->subject->getDataItem(), &$body))) {
             $body .= \Html::element('a', array('href' => \SpecialPage::getSafeTitleFor('SearchByProperty')->getLocalURL(array('property' => $dvProperty->getWikiValue(), 'value' => $this->subject->getWikiValue()))), wfMessage('smw_browse_more')->text());
         }
         $body .= "</td>\n";
         // display row
         $html .= "<tr class=\"{$ccsPrefix}propvalue\">\n" . ($left ? $head . $body : $body . $head) . "</tr>\n";
         $noresult = false;
     }
     // end foreach properties
     if ($noresult) {
         $html .= "<tr class=\"smwb-propvalue\"><th> &#160; </th><td><em>" . wfMessage($incoming ? 'smw_browse_no_incoming' : 'smw_browse_no_outgoing')->escaped() . "</em></td></tr>\n";
     }
     $html .= "</table>\n";
     return $html;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:74,代码来源:HtmlContentBuilder.php


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