Public Member Functions | |
| __construct ($context=SMWQueryUIHelper::SPECIAL_PAGE) | |
| Although this constructor is publicly accessible, its use is discouraged. | |
| hasError () | |
| Returns true if any errors have occured. | |
| getLimit () | |
| Returns the limit of results defined. | |
| getOffset () | |
| Returns the offset of results. | |
| hasFurtherResults () | |
| Would there be more query results that were not shown due to a limit? | |
| getResultObject () | |
| Returns a handle to the underlying Result object. | |
| getErrors () | |
| Returns an array of errors, if any have occured. | |
| setQueryString ($queryString="", $enableValidation=false) | |
| Sets up a query. | |
| setPrintOuts (array $printOuts=array(), $enableValidation=false) | |
| Sets up any extra properties which need to be displayed with results. | |
| setParams (array $params=array(), $enableValidation=false) | |
| Sets the parameters for the query. | |
| extractParameters ($p) | |
| Processes the QueryString, Params, and PrintOuts. | |
| execute () | |
| Executes the query. | |
| getHTMLResult () | |
| Returns the results in HTML, or in case of exports, a link to the result. | |
| getAsk () | |
| Returns the query in the ask format. | |
| getQueryString () | |
| Returns the query. | |
| getResultCount () | |
| Returns number of available results. | |
| getParameters () | |
| Returns the parameter array. | |
| getPrintOuts () | |
| Returns additional prinouts as an array of SMWPrintRequests. | |
Static Public Member Functions | |
| static | addUI (SpecialPage &$page) |
| Register a Semantic Search Special Page. | |
| static | getUiList () |
| Returns an array of Semantic Search Special Pages. | |
| static | makeForInfoLink ($p, $enableValidation=false) |
| Constructs a new SMWQueryUIHelper object when the query is passed to the UI in the Info-link format. | |
| static | makeForUI ($query, array $params, array $printouts, $enableValidation=false) |
| Constructs a new SMWQueryUIHelper when the query is passed to the UI from a web form. | |
Public Attributes | |
| const | SPECIAL_PAGE = 0 |
| Constants define whether the parameters was passed from the ui form (SPECIAL_PAGE) or from the further results infolink (WIKI_LINK). | |
| const | WIKI_LINK = 1 |
| Has the query come from a special page, or from an InfoLink? | |
Static Protected Member Functions | |
| static | validateProperty ($property) |
| Checks if $property exists in the wiki or not. | |
Protected Attributes | |
| $queryString = '' | |
| $parameters = array() | |
| $printOuts = array() | |
| $printOutStrings = array() | |
Static Protected Attributes | |
| static | $uiPages = array() |
Private Attributes | |
| $errorsOccured = false | |
| $context | |
| $errors = array() | |
| $defaultResultPrinter = 'broadtable' | |
| The default result printer if no format is set at the higher level. | |
| $queryResult = null | |
Query UIs may use this class to create a customised UI interface. In most cases, one is likely to extend the SMWQueryUI class to build a Search Special page. However in order to access some core featues, one may directly access the methods of this class.
This class does not define the format in which data should be passed through the web, except those already defined by SMWInfolink.
Definition at line 18 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::__construct | ( | $ | context = SMWQueryUIHelper::SPECIAL_PAGE |
) |
Although this constructor is publicly accessible, its use is discouraged.
Instantiation can instead be done by the makeForInfoLink() to handle infolink requests or makeForUI() to handle requests from a Query form.
| mixed | $context SMWQueryUIHelper::SPECIAL_PAGE | SMWQueryUIHelper::WIKI_LINK |
Definition at line 100 of file SMW_QueryUIHelper.php.
References $context.
| SMWQueryUIHelper::hasError | ( | ) |
Returns true if any errors have occured.
Definition at line 109 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::getLimit | ( | ) |
Returns the limit of results defined.
If not set, it returns 0.
Definition at line 118 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::getOffset | ( | ) |
Returns the offset of results.
If it isnt defined, returns a default value of 20.
Definition at line 132 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::hasFurtherResults | ( | ) |
Would there be more query results that were not shown due to a limit?
Definition at line 145 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::getResultObject | ( | ) |
Returns a handle to the underlying Result object.
Definition at line 158 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::getErrors | ( | ) |
Returns an array of errors, if any have occured.
Definition at line 167 of file SMW_QueryUIHelper.php.
Referenced by execute().
| static SMWQueryUIHelper::addUI | ( | SpecialPage &$ | page | ) | [static] |
Register a Semantic Search Special Page.
This method can be used by any new Query UI to register itself. The corresponding method getUiList() would return the names of all lists Query UIs.
| SpecialPage | $page |
Definition at line 181 of file SMW_QueryUIHelper.php.
| static SMWQueryUIHelper::getUiList | ( | ) | [static] |
Returns an array of Semantic Search Special Pages.
Definition at line 195 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::setQueryString | ( | $ | queryString = "", |
|
| $ | enableValidation = false | |||
| ) |
Sets up a query.
If validation is enabled, then the query string is checked for errors.
| string | $queryString The query |
Definition at line 206 of file SMW_QueryUIHelper.php.
References $errors, $queryString, and SMWQueryProcessor::createQuery().
| SMWQueryUIHelper::setPrintOuts | ( | array $ | printOuts = array(), |
|
| $ | enableValidation = false | |||
| ) |
Sets up any extra properties which need to be displayed with results.
Each string in printouts should be of the form "?property" or "property".
When validation is enabled, the values in $printOuts are checked against properties which exist in the wiki, and a warning string (for each property) is returned. Returns an empty array otherwise.
| array | $printOuts Array of strings | |
| boolean | $enableValidation |
Definition at line 240 of file SMW_QueryUIHelper.php.
References $errors, $printOuts, and validateProperty().
| SMWQueryUIHelper::setParams | ( | array $ | params = array(), |
|
| $ | enableValidation = false | |||
| ) |
Sets the parameters for the query.
The structure of $params is defined partly by ask and also by the Result Printer used. When validation is enabled, $params are checked for conformance, and error messages, if any, are returned.
Although it is not mandatory for any params to be set while calling this method, this method must be called so that default parameters are used.
int $smwgQMaxInlineLimit array $smwgResultFormats
| array | $params | |
| boolean | $enableValidation |
Definition at line 279 of file SMW_QueryUIHelper.php.
References $errors, $smwgQMaxInlineLimit, $smwgResultFormats, and SMWQueryProcessor::getResultPrinter().
Referenced by extractParameters().
| SMWQueryUIHelper::extractParameters | ( | $ | p | ) |
Processes the QueryString, Params, and PrintOuts.
Definition at line 324 of file SMW_QueryUIHelper.php.
References SMWInfolink::decodeParameters(), SMWQueryProcessor::processFunctionParams(), and setParams().
| SMWQueryUIHelper::execute | ( | ) |
Executes the query.
This method can be called once $queryString, $parameters, $printOuts are set either by using the setQueryString(), setParams() and setPrintOuts() followed by extractParameters(), or one of the static factory methods such as makeForInfoLink() or makeForUI().
Errors, if any can be accessed from hasError() and getErrors().
Definition at line 348 of file SMW_QueryUIHelper.php.
References $errors, SMWQueryProcessor::addThisPrintout(), SMWQueryProcessor::createQuery(), getErrors(), SMWQueryProcessor::getProcessedParams(), SMWQueryProcessor::getResultPrinter(), SMWWikiPageValue::makePageFromTitle(), smwfGetStore(), and SMWQueryProcessor::SPECIAL_PAGE.
| SMWQueryUIHelper::getHTMLResult | ( | ) |
Returns the results in HTML, or in case of exports, a link to the result.
This method can only be called after execute() has been called.
Definition at line 436 of file SMW_QueryUIHelper.php.
References $queryResult, SMWQueryProcessor::getResultPrinter(), and SMWQueryProcessor::SPECIAL_PAGE.
| SMWQueryUIHelper::getAsk | ( | ) |
Returns the query in the ask format.
Definition at line 463 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::getQueryString | ( | ) |
| SMWQueryUIHelper::getResultCount | ( | ) |
Returns number of available results.
Definition at line 490 of file SMW_QueryUIHelper.php.
| SMWQueryUIHelper::getParameters | ( | ) |
| SMWQueryUIHelper::getPrintOuts | ( | ) |
Returns additional prinouts as an array of SMWPrintRequests.
Definition at line 512 of file SMW_QueryUIHelper.php.
| static SMWQueryUIHelper::makeForInfoLink | ( | $ | p, | |
| $ | enableValidation = false | |||
| ) | [static] |
Constructs a new SMWQueryUIHelper object when the query is passed to the UI in the Info-link format.
This constructor should be used for handling the "further results" links in wiki-pages that use ask. If your search UI handles form parameters only, then consider using makeForUI().
If any errors do occur while parsing parameters, they may be accessed from hasError() and getErrors().
| string | $p parameters of the query. | |
| boolean | $enableValidation |
Definition at line 536 of file SMW_QueryUIHelper.php.
Referenced by SMWQueryUI::execute().
| static SMWQueryUIHelper::makeForUI | ( | $ | query, | |
| array $ | params, | |||
| array $ | printouts, | |||
| $ | enableValidation = false | |||
| ) | [static] |
Constructs a new SMWQueryUIHelper when the query is passed to the UI from a web form.
This constructor should be used to handle form parameters sent from the UI itself. If your search UI must also handle "further results" links from a wiki page, consider using makeForInfoLink().
If any errors do occur while parsing parameters, they may be accessed from hasError() and getErrors().
| string | $query | |
| array | $params of key=>value pairs | |
| array | $printouts array of '?property' strings | |
| boolean | $enableValidation |
Definition at line 560 of file SMW_QueryUIHelper.php.
Referenced by SMWQueryUI::execute().
| static SMWQueryUIHelper::validateProperty | ( | $ | property | ) | [static, protected] |
Checks if $property exists in the wiki or not.
| string | $property a property name in "?property" format |
Definition at line 575 of file SMW_QueryUIHelper.php.
Referenced by setPrintOuts().
SMWQueryUIHelper::$queryString = '' [protected] |
SMWQueryUIHelper::$parameters = array() [protected] |
Definition at line 31 of file SMW_QueryUIHelper.php.
SMWQueryUIHelper::$printOuts = array() [protected] |
SMWQueryUIHelper::$printOutStrings = array() [protected] |
Definition at line 45 of file SMW_QueryUIHelper.php.
SMWQueryUIHelper::$errorsOccured = false [private] |
Definition at line 51 of file SMW_QueryUIHelper.php.
SMWQueryUIHelper::$context [private] |
SMWQueryUIHelper::$errors = array() [private] |
Definition at line 65 of file SMW_QueryUIHelper.php.
Referenced by execute(), setParams(), setPrintOuts(), and setQueryString().
SMWQueryUIHelper::$defaultResultPrinter = 'broadtable' [private] |
The default result printer if no format is set at the higher level.
Definition at line 70 of file SMW_QueryUIHelper.php.
SMWQueryUIHelper::$queryResult = null [private] |
| const SMWQueryUIHelper::SPECIAL_PAGE = 0 |
Constants define whether the parameters was passed from the ui form (SPECIAL_PAGE) or from the further results infolink (WIKI_LINK).
Definition at line 83 of file SMW_QueryUIHelper.php.
Has the query come from a special page, or from an InfoLink?
Definition at line 84 of file SMW_QueryUIHelper.php.
SMWQueryUIHelper::$uiPages = array() [static, protected] |
Definition at line 91 of file SMW_QueryUIHelper.php.
1.5.6