BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
SMW\QueryResultPrinter Interface Reference
Inheritance diagram for SMW\QueryResultPrinter:

Public Member Functions

 getResult (QueryResult $results, array $fullParams, $outputMode)
 
 getQueryMode ($context)
 
 getName ()
 
 setShowErrors ($show)
 
 getParamDefinitions (array $definitions)
 
 isExportFormat ()
 

Detailed Description

Interface for SMW result printers.

GNU GPL v2+

Since
1.8
Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Markus Krötzsch

Member Function Documentation

SMW\QueryResultPrinter::getName ( )

Get a human readable label for this printer. The default is to return just the format identifier. Concrete implementations may refer to messages here. The format name is normally not used in wiki text but only in forms etc. hence the user language should be used when retrieving messages.

Returns
string

Implemented in SMW\ResultPrinter, SMMapPrinter, SRFGraph, SMKMLPrinter, SMW\ListResultPrinter, SRFJitGraph, SRF\Filtered\Filtered, SRFOutline, SMW\DsvResultPrinter, SMW\RdfResultPrinter, SRF\MediaPlayer, SRFCalendar, SRFTimeline, SRFArray, SMW\CategoryResultPrinter, SMW\EmbeddedResultPrinter, SRF\TagCloud, SRF\Formats\Tree\TreeResultPrinter, SMW\FeedResultPrinter, SMW\JsonResultPrinter, SRFValueRank, SMW\TableResultPrinter, SMW\CsvResultPrinter, SRF\Gallery, SRFBoilerplate, SRFGooglePie, SRFListWidget, SRFGoogleBar, SRFSlideShow, SRFTime, SRFDygraphs, SRFIncoming, SRFTimeseries, SRFPageWidget, SRFMath, SRFjqPlotSeries, and BSGridResultPrinter.

SMW\QueryResultPrinter::getParamDefinitions ( array  $definitions)
SMW\QueryResultPrinter::getQueryMode (   $context)

This function determines the query mode that is to be used for this printer in various contexts. The query mode influences how queries to that printer should be processed to obtain a result. Possible values are SMWQuery::MODE_INSTANCES (retrieve instances), SMWQuery::MODE_NONE (do nothing), SMWQuery::MODE_COUNT (get number of results), SMWQuery::MODE_DEBUG (return debugging text). Possible values for context are SMWQueryProcessor::SPECIAL_PAGE, SMWQueryProcessor::INLINE_QUERY, SMWQueryProcessor::CONCEPT_DESC.

The default implementation always returns SMWQuery::MODE_INSTANCES. File exports like RSS will use MODE_INSTANCES on special pages (so that instances are retrieved for the export) and MODE_NONE otherwise (displaying just a download link).

Parameters
$context
Returns
integer

Implemented in SMW\ResultPrinter, SMW\FileExportPrinter, and SRFArray.

SMW\QueryResultPrinter::getResult ( QueryResult  $results,
array  $fullParams,
  $outputMode 
)

Main entry point: takes an QueryResult and parameters given as key-value-pairs in an array, and returns the serialised version of the results, formatted as HTML or Wiki or whatever is specified. Normally this is not overwritten by subclasses.

If the outputmode is SMW_OUTPUT_WIKI, then the function will return something that is suitable for being used in a MediaWiki parser function, i.e. a wikitext strong or an array with flags and the string as entry 0. See Parser::setFunctionHook() for documentation on this. In all other cases, the function returns just a string.

For outputs SMW_OUTPUT_WIKI and SMW_OUTPUT_HTML, error messages or standard "further results" links are directly generated and appended. For SMW_OUTPUT_FILE, only the plain generated text is returned.

Note
A note on recursion: some query printers may return wiki code that comes from other pages, e.g. from templates that are used in formatting or from embedded result pages. Both kinds of pages may contain #ask queries that do again use new pages, so we must care about recursion. We do so by simply counting how often this method starts a subparse and stopping at depth 2. There is one special case: if this method is called outside parsing, and the concrete printer returns wiki text, and wiki text is requested, then we may return wiki text with sub-queries to the caller. If the caller parses this (which is likely) then this will again call us in parse-context and all recursion checks catch. Only the first level of parsing is done outside and thus not counted. Thus you effectively can get down to level 3. The basic maximal depth of 2 can be changed by setting the variable SMWResultPrinter::$maxRecursionDepth (in LocalSettings.php, after enableSemantics()). Do this at your own risk.
Parameters
$resultsQueryResult
$fullParamsarray
$outputModeinteger
Returns
string
SMW\QueryResultPrinter::isExportFormat ( )

Returns if the format is an export format.

Since
1.8
Returns
boolean

Implemented in SMW\ResultPrinter, and SMW\FileExportPrinter.

SMW\QueryResultPrinter::setShowErrors (   $show)

Set whether errors should be shown. By default they are.

Parameters
boolean$show

Implemented in SMW\ResultPrinter.


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