本文整理汇总了PHP中SMWQueryProcessor::getParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQueryProcessor::getParameters方法的具体用法?PHP SMWQueryProcessor::getParameters怎么用?PHP SMWQueryProcessor::getParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWQueryProcessor
的用法示例。
在下文中一共展示了SMWQueryProcessor::getParameters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormatParameters
/**
* Returns the definitions of all parameters supported by the specified format.
*
* @since 1.8
*
* @param string $format
*
* @return array of IParamDefinition
*/
public static function getFormatParameters($format)
{
SMWParamFormat::resolveFormatAliases($format);
if (array_key_exists($format, $GLOBALS['smwgResultFormats'])) {
return ParamDefinition::getCleanDefinitions(SMWQueryProcessor::getResultPrinter($format)->getParamDefinitions(SMWQueryProcessor::getParameters()));
} else {
return array();
}
}
示例2: getFormatParameters
/**
* @param string $format
*
* @return array of IParamDefinition
*/
protected function getFormatParameters($format)
{
if (array_key_exists($format, $GLOBALS['smwgResultFormats'])) {
return ParamDefinition::getCleanDefinitions(SMWQueryProcessor::getResultPrinter($format)->getParamDefinitions(SMWQueryProcessor::getParameters()));
} else {
return array();
}
}
示例3: render
/**
* Renders and returns the output.
* @see ParserHook::render
*
* @since 1.0
*
* @param array $parameters
*
* @return string
*/
public function render(array $parameters)
{
$this->language = $parameters['language'];
$params = array();
if (in_array($parameters['parameters'], array('all', 'base'))) {
$params = array_merge($params, SMWQueryProcessor::getParameters());
}
if (in_array($parameters['parameters'], array('all', 'specific'))) {
$params = array_merge($params, $this->getFormatParameters($parameters['format']));
}
return $this->getParameterTable($params);
}
示例4: testGetParamDefinitions
/**
* @dataProvider instanceProvider
*
* @param \SMWResultPrinter $printer
*/
public function testGetParamDefinitions(\SMWResultPrinter $printer)
{
$params = $printer->getParamDefinitions(\SMWQueryProcessor::getParameters());
$params = \ParamDefinition::getCleanDefinitions($params);
$this->assertInternalType('array', $params);
}
示例5: showFormatOptions
/**
* Display a form section showing the options for a given format,
* based on the getParameters() value for that format's query printer.
*
* @param string $format
* @param array $paramValues The current values for the parameters (name => value)
*
* @return string
*/
protected function showFormatOptions( $format, array $paramValues ) {
$printer = SMWQueryProcessor::getResultPrinter( $format, SMWQueryProcessor::SPECIAL_PAGE );
$params = SMWQueryProcessor::getParameters();
if ( method_exists( $printer, 'getValidatorParameters' ) ) {
$params = array_merge( $params, $printer->getValidatorParameters() );
}
$optionsHtml = array();
foreach ( $params as $param ) {
// Ignore the format parameter, as we got a special control in the GUI for it already.
if ( $param->getName() == 'format' ) {
continue;
}
$currentValue = array_key_exists( $param->getName(), $paramValues ) ? $paramValues[$param->getName()] : false;
$optionsHtml[] =
Html::rawElement(
'div',
array(
'style' => 'width: 30%; padding: 5px; float: left;'
),
htmlspecialchars( $param->getName() ) . ': ' .
$this->showFormatOption( $param, $currentValue ) .
'<br />' .
Html::element( 'em', array(), $param->getDescription() )
);
}
for ( $i = 0, $n = count( $optionsHtml ); $i < $n; $i++ ) {
if ( $i % 3 == 2 || $i == $n - 1 ) {
$optionsHtml[$i] .= "<div style=\"clear: both\";></div>\n";
}
}
$i = 0;
$rowHtml = '';
$resultHtml = '';
while ( $option = array_shift( $optionsHtml ) ) {
$rowHtml .= $option;
$i++;
$resultHtml .= Html::rawElement(
'div',
array(
'style' => 'background: ' . ( $i % 6 == 0 ? 'white' : '#dddddd' ) . ';'
),
$rowHtml
);
$rowHtml = '';
}
return $resultHtml;
}
示例6: getParameters
public function getParameters() {
global $smwgQMaxInlineLimit;
$params = array();
$dfltParams = SMWQueryProcessor::getParameters();
### adjusted basic SMW params: ###
$params['limit'] = $dfltParams['limit'];
$params['limit']->setDefault( $smwgQMaxInlineLimit );
$params['link'] = $dfltParams['link'];
$params['link']->setDefault( 'none' );
$params['headers'] = $dfltParams['headers'];
$params['headers']->setDefault( 'hide' );
### new params: ###
$params['titles'] = new Parameter( 'titles' );
$params['titles']->setMessage( 'srf_paramdesc_pagetitle' );
$params['titles']->addCriteria( new CriterionInArray( 'show', 'hide' ) );
$params['titles']->addAliases( 'pagetitle', 'pagetitles' );
$params['titles']->setDefault( 'show' );
$params['hidegaps'] = new Parameter( 'hidegaps' );
$params['hidegaps']->setMessage( 'srf_paramdesc_hidegaps' );
$params['hidegaps']->addCriteria( new CriterionInArray( 'none', 'all', 'property', 'record' ) );
$params['hidegaps']->setDefault( 'none' );
# name to create 'real' array with if set (empty string '' counts as set!):
$params['name'] = new Parameter( 'name' );
$params['name']->setMessage( 'srf_paramdesc_arrayname' );
$params['name']->setDefault( false, false );
# separators (default values are defined in the following globals:)
global $srfgArraySep, $srfgArrayPropSep, $srfgArrayManySep, $srfgArrayRecordSep, $srfgArrayHeaderSep;
$params['sep'] = new Parameter( 'sep' );
$params['sep']->setMessage( 'smw_paramdesc_sep' );
$params['sep']->setDefault( $this->initializeCfgValue( $srfgArraySep, 'sep' ) );
$params['propsep'] = new Parameter( 'propsep' );
$params['propsep']->setMessage( 'srf_paramdesc_propsep' );
$params['propsep']->setDefault( $this->initializeCfgValue( $srfgArrayPropSep, 'propsep' ) );
$params['manysep'] = new Parameter( 'manysep' );
$params['manysep']->setMessage( 'srf_paramdesc_manysep' );
$params['manysep']->setDefault( $this->initializeCfgValue( $srfgArrayManySep, 'manysep' ) );
$params['recordsep'] = new Parameter( 'recordsep' );
$params['recordsep']->setMessage( 'srf_paramdesc_recordsep' );
$params['recordsep']->addAliases( 'narysep', 'rcrdsep', 'recsep' );
$params['recordsep']->setDefault( $this->initializeCfgValue( $srfgArrayRecordSep, 'recordsep' ) );
$params['headersep'] = new Parameter( 'headersep' );
$params['headersep']->setMessage( 'srf_paramdesc_headersep' );
$params['headersep']->addAliases( 'narysep', 'rcrdsep', 'recsep' );
$params['headersep']->setDefault( $this->initializeCfgValue( $srfgArrayHeaderSep, 'headersep' ) );
return $params;
}