Inherited by SMKMLPrinter, SMMapPrinter, SMWAggregatablePrinter, SMWCategoryResultPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWEmbeddedResultPrinter, SMWJSONResultPrinter, SMWListResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SMWTableResultPrinter, SRFArray, SRFBibTeX, SRFCalendar, SRFGallery, SRFGoogleBar, SRFGooglePie, SRFGraph, SRFiCalendar, SRFMath, SRFOutline, SRFPloticus, SRFProcess, SRFTagCloud, SRFTimeline, SRFValueRank, and SRFvCard.
Public Member Functions | |
| __construct ($format, $inline, $useValidator=false) | |
| Constructor. | |
| getResult (SMWQueryResult $results, array $params, $outputmode) | |
| Main entry point: takes an SMWQueryResult 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. | |
| getMimeType ($res) | |
| Some printers do not mainly produce embeddable HTML or Wikitext, but produce stand-alone files. | |
| getQueryMode ($context) | |
| This function determines the query mode that is to be used for this printer in various contexts. | |
| getFileName ($res) | |
| Some printers can produce not only embeddable HTML or Wikitext, but can also produce stand-alone files. | |
| getName () | |
| Get a human readable label for this printer. | |
| getErrorString (SMWQueryResult $res) | |
| Provides a simple formatted string of all the error messages that occurred. | |
| setShowErrors ($show) | |
| Set whether errors should be shown. | |
| getValidatorParameters () | |
| Returns the parameters from getParameters, but with all non-Validator parameters converted to Validator parameters. | |
| getParameters () | |
| A function to describe the allowed parameters of a query using any specific format - most query printers should override this function. | |
Static Public Attributes | |
| static | $maxRecursionDepth = 2 |
| 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(). | |
Protected Member Functions | |
| getResultText (SMWQueryResult $res, $outputmode) | |
| Return serialised results in specified format. | |
| handleNonFileResult ($result, SMWQueryResult $results, $outputmode) | |
| Continuation of getResult that only gets executed for non file outputs. | |
| handleParameters (array $params, $outputmode) | |
| Read an array of parameter values given as key-value-pairs and initialise internal member fields accordingly. | |
| getLinker ($firstcol=false) | |
| Depending on current linking settings, returns a linker object for making hyperlinks or NULL if no links should be created. | |
| escapeText ($text, $outputmode) | |
| If $outputmode is SMW_OUTPUT_HTML, escape special characters occuring in the given text. | |
| getSearchLabel ($outputmode) | |
| Get the string the user specified as a text for the "further results" link, properly escaped for the current output mode. | |
| linkFurtherResults ($results) | |
| Check whether a "further results" link would normally be generated for this result set with the given parameters. | |
| addError ($errorMessage) | |
| Adds an error message for a parameter handling error so a list of errors can be created later on. | |
| textDisplayParameters () | |
| Return an array describing the parameters of specifically text-based formats, like 'list' and 'table', for use in their getParameters() functions. | |
| exportFormatParameters () | |
| Return an array describing the parameters of the export formats like 'rss' and 'csv', for use in their getParameters() functions. | |
| toValidatorParam ($param) | |
| Returns a Validator style Parameter definition. | |
Protected Attributes | |
| $m_params | |
| $params | |
| $mIntro = '' | |
| Text to print *before* the output in case it is *not* empty; assumed to be wikitext. | |
| $mOutro = '' | |
| Text to print *after* the output in case it is *not* empty; assumed to be wikitext. | |
| $mSearchlabel = null | |
| Text to use for link to further results, or empty if link should not be shown. | |
| $mDefault = '' | |
| Default return value for empty queries. | |
| $mFormat | |
| $mLinkFirst | |
| $mLinkOthers | |
| $mShowHeaders = SMW_HEADERS_SHOW | |
| $mShowErrors = true | |
| $mInline | |
| $mLinker | |
| $mErrors = array() | |
| $isHTML = false | |
| If set, treat result as plain HTML. | |
| $hasTemplates = false | |
| If set, take the necessary steps to make sure that things like {{templatename| . | |
Static Private Attributes | |
| static | $mRecursionDepth = 0 |
| Incremented while expanding templates inserted during printout; stop expansion at some point. | |
It implements part of the former functionality of SMWInlineQuery (everything related to output formatting and the correspoding parameters) and is subclassed by concrete printers that provide the main formatting functionality.
Definition at line 26 of file SMW_QueryPrinter.php.
| SMWResultPrinter::__construct | ( | $ | format, | |
| $ | inline, | |||
| $ | useValidator = false | |||
| ) |
Constructor.
The parameter $format is a format string that may influence the processing details.
| string | $format | |
| $inline | ||
| boolean | $useValidator Deprecated since 1.6.2 |
TODO: how can we get the default or user skin here (depending on context)?
Reimplemented in SRFArray.
Definition at line 120 of file SMW_QueryPrinter.php.
References $smwgQDefaultLinking.
| SMWResultPrinter::getResultText | ( | SMWQueryResult $ | res, | |
| $ | outputmode | |||
| ) | [abstract, protected] |
Return serialised results in specified format.
Implemented by subclasses.
Reimplemented in SMKMLPrinter, SMMapPrinter, SMWAggregatablePrinter, SMWCategoryResultPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWEmbeddedResultPrinter, SMWJSONResultPrinter, SMWListResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SMWTableResultPrinter, SRFArray, SRFBibTeX, SRFCalendar, SRFGallery, SRFGoogleBar, SRFGooglePie, SRFGraph, SRFProcess, SRFiCalendar, SRFMath, SRFOutline, SRFPloticus, SRFTagCloud, SRFTimeline, SRFValueRank, and SRFvCard.
Referenced by getResult().
| SMWResultPrinter::getResult | ( | SMWQueryResult $ | results, | |
| array $ | params, | |||
| $ | outputmode | |||
| ) |
Main entry point: takes an SMWQueryResult 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.
| $results | SMWQueryResult | |
| $params | array | |
| $outputmode | integer |
Reimplemented in SMMapPrinter, SRFCalendar, SRFGallery, and SRFMath.
Definition at line 161 of file SMW_QueryPrinter.php.
References escapeText(), getErrorString(), getMimeType(), SMWQueryResult::getQueryLink(), getResultText(), handleNonFileResult(), and handleParameters().
| SMWResultPrinter::handleNonFileResult | ( | $ | result, | |
| SMWQueryResult $ | results, | |||
| $ | outputmode | |||
| ) | [protected] |
Continuation of getResult that only gets executed for non file outputs.
| string | $result | |
| SMWQueryResult | $results | |
| integer | $outputmode |
TODO: explain problem (too much recursive parses)
NOTE: as of MW 1.14SVN, there is apparently no better way to hide the TOC
TODO: explain problem (too much recursive parses)
Definition at line 218 of file SMW_QueryPrinter.php.
References $maxRecursionDepth, $mRecursionDepth, $wgTitle, getErrorString(), and SMWOutputs::requireFromParserOutput().
Referenced by getResult().
| SMWResultPrinter::handleParameters | ( | array $ | params, | |
| $ | outputmode | |||
| ) | [protected] |
Read an array of parameter values given as key-value-pairs and initialise internal member fields accordingly.
Possibly overwritten (extended) by subclasses.
| array | $params | |
| $outputmode |
Reimplemented in SMKMLPrinter, SMWCategoryResultPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWEmbeddedResultPrinter, SMWListResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SMWTableResultPrinter, SRFArray, SRFHash, SRFCalendar, SRFGoogleBar, SRFGooglePie, SRFGraph, SRFProcess, SRFiCalendar, SRFjqPlotBar, SRFjqPlotPie, SRFOutline, SRFTagCloud, SRFTimeline, and SRFValueRank.
Definition at line 296 of file SMW_QueryPrinter.php.
Referenced by SRFMath::getResult(), SRFGallery::getResult(), getResult(), and SMMapPrinter::getResult().
| SMWResultPrinter::getLinker | ( | $ | firstcol = false |
) | [protected] |
Depending on current linking settings, returns a linker object for making hyperlinks or NULL if no links should be created.
| $firstcol | True of this is the first result column (having special linkage settings). |
Definition at line 339 of file SMW_QueryPrinter.php.
Referenced by SRFGallery::addImagePages(), SRFGallery::addImageProperties(), SMWTableResultPrinter::getCellContent(), SMWAggregatablePrinter::getDistributionResults(), SMWCategoryResultPrinter::getResultText(), SRFTagCloud::getTags(), SRFValueRank::getVRValues(), SRFTimeline::handlePropertyValue(), and SMWListResultPrinter::printRow().
| SMWResultPrinter::getMimeType | ( | $ | res | ) |
Some printers do not mainly produce embeddable HTML or Wikitext, but produce stand-alone files.
An example is RSS or iCalendar. This function returns the mimetype string that this file would have, or FALSE if no standalone files are produced.
If this function returns something other than FALSE, then the printer will not be regarded as a printer that displays in-line results. This is used to determine if a file output should be generated in Special:Ask.
Reimplemented in SMKMLPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWJSONResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SRFBibTeX, SRFiCalendar, and SRFvCard.
Definition at line 357 of file SMW_QueryPrinter.php.
Referenced by getResult().
| SMWResultPrinter::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).
Reimplemented in SMWCsvResultPrinter, SMWDSVResultPrinter, SMWJSONResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SRFArray, SRFBibTeX, SRFiCalendar, and SRFvCard.
Definition at line 374 of file SMW_QueryPrinter.php.
References SMWQuery::MODE_INSTANCES.
| SMWResultPrinter::getFileName | ( | $ | res | ) |
Some printers can produce not only embeddable HTML or Wikitext, but can also produce stand-alone files.
An example is RSS or iCalendar. This function returns a filename that is to be sent to the caller in such a case (the default filename is created by browsers from the URL, and it is often not pretty).
See also SMWResultPrinter::getMimeType()
Reimplemented in SMKMLPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWJSONResultPrinter, SMWRDFResultPrinter, SRFBibTeX, SRFiCalendar, and SRFvCard.
Definition at line 387 of file SMW_QueryPrinter.php.
| SMWResultPrinter::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.
Reimplemented in SMKMLPrinter, SMMapPrinter, SMWCategoryResultPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWEmbeddedResultPrinter, SMWJSONResultPrinter, SMWListResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SMWTableResultPrinter, SRFArray, SRFBibTeX, SRFCalendar, SRFGallery, SRFGoogleBar, SRFGooglePie, SRFGraph, SRFiCalendar, SRFjqPlotBar, SRFjqPlotPie, SRFMath, SRFOutline, SRFTagCloud, SRFTimeline, SRFValueRank, and SRFvCard.
Definition at line 400 of file SMW_QueryPrinter.php.
| SMWResultPrinter::getErrorString | ( | SMWQueryResult $ | res | ) |
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.
| SMWQueryResult | $res |
Definition at line 413 of file SMW_QueryPrinter.php.
References smwfEncodeMessages().
Referenced by getResult(), and handleNonFileResult().
| SMWResultPrinter::setShowErrors | ( | $ | show | ) |
Set whether errors should be shown.
By default they are.
| boolean | $show |
Definition at line 422 of file SMW_QueryPrinter.php.
| SMWResultPrinter::escapeText | ( | $ | text, | |
| $ | outputmode | |||
| ) | [protected] |
If $outputmode is SMW_OUTPUT_HTML, escape special characters occuring in the given text.
Otherwise return text as is.
Definition at line 432 of file SMW_QueryPrinter.php.
Referenced by getResult(), and getSearchLabel().
| SMWResultPrinter::getSearchLabel | ( | $ | outputmode | ) | [protected] |
Get the string the user specified as a text for the "further results" link, properly escaped for the current output mode.
Definition at line 442 of file SMW_QueryPrinter.php.
References escapeText().
Referenced by SRFvCard::getFileName(), SRFBibTeX::getFileName(), SMWJSONResultPrinter::getFileName(), SRFiCalendar::getIcalLink(), SMKMLPrinter::getLink(), SMWDSVResultPrinter::getLinkToFile(), SRFvCard::getResultText(), SRFOutline::getResultText(), SRFBibTeX::getResultText(), SMWTableResultPrinter::getResultText(), SMWRSSResultPrinter::getResultText(), SMWRDFResultPrinter::getResultText(), SMWListResultPrinter::getResultText(), SMWJSONResultPrinter::getResultText(), SMWEmbeddedResultPrinter::getResultText(), SMWCsvResultPrinter::getResultText(), SMWCategoryResultPrinter::getResultText(), and SMWListResultPrinter::showFurtherResults().
| SMWResultPrinter::linkFurtherResults | ( | $ | 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.
Definition at line 453 of file SMW_QueryPrinter.php.
Referenced by SRFOutline::getResultText(), SMWTableResultPrinter::getResultText(), SMWListResultPrinter::getResultText(), SMWEmbeddedResultPrinter::getResultText(), and SMWCategoryResultPrinter::getResultText().
| SMWResultPrinter::addError | ( | $ | errorMessage | ) | [protected] |
Adds an error message for a parameter handling error so a list of errors can be created later on.
| string | $errorMessage |
Definition at line 465 of file SMW_QueryPrinter.php.
| SMWResultPrinter::textDisplayParameters | ( | ) | [protected] |
Return an array describing the parameters of specifically text-based formats, like 'list' and 'table', for use in their getParameters() functions.
Definition at line 478 of file SMW_QueryPrinter.php.
References $params.
Referenced by SMWCategoryResultPrinter::getParameters().
| SMWResultPrinter::exportFormatParameters | ( | ) | [protected] |
Return an array describing the parameters of the export formats like 'rss' and 'csv', for use in their getParameters() functions.
Definition at line 504 of file SMW_QueryPrinter.php.
References $params.
Referenced by SRFvCard::getParameters(), SRFiCalendar::getParameters(), SRFBibTeX::getParameters(), SMWRSSResultPrinter::getParameters(), SMWRDFResultPrinter::getParameters(), SMWJSONResultPrinter::getParameters(), SMWDSVResultPrinter::getParameters(), SMWCsvResultPrinter::getParameters(), and SMKMLPrinter::getParameters().
| SMWResultPrinter::getValidatorParameters | ( | ) |
Returns the parameters from getParameters, but with all non-Validator parameters converted to Validator parameters.
Definition at line 522 of file SMW_QueryPrinter.php.
References $params, getParameters(), and toValidatorParam().
| SMWResultPrinter::toValidatorParam | ( | $ | param | ) | [protected] |
Returns a Validator style Parameter definition.
SMW 1.5.x style definitions are converted.
| mixed | $param |
Definition at line 543 of file SMW_QueryPrinter.php.
Referenced by getValidatorParameters().
| SMWResultPrinter::getParameters | ( | ) |
A function to describe the allowed parameters of a query using any specific format - most query printers should override this function.
TODO: refactor non-printer params up to the query processor and do all param handling there.
Reimplemented in SMKMLPrinter, SMMapPrinter, SMWAggregatablePrinter, SMWCategoryResultPrinter, SMWCsvResultPrinter, SMWDSVResultPrinter, SMWEmbeddedResultPrinter, SMWJSONResultPrinter, SMWListResultPrinter, SMWRDFResultPrinter, SMWRSSResultPrinter, SMWTableResultPrinter, SRFArray, SRFHash, SRFBibTeX, SRFCalendar, SRFGallery, SRFGoogleBar, SRFGooglePie, SRFGraph, SRFProcess, SRFiCalendar, SRFjqPlotBar, SRFjqPlotPie, SRFMath, SRFOutline, SRFPloticus, SRFTagCloud, SRFTimeline, SRFValueRank, and SRFvCard.
Definition at line 585 of file SMW_QueryPrinter.php.
Referenced by getValidatorParameters().
SMWResultPrinter::$m_params [protected] |
SMWResultPrinter::$params [protected] |
Definition at line 41 of file SMW_QueryPrinter.php.
Referenced by exportFormatParameters(), SRFArray::getCfgSepText(), SRFiCalendar::getIcalForItem(), SMMapPrinter::getParameterInfo(), SRFValueRank::getParameters(), SRFTimeline::getParameters(), SRFTagCloud::getParameters(), SRFOutline::getParameters(), SRFMath::getParameters(), SRFjqPlotPie::getParameters(), SRFjqPlotBar::getParameters(), SRFiCalendar::getParameters(), SRFProcess::getParameters(), SRFGraph::getParameters(), SRFGooglePie::getParameters(), SRFGoogleBar::getParameters(), SRFGallery::getParameters(), SRFCalendar::getParameters(), SRFHash::getParameters(), SRFArray::getParameters(), SMWTableResultPrinter::getParameters(), SMWRSSResultPrinter::getParameters(), SMWRDFResultPrinter::getParameters(), SMWListResultPrinter::getParameters(), SMWEmbeddedResultPrinter::getParameters(), SMWDSVResultPrinter::getParameters(), SMWCsvResultPrinter::getParameters(), SMWCategoryResultPrinter::getParameters(), SMWAggregatablePrinter::getParameters(), SMMapPrinter::getParameters(), SMKMLPrinter::getParameters(), SMMapPrinter::getResultText(), getValidatorParameters(), SRFPloticusVBar::readParameters(), SRFPloticus::readParameters(), and textDisplayParameters().
SMWResultPrinter::$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.
Definition at line 47 of file SMW_QueryPrinter.php.
SMWResultPrinter::$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.
Definition at line 53 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mSearchlabel = null [protected] |
Text to use for link to further results, or empty if link should not be shown.
Unescaped! Use SMWResultPrinter::getSearchLabel() and SMWResultPrinter::linkFurtherResults() instead of accessing this directly.
Definition at line 60 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mDefault = '' [protected] |
Default return value for empty queries.
Unescaped. Normally not used in sub-classes!
Definition at line 63 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mFormat [protected] |
Definition at line 66 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mLinkFirst [protected] |
Definition at line 67 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mLinkOthers [protected] |
Definition at line 68 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mShowHeaders = SMW_HEADERS_SHOW [protected] |
Definition at line 69 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mShowErrors = true [protected] |
Definition at line 70 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mInline [protected] |
Definition at line 71 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mLinker [protected] |
Definition at line 72 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mErrors = array() [protected] |
Definition at line 81 of file SMW_QueryPrinter.php.
SMWResultPrinter::$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.
Definition at line 89 of file SMW_QueryPrinter.php.
SMWResultPrinter::$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.
Definition at line 99 of file SMW_QueryPrinter.php.
SMWResultPrinter::$mRecursionDepth = 0 [static, private] |
Incremented while expanding templates inserted during printout; stop expansion at some point.
Definition at line 101 of file SMW_QueryPrinter.php.
Referenced by handleNonFileResult().
SMWResultPrinter::$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().
Definition at line 104 of file SMW_QueryPrinter.php.
Referenced by handleNonFileResult().
1.5.6