public function actionUpdateStatus() { $ids = Yii::app()->request->getPost('ids'); $status = Yii::app()->request->getPost('status'); $models = Follow::model()->findAllByPk($ids); if(!array_key_exists($status, Follow::getStatuses())) throw new CHttpException(404, FollowModule::t('Ошибка')); if(!empty($models)) { foreach ($models as $follow) { $follow->status = $status; $follow->save(); } } echo FollowModule::t('Status changed successfully'); }
), array( 'name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), array("update", "id"=>$data->id))', ), array( 'name'=>'email', ), array( 'name'=>'text', 'value'=>'Follow::truncate($data, 100)' ), array( 'name'=>'status', 'filter'=>Follow::getStatuses(), 'value'=>'$data->statusTitle', ), array( 'name'=>'owner_title', 'type'=>'raw', 'value'=>'CHtml::link($data->getOwner_title(), $data->getViewUrl(), array("target"=>"_blank"))', 'filter'=>false ), 'ip_address', array( 'name'=>'created', ), // Buttons array( 'class'=>'CButtonColumn',
/** * Comment form */ Yii::import('zii.widgets.jui.CJuiDatePicker'); return array( 'id'=>'followUpdateForm', 'elements'=>array( 'tab1'=>array( 'type'=>'form', 'title'=>'', 'elements'=>array( 'status'=>array( 'type'=>'dropdownlist', 'items'=>Follow::getStatuses() ), 'name'=>array( 'type'=>'text', ), 'email'=>array( 'type'=>'text' ), 'text'=>array( 'type'=>'textarea', 'style'=>'height:200px' ), 'created'=>array( 'type'=>'CJuiDatePicker', 'options'=>array( 'dateFormat'=>'yy-mm-dd '.date('H:i:s'),