SMWSearchByProperty Class Reference
[SMWSpecialPageSpecialPage]

This special page for Semantic MediaWiki implements a view on a relation-object pair,i.e. More...

List of all members.

Public Member Functions

 __construct ()
 Constructor.
 execute ($query)
 Main entry point for Special Pages.

Static Protected Member Functions

static addAutoComplete ()
 Creates the JS needed for adding auto-completion to queryForm().

Private Member Functions

 displaySearchByProperty ()
 Returns the HTML for the complete search by property.
 displayResults ($results, $number=-1, $first=true, $highlight=false)
 Creates the HTML for a bullet list with all the results of the set query.
 getNavigationBar ($count)
 Creates the HTML for a Navigation bar for too many results.
 getExactResults ()
 Returns all results that have exactly the value on the property.
 getNearbyResults ($count, $greater=true)
 Returns all results that have a value near to the searched for value on the property, ordered, and sorted by ending with the smallest one.
 queryForm ()
 Creates the HTML for the query form for this special page.

Private Attributes

 $propertystring = ''
 string Name of the property searched for
 $property = null
 SMWPropertyValue The property that is searched for.
 $valuestring = ''
 string Name of the value that is searched for
 $value = null
 SMWDataValue The value that is searched for.
 $limit = 20
 How many results should be displayed.
 $offset = 0
 At what position are we currently.


Detailed Description

This special page for Semantic MediaWiki implements a view on a relation-object pair,i.e.

a typed backlink. For example, it shows me all persons born in Croatia, or all winners of the Academy Award for best actress.

Definition at line 24 of file SMW_SpecialSearchByProperty.php.


Constructor & Destructor Documentation

SMWSearchByProperty::__construct (  ) 

Constructor.

Definition at line 42 of file SMW_SpecialSearchByProperty.php.


Member Function Documentation

SMWSearchByProperty::execute ( query  ) 

Main entry point for Special Pages.

Gets all required parameters.

Parameters:
[in] $query string Given by MediaWiki

Definition at line 51 of file SMW_SpecialSearchByProperty.php.

References SMWOutputs::commitToOutputPage(), SMWInfolink::decodeParameters(), displaySearchByProperty(), SMWPropertyValue::makeUserProperty(), SMWDataValueFactory::newPropertyObjectValue(), and queryForm().

SMWSearchByProperty::displaySearchByProperty (  )  [private]

Returns the HTML for the complete search by property.

Returns:
string HTML of the search by property function

Definition at line 104 of file SMW_SpecialSearchByProperty.php.

References $smwgSearchByPropertyFuzzy, displayResults(), getExactResults(), getNavigationBar(), getNearbyResults(), and smwfGetLinker().

Referenced by execute().

SMWSearchByProperty::displayResults ( results,
number = -1,
first = true,
highlight = false 
) [private]

Creates the HTML for a bullet list with all the results of the set query.

Parameters:
[in] $results array of array of SMWWikiPageValue, SMWDataValue The entity and its datavalue
[in] $number int How many results should be displayed? -1 for all
[in] $first bool If less results should be displayed than given, should they show the first $number results, or the last $number results?
[in] $highlight bool Should the results be highlighted?
Returns:
string HTML with the bullet list and a header

Definition at line 187 of file SMW_SpecialSearchByProperty.php.

References SMWInfolink::newBrowsingLink(), and smwfGetLinker().

Referenced by displaySearchByProperty().

SMWSearchByProperty::getNavigationBar ( count  )  [private]

Creates the HTML for a Navigation bar for too many results.

Most of the parameters are taken from the object members.

Parameters:
[in] $count int How many results are currently displayed?
Returns:
string HTML with the navigation bar

Definition at line 231 of file SMW_SpecialSearchByProperty.php.

References $smwgQMaxInlineLimit.

Referenced by displaySearchByProperty().

SMWSearchByProperty::getExactResults (  )  [private]

Returns all results that have exactly the value on the property.

Returns:
array of array of SMWWikiPageValue, SMWDataValue with the first being the entity, and the second the value

Definition at line 322 of file SMW_SpecialSearchByProperty.php.

References SMWDataValueFactory::newDataItemValue(), and smwfGetStore().

Referenced by displaySearchByProperty().

SMWSearchByProperty::getNearbyResults ( count,
greater = true 
) [private]

Returns all results that have a value near to the searched for value on the property, ordered, and sorted by ending with the smallest one.

Parameters:
[in] $count int How many entities have the exact same value on the property?
[in] $greater bool Should the values be bigger? Set false for smaller values
Returns:
array of array of SMWWikiPageValue, SMWDataValue with the first being the entity, and the second the value

Definition at line 350 of file SMW_SpecialSearchByProperty.php.

References SMWQueryProcessor::addThisPrintout(), SMWQueryProcessor::createQuery(), SMWQueryProcessor::getProcessedParams(), SMWQuery::MODE_INSTANCES, SMWPrintRequest::PRINT_PROP, smwfGetStore(), and SMWQueryProcessor::SPECIAL_PAGE.

Referenced by displaySearchByProperty().

SMWSearchByProperty::queryForm (  )  [private]

Creates the HTML for the query form for this special page.

Returns:
string HTML for the query form

Definition at line 407 of file SMW_SpecialSearchByProperty.php.

Referenced by execute().

static SMWSearchByProperty::addAutoComplete (  )  [static, protected]

Creates the JS needed for adding auto-completion to queryForm().

Uses the MW API to fetch suggestions.

Definition at line 424 of file SMW_SpecialSearchByProperty.php.

References END, SMWOutputs::requireResource(), SMWOutputs::requireScript(), and public::response().


Member Data Documentation

SMWSearchByProperty::$propertystring = '' [private]

string Name of the property searched for

Definition at line 27 of file SMW_SpecialSearchByProperty.php.

SMWSearchByProperty::$property = null [private]

SMWPropertyValue The property that is searched for.

Definition at line 29 of file SMW_SpecialSearchByProperty.php.

SMWSearchByProperty::$valuestring = '' [private]

string Name of the value that is searched for

Definition at line 31 of file SMW_SpecialSearchByProperty.php.

SMWSearchByProperty::$value = null [private]

SMWDataValue The value that is searched for.

Definition at line 33 of file SMW_SpecialSearchByProperty.php.

SMWSearchByProperty::$limit = 20 [private]

How many results should be displayed.

Definition at line 35 of file SMW_SpecialSearchByProperty.php.

SMWSearchByProperty::$offset = 0 [private]

At what position are we currently.

Definition at line 37 of file SMW_SpecialSearchByProperty.php.


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

Generated on Sun Mar 18 07:15:43 2012 for Semantic MediaWiki by  doxygen 1.5.6