Stud.IP  5.4
Query Class Reference

Public Member Functions

 __construct (\User $user=null)
 
 getError ()
 
 getFilter ()
 
 getUser ()
 
 getOffset ()
 
 getPage ()
 
 getQuery ()
 
 getResultsPerPage ()
 
 getSort ()
 
 hasError ()
 
 setFilter (Filter $filter)
 
 setPage ($page)
 
 setQuery ($query)
 
 setResultsPerPage ($resultsPerPage)
 
 setSort ($sort)
 

Data Fields

const MIN_LENGTH = 4
 
const SORT_RELEVANCE = 'relevance'
 
const SORT_CHDATE = 'chdate'
 

Detailed Description

Simple class to hold everything about a files search query.

GPL2 or any later version

Since
Stud.IP 4.1

Constructor & Destructor Documentation

◆ __construct()

__construct ( \User  $user = null)

Creates an empty search query.

(PHPMD.Superglobals)

Member Function Documentation

◆ getError()

getError ( )

Returns a possible error.

Returns
string if there is an error, returns a string, otherwise null

◆ getFilter()

getFilter ( )

Returns the associated filter.

Returns
Filter the associated filter

◆ getOffset()

getOffset ( )

Returns the offset of the first result using the current page and the setting of results per page.

Returns
int the offset of the first result

◆ getPage()

getPage ( )

Returns the current page.

Returns
int the current page

◆ getQuery()

getQuery ( )

Returns the search query term.

Returns
string the search query term

◆ getResultsPerPage()

getResultsPerPage ( )

Returns the current number of results per page.

Returns
int the current number of results per page

◆ getSort()

getSort ( )

Returns the sorting type.

Returns
string the sorting type

◆ getUser()

getUser ( )

Returns the user performing the search.

Returns
User the associated user

◆ hasError()

hasError ( )

Has the query an error?

Returns
bool either true, if there is an error; false otherwise

◆ setFilter()

setFilter ( Filter  $filter)

Set the filter of this search query.

Parameters
Filter$filterthe filter to associate
Returns
Query returns $this for chaining

◆ setPage()

setPage (   $page)

Set the current page.

Parameters
int$pagethe current page
Returns
Query returns $this for chaining

◆ setQuery()

setQuery (   $query)

Set the search query term.

Parameters
string$querythe search query term
Returns
Query returns $this for chaining

◆ setResultsPerPage()

setResultsPerPage (   $resultsPerPage)

Set the number of results per page.

Parameters
int$resultsPerPagethe number of results per page
Returns
Query returns $this for chaining

◆ setSort()

setSort (   $sort)

Set the sort order.

Parameters
string$sorteither one of the two symbols Query::SORT_CHDATE or Query:SORT_RELEVANCE
Returns
Query returns $this for chaining

Field Documentation

◆ MIN_LENGTH

const MIN_LENGTH = 4

◆ SORT_CHDATE

const SORT_CHDATE = 'chdate'

◆ SORT_RELEVANCE

const SORT_RELEVANCE = 'relevance'

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