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


PHP SMWQueryProcessor::getFormatParameters方法代码示例

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


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

示例1: showFormatOptions

 /**
  * Display a form section showing the options for a given format,
  * based on the getParameters() value for that format's query printer.
  *
  * @since 1.8
  *
  * @param string $format
  * @param array $paramValues The current values for the parameters (name => value)
  *
  * @return string
  */
 protected function showFormatOptions($format, array $paramValues)
 {
     $definitions = SMWQueryProcessor::getFormatParameters($format);
     $optionsHtml = array();
     /**
      * @var ParamProcessor\ParamDefinition $definition
      */
     foreach ($definitions as $name => $definition) {
         // Ignore the format parameter, as we got a special control in the GUI for it already.
         if ($name == 'format') {
             continue;
         }
         // Maybe there is a better way but somehow I couldn't find one therefore
         // 'source' display will be omitted where no alternative source was found or
         // a source that was marked as default but had no other available options
         $allowedValues = $definition->getAllowedValues();
         if ($name == 'source' && (count($allowedValues) == 0 || in_array('default', $allowedValues) && count($allowedValues) < 2)) {
             continue;
         }
         $currentValue = array_key_exists($name, $paramValues) ? $paramValues[$name] : false;
         $dataInfo = $definition->getMessage() !== null ? $this->msg($definition->getMessage())->text() : '';
         $optionsHtml[] = '<td>' . Html::rawElement('span', array('class' => $this->isTooltipDisplay() == true ? 'smw-ask-info' : '', 'word-wrap' => 'break-word', 'data-info' => $dataInfo), htmlspecialchars($name) . ': ') . '</td>' . $this->showFormatOption($definition, $currentValue);
     }
     $i = 0;
     $n = 0;
     $rowHtml = '';
     $resultHtml = '';
     // Top info text for a collapsed option box
     if ($this->isTooltipDisplay() == true) {
         $resultHtml .= Html::element('div', array('style' => 'margin-bottom:10px;'), wfMessage('smw-ask-otheroptions-info')->text());
     }
     // Table
     $resultHtml .= Html::openElement('table', array('class' => 'smw-ask-otheroptions', 'width' => '100%'));
     $resultHtml .= Html::openElement('tbody');
     while ($option = array_shift($optionsHtml)) {
         $i++;
         // Collect elements for a row
         $rowHtml .= $option;
         // Create table row
         if ($i % 3 == 0) {
             $resultHtml .= Html::rawElement('tr', array('style' => 'background: ' . ($i % 6 == 0 ? 'white' : '#eee')), $rowHtml);
             $rowHtml = '';
             $n++;
         }
     }
     // Ensure left over elements are collected as well
     $resultHtml .= Html::rawElement('tr', array('style' => 'background: ' . ($n % 2 == 0 ? '#eee' : 'white')), $rowHtml);
     $resultHtml .= Html::closeElement('tbody');
     $resultHtml .= Html::closeElement('table');
     return $resultHtml;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:62,代码来源:SMW_QuerySpecialPage.php


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