67 public function run() {
69 $pk = Yii::app()->request->getParam(
'pk');
70 $attribute = Yii::app()->request->getParam(
'attribute');
72 if (Yii::app()->getRequest()->isPostRequest) {
74 $model->$attribute = ($model->$attribute ==
$this->noValue) ? $this->yesValue : $this->noValue;
75 $success = $model->save(
false, array($attribute));
77 if (Yii::app()->getRequest()->isAjaxRequest) {
81 if ($this->redirectRoute !== null) {
82 $this->getController()->redirect($this->redirectRoute);
85 throw new CHttpException(Yii::t(
'zii',
'Invalid request'));
99 $finder = CActiveRecord::model($this->modelName);
100 if ($this->additionalCriteriaOnLoadModel) {
101 $c =
new CDbCriteria($this->additionalCriteriaOnLoadModel);
104 'condition' => $finder->tableSchema->primaryKey .
'=:id',
105 'params' => array(
':id' => $id),
108 $model = $finder->find($c);
110 $model = $finder->findByPk($id);
114 throw new CHttpException(404,
'Unable to find the requested object.');