SearchBoxWidget
extends CWidget
in package
SearchBoxWidget is a custom Yii widget used to render a search box with filtering capabilities.
It supports different view types and can switch between them based on user preferences or query parameters.
Table of Contents
Properties
- $formUrl : string
- $model : CActiveRecord
- $onlyfilter : bool
- $switch : bool
- $viewtype : string|null
Methods
- getFormUrl() : string
- Generates and returns the form URL, handling URL formatting and GET parameters.
- init() : void
- Initializes the widget by registering necessary client scripts.
- registerClientScript() : mixed
- Registers the necessary JavaScript and CSS files for the widget if needed.
- run() : mixed
- Runs the widget, rendering the appropriate view based on the viewtype and switch properties.
Properties
$formUrl
public
string
$formUrl
= 'dashboard/view'
The URL to which the form will be submitted. Defaults to 'dashboard/view'.
$model
public
CActiveRecord
$model
The model associated with the search form.
$onlyfilter
public
bool
$onlyfilter
= \false
If true, only the filter section of the widget is rendered.
$switch
public
bool
$switch
= \false
If true, the view type selection is saved to user settings.
$viewtype
public
string|null
$viewtype
= ''
The type of view widget (list-widget or box-widget) to render. Can be set via query parameter, user settings, or defaults to 'list-widget'.
Methods
getFormUrl()
Generates and returns the form URL, handling URL formatting and GET parameters.
public
getFormUrl() : string
Tags
Return values
string —The generated form URL.
init()
Initializes the widget by registering necessary client scripts.
public
init() : void
registerClientScript()
Registers the necessary JavaScript and CSS files for the widget if needed.
public
registerClientScript() : mixed
run()
Runs the widget, rendering the appropriate view based on the viewtype and switch properties.
public
run() : mixed
It determines the viewtype from the query parameters, user settings, or defaults.