PHP Class WhToggleAction

Works in conjunction with WhToggleColumn widget in order to ease the task of the developer to update the the attribute displayed on the grid. Just attach to the controller you wish to make the calls to.
Author: Antonio Ramirez ([email protected])
Inheritance: extends CAction
Show file Open project: 2amigos/yiiwheels

Public Properties

Property Type Description
$additionalCriteriaOnLoadModel additional criteria to use to get the model
$ajaxResponseOnFailed the response to return to an AJAX call when failed to update the attribute.
$ajaxResponseOnSuccess the response to return to an AJAX call when the attribute was successfully saved.
$exceptionOnNullModel whether to throw an exception if we cannot find a model requested by the id
$modelName the name of the model we are going to toggle values to
$noValue the value to update the model to [yes|no]
$redirectRoute the route to redirect the call after updating attribute
$yesValue the value to update the model to [yes|no] standard toggle options, but you can toggle any value.

Public Methods

Method Description
run ( integer $id, string $attribute ) Widgets run function

Protected Methods

Method Description
loadModel ( integer $id ) : CActiveRecord Loads the requested data model.

Method Details

loadModel() protected method

Loads the requested data model.
protected loadModel ( integer $id ) : CActiveRecord
$id integer the model ID
return CActiveRecord the model instance.

run() public method

Widgets run function
public run ( integer $id, string $attribute )
$id integer
$attribute string

Property Details

$additionalCriteriaOnLoadModel public property

additional criteria to use to get the model
public $additionalCriteriaOnLoadModel

$ajaxResponseOnFailed public property

the response to return to an AJAX call when failed to update the attribute.
public $ajaxResponseOnFailed

$ajaxResponseOnSuccess public property

the response to return to an AJAX call when the attribute was successfully saved.
public $ajaxResponseOnSuccess

$exceptionOnNullModel public property

whether to throw an exception if we cannot find a model requested by the id
public $exceptionOnNullModel

$modelName public property

the name of the model we are going to toggle values to
public $modelName

$noValue public property

the value to update the model to [yes|no]
public $noValue

$redirectRoute public property

the route to redirect the call after updating attribute
public $redirectRoute

$yesValue public property

the value to update the model to [yes|no] standard toggle options, but you can toggle any value.
public $yesValue