PHP Class ModelSearch

Inheritance: extends Model
Afficher le fichier Open project: openeyes/openeyes Class Usage Examples

Protected Properties

Свойство Type Description
$criteria CDbCriteria
$itemsPerPage integer
$model BaseActiveRecord
$request Request
$searchItems array
$searchTerms array

Méthodes publiques

Méthode Description
__construct ( BaseActiveRecord $model )
addActiveFilter ( )
addSearchItem ( $key, string | array $search = '' ) Add a search item.
getCriteria ( ) : CDbCriteria
getItemsPerPage ( ) : integer
getModel ( ) : BaseActiveRecord
getRequest ( ) : mixed
getSearchItems ( ) : array
getSearchTermForAttribute ( $attribute, string $default = '' ) : string Retrieves the search term supplied by the user for a given attribute if there was one.
initPagination ( ) : CPagination Inits pagination for the results and returns it.
initSearch ( $searchInput )
retrieveResults ( ) : CActiveRecord[] Performs the query that has been generated.
setCriteria ( CDbCriteria $criteria )
setItemsPerPage ( integer $itemsPerPage )
setModel ( BaseActiveRecord $model )
setRequest ( mixed $request )
setSearchItems ( array $searchItems )

Méthodes protégées

Méthode Description
addCompare ( CDbCriteria $criteria, $attribute, $value, boolean $sensitive = false, string $operator = 'AND', $exactmatch = false ) Adds a comparison between a search term and an attribute.
generateCriteria ( string | array $attr = 'search' ) Generates the required Criteria object for the search.
relationalAttribute ( CDbCriteria $criteria, string $attribute, string $search ) : string Takes an attribute name and makes sure appropriate relationships are included.

Method Details

__construct() public méthode

public __construct ( BaseActiveRecord $model )
$model BaseActiveRecord

addActiveFilter() public méthode

public addActiveFilter ( )

addCompare() protected méthode

Adds a comparison between a search term and an attribute.
protected addCompare ( CDbCriteria $criteria, $attribute, $value, boolean $sensitive = false, string $operator = 'AND', $exactmatch = false )
$criteria CDbCriteria
$attribute
$value
$sensitive boolean
$operator string

addSearchItem() public méthode

Add a search item.
public addSearchItem ( $key, string | array $search = '' )
$key
$search string | array

generateCriteria() protected méthode

Generates the required Criteria object for the search.
protected generateCriteria ( string | array $attr = 'search' )
$attr string | array

getCriteria() public méthode

public getCriteria ( ) : CDbCriteria
Résultat CDbCriteria

getItemsPerPage() public méthode

public getItemsPerPage ( ) : integer
Résultat integer

getModel() public méthode

public getModel ( ) : BaseActiveRecord
Résultat BaseActiveRecord

getRequest() public méthode

public getRequest ( ) : mixed
Résultat mixed

getSearchItems() public méthode

public getSearchItems ( ) : array
Résultat array

getSearchTermForAttribute() public méthode

Retrieves the search term supplied by the user for a given attribute if there was one.
public getSearchTermForAttribute ( $attribute, string $default = '' ) : string
$attribute
$default string
Résultat string

initPagination() public méthode

Inits pagination for the results and returns it.
public initPagination ( ) : CPagination
Résultat CPagination

initSearch() public méthode

public initSearch ( $searchInput )
$searchInput

relationalAttribute() protected méthode

This will take an attribute name many layers of relationship deep, make sure that all appropriate tables are included with the result and return a string that is then acceptable to be used in a where clause.
protected relationalAttribute ( CDbCriteria $criteria, string $attribute, string $search ) : string
$criteria CDbCriteria
$attribute string
$search string
Résultat string

retrieveResults() public méthode

Performs the query that has been generated.
public retrieveResults ( ) : CActiveRecord[]
Résultat CActiveRecord[]

setCriteria() public méthode

public setCriteria ( CDbCriteria $criteria )
$criteria CDbCriteria

setItemsPerPage() public méthode

public setItemsPerPage ( integer $itemsPerPage )
$itemsPerPage integer

setModel() public méthode

public setModel ( BaseActiveRecord $model )
$model BaseActiveRecord

setRequest() public méthode

public setRequest ( mixed $request )
$request mixed

setSearchItems() public méthode

public setSearchItems ( array $searchItems )
$searchItems array

Property Details

$criteria protected_oe property

protected CDbCriteria $criteria
Résultat CDbCriteria

$itemsPerPage protected_oe property

protected int $itemsPerPage
Résultat integer

$model protected_oe property

protected BaseActiveRecord $model
Résultat BaseActiveRecord

$request protected_oe property

protected Request $request
Résultat Request

$searchItems protected_oe property

protected array $searchItems
Résultat array

$searchTerms protected_oe property

protected array $searchTerms
Résultat array