Semantic MediaWiki and related extensions
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SMW\ResultPrinter Class Reference
Collaboration diagram for SMW\ResultPrinter:
Collaboration graph
[legend]

Public Member Functions

 __construct ($format, $inline=true, $useValidator=false)
 
 isEnabledFeature ($feature)
 
 getQueryMode ($context)
 
 getName ()
 
 setShowErrors ($show)
 
 getParameters ()
 
 getParamDefinitions (array $definitions)
 
 getNamedParameters (array $definitions=array())
 
 isExportFormat ()
 
 getDefaultSort ()
 
- Public Member Functions inherited from SMW\QueryResultPrinter
 getResult (QueryResult $results, array $fullParams, $outputMode)
 

Static Public Attributes

static $maxRecursionDepth = 2
 

Protected Member Functions

 getResultText (SMWQueryResult $res, $outputMode)
 
 buildResult (SMWQueryResult $results)
 
 handleParameters (array $params, $outputMode)
 
 postProcessParameters ()
 
 getLinker ($firstcol=false)
 
 getFurtherResultsLink (SMWQueryResult $res, $outputMode)
 
 getErrorString (SMWQueryResult $res)
 
 escapeText ($text, $outputmode)
 
 getSearchLabel ($outputmode)
 
 linkFurtherResults (SMWQueryResult $results)
 
 addError ($errorMessage)
 
 textDisplayParameters ()
 
 exportFormatParameters ()
 

Protected Attributes

 $m_params
 
 $params
 
 $fullParams
 
 $outputMode
 
 $results
 
 $mIntro = ''
 
 $mOutro = ''
 
 $mSearchlabel = null
 
 $mDefault = ''
 
 $mFormat
 
 $mLinkFirst
 
 $mLinkOthers
 
 $mShowHeaders = SMW_HEADERS_SHOW
 
 $mShowErrors = true
 
 $mInline
 
 $mLinker
 
 $mErrors = array()
 
 $isHTML = false
 
 $hasTemplates = false
 

Detailed Description

Abstract base class for SMW's novel query printing mechanism. It implements part of the former functionality of SMWInlineQuery (everything related to output formatting and the corresponding parameters) and is subclassed by concrete printers that provide the main formatting functionality.

Constructor & Destructor Documentation

SMW\ResultPrinter::__construct (   $format,
  $inline = true,
  $useValidator = false 
)

Constructor. The parameter $format is a format string that may influence the processing details.

Do not override in deriving classes.

Parameters
string$format
boolean$inlineOptional since 1.9
boolean$useValidatorDeprecated since 1.6.2, removal in 1.10

TODO: how can we get the default or user skin here (depending on context)?

Member Function Documentation

SMW\ResultPrinter::addError (   $errorMessage)
protected

Adds an error message for a parameter handling error so a list of errors can be created later on.

Since
1.6
Parameters
string$errorMessage
SMW\ResultPrinter::buildResult ( SMWQueryResult  $results)
protected

Build and return the HTML result.

Since
1.8
Parameters
SMWQueryResult$results
Returns
string
SMW\ResultPrinter::escapeText (   $text,
  $outputmode 
)
protected

If $outputmode is SMW_OUTPUT_HTML, escape special characters occuring in the given text. Otherwise return text as is.

Parameters
string$text
$outputmode
Returns
string
SMW\ResultPrinter::exportFormatParameters ( )
protected

Return an array describing the parameters of the export formats like 'rss' and 'csv', for use in their getParameters() functions

Deprecated:
since 1.8, removal in 1.10
Since
1.5.0
Returns
array
SMW\ResultPrinter::getDefaultSort ( )
Since
2.5
Returns
string
SMW\ResultPrinter::getErrorString ( SMWQueryResult  $res)
protected

Provides a simple formatted string of all the error messages that occurred. Can be used if not specific error formatting is desired. Compatible with HTML and Wiki.

Parameters
SMWQueryResult$res
Returns
string
SMW\ResultPrinter::getFurtherResultsLink ( SMWQueryResult  $res,
  $outputMode 
)
protected

Gets a SMWInfolink object that allows linking to further results for the query.

Since
1.8
Parameters
SMWQueryResult$res
$outputMode
Returns
SMWInfolink
SMW\ResultPrinter::getLinker (   $firstcol = false)
protected

Depending on current linking settings, returns a linker object for making hyperlinks or NULL if no links should be created.

Parameters
boolean$firstcolTrue of this is the first result column (having special linkage settings).
SMW\ResultPrinter::getName ( )
See also
SMWIResultPrinter::getName
Returns
string

Implements SMW\QueryResultPrinter.

SMW\ResultPrinter::getNamedParameters ( array  $definitions = array())
final

Returns the parameter definitions as an associative array where the keys hold the parameter names and point to their full definitions. array( name => array|IParamDefinition )

Since
1.8
Parameters
array$definitionsList of definitions to prepend to the result printers list before further processing.
Returns
array
SMW\ResultPrinter::getParamDefinitions ( array  $definitions)
See also
SMWIResultPrinter::getParamDefinitions
Since
1.8
Parameters
ParamDefinition[]$definitions
Returns
array

Implements SMW\QueryResultPrinter.

SMW\ResultPrinter::getParameters ( )

A function to describe the allowed parameters of a query using any specific format - most query printers should override this function.

Deprecated:
since 1.8, use getParamDefinitions instead.
Since
1.5
Returns
array
SMW\ResultPrinter::getQueryMode (   $context)
See also
SMWIResultPrinter::getQueryMode
Parameters
$context
Returns
integer

Implements SMW\QueryResultPrinter.

SMW\ResultPrinter::getResultText ( SMWQueryResult  $res,
  $outputMode 
)
abstractprotected

Return serialised results in specified format. Implemented by subclasses.

SMW\ResultPrinter::getSearchLabel (   $outputmode)
protected

Get the string the user specified as a text for the "further results" link, properly escaped for the current output mode.

Parameters
$outputmode
Returns
string
SMW\ResultPrinter::handleParameters ( array  $params,
  $outputMode 
)
protected

Does any additional parameter handling that needs to be done before the actual result is build. This includes cleaning up parameter values and setting class fields.

Since 1.6 parameter handling should happen via validator based on the parameter definitions returned in getParameters. Therefore this method should likely not be used in any new code. It's mainly here for legacy reasons.

Since
1.6
Parameters
array$params
$outputMode
SMW\ResultPrinter::isEnabledFeature (   $feature)
Since
2.5
Parameters
integer$feature
Returns
boolean
SMW\ResultPrinter::isExportFormat ( )
See also
SMWIResultPrinter::isExportFormat
Since
1.8
Returns
boolean

Implements SMW\QueryResultPrinter.

SMW\ResultPrinter::linkFurtherResults ( SMWQueryResult  $results)
protected

Check whether a "further results" link would normally be generated for this result set with the given parameters. Individual result printers may decide to create or hide such a link independent of that, but this is the default.

Parameters
SMWQueryResult$results
Returns
boolean
SMW\ResultPrinter::postProcessParameters ( )
protected

Similar to handleParameters.

Since
1.8
SMW\ResultPrinter::setShowErrors (   $show)
See also
SMWIResultPrinter::setShowErrors
Parameters
boolean$show

Implements SMW\QueryResultPrinter.

SMW\ResultPrinter::textDisplayParameters ( )
protected

Return an array describing the parameters of specifically text-based formats, like 'list' and 'table', for use in their getParameters() functions

Deprecated:
since 1.8, removal in 1.10
Since
1.5.0
Returns
array

Member Data Documentation

SMW\ResultPrinter::$fullParams
protected
SMW\ResultPrinter::$hasTemplates = false
protected

If set, take the necessary steps to make sure that things like {{templatename| ...}} are properly processed if they occur in the result. Clearly, this is only relevant if the output is not HTML, i.e. it is ignored if SMWResultPrinter::$is_HTML is true. This setting is used only after the result text was generated.

Note
This requires extra processing and may make the result less useful for being used as a parameter for further parser functions. Use only if required.
SMW\ResultPrinter::$isHTML = false
protected

If set, treat result as plain HTML. Can be used by printer classes if wiki mark-up is not enough. This setting is used only after the result text was generated.

Note
HTML query results cannot be used as parameters for other templates or in any other way in combination with other wiki text. The result will be inserted on the page literally.
SMW\ResultPrinter::$m_params
protected
Deprecated:
Use $params instead. Will be removed in 1.10.
SMW\ResultPrinter::$maxRecursionDepth = 2
static

This public variable can be set to higher values to allow more recursion; do this at your own risk! This can be set in LocalSettings.php, but only after enableSemantics().

SMW\ResultPrinter::$mDefault = ''
protected

Default return value for empty queries. Unescaped. Normally not used in sub-classes!

SMW\ResultPrinter::$mErrors = array()
protected
SMW\ResultPrinter::$mFormat
protected
SMW\ResultPrinter::$mInline
protected
SMW\ResultPrinter::$mIntro = ''
protected

Text to print before the output in case it is not empty; assumed to be wikitext. Normally this is handled in SMWResultPrinter and can be ignored by subclasses.

SMW\ResultPrinter::$mLinker
protected
SMW\ResultPrinter::$mLinkFirst
protected
SMW\ResultPrinter::$mLinkOthers
protected
SMW\ResultPrinter::$mOutro = ''
protected

Text to print after the output in case it is not empty; assumed to be wikitext. Normally this is handled in SMWResultPrinter and can be ignored by subclasses.

SMW\ResultPrinter::$mSearchlabel = null
protected

Text to use for link to further results, or empty if link should not be shown. Unescaped! Use

See also
SMWResultPrinter::getSearchLabel() and
SMWResultPrinter::linkFurtherResults() instead of accessing this directly.
SMW\ResultPrinter::$mShowErrors = true
protected
SMW\ResultPrinter::$mShowHeaders = SMW_HEADERS_SHOW
protected
SMW\ResultPrinter::$outputMode
protected
SMW\ResultPrinter::$params
protected
SMW\ResultPrinter::$results
protected

The documentation for this class was generated from the following file: